Change area names to new naming scheme and remove some areas.#3299
Change area names to new naming scheme and remove some areas.#3299BENR0 wants to merge 3 commits intopytroll:mainfrom
Conversation
gerritholl
left a comment
There was a problem hiding this comment.
Looks good, some small corrections to be implemented. The use of a decorator function is a little odd to me.
I wonder if we can do something about deleted areas.
| area_dict = None | ||
| for new_area_name, v in areas_dict.items(): | ||
|
|
||
| if "old_name" in v.keys() and area_name in v["old_name"]:# == area_name: |
| warnings.simplefilter("always", DeprecationWarning) | ||
| warnings.warn(f"This area name is being deprecated in Satpy v1.0. Pleas use the new area name:" | ||
| f" {new_area_name}", DeprecationWarning, stacklevel=2) | ||
| warnings.simplefilter("default", DeprecationWarning) |
There was a problem hiding this comment.
This should use the warnings.catch_warnings context manager, so any previously existing user settings are not lost.
| warnings.simplefilter("default", DeprecationWarning) | ||
| return _create_area_def_from_dict(new_area_name, area_dict) | ||
| else: | ||
| raise AreaNotFound('Area "{0}" not found in file "{1}"'.format(area_name, area_file_name)) |
There was a problem hiding this comment.
This would be easier to read with an f-strring.
|
|
||
| return area_with_new_name | ||
|
|
||
| @deprecate_area_name |
There was a problem hiding this comment.
I find it confusing to define a decorator that is used exactly once and unlikely to be reused elsewhere. Wouldn't it be clearer to simply integrate this into get_area_def, then refactoring that function if it becomes too large?
|
|
||
| if area_dict is not None: | ||
| warnings.simplefilter("always", DeprecationWarning) | ||
| warnings.warn(f"This area name is being deprecated in Satpy v1.0. Pleas use the new area name:" |
There was a problem hiding this comment.
| warnings.warn(f"This area name is being deprecated in Satpy v1.0. Pleas use the new area name:" | |
| warnings.warn(f"This area name is being deprecated in Satpy v1.0. Please use the new area name:" |
| description: | ||
| Euroasia - optimised for Asia - | ||
| Global 1km USGS Landuse database | ||
| euroasia_asia_laea_1km: |
There was a problem hiding this comment.
Having Asia in the name twice is confusing.
|
|
||
| euroasia_asia_10km: | ||
| description: Euroasia - optimised for Asia - Global 1km USGS Landuse database | ||
| euroasia_asia_laea_10km: |
There was a problem hiding this comment.
Having Asia in the name twice is confusing.
| global_moll_10km: | ||
| old_name: moll | ||
| description: Globe in Mollweide projection |
There was a problem hiding this comment.
Maybe "world" is a better term here than "globe"? To me a globe is a spheroid, (almost) unprojected in lat/lon coordinates.
| greenland_robin_1km: | ||
| old_name: robinson | ||
| description: Greenland in Robinson projection |
There was a problem hiding this comment.
I would say that if the Robinson projection contained only Greenland and not the whole world, this counts as a bug...
| EPSG_4326_0.01deg: | ||
| old_name: EPSG_4326_36000x18000 |
There was a problem hiding this comment.
Then this too should have world in the name?
This PR changes area names for almost all areas to the naming scheme proposed in #2310 and removes areas listed by @mraspaud in https://docs.google.com/document/d/1LOGtyu8qjHiBcEhDToIgUPjUUlJalpGNgo-hpmBsb_k/edit?tab=t.0#heading=h.5adsx7apljox
Further possible areas which could be deprecated/replaced by other areas (please discuss):
Closes
Tests added
Fully documented
Notes for the "far" ahead future removal of old area names from areas.yaml and the introduced decorator:
old_namecan easily be removed for example with sed because it is only one line to be deleted in the corresponding areas