question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Deprecate `lon_name` and `lat_name`?

See original GitHub issue

If 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:closed
  • Created 2 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
mathausecommented, Aug 25, 2022

Thanks for the feedback @jbusecke !

0reactions
jbuseckecommented, Aug 23, 2022

Just my two cents: I support the initial proposal to deprecate this syntax:

region.mask(ds, lon_name="longitude", lat_name="latitude")  # (1)

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!

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found