Skip to content
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

Allow users to define the x.y coordinates (similar to set_geometry in geopandas) #27

Closed
snowman2 opened this issue Jul 11, 2019 · 0 comments · Fixed by #28
Closed

Allow users to define the x.y coordinates (similar to set_geometry in geopandas) #27

snowman2 opened this issue Jul 11, 2019 · 0 comments · Fixed by #28

Comments

@snowman2
Copy link
Member

snowman2 commented Jul 11, 2019

Currently only x,y and latitude,longitude are supported. But, sometime people use lat& lon etc... See: https://gis.stackexchange.com/questions/328128/extracting-data-within-geometry-shape/328320#comment535454_328320

It would be useful to allow users to define it themselves. Either set_geometry or set_xy?
Also, this would mean that the check for x,y coordinates would have to be delayed until users use a function that needs it.

Current workaround:

>>> import xarray
>>> xds = xarray.Dataset(coords={"lon": [1, 2], "lat": [3, 4]})
>>> xds
<xarray.Dataset>
Dimensions:  (lat: 2, lon: 2)
Coordinates:
  * lon      (lon) int64 1 2
  * lat      (lat) int64 3 4
Data variables:
    *empty*
>>> xds.rename({"lon": "longitude", "lat": "latitude"})
<xarray.Dataset>
Dimensions:    (latitude: 2, longitude: 2)
Coordinates:
  * longitude  (longitude) int64 1 2
  * latitude   (latitude) int64 3 4
Data variables:
    *empty*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant