Deprecate `lon_name` and `lat_name`?
See original GitHub issueIf the coords are named "lon"
and "lat"
we can do the following:
region.mask(ds)
If they are named "longitude"
and "latitude"
we have two possibilities:
region.mask(ds, lon_name="longitude", lat_name="latitude") # (1)
region.mask(ds.longitude, ds.latitude) # (2)
I don’t think ~(2)~ (1) offers any advantage over ~(1)~ (2) - it’s more verbose and harder to read (for me). Without (1) you can always do:
region.mask(ds["longitude"], ds["latitude"])
region.mask(ds[lon_name], ds[lat_name])
What we loose is the possibility to set a custom name when numpy arrays are passed. I.e. the following is no longer possible:
region.mask(ds.lon.values, ds.lat.values, lon_name="longitude", lat_name="latitude")
But I don’t think it’s worth it - if you pass a numpy array you are unlikely wanting back a DataArray with a very specific naming (?). And the workaround would be relatively straightforward:
mask = region.mask(ds.lon.values, ds.lat.values)
mask = mask.rename(lat="latitude", lon="longitude")
This allows to remove two params from mask
which is always a gain (IMHO).
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
How to Split or Reverse First Last Names in Excel - Contextures
Before splitting the names into separate cells, follow these steps, to remove the space after the comma. Otherwise, a space will appear before ......
Read more >Separate First and Last Name in Excel (Split Names Using ...
The above steps would remove the middle name from a full name. In case some names don't have any middle name, they would...
Read more >Deprecated Identifier Name - Glossary | CSRC
An identifier name that is no longer valid because it has either been replaced by a new identifier name or set of identifier...
Read more >Deprecate old name for class in C++ - Stack Overflow
I work on a framework that has massively renamed all its classes and functions, I created a transition header allowing to use old...
Read more >Remove middle initial from full name in Excel - ExtendOffice
Sometime, your full names are formatted as first, last and middle names, to remove the middle initial from the end of name as...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thanks for the feedback @jbusecke !
Just my two cents: I support the initial proposal to deprecate this syntax:
As you suggested in my personal workflows I would not miss the ability to pass numpy arrays (e.g.
region.mask(ds.lon.values, ds.lat.values, lon_name="longitude", lat_name="latitude")
). In fact I think that it is better to force the user to wrap things into xarray before passing them.The options setting seem quite confusing to me and I believe the initial deprecation + #364 would be a better choice!