Closed dcdenu4 closed 3 years ago
I think this error is causing the rest of the operation to fail.
It appears the issue is with the Antarctica raster.
('processed-data\\gadm_pct_rasters\\acc\\acc_gadm0_pct_rasters\\acc_ATA_percentile.tif', 1)
ERROR 5: acc-stitched-test.tif, band 1: Access window out of range in RasterIO(). Requested
(0,57422) of size 256x256 on raster of 129600x57603.
Traceback (most recent call last):
File "stitch-rasters.py", line 38, in <module>
pygeoprocessing.stitch_rasters(
File "C:\Users\ddenu\Workspace\NatCap\Repositories\venv-space\py38-latest\lib\site-packages\pygeoprocessing-2.2.0.post28+g01f363e-py3.8-win-amd64.egg\pygeoprocessing\geoprocessing.py", line 3896, in stitch_rasters
target_nodata_mask = numpy.isclose(target_array, target_nodata)
File "<__array_function__ internals>", line 5, in isclose
File "C:\Users\ddenu\Workspace\NatCap\Repositories\venv-space\py38-latest\lib\site-packages\numpy\core\numeric.py", line 2362, in isclose
xfin = isfinite(x)
TypeError: ufunc 'isfinite' not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ''safe''
Here is the output path info for the stitch:
CRS | EPSG:4326 - WGS 84 - Geographic
Extent | -180.0000000000000000,-80.0039591959999825 : 180.0000000000287628,80.0043741373461614
Unit | degrees
Width | 129600
Height | 57603
Data type | Float32 - Thirty two bit floating point
GDAL Driver Description | GTiff
And the raster trying to be stitched in:
CRS | EPSG:4326 - WGS 84 - Geographic
Extent | -179.9999999999999432,-90.0000000000000000 : 180.0000000000288196,-59.5916666666642385
Unit | degrees
Width | 129600
Height | 10947
Data type | Byte - Eight bit unsigned integer
GDAL Driver Description | GTiff
Obviously the southern latitude of the raster to be stitched in is beyond the latitude of the base output. What's interesting is that the raster to be stitched in originates from the raster that created the base output path. Like so:
-90
latitude.So, it's unclear why the clipped Antarctica raster gets the bounds that it does.
Ah, I guess it gets those extents because that is the manual mask being passed into align_and_resize_raster_stack
. Well that was a fun problem.
Ideally I think the solution is to merge or intersect the bounding boxes before doing the clip using align_and_resize_raster_stack
.
I believe this has been addressed by checking bounding box intersection up front.
In computing the percentile raster for the nature access service, it seems like the individual percentile rasters for the boundaries have no problem. But when stitching them together I get this gdal error:
ERROR 5: C:\Users\ddenu\Workspace\NatCap\Repositories\global-web-viewer\processed-data\gadm_pct_rasters\acc\acc_gadm0_pct_stitched.tif, band 1: Access window out of range in RasterIO(). Requested (0,57422) of size 256x256 on raster of 129600x57603.