Skip to content

Commit 00e1e7e

Browse files
Tag Removal Modules Structure Rearranged (#779)
* completely remove hazard.tag class * isolate deprecated entity.tag class * entity.tag: update pydoc * changelog: consolidate with regard to tag removal
1 parent c8678ac commit 00e1e7e

File tree

6 files changed

+18
-247
lines changed

6 files changed

+18
-247
lines changed

CHANGELOG.md

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,8 @@ Removed:
6464
- Added method `Exposures.centroids_total_value` to replace the functionality of `Exposures.affected_total_value`. This method is temporary and deprecated. [#702](https://github.com/CLIMADA-project/climada_python/pull/702)
6565
- New method `climada.util.api_client.Client.purge_cache`: utility function to remove outdated files from the local file system to free disk space.
6666
([#737](https://github.com/CLIMADA-project/climada_python/pull/737))
67-
- New attribute `climada.entity.exposures.Exposures.description`: used for setting the default title in plots from plotting mathods `plot_hexbin` and `plot_scatter`. [#756](https://github.com/CLIMADA-project/climada_python/pull/756)
67+
- New attribute `climada.hazard.Hazard.haz_type`: used for assigning impacts to hazards. In previous versions this information was stored in the now removed `climada.hazard.tag.Tag` class. [#736](https://github.com/CLIMADA-project/climada_python/pull/736)
68+
- New attribute `climada.entity.exposures.Exposures.description`: used for setting the default title in plots from plotting mathods `plot_hexbin` and `plot_scatter`. In previous versions this information was stored in the deprecated `climada.entity.tag.Tag` class. [#756](https://github.com/CLIMADA-project/climada_python/pull/756)
6869
- Added advanced examples in unsequa tutorial for coupled input variables and for handling efficiently the loading of multiple large files [#766](https://github.com/CLIMADA-project/climada_python/pull/766)
6970

7071
### Changed
@@ -86,7 +87,6 @@ Removed:
8687
- Use `pytest` for executing tests [#726](https://github.com/CLIMADA-project/climada_python/pull/726)
8788
- Users can opt-out of the climada specific logging definitions and freely configure logging to their will, by setting the config value `logging.managed` to `false`. [#724](https://github.com/CLIMADA-project/climada_python/pull/724)
8889
- Add option to read additional variables from IBTrACS when using `TCTracks.from_ibtracs_netcdf` [#728](https://github.com/CLIMADA-project/climada_python/pull/728)
89-
- The `haz_type` attribute has been moved from `climada.hazard.tag.Tag` to `climada.hazard.Hazard` itself. [#736](https://github.com/CLIMADA-project/climada_python/pull/736)
9090
- New file format for `TCTracks` I/O with better performance. This change is not backwards compatible: If you stored `TCTracks` objects with `TCTracks.write_hdf5`, reload the original data and store them again. [#735](https://github.com/CLIMADA-project/climada_python/pull/735)
9191
- Add option to load only a subset when reading TC tracks using `TCTracks.from_simulations_emanuel`. [#741](https://github.com/CLIMADA-project/climada_python/pull/741)
9292
- Set `save_mat` to `False` in the `unsequa` module [#746](https://github.com/CLIMADA-project/climada_python/pull/746)
@@ -112,16 +112,22 @@ Removed:
112112

113113
- `Centroids.from_geodataframe` and `Centroids.from_pix_bounds` [#721](https://github.com/CLIMADA-project/climada_python/pull/721)
114114
- `Impact.tot_value`: Use `Exposures.affected_total_value` to compute the total value affected by a hazard intensity above a custom threshold [#702](https://github.com/CLIMADA-project/climada_python/pull/702)
115-
- `climada.hazard.tag.Tag` and `climada.entity.tag.Tag`. [#736](https://github.com/CLIMADA-project/climada_python/pull/736). They were unified into `climada.util.tag.Tag`. Note: the latter is to be deprecated and removed in a future version as well.
115+
- `climada.entity.tag.Tag`. [#779](https://github.com/CLIMADA-project/climada_python/pull/779). The class is not used anymore but had to be kept for reading Exposures HDF5 files that were created with previous versions of CLIMADA.
116116

117117
### Removed
118118

119119
- `Centroids.set_raster_from_pix_bounds` [#721](https://github.com/CLIMADA-project/climada_python/pull/721)
120120
- `requirements/env_developer.yml` environment specs. Use 'extra' requirements when installing the Python package instead [#712](https://github.com/CLIMADA-project/climada_python/pull/712)
121-
- `Impact.tag` attribute. This change is not backwards-compatible with respect to the files written and read by the `Impact` class [#743](https://github.com/CLIMADA-project/climada_python/pull/743)
122-
- `Exposures.tag` attribute. This change is not backwards-compatible with respect to the files written and read by the `Exposures` class [#756](https://github.com/CLIMADA-project/climada_python/pull/756)
123-
- `Hazard.tag` attribute. This change is not backwards-compatible with respect to the files written and read by the `Hazard` class [#767](https://github.com/CLIMADA-project/climada_python/pull/767)
124-
- `impact.tot_value ` attribute removed from unsequa module [#763](https://github.com/CLIMADA-project/climada_python/pull/763)
121+
- The `climada.entitity.tag.Tag` class, together with `Impact.tag`, `Exposures.tag`, `ImpactFuncSet.tag`, `MeasuresSet.tag`, `Hazard.tag` attributes.
122+
This may break backwards-compatibility with respect to the files written and read by the `Impact` class.
123+
[#736](https://github.com/CLIMADA-project/climada_python/pull/736),
124+
[#743](https://github.com/CLIMADA-project/climada_python/pull/743),
125+
[#753](https://github.com/CLIMADA-project/climada_python/pull/753),
126+
[#754](https://github.com/CLIMADA-project/climada_python/pull/754),
127+
[#756](https://github.com/CLIMADA-project/climada_python/pull/756),
128+
[#767](https://github.com/CLIMADA-project/climada_python/pull/767),
129+
[#779](https://github.com/CLIMADA-project/climada_python/pull/779)
130+
- `impact.tot_value` attribute removed from unsequa module [#763](https://github.com/CLIMADA-project/climada_python/pull/763)
125131

126132
## v3.3.2
127133

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
from deprecation import deprecated
2323

24-
from climada.util.tag import Tag as _Tag
24+
from .tag import Tag as _Tag
2525

2626

2727
# deprecating the whole class instead of just the constructor (s.b.) would be preferable
@@ -31,7 +31,6 @@
3131
# @deprecated(details="This class is not supported anymore.")
3232
class Tag(_Tag):
3333
"""kept for backwards compatibility with climada <= 3.3
34-
use ``climada.util.tag.Tag`` instead
3534
"""
3635
@deprecated(details="This class is not supported anymore and will be removed in the next"
3736
" version of climada.")
Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,10 @@
1919
Define Tag class.
2020
"""
2121
from __future__ import annotations
22-
2322
from pathlib import Path
2423
from typing import Union, List
25-
import h5py
2624

27-
__all__ = ['Tag']
25+
import h5py
2826

2927

3028
STR_DT = h5py.special_dtype(vlen=str)
@@ -42,7 +40,8 @@ def _distinct_list_of_str(list_of_str: list, arg: Union[list, str, object]):
4240

4341

4442
class Tag():
45-
"""Source data tag for Exposures, DiscRates, ImpactFuncSet, MeasureSet.
43+
"""Deprecated since climada 4.*. This class is only used for unpickling, e.g., when reading
44+
Exposures hdf5 data files that have been created with climada <=3.*.
4645
4746
Attributes
4847
----------
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
import unittest
2323

24-
from climada.util.tag import Tag
24+
from climada.entity.tag import Tag
2525

2626
class TestAppend(unittest.TestCase):
2727
"""Test loading funcions from the Hazard class"""

climada/hazard/tag.py

Lines changed: 0 additions & 120 deletions
This file was deleted.

climada/hazard/test/test_tag.py

Lines changed: 0 additions & 113 deletions
This file was deleted.

0 commit comments

Comments
 (0)