Skip to content

Commit 3468a7e

Browse files
removed class attributes from StormEurope and TropCyclone and removed TropCyclone.set_from_tracks
1 parent cf1a5c4 commit 3468a7e

File tree

3 files changed

+3
-29
lines changed

3 files changed

+3
-29
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ Code freeze date: YYYY-MM-DD
1313
Removed:
1414

1515
- `pandas-datareader`
16-
- `intensity_thres` of a general `Hazard` object [#1065](https://github.com/CLIMADA-project/climada_python/pull/1065)
16+
- `intensity_thres` of `Hazard`, `StormEurope`, and `TropCyclones` object [#1065](https://github.com/CLIMADA-project/climada_python/pull/1065)
17+
- Deprecated method `climada.hazard.trop_cyclone.trop_cyclone.TropCyclone.set_from_tracks` [#1065](https://github.com/CLIMADA-project/climada_python/pull/1065)
1718

1819
### Added
1920
- Added optional parameter to `geo_im_from_array`, `plot_from_gdf`, `plot_rp_imp`, `plot_rp_intensity`,

climada/hazard/storm_europe.py

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,6 @@ class StormEurope(Hazard):
9292
Threshold below which wind speeds (in m/s) are stored as 0. Defaults to 14.6.
9393
"""
9494

95-
intensity_thres = DEF_INTENSITY_THRES
96-
"""Intensity threshold for storage in m/s."""
97-
9895
vars_opt = Hazard.vars_opt.union({"ssi_wisc", "ssi", "ssi_full_area"})
9996
"""Name of the variables that aren't need to compute the impact."""
10097

@@ -726,8 +723,7 @@ def calc_ssi(
726723
ignoring the intensities at sea. Defaults to true, whereas
727724
the MATLAB version did not.
728725
threshold : float, optional
729-
Intensity threshold used in index
730-
definition. Cannot be lower than the read-in value.
726+
Intensity threshold used in index definition.
731727
sel_cen : np.array, bool
732728
A boolean vector selecting centroids.
733729
Takes precendence over on_land.
@@ -741,12 +737,7 @@ def calc_ssi(
741737
intensity = self.intensity
742738

743739
if threshold is not None:
744-
assert (
745-
threshold >= self.intensity_thres
746-
), "threshold cannot be below threshold upon read_footprint"
747740
intensity = intensity.multiply(intensity > threshold)
748-
else:
749-
intensity = intensity.multiply(intensity > self.intensity_thres)
750741

751742
cent = self.centroids
752743
area_pixel = cent.get_area_pixel()

climada/hazard/trop_cyclone/trop_cyclone.py

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,6 @@ class TropCyclone(Hazard):
9595
Threshold below which wind speeds (in m/s) are stored as 0. Defaults to 17.5.
9696
"""
9797

98-
intensity_thres = DEF_INTENSITY_THRES
99-
"""intensity threshold for storage in m/s"""
100-
10198
vars_opt = Hazard.vars_opt.union({"category"})
10299
"""Name of the variables that are not needed to compute the impact."""
103100

@@ -147,19 +144,6 @@ def __init__(
147144
self.basin = basin if basin is not None else []
148145
self.windfields = windfields if windfields is not None else []
149146

150-
def set_from_tracks(self, *args, **kwargs):
151-
"""This function is deprecated, use TropCyclone.from_tracks instead."""
152-
LOGGER.warning(
153-
"The use of TropCyclone.set_from_tracks is deprecated."
154-
"Use TropCyclone.from_tracks instead."
155-
)
156-
if "intensity_thres" not in kwargs:
157-
# some users modify the threshold attribute before calling `set_from_tracks`
158-
kwargs["intensity_thres"] = self.intensity_thres
159-
if self.pool is not None and "pool" not in kwargs:
160-
kwargs["pool"] = self.pool
161-
self.__dict__ = TropCyclone.from_tracks(*args, **kwargs).__dict__
162-
163147
@classmethod
164148
def from_tracks(
165149
cls,
@@ -386,7 +370,6 @@ def from_tracks(
386370
LOGGER.debug("Concatenate events.")
387371
haz = cls.concat(tc_haz_list)
388372
haz.pool = pool
389-
haz.intensity_thres = intensity_thres
390373
LOGGER.debug("Compute frequency.")
391374
haz.frequency_from_tracks(tracks.data)
392375
return haz
@@ -714,7 +697,6 @@ def from_single_track(
714697
)
715698

716699
new_haz = cls(haz_type=HAZ_TYPE)
717-
new_haz.intensity_thres = intensity_thres
718700
new_haz.intensity = intensity_sparse
719701
if store_windfields:
720702
new_haz.windfields = [windfields_sparse]

0 commit comments

Comments
 (0)