adjust test string and fix whitespace #1113
GitHub Actions / Petals / Unit Test Results (3.11)
failed
Dec 13, 2024 in 0s.
View latest attempt.
1 fail, 2 skipped, 213 pass in 5m 32s
216 tests 213 ✅ 5m 32s ⏱️
1 suites 2 💤
1 files 1 ❌
Results for commit 1490603.
Annotations
Check warning on line 0 in climada_petals.hazard.test.test_tc_rainfield.TestReader
github-actions / Petals / Unit Test Results (3.11)
test_tcr (climada_petals.hazard.test.test_tc_rainfield.TestReader) failed
climada_petals/tests_xml/tests.xml [took 0s]
Raw output
TypeError: compute_angular_windspeeds() got an unexpected keyword argument 'model_kwarg'
self = <climada_petals.hazard.test.test_tc_rainfield.TestReader testMethod=test_tcr>
def test_tcr(self):
"""Test from_tracks constructor with model TCR."""
tc_track = TCTracks.from_processed_ibtracs_csv(TEST_TRACK)
tc_track.equal_timestep()
> tc_haz = TCRain.from_tracks(tc_track, model="TCR", centroids=CENTR_TEST_BRB)
climada_petals/hazard/test/test_tc_rainfield.py:97:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
climada_petals/hazard/tc_rainfield.py:457: in from_tracks
cls._from_track(track, centroids, idx_centr_filter,
climada_petals/hazard/tc_rainfield.py:524: in _from_track
intensity_sparse, rainrates_sparse = _compute_rain_sparse(
climada_petals/hazard/tc_rainfield.py:678: in _compute_rain_sparse
rainrates, idx_centr_reachable = compute_rain(
climada_petals/hazard/tc_rainfield.py:840: in compute_rain
rainrates = _tcr(
climada_petals/hazard/tc_rainfield.py:1112: in _tcr
w = _compute_vertical_velocity(si_track, centroids, d_centr, mask_centr_close, **kwargs)
climada_petals/hazard/tc_rainfield.py:1185: in _compute_vertical_velocity
h_winds = _horizontal_winds(
climada_petals/hazard/tc_rainfield.py:1254: in _horizontal_winds
"nocoriolis": _windprofile(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
si_track = <xarray.Dataset> Size: 25kB
Dimensions: (time: 223, component: 2)
Coordinates:
lat (time) float64 2k... 1951239012334.0
category: 1
mid_lon: -52.55
latsign: 1.0
d_centr = array([[3695207.91650535, 3695449.24147036, 3695713.75265507, ...,
3533911.09719767, 3536021.45430381, 3538736...4488.39822548, 2143368.52279856, 2142288.08849876, ...,
2299126.86581836, 2295207.47409199, 2292216.77271757]])
mask_centr_close = array([[False, False, False, ..., False, False, False],
[False, False, False, ..., False, False, False],
...alse],
[False, False, False, ..., False, False, False],
[False, False, False, ..., False, False, False]])
model = 3, cyclostrophic = True, matlab_ref_mode = False
def _windprofile(
si_track: xr.Dataset,
d_centr: dict,
mask_centr_close: np.ndarray,
model: int,
cyclostrophic: bool = False,
matlab_ref_mode: bool = False,
) -> np.ndarray:
"""Compute (absolute) angular wind speeds according to a parametric wind profile
Wrapper around ``compute_angular_windspeeds`` (from climada.trop_cyclone) that adjusts the
Coriolis parameter if matlab_ref_mode is True.
Parameters
----------
si_track : xr.Dataset
Output of ``tctrack_to_si``. Which data variables are used depends on the wind model.
d_centr : ndarray of shape (npositions, ncentroids)
Distances from storm centers to centroids.
mask_centr_close : np.ndarray of shape (npositions, ncentroids)
For each track position one row indicating which centroids are within reach.
model : int
Wind profile model selection according to MODEL_VANG.
cyclostrophic : bool, optional
If True, don't apply the influence of the Coriolis force (set the Coriolis terms to 0).
Default: False
matlab_ref_mode : bool, optional
Do not apply the changes to the reference MATLAB implementation. Default: False
Returns
-------
ndarray of shape (npositions, ncentroids)
"""
if matlab_ref_mode:
# In the MATLAB implementation, the Coriolis parameter is chosen to be 5e-5 (independent of
# latitude), following formula (2) and the remark in Section 3 of Emanuel & Rotunno (2011).
si_track = si_track.copy(deep=True)
si_track["cp"].values[:] = 5e-5
> return compute_angular_windspeeds(
si_track, d_centr, mask_centr_close, model, model_kwarg=dict(cyclostrophic=cyclostrophic),
)
E TypeError: compute_angular_windspeeds() got an unexpected keyword argument 'model_kwarg'
climada_petals/hazard/tc_rainfield.py:1323: TypeError
Loading