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

Improve support for geographic coordinates #171

Closed
santisoler opened this issue Mar 15, 2019 · 7 comments · Fixed by #181
Closed

Improve support for geographic coordinates #171

santisoler opened this issue Mar 15, 2019 · 7 comments · Fixed by #181
Labels
enhancement Idea or request for a new feature

Comments

@santisoler
Copy link
Member

santisoler commented Mar 15, 2019

Description of the desired feature

Some functions from verde are intended to work with both projected and geographic coordinates.
Nevertheless, working with the latter imposes some requirements.
For example, one must ensure continuity around the globe: setting a grid between longitudes 170° and -170° or between 350° and 10° is not possible at the time because numerically the east coordinate is lower than the west one.
One way to fix this is to add a latlon=True argument to those functions in order to make clear that we are passing geographic coordinates.

I'll try to make a complete list of the functions that needs to be enhanced:

  • inside()
  • grid_coordinates()
  • scatter_coordinates()
  • profile_coordinates()
  • get_region()
  • pad_region()

Are you willing to help implement and maintain this feature? Yes

@welcome
Copy link

welcome bot commented Mar 15, 2019

👋 Thanks for opening your first issue here! Please make sure you filled out the template with as much detail as possible.

You might also want to take a look at our Contributing Guide and Code of Conduct.

@santisoler
Copy link
Member Author

@leouieda Can you think more functions that need this enhancement?

@djhoese
Copy link
Contributor

djhoese commented Mar 15, 2019

I'm not used to using verde functions directly (just a fan of the package and its interfaces), but I am dealing with similar issues in pyresample and the geoxarray library (geoxarray/geoxarray#6). I wonder if units could be specified instead of a boolean latlon keyword argument. Just an idea.

@snowman2
Copy link

snowman2 commented Mar 15, 2019

The pyproj.CRS object has a is_geographic property that is likely useful.

@leouieda
Copy link
Member

@djhoese I kind of wanted to avoid units in Verde because there are no restrictions on the actual data types that can be used. I like the idea but I don't know if it would be worth the effort of dealing with a unit library to replace the keyword. Are you planning on using that with geoxarray?

@snowman2 that's interesting but I'm not sure how we could use it. The functions above don't really take any CRS arguments right now. So we'd still have to add an argument and pass it around but instead of latlon=bool it would be crs=proj.CRS(...). We'll keep this in mind in case there is an added bonus to this, since it would also add a dependency on the pyproj API.

@leouieda leouieda added the enhancement Idea or request for a new feature label Mar 20, 2019
@leouieda
Copy link
Member

@santisoler I think you could get started with a latlon or geographic style option in one of those functions.

@santisoler
Copy link
Member Author

👍 I'll add a PR when I start tackling this.

leouieda pushed a commit that referenced this issue Jul 16, 2019
The function moves a set of longitudinal coordinates either to the `[0, 360)`
or `[-180, 180)` degrees intervals to ensure that longitude is continuous
throughout the array (no 360 -> 0 jump). Optionally change a given region
to match the longitude values.
This way, longitude arrays can be sliced to a sub region with simple `>= <=`
comparisons.

Fixes #171
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Idea or request for a new feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants