-
Notifications
You must be signed in to change notification settings - Fork 13
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
gips_project returns nan when feature contains no raster pixel centers #47
Comments
gdal_rasterize isn't used directly, it uses the GDAL warp api. I don't think the fix lies there, or with GIPS though. There are some counties that are smaller than a Merra pixel? It should still return something. Without knowing the details, you might consider just buffering out the counties though, to ensure that working with data immediately outside the boundary. You can always clip the final result to the actual county boundary. |
Yeah, as an example, Merra grid cells are just big enough so that 3 out of 10 NH counties do not contain a grid cell center and also return an image containing nan from gips_project. I assume that's what is going on but can't think of another reason for the error. I could change the Merra products so that they have a finer resolution, but that seems like the worst way to go. Maybe the buffering fix could be implemented within GIPS? |
seems like the analog of gdal_rasterize's "ALL_TOUCHED" option is what is ++ Ian |
There is an option to set in the Warp API called CUTLINE_ALL_TOUCHED, it would be straigtforward to implement in order to test out if that's the issue. |
I didn't see that one. Thanks, Matt. @bhbraswell -- It does look straight forward to add to the mix. I could put a version that uses this option onto one of our servers for you to test -- unless you wanted to roll a little test script for me to check it with? |
I did the quick hard-coded test and it does work. I will sew this into gips/gippy so that |
Fixed in AGS fork via adding |
Example: Merra is 0.5 x 0.67 degree raster images. I want to extract data for each county in NH, even if it is only one pixel by one pixel. In this unusual case, I get a nan result for some counties, I believe because they are on the order of the size of the merra pixels, and do not contain a pixel center. Is this a gdal_rasterize issue that is outside the current scope of GIPS?
gips_project merra -p tave -d 2015-201 -s gadm2_vtnh_3410.shp -v4 --fetch --overwrite --outdir test102 -w "HASC_1='US.NH'" --res 1000 1000 -k HASC_2 --notld --interpolation 1
The text was updated successfully, but these errors were encountered: