-
Notifications
You must be signed in to change notification settings - Fork 26
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
NaN values in extraction #21
Comments
Are all of the results NaN, or just some of them? If a polygon doesn't intersect any defined cell in your raster, the mean will be 0/0 = NaN. |
I can provide some feedback (for this closed and old issue) since I experimented the same today with
While in other R installation (outside conda environment with
Session info where the task fails:
Session info where the task runs ok:
I tried to update R to 4.2.0 or 4.2.1 in my conda env without success, so far I'm using a scale factor as workaround and works alright for my needs:
|
A bit more on context: The scale factor inside the R function wasn't enough. I'm processing files in Python and exporting them to R for using the exact_extract computing weighted stats and the percent of valid pixels in the analysis. So I applied a scale factor while doing the process in Python and saved the file in uint8 data type, everything works great so far. Now the output takes all the valid pixels when using floating point rasters some zones took 0 pixels (NaN output) or 30 - 50%, which is wrong knowing the data. Any hints or ideas of this behavior? |
Thanks for documenting this. Is my hunch right that any of the following modifications (applied by itself) would "fix" this?
|
|
Sure, you can access to data in this drive folder I also saved the result and sessionInfo in workspace.RData. Also, this example is the extraction of one of the +400 vectors used. Some of them have the same issue. The script used is:
|
I am trying to use exact_extract function where the shapefile is the one used in the Basic Usage section of the readme file
I have the following RasterLayer:
Then i run the exact_extract function
brazil$mean <- (brazil, my_raster, 'mean')
which returns me NaN values, as shown below
Am i doing something wrong importing the raster or this is a known issue in the package?
The text was updated successfully, but these errors were encountered: