-
Notifications
You must be signed in to change notification settings - Fork 26
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
What happened?
When using feature crops in polytope, there are two problems in the data returned
- X and Y are swapped.
- longitude values are above 360
When requesting data from polytope using a feature that crosses the zero meridian, the data is returned with coordinates that have values above 360. It looks like all points that have longitude above 0 get somehow pushed above 360.
What are the steps to reproduce the bug?
This script loads data, then substracts the values that are too high and swaps X and Y, which results in the plot as expected.
import earthkit.data
import geopandas as gpd
import shapely
import matplotlib.pyplot as plt
request = {
"class": "d1",
"dataset": "climate-dt",
"activity": "ScenarioMIP",
"experiment": "SSP3-7.0",
"model": "IFS-NEMO",
"generation": "1",
"realization": "1",
"resolution": "high",
"expver": "0001",
"stream": "clte",
"time": "0000",
"date": "20260101",
"type": "fc",
"levtype": "o2d",
"param": "263101",
"feature" : {
"type" : "boundingbox",
"points" : [[-2, -1], [2, 1]],
},
}
ds = earthkit.data.from_source("polytope", "destination-earth", request, stream=False, address="polytope.lumi.apps.dte.destination-earth.eu")
da = ds.to_xarray()
df = da.to_dataframe()
# Transform the data so that the coords are fixed
df.loc[df.y > 180, "y"] = df.loc[df.y > 180, "y"] - 360
# X and Y are swapped in the data
geometry = shapely.points(df.pop("y"), y=df.pop("x"))
gdf = gpd.GeoDataFrame(df, geometry=geometry)
gdf.shape
gdf.plot(
column='avg_tos',
cmap='viridis',
)
plt.show()Renders
Version
v0.11.1
Platform (OS and architecture)
osx
Relevant log output
Accompanying data
No response
Organisation
Development Seed
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working