-
Notifications
You must be signed in to change notification settings - Fork 14
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
Longitude -180 pixels included in weightmap #51
Comments
Yikes, that should've theoretically been captured by |
Okay I think I've isolated the issue. It happens when pixels cross the antimeridian and is related to the fact that The fix seems to be to change the way pixel polygons are made at the antimeridian, maybe akin to what the antimeridian package does - ie, split pixels at the antimeridian and recombine them as a multipolygon instead. Hopefully can fix soon. |
Fixes #51, which is related to pixels incorrectly splitting at the antimeridian. This required two fixes: 1) `create_raster_polygons()` updated to GeoJSON standards of splitting pixels that cross the antimeridian *at* the antimerdiain, forming a MultiPolygon 2) `get_bnds()` updated to correctly set bounds of grids that cross the antimeridian This commit also adds or updates many tests to make sure this process works correctly, including `get_bnds()` tests checking - partial grids - grids crossing the antimeridian - grids with individual grid cells on both sides of the antimeridian Further, adds a `NoOverlapError` raised when the polygons and input rasters don't overlap at all.
I am aggregating ADM1-level regions (states) across the globe according to the ERA5 map. I discovered that my temperatures where, in some cases, much lower than they should be. This is because pixels from the international dateline are being included in their aggregations. I have a partial diagnosis for this problem. By the way, this is all under xagg v0.3.0.2, since I get an error (
ValueError: new dimensions ('lat', 'bnds') must be a superset of existing dimensions ('lat', 'bnd')
) when I try to run xagg v.0.3.1.For example, Oslo (as defined in GADM 3.6) just overlaps 4 ERA5 pixels. However, the weight map has significant weights on 6 pixels:
[(59.75, -180.0), (60.0, -180.0), (59.75, 10.75), (60.0, 10.5), (60.0, 10.75), (60.0, 11.0)]
. The first two of these should not be there.The pixel polygon that overlaps Oslo and produced the first pixel entry has these coordinates:
[(179.875, 59.625), (179.875, 59.875), (-179.875, 59.875), (-179.875, 59.625), (179.875, 59.625)]
which in turn comes from the first ERA5 longitude value having bounds of
[ 179.875, -179.875]
.So,
geopandas
interprets that as a strip across the whole world, which is then assigned the temperature at 180 W.I would expect this to be a problem everywhere, but (for reasons I haven't figured out), it seems to mainly be a problem in Norway and China.
The text was updated successfully, but these errors were encountered: