pace oci L2 boundary points: earthaccess vs xarray attributes #958
Replies: 1 comment
-
Hello, and welcome back! You are seeing the difference between a polygon and it's bounding box. The metadata you have from CMR via earthaccess is a polygon that gives the four corners of a rotated rectangle. Any polygon will have a bounding box defined only by it's "southwest" and "northeast" corners, which does not reflect the rotation of the polygon. The metadata you have from the granule itself via xarray is the bounding box. The PACE/OCI L2 granules include the full lat and lon grids in the "navigation_data" group, from which you can construct a matching polygon from the four corners. Here's a little bit of Python that returns a bounding box using the CMR metadata, which you can compare with the the granule attributes. import shapely
umm = {'HorizontalSpatialDomain': {'Geometry': {'GPolygons': [{'Boundary': {'Points':
[{'Latitude': 26.53716, 'Longitude': -65.46725},
{'Latitude': 21.2824, 'Longitude': -91.30593},
{'Latitude': 3.60241, 'Longitude': -86.43124},
{'Latitude': 8.66868, 'Longitude': -62.64935},
{'Latitude': 26.53716, 'Longitude': -65.46725}]}}]}}}
coords = umm["HorizontalSpatialDomain"]["Geometry"]["GPolygons"][0]["Boundary"]["Points"]
polygon = shapely.Polygon((i["Longitude"], i["Latitude"]) for i in coords)
polygon.bounds # returns (-91.30593, 3.60241, -62.64935, 26.53716) |
Beta Was this translation helpful? Give feedback.
-
Hi, I noticed that earthaccess gives boundary points that is more informative rather than accessing the coordinates attributes through xarray. For example, using earthaccess will give coordinates like this (i will show coordinates only since there are so many attributes listed):
Spatial coverage: {'HorizontalSpatialDomain': {'Geometry': {'GPolygons': [{'Boundary': {'Points':
[{'Latitude': 26.53716, 'Longitude': -65.46725},
{'Latitude': 21.2824, 'Longitude': -91.30593},
{'Latitude': 3.60241, 'Longitude': -86.43124},
{'Latitude': 8.66868, 'Longitude': -62.64935},
{'Latitude': 26.53716, 'Longitude': -65.46725}]}}]}}}
meanwhile, accessing the coordinates through xarray will give me this result (i will show coordinates only since there are so many attributes listed):
start_center_longitude :
-74.501495
start_center_latitude :
5.7442007
end_center_longitude :
-78.543
end_center_latitude :
23.93937
geospatial_lat_max : northernmost_latitude
26.53716
geospatial_lat_min : southernmost_latitude
3.6024086
geospatial_lon_max : easternmost_longitude
-62.64935
geospatial_lon_min : westernmost_longitude
-91.30593
After comparing these coordinates, earthaccess provide additional coordinates (producing accurate bounding box) while xarray attribute only provide 2 set of coordinates (producing a rectangular bounding box). My question is, I was wondering if the additional coordinates from the earthaccess are a third party information to get, since I want to have similar coordinates result but just from using xarray. Apology if this discussion is quite long. Thank you!
Beta Was this translation helpful? Give feedback.
All reactions