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 realize this might not be super straight-forward since you can't guarantee the preservation of the integral. Since your package looks at how any pixels overlap with the shapefile, you might be reusing some pixels. Or maybe not, since the idea is that you're calculating the percentage overlap here, so even a small shapefile would only grab a small percentage of a given pixel.
I'm thinking this is useful if one wants to convert from something like total precipitation on a raster grid to total/accumulated precipitation over a larger shapefile.
The text was updated successfully, but these errors were encountered:
I realize this might not be super straight-forward since you can't guarantee the preservation of the integral. Since your package looks at how any pixels overlap with the shapefile, you might be reusing some pixels. Or maybe not, since the idea is that you're calculating the percentage overlap here, so even a small shapefile would only grab a small percentage of a given pixel.
I had considered doing this (I think I have a local branch that allows sum calculations somewhere), but I haven't stuck it into the main package for exactly this question. rasterstats (and other packages that are doing similar things, like regionmask's aggregating module) don't do area overlaps, so I wouldn't be as worried about that mass-preservation question, but here I'm worried that there's no good way to deal with that?
Is it feasible with the current code structure to have an option to return the sum over a polygon instead of the mean? I.e., something like http://xarray.pydata.org/en/stable/generated/xarray.core.weighted.DataArrayWeighted.sum.html instead of http://xarray.pydata.org/en/stable/generated/xarray.core.weighted.DataArrayWeighted.mean.html.
The
rasterstats
zonal statistics module allows one to return mean, sum, etc: https://pythonhosted.org/rasterstats/manual.html#zonal-statistics.I realize this might not be super straight-forward since you can't guarantee the preservation of the integral. Since your package looks at how any pixels overlap with the shapefile, you might be reusing some pixels. Or maybe not, since the idea is that you're calculating the percentage overlap here, so even a small shapefile would only grab a small percentage of a given pixel.
I'm thinking this is useful if one wants to convert from something like total precipitation on a raster grid to total/accumulated precipitation over a larger shapefile.
The text was updated successfully, but these errors were encountered: