-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FATAL ERROR: DgQ2DDtoIConverter::convertTypedAddress() #63
Comments
I'm seeing the same, but only on one of my machines (an M1 mac; I also have an intel mac that runs everything just fine). I don't know if the behavior is specific to M1 or to some other difference between the machines (compiler toolchain, OS, goodness knows what else), but I see that @LewisAJones was on M1 and also that a related issue here #54 suggests that the M1 architecture is implicated. In this comment I'll use "M1" and "Intel" as shorthands for everything that might be different between the machines. The behavior is pretty spooky, and comes from
I get
This is particularly dangerous, because the fatal error didn't actually raise an error in the R session, it did produce a syntactically correct output, and the output is wrong. On an intel mac, I get 3672 as the seqnum, with no But it gets spookier, and even (much) more dangerous. The coordinates where the M1 raises the message and then fails are geographically coherent. For example:
HOWEVER, although on the M1 mac I've confirmed that this behavior comes directly from the So then I reverted to d92fc92, and all of the weird behavior on the M1 vanished. No more I don't have any brilliant ideas about what to do here, except to mention to @LewisAJones that you might be able to make progress by reverting with Here's the sessionInfo from the M1, which is where all the problems are occurring:
|
… of a double (factor) to long int here: on M1 Macs this is rounded downwards, thus I needed to add a small number. Took me 6 freaking hours of simultaneous debugging on Mac and Windows to find it...
This issue has been fixed in PR #66, at least for the use cases flagged above. While this PR is not merged, Apple Silicon users can install from my fork e.g. |
@SebKrantz i updated my dggridR 3.0.0 to 3.1.0 follow the code #Generate a dggs specifying an intercell spacing of ~25 miles #Read in the South Africa's borders from the shapefile #Get a grid covering South Africa #Plot South Africa's borders and the associated grid |
Ok, interesting, but this does not correspond to the error I solved. Can
you try increasing the spacing? And do you get the same behavior with the
previous sp-based version (v2.0.4)?
…On Sun 6. Aug 2023 at 08:33, Daniel Qin ***@***.***> wrote:
@SebKrantz <https://github.com/SebKrantz> i updated my dggridR 3.0.0 to
3.1.0 follow the code
library(remotes) remotes::install_github("SebKrantz/dggridR")
but it still not works well when i run
`library(dggridR)
#Generate a dggs specifying an intercell spacing of ~25 miles
dggs <- dgconstruct(spacing=100, metric=FALSE, resround='nearest')
#Read in the South Africa's borders from the shapefile
sa_border <- st_read(dg_shpfname_south_africa(), layer="ZAF_adm0")
st_crs(sa_border) = 4326
#Get a grid covering South Africa
sa_grid <- dgshptogrid(dggs, dg_shpfname_south_africa())
#Plot South Africa's borders and the associated grid
p <- ggplot() +
geom_sf(data=sa_border, fill=NA, color="black") +
geom_sf(data=sa_grid, fill=alpha("blue", 0.4), color=alpha("white", 0.4))
p
`
got figure
[image: image]
<https://user-images.githubusercontent.com/73114267/258625453-39ee14c6-7517-400c-a5c8-53a8e0d779a3.png>
—
Reply to this email directly, view it on GitHub
<#63 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ALOT4UR4DTUD4YTCC2L3X7DXT43EDANCNFSM6AAAAAAUTWL7DQ>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Thanks for your response. |
@Daniel-Huff, library(dggridR)
library(ggplot2)
library(sf)
#> Linking to GEOS 3.11.0, GDAL 3.5.3, PROJ 9.1.0; sf_use_s2() is TRUE
#Generate a dggs specifying an intercell spacing of ~25 miles
dggs <- dgconstruct(spacing=100, metric=FALSE, resround='nearest')
#> Resolution: 7, Area (mi^2): 14491.99750509, Spacing (mi): 93.7218051701576, CLS (mi): 107.077441232619
#Read in the South Africa's borders from the shapefile
sa_border <- st_read(dg_shpfname_south_africa(), layer="ZAF_adm0")
#> Reading layer `ZAF_adm0' from data source
#> `/Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/library/dggridR/extdata/ZAF_adm0.shp'
#> using driver `ESRI Shapefile'
#> Simple feature collection with 1 feature and 1 field
#> Geometry type: MULTIPOLYGON
#> Dimension: XY
#> Bounding box: xmin: 16.45802 ymin: -46.93639 xmax: 37.87945 ymax: -22.14108
#> CRS: NA
st_crs(sa_border) = 4326
#Get a grid covering South Africa
sa_grid <- dgshptogrid(dggs, sa_border)
#Plot South Africa's borders and the associated grid
p <- ggplot() +
geom_sf(data=sa_border, fill=NA, color="black") +
geom_sf(data=sa_grid, fill=alpha("blue", 0.4), color=alpha("white", 0.4))
p Created on 2023-08-07 with reprex v2.0.2 Note that in v3.1.0, you can also direcly pass the sf data frame to |
…ome optimization * Small fix. * Need to add sf and rename count column. * Using R's numeric() instead of alloc(). * Update NEWS * Fixing #63. The issue on M1 Mac is due to implicit conversion of a double (factor) to long int here: on M1 Macs this is rounded downwards, thus I needed to add a small number. Took me 6 freaking hours of simultaneous debugging on Mac and Windows to find it... * Adding return_sf argument: set to FALSE for memory efficient long datat frame (can be converted to S2 and other classes). * Appeasing R CMD check. * Comment and change of notation as requested by @r-barnes. * Using dgprintf as requested by @r-barnes. * Update CONTRIBUTING.md to explain C++ workflow * Also using dgprintf here. * Install instructions for fork. * Update README.md * Remove magrittr pipe. * Need to add dplyr for vignette it seems.
…ome optimization * Small fix. * Need to add sf and rename count column. * Using R's numeric() instead of alloc(). * Update NEWS * Fixing #63. The issue on M1 Mac is due to implicit conversion of a double (factor) to long int here: on M1 Macs this is rounded downwards, thus I needed to add a small number. Took me 6 freaking hours of simultaneous debugging on Mac and Windows to find it... * Adding return_sf argument: set to FALSE for memory efficient long datat frame (can be converted to S2 and other classes). * Appeasing R CMD check. * Comment and change of notation as requested by @r-barnes. * Using dgprintf as requested by @r-barnes. * Update CONTRIBUTING.md to explain C++ workflow * Also using dgprintf here. * Install instructions for fork. * Update README.md * Remove magrittr pipe. * Need to add dplyr for vignette it seems.
…ome optimization * Small fix. * Need to add sf and rename count column. * Using R's numeric() instead of alloc(). * Update NEWS * Fixing #63. The issue on M1 Mac is due to implicit conversion of a double (factor) to long int here: on M1 Macs this is rounded downwards, thus I needed to add a small number. Took me 6 freaking hours of simultaneous debugging on Mac and Windows to find it... * Adding return_sf argument: set to FALSE for memory efficient long datat frame (can be converted to S2 and other classes). * Appeasing R CMD check. * Comment and change of notation as requested by @r-barnes. * Using dgprintf as requested by @r-barnes. * Update CONTRIBUTING.md to explain C++ workflow * Also using dgprintf here. * Install instructions for fork. * Update README.md * Remove magrittr pipe. * Need to add dplyr for vignette it seems.
This was due to a numeric precision error in the C++ source code visible on systems without a long double type - such as Apple Silicon. It should be fixed by PR #66, at least in my experience as a M1 Mac user. |
* Getting rid of dplyr and sp: replacing with collapse, sf and s2 + some optimization * Small fix. * Need to add sf and rename count column. * Using R's numeric() instead of alloc(). * Update NEWS * Fixing #63. The issue on M1 Mac is due to implicit conversion of a double (factor) to long int here: on M1 Macs this is rounded downwards, thus I needed to add a small number. Took me 6 freaking hours of simultaneous debugging on Mac and Windows to find it... * Adding return_sf argument: set to FALSE for memory efficient long datat frame (can be converted to S2 and other classes). * Appeasing R CMD check. * Comment and change of notation as requested by @r-barnes. * Update CONTRIBUTING.md to explain C++ workflow * Using dgprintf as requested by @r-barnes. * Also using dgprintf here. * Install instructions for fork. * Update README.md * Remove magrittr pipe. * Need to add dplyr for vignette it seems. * Fix C++ issues. * Change of maintainer. * Spacing. * Remove duplicate. * Remove installation notes. * Fix spacing. --------- Co-authored-by: Richard Barnes <[email protected]>
Hi @r-barnes,
First, thanks for getting dggridR back on CRAN - I'm really glad to see it back!
I've recently been rerunning some of my R scripts and I am getting some fatal error messages (even when using your README example).
Returns:
... And so on
This error seems to be independent of
spacing
size.Any ideas on a fix for this or what is going on? And apologies if I've missed something obvious!
Thanks,
Lewis
The text was updated successfully, but these errors were encountered: