You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I found this while attempting to resample the input dataset in the beetles endpoint, with the goal of improving zonal stats weighted average output. (Resampling was tried using a method similar to the one described here, where we can just apply a scaling factor to the lat/lon axis and not worry about the actual grid size).
In this example (http://localhost:5000//beetles/area/1908030801), I use a scaling factor of 3. So what is originally a 5x5 input dataset becomes a 15x15 input dataset.
No scaling factor, shapes match (this is a working return but returns nodata):
Data array of all zeroes derived from bbox
shape: (5, 5)
[[0. 0. 0. 0. 0.]
[0. 0. 0. 0. 0.]
[0. 0. 0. 0. 0.]
[0. 0. 0. 0. 0.]
[0. 0. 0. 0. 0.]]
Mask array from zonal_stats (all_touched=False)
shape: (5, 5)
[[-- -- -- -- --]
[-- -- -- 0.0 --]
[-- -- 0.0 0.0 --]
[-- 0.0 0.0 -- --]
[-- -- -- -- --]]
Mask array from zonal_stats (all_touched=True)
shape: (5, 5)
[[-- -- -- 0.0 0.0]
[-- -- 0.0 0.0 0.0]
[0.0 0.0 0.0 0.0 0.0]
[0.0 0.0 0.0 0.0 0.0]
[-- 0.0 -- -- --]]
Bounds of original data array:
272320.95112357556 1466730.4403734806 320085.01195382874 1514494.5012037337
Bounds of the geojson (all_touched=False):
274748.77465159545 1472485.4052244318 318266.31339097966 1509566.0564900415
Bounds of the geojson (all_touched=True):
274748.77465159545 1472485.4052244318 318266.31339097966 1509566.0564900415
Scaling factor of 3 applied. Notice how the shape of the raster mini map is now smaller than the input data array, regardless of all_touched method used:
We might need to figure out a way to use rasterio's rasterize function directly instead of using zonal stats to produce the rasterized polygon (zonal stats uses this under the hood anyways, but it appears to have issues)
The text was updated successfully, but these errors were encountered:
This is basically the same issue @kyleredilla found here: #399
I found this while attempting to resample the input dataset in the
beetles
endpoint, with the goal of improving zonal stats weighted average output. (Resampling was tried using a method similar to the one described here, where we can just apply a scaling factor to the lat/lon axis and not worry about the actual grid size).In this example (
http://localhost:5000//beetles/area/1908030801
), I use a scaling factor of 3. So what is originally a 5x5 input dataset becomes a 15x15 input dataset.No scaling factor, shapes match (this is a working return but returns nodata):
Scaling factor of 3 applied. Notice how the shape of the raster mini map is now smaller than the input data array, regardless of
all_touched
method used:We might need to figure out a way to use
rasterio
's rasterize function directly instead of using zonal stats to produce the rasterized polygon (zonal stats uses this under the hood anyways, but it appears to have issues)The text was updated successfully, but these errors were encountered: