Unidata / MetPy

MetPy is a collection of tools in Python for reading, visualizing and performing calculations with weather data.
https://unidata.github.io/MetPy/
BSD 3-Clause "New" or "Revised" License
1.26k stars 415 forks source link

Allow internally consistent aliases for the MapPanel layers attribute #2042

Open sgdecker opened 3 years ago

sgdecker commented 3 years ago

Pulled from discussion under #2016:

Currently, the strings used to specify the layers of a MapPanel, such as panel.layers = ['coastline', 'borders', 'states'] are maddeningly inconsistent.

Why is coastline singular? borders is vague; why isn't it countries?

I propose that we allow aliases ('coastlines' = 'coastline', 'countries' = 'borders', and perhaps others).

Perhaps a 'default' alias (equivalent to ['coastline', 'borders', 'states']) would be nice as well.

dopplershift commented 3 years ago

I really don't like the idea of a "default" that isn't actually...the default value. And we can't change the default until 2.0. I've not been able to come up with a better name, though.

kgoebber commented 3 years ago

@dopplershift what about "standard"?

dopplershift commented 3 years ago

"standard" seems fine. Now, would that be set as 'standard' or ['standard']. Would we support then ['standard', 'uscounties']?

sgdecker commented 3 years ago

Great questions. Since the current implementation requires a list (or tuple), it seems ['standard'] would be the way to go. I suppose support for a string as an alternative to a list with one item could be added, but that's a separate feature, and you can already do panel.layers = 'states', (or perhaps in the future, panel.layers = 'standard',) and it will work, so I'm not sure it is worth it just to save a comma.

I think it would make sense to support additional items in a list where 'standard' is present, in any order (so ['uscounties', 'standard'] should also work).