Skip to content

no numba and temp fix warnings #934

no numba and temp fix warnings

no numba and temp fix warnings #934

GitHub Actions / Core / Unit Test Results (3.9) failed Aug 27, 2024 in 0s

8 fail, 699 pass in 8m 48s

707 tests  ±0   699 ✅ ±0   8m 48s ⏱️ -15s
  1 suites ±0     0 💤 ±0 
  1 files   ±0     8 ❌ ±0 

Results for commit b0c13f0. ± Comparison against earlier commit 852c54d.

Annotations

Check warning on line 0 in climada.hazard.test.test_tc_tracks_synth.TestSynth

See this annotation in the file changed.

@github-actions github-actions / Core / Unit Test Results (3.9)

test_random_walk_decay_pass (climada.hazard.test.test_tc_tracks_synth.TestSynth) failed

tests_xml/tests.xml [took 0s]
Raw output
ValueError: Set `adjust_intensity` to "legacy_decay" or `decay` to False.
self = <climada.hazard.test.test_tc_tracks_synth.TestSynth testMethod=test_random_walk_decay_pass>

    def test_random_walk_decay_pass(self):
        """Test land decay is called from calc_perturbed_trajectories."""
        assert TC_ANDREW_FL.is_file()
        tc_track = tc.TCTracks.from_processed_ibtracs_csv(TC_ANDREW_FL)
        nb_synth_tracks = 2
        # should work if using global parameters
        with self.assertLogs('climada.hazard.tc_tracks_synth', level='DEBUG') as cm0:
>           tc_track.calc_perturbed_trajectories(nb_synth_tracks=nb_synth_tracks, seed=25, decay=True,
                                                 use_global_decay_params=True)

climada/hazard/test/test_tc_tracks_synth.py:605: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
climada/hazard/tc_tracks.py:1152: in calc_perturbed_trajectories
    climada.hazard.tc_tracks_synth.calc_perturbed_trajectories(self, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

tracks = <climada.hazard.tc_tracks.TCTracks object at 0x7fb45c282d00>
nb_synth_tracks = 2, max_shift_ini = 0.75, max_dspeed_rel = 0.3
max_ddirection = 0.008726646259971648, autocorr_dspeed = 0.85
autocorr_ddirection = 0.5, decay_ddirection_hourly = 0.016666666666666666
seed = 25, adjust_intensity = 'explicit', central_pressure_pert = 7.5
decay = True, use_global_decay_params = True, extend_track = True, pool = None

    def calc_perturbed_trajectories(
        tracks,
        nb_synth_tracks: int = 9,
        max_shift_ini: float = 0.75,
        max_dspeed_rel: float = 0.3,
        max_ddirection: float = np.pi / 360,
        autocorr_dspeed: float = 0.85,
        autocorr_ddirection: float = 0.5,
        decay_ddirection_hourly: float = 1/(2.5*24),
        seed: int = CONFIG.hazard.trop_cyclone.random_seed.int(),
        adjust_intensity: str = 'explicit',
        central_pressure_pert: float = 7.5,
        decay: bool = None,
        use_global_decay_params: bool = True,
        extend_track: bool = True,
        pool: AbstractWorkerPool = None,
    ):
        """
        Generate synthetic tracks based on directed random walk. An ensemble of nb_synth_tracks
        synthetic tracks is computed for every track contained in self.
    
        The methodology perturbs the tracks locations, and if decay is True it additionally
        includes decay of wind speed and central pressure drop after landfall. No other track
        parameter is perturbed.
        The track starting point location is perturbed by random uniform values of
        magnitude up to max_shift_ini in both longitude and latitude. Then, each segment
        between two consecutive points is perturbed in direction and distance (i.e.,
        translational speed). These perturbations can be correlated in time, i.e.,
        the perturbation in direction applied to segment i is correlated with the perturbation
        in direction applied to segment i-1 (and similarly for the perturbation in translational
        speed).
        Perturbations in track direction and temporal auto-correlations in perturbations are
        on an hourly basis, and the perturbations in translational speed is relative.
        Hence, the parameter values are relatively insensitive to the temporal
        resolution of the tracks. Note however that all tracks should be at the same
        temporal resolution, which can be achieved using equal_timestep().
        max_dspeed_rel and autocorr_dspeed control the spread along the track ('what distance
        does the track run for'), while max_ddirection and autocorr_ddirection control the spread
        perpendicular to the track movement ('how does the track diverge in direction').
        max_dspeed_rel and max_ddirection control the amplitude of perturbations at each track
        timestep but perturbations may tend to compensate each other over time, leading to
        a similar location at the end of the track, while autocorr_dspeed and autocorr_ddirection
        control how these perturbations persist in time and hence the amplitude of the
        perturbations towards the end of the track.
    
        Note that the default parameter values have been only roughly calibrated so that
        the frequency of tracks in each 5x5degree box remains approximately constant.
        This is not an in-depth calibration and should be treated as such.
        The object is mutated in-place.
    
        Parameters
        ----------
        tracks : climada.hazard.TCTracks
            Tracks data.
        nb_synth_tracks : int, optional
            Number of ensemble members per track. Default: 9.
        max_shift_ini : float, optional
            Amplitude of max random starting point shift in decimal degree
            (up to +/-max_shift_ini for longitude and latitude). Default: 0.75.
        max_dspeed_rel : float, optional
            Amplitude of translation speed perturbation in relative terms
            (e.g., 0.2 for +/-20%). Default: 0.3.
        max_ddirection : float, optional
            Amplitude of track direction (bearing angle) perturbation
            per hour, in radians. Default: pi/360.
        autocorr_dspeed : float, optional
            Temporal autocorrelation in translation speed perturbation
            at a lag of 1 hour. Default: 0.85.
        autocorr_ddirection : float, optional
            Temporal autocorrelation of track direction perturbation
            at a lag of 1 hour. Default: 0.5.
        decay_ddirection_hourly : float, optional
            Exponential decay parameter applied to reduce the track direction
            perturbation with track time, in units of "per hour". Set to larger than
            0 to prevent long tracks to deviate too much from their historical
            counterpart. Default: 1/(2.5*24) (i.e. per 2.5 days).
        seed : int, optional
            Random number generator seed for replicability of random walk.
            Put negative value if you don't want to use it. Default: configuration file.
        adjust_intensity : str, optional
            Whether and how tropical cyclone intensity (central pressure,
            max_sustained_wind) should be modelled. One of 'explicit',
            'legacy_decay', or 'none'.
            For 'explicit', intensity as well as radius_oci (outermost closed isobar)
            and radius_max_wind are statistically modelled depending on landfalls in
            historical and synthetic tracks (track intensification, peak intensity
            duration as well as intensity decay over the ocean and over land are
            explicitly modelled).
            For 'legacy_decay', a landfall decay is applied when a synthetic track
            reached land; however when a synthetic track is over the ocean while its
            historical counterpart was over land, intensity will be underestimated.
            For 'none', the track intensity will be the same as the historical track
            independently on whether both tracks are over land or the ocean.
            For None, will be set to 'explicit'.
            Default: None (i.e., 'explicit').
        central_pressure_pert : float, optional
            Magnitude of the intensity perturbation (in mbar). This value is used to
            perturb the maximum intensity (lowest central_pressure value) when
            adjust_intensity is True. Perturbations are generated from a normal
            distribution with mean=0 and sd=central_pressure_pert/2 constrained
            between -central_pressure_pert and +central_pressure_pert. Default: 7.5
            (corresponds to about 10 kn).
        decay : bool, optional
            Deprecated, for backward compatibility only. If True, equivalent to
            setting 'adjust_intensity' to 'legacy_decay'. If False, equivalent to
            setting 'adjust_intensity' to 'none'. Default: None (i.e. rely on the
            value of 'adjust_intensity').
        use_global_decay_params : bool, optional
            Whether to use precomputed global parameter values for landfall decay
            obtained from IBTrACS (1980-2019). If False, parameters are fitted
            using historical tracks in input parameter 'tracks', in which case the
            landfall decay applied depends on the tracks passed as an input and may
            not be robust if few historical tracks make landfall in this object.
            Default: True.
        pool : pathos.pool, optional
            Pool that will be used for parallel computation when applicable. If not given, the
            pool attribute of `tracks` will be used. Default: None
        """
        if decay is not None:
            LOGGER.warning("`decay` is deprecated. "
                            "Use `adjust_intensity` instead.")
            if adjust_intensity == 'explicit':
>               raise ValueError(
                    'Set `adjust_intensity` to "legacy_decay" or `decay` to False.'
                )
E               ValueError: Set `adjust_intensity` to "legacy_decay" or `decay` to False.

climada/hazard/tc_tracks_synth.py:361: ValueError

Check warning on line 0 in climada.hazard.test.test_tc_tracks_synth.TestSynth

See this annotation in the file changed.

@github-actions github-actions / Core / Unit Test Results (3.9)

test_random_walk_identical_pass (climada.hazard.test.test_tc_tracks_synth.TestSynth) failed

tests_xml/tests.xml [took 0s]
Raw output
ValueError: Set `adjust_intensity` to "legacy_decay" or `decay` to False.
self = <climada.hazard.test.test_tc_tracks_synth.TestSynth testMethod=test_random_walk_identical_pass>

    def test_random_walk_identical_pass(self):
        """Test 0 perturbation leads to identical tracks."""
        tc_track = tc.TCTracks.from_processed_ibtracs_csv(TC_ANDREW_FL)
        nb_synth_tracks = 2
>       tc_track.calc_perturbed_trajectories(nb_synth_tracks=nb_synth_tracks,
                                  max_shift_ini=0, max_dspeed_rel=0, max_ddirection=0, decay=False)

climada/hazard/test/test_tc_tracks_synth.py:632: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
climada/hazard/tc_tracks.py:1152: in calc_perturbed_trajectories
    climada.hazard.tc_tracks_synth.calc_perturbed_trajectories(self, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

tracks = <climada.hazard.tc_tracks.TCTracks object at 0x7fb45c2c0160>
nb_synth_tracks = 2, max_shift_ini = 0, max_dspeed_rel = 0, max_ddirection = 0
autocorr_dspeed = 0.85, autocorr_ddirection = 0.5
decay_ddirection_hourly = 0.016666666666666666, seed = 54
adjust_intensity = 'explicit', central_pressure_pert = 7.5, decay = False
use_global_decay_params = True, extend_track = True, pool = None

    def calc_perturbed_trajectories(
        tracks,
        nb_synth_tracks: int = 9,
        max_shift_ini: float = 0.75,
        max_dspeed_rel: float = 0.3,
        max_ddirection: float = np.pi / 360,
        autocorr_dspeed: float = 0.85,
        autocorr_ddirection: float = 0.5,
        decay_ddirection_hourly: float = 1/(2.5*24),
        seed: int = CONFIG.hazard.trop_cyclone.random_seed.int(),
        adjust_intensity: str = 'explicit',
        central_pressure_pert: float = 7.5,
        decay: bool = None,
        use_global_decay_params: bool = True,
        extend_track: bool = True,
        pool: AbstractWorkerPool = None,
    ):
        """
        Generate synthetic tracks based on directed random walk. An ensemble of nb_synth_tracks
        synthetic tracks is computed for every track contained in self.
    
        The methodology perturbs the tracks locations, and if decay is True it additionally
        includes decay of wind speed and central pressure drop after landfall. No other track
        parameter is perturbed.
        The track starting point location is perturbed by random uniform values of
        magnitude up to max_shift_ini in both longitude and latitude. Then, each segment
        between two consecutive points is perturbed in direction and distance (i.e.,
        translational speed). These perturbations can be correlated in time, i.e.,
        the perturbation in direction applied to segment i is correlated with the perturbation
        in direction applied to segment i-1 (and similarly for the perturbation in translational
        speed).
        Perturbations in track direction and temporal auto-correlations in perturbations are
        on an hourly basis, and the perturbations in translational speed is relative.
        Hence, the parameter values are relatively insensitive to the temporal
        resolution of the tracks. Note however that all tracks should be at the same
        temporal resolution, which can be achieved using equal_timestep().
        max_dspeed_rel and autocorr_dspeed control the spread along the track ('what distance
        does the track run for'), while max_ddirection and autocorr_ddirection control the spread
        perpendicular to the track movement ('how does the track diverge in direction').
        max_dspeed_rel and max_ddirection control the amplitude of perturbations at each track
        timestep but perturbations may tend to compensate each other over time, leading to
        a similar location at the end of the track, while autocorr_dspeed and autocorr_ddirection
        control how these perturbations persist in time and hence the amplitude of the
        perturbations towards the end of the track.
    
        Note that the default parameter values have been only roughly calibrated so that
        the frequency of tracks in each 5x5degree box remains approximately constant.
        This is not an in-depth calibration and should be treated as such.
        The object is mutated in-place.
    
        Parameters
        ----------
        tracks : climada.hazard.TCTracks
            Tracks data.
        nb_synth_tracks : int, optional
            Number of ensemble members per track. Default: 9.
        max_shift_ini : float, optional
            Amplitude of max random starting point shift in decimal degree
            (up to +/-max_shift_ini for longitude and latitude). Default: 0.75.
        max_dspeed_rel : float, optional
            Amplitude of translation speed perturbation in relative terms
            (e.g., 0.2 for +/-20%). Default: 0.3.
        max_ddirection : float, optional
            Amplitude of track direction (bearing angle) perturbation
            per hour, in radians. Default: pi/360.
        autocorr_dspeed : float, optional
            Temporal autocorrelation in translation speed perturbation
            at a lag of 1 hour. Default: 0.85.
        autocorr_ddirection : float, optional
            Temporal autocorrelation of track direction perturbation
            at a lag of 1 hour. Default: 0.5.
        decay_ddirection_hourly : float, optional
            Exponential decay parameter applied to reduce the track direction
            perturbation with track time, in units of "per hour". Set to larger than
            0 to prevent long tracks to deviate too much from their historical
            counterpart. Default: 1/(2.5*24) (i.e. per 2.5 days).
        seed : int, optional
            Random number generator seed for replicability of random walk.
            Put negative value if you don't want to use it. Default: configuration file.
        adjust_intensity : str, optional
            Whether and how tropical cyclone intensity (central pressure,
            max_sustained_wind) should be modelled. One of 'explicit',
            'legacy_decay', or 'none'.
            For 'explicit', intensity as well as radius_oci (outermost closed isobar)
            and radius_max_wind are statistically modelled depending on landfalls in
            historical and synthetic tracks (track intensification, peak intensity
            duration as well as intensity decay over the ocean and over land are
            explicitly modelled).
            For 'legacy_decay', a landfall decay is applied when a synthetic track
            reached land; however when a synthetic track is over the ocean while its
            historical counterpart was over land, intensity will be underestimated.
            For 'none', the track intensity will be the same as the historical track
            independently on whether both tracks are over land or the ocean.
            For None, will be set to 'explicit'.
            Default: None (i.e., 'explicit').
        central_pressure_pert : float, optional
            Magnitude of the intensity perturbation (in mbar). This value is used to
            perturb the maximum intensity (lowest central_pressure value) when
            adjust_intensity is True. Perturbations are generated from a normal
            distribution with mean=0 and sd=central_pressure_pert/2 constrained
            between -central_pressure_pert and +central_pressure_pert. Default: 7.5
            (corresponds to about 10 kn).
        decay : bool, optional
            Deprecated, for backward compatibility only. If True, equivalent to
            setting 'adjust_intensity' to 'legacy_decay'. If False, equivalent to
            setting 'adjust_intensity' to 'none'. Default: None (i.e. rely on the
            value of 'adjust_intensity').
        use_global_decay_params : bool, optional
            Whether to use precomputed global parameter values for landfall decay
            obtained from IBTrACS (1980-2019). If False, parameters are fitted
            using historical tracks in input parameter 'tracks', in which case the
            landfall decay applied depends on the tracks passed as an input and may
            not be robust if few historical tracks make landfall in this object.
            Default: True.
        pool : pathos.pool, optional
            Pool that will be used for parallel computation when applicable. If not given, the
            pool attribute of `tracks` will be used. Default: None
        """
        if decay is not None:
            LOGGER.warning("`decay` is deprecated. "
                            "Use `adjust_intensity` instead.")
            if adjust_intensity == 'explicit':
>               raise ValueError(
                    'Set `adjust_intensity` to "legacy_decay" or `decay` to False.'
                )
E               ValueError: Set `adjust_intensity` to "legacy_decay" or `decay` to False.

climada/hazard/tc_tracks_synth.py:361: ValueError

Check warning on line 0 in climada.hazard.test.test_tc_tracks_synth.TestSynth

See this annotation in the file changed.

@github-actions github-actions / Core / Unit Test Results (3.9)

test_random_walk_ref_pass (climada.hazard.test.test_tc_tracks_synth.TestSynth) failed

tests_xml/tests.xml [took 0s]
Raw output
ValueError: Set `adjust_intensity` to "legacy_decay" or `decay` to False.
self = <climada.hazard.test.test_tc_tracks_synth.TestSynth testMethod=test_random_walk_ref_pass>

    def test_random_walk_ref_pass(self):
        """Test against MATLAB reference."""
        tc_track = tc.TCTracks.from_processed_ibtracs_csv(TEST_TRACK_SHORT)
        nb_synth_tracks = 2
>       tc_track.calc_perturbed_trajectories(nb_synth_tracks=nb_synth_tracks, seed=25, decay=False, decay_ddirection_hourly=0)

climada/hazard/test/test_tc_tracks_synth.py:564: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
climada/hazard/tc_tracks.py:1152: in calc_perturbed_trajectories
    climada.hazard.tc_tracks_synth.calc_perturbed_trajectories(self, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

tracks = <climada.hazard.tc_tracks.TCTracks object at 0x7fb45c36c220>
nb_synth_tracks = 2, max_shift_ini = 0.75, max_dspeed_rel = 0.3
max_ddirection = 0.008726646259971648, autocorr_dspeed = 0.85
autocorr_ddirection = 0.5, decay_ddirection_hourly = 0, seed = 25
adjust_intensity = 'explicit', central_pressure_pert = 7.5, decay = False
use_global_decay_params = True, extend_track = True, pool = None

    def calc_perturbed_trajectories(
        tracks,
        nb_synth_tracks: int = 9,
        max_shift_ini: float = 0.75,
        max_dspeed_rel: float = 0.3,
        max_ddirection: float = np.pi / 360,
        autocorr_dspeed: float = 0.85,
        autocorr_ddirection: float = 0.5,
        decay_ddirection_hourly: float = 1/(2.5*24),
        seed: int = CONFIG.hazard.trop_cyclone.random_seed.int(),
        adjust_intensity: str = 'explicit',
        central_pressure_pert: float = 7.5,
        decay: bool = None,
        use_global_decay_params: bool = True,
        extend_track: bool = True,
        pool: AbstractWorkerPool = None,
    ):
        """
        Generate synthetic tracks based on directed random walk. An ensemble of nb_synth_tracks
        synthetic tracks is computed for every track contained in self.
    
        The methodology perturbs the tracks locations, and if decay is True it additionally
        includes decay of wind speed and central pressure drop after landfall. No other track
        parameter is perturbed.
        The track starting point location is perturbed by random uniform values of
        magnitude up to max_shift_ini in both longitude and latitude. Then, each segment
        between two consecutive points is perturbed in direction and distance (i.e.,
        translational speed). These perturbations can be correlated in time, i.e.,
        the perturbation in direction applied to segment i is correlated with the perturbation
        in direction applied to segment i-1 (and similarly for the perturbation in translational
        speed).
        Perturbations in track direction and temporal auto-correlations in perturbations are
        on an hourly basis, and the perturbations in translational speed is relative.
        Hence, the parameter values are relatively insensitive to the temporal
        resolution of the tracks. Note however that all tracks should be at the same
        temporal resolution, which can be achieved using equal_timestep().
        max_dspeed_rel and autocorr_dspeed control the spread along the track ('what distance
        does the track run for'), while max_ddirection and autocorr_ddirection control the spread
        perpendicular to the track movement ('how does the track diverge in direction').
        max_dspeed_rel and max_ddirection control the amplitude of perturbations at each track
        timestep but perturbations may tend to compensate each other over time, leading to
        a similar location at the end of the track, while autocorr_dspeed and autocorr_ddirection
        control how these perturbations persist in time and hence the amplitude of the
        perturbations towards the end of the track.
    
        Note that the default parameter values have been only roughly calibrated so that
        the frequency of tracks in each 5x5degree box remains approximately constant.
        This is not an in-depth calibration and should be treated as such.
        The object is mutated in-place.
    
        Parameters
        ----------
        tracks : climada.hazard.TCTracks
            Tracks data.
        nb_synth_tracks : int, optional
            Number of ensemble members per track. Default: 9.
        max_shift_ini : float, optional
            Amplitude of max random starting point shift in decimal degree
            (up to +/-max_shift_ini for longitude and latitude). Default: 0.75.
        max_dspeed_rel : float, optional
            Amplitude of translation speed perturbation in relative terms
            (e.g., 0.2 for +/-20%). Default: 0.3.
        max_ddirection : float, optional
            Amplitude of track direction (bearing angle) perturbation
            per hour, in radians. Default: pi/360.
        autocorr_dspeed : float, optional
            Temporal autocorrelation in translation speed perturbation
            at a lag of 1 hour. Default: 0.85.
        autocorr_ddirection : float, optional
            Temporal autocorrelation of track direction perturbation
            at a lag of 1 hour. Default: 0.5.
        decay_ddirection_hourly : float, optional
            Exponential decay parameter applied to reduce the track direction
            perturbation with track time, in units of "per hour". Set to larger than
            0 to prevent long tracks to deviate too much from their historical
            counterpart. Default: 1/(2.5*24) (i.e. per 2.5 days).
        seed : int, optional
            Random number generator seed for replicability of random walk.
            Put negative value if you don't want to use it. Default: configuration file.
        adjust_intensity : str, optional
            Whether and how tropical cyclone intensity (central pressure,
            max_sustained_wind) should be modelled. One of 'explicit',
            'legacy_decay', or 'none'.
            For 'explicit', intensity as well as radius_oci (outermost closed isobar)
            and radius_max_wind are statistically modelled depending on landfalls in
            historical and synthetic tracks (track intensification, peak intensity
            duration as well as intensity decay over the ocean and over land are
            explicitly modelled).
            For 'legacy_decay', a landfall decay is applied when a synthetic track
            reached land; however when a synthetic track is over the ocean while its
            historical counterpart was over land, intensity will be underestimated.
            For 'none', the track intensity will be the same as the historical track
            independently on whether both tracks are over land or the ocean.
            For None, will be set to 'explicit'.
            Default: None (i.e., 'explicit').
        central_pressure_pert : float, optional
            Magnitude of the intensity perturbation (in mbar). This value is used to
            perturb the maximum intensity (lowest central_pressure value) when
            adjust_intensity is True. Perturbations are generated from a normal
            distribution with mean=0 and sd=central_pressure_pert/2 constrained
            between -central_pressure_pert and +central_pressure_pert. Default: 7.5
            (corresponds to about 10 kn).
        decay : bool, optional
            Deprecated, for backward compatibility only. If True, equivalent to
            setting 'adjust_intensity' to 'legacy_decay'. If False, equivalent to
            setting 'adjust_intensity' to 'none'. Default: None (i.e. rely on the
            value of 'adjust_intensity').
        use_global_decay_params : bool, optional
            Whether to use precomputed global parameter values for landfall decay
            obtained from IBTrACS (1980-2019). If False, parameters are fitted
            using historical tracks in input parameter 'tracks', in which case the
            landfall decay applied depends on the tracks passed as an input and may
            not be robust if few historical tracks make landfall in this object.
            Default: True.
        pool : pathos.pool, optional
            Pool that will be used for parallel computation when applicable. If not given, the
            pool attribute of `tracks` will be used. Default: None
        """
        if decay is not None:
            LOGGER.warning("`decay` is deprecated. "
                            "Use `adjust_intensity` instead.")
            if adjust_intensity == 'explicit':
>               raise ValueError(
                    'Set `adjust_intensity` to "legacy_decay" or `decay` to False.'
                )
E               ValueError: Set `adjust_intensity` to "legacy_decay" or `decay` to False.

climada/hazard/tc_tracks_synth.py:361: ValueError

Check warning on line 0 in climada.hazard.test.test_tc_tracks_synth.TestSynthIdChunks

See this annotation in the file changed.

@github-actions github-actions / Core / Unit Test Results (3.9)

test_add_id_synth_chunks_complex (climada.hazard.test.test_tc_tracks_synth.TestSynthIdChunks) failed

tests_xml/tests.xml [took 0s]
Raw output
AssertionError: 
Arrays are not equal

Mismatched elements: 2 / 9 (22.2%)
Max absolute difference: 1
Max relative difference: 0.
 x: array([ 0,  0,  1,  1,  1, -1, -1, -1,  2])
 y: array([ 0,  0,  0,  0,  1, -1, -1, -1,  2])
self = <climada.hazard.test.test_tc_tracks_synth.TestSynthIdChunks testMethod=test_add_id_synth_chunks_complex>

    def test_add_id_synth_chunks_complex(self):
        """Test _add_id_synth_chunks_shift_init for idealized cases"""
        on_land_hist = np.array([True, True, False, False, True, True, True, False, False])
        on_land = np.array([True, False, False, False, False, True, True, True, False])
        pcen = np.arange(0, len(on_land))
        # expected values
        expected_id_chunk = np.array([0, 0, 0, 0, 1, -1, -1, -1, 2])
        expected_no_chunks_land = 1
        expected_no_chunks_sea = 2
        expected_pcen = np.append(pcen[1:], pcen[-1])
        # create fake xarray with time, on_land and on_land_hist
        tc_track = dummy_track_builder({'on_land': on_land, 'on_land_hist': on_land_hist, 'central_pressure': pcen.copy()})
        # call _add_id_synth_chunks
        synth_track, no_chunks_sea, no_chunks_land, _ = tc_synth._add_id_synth_chunks_shift_init(tc_track)
        # check output
        self.assertEqual(no_chunks_land, expected_no_chunks_land)
        self.assertEqual(no_chunks_sea, expected_no_chunks_sea)
>       np.testing.assert_array_equal(synth_track.id_chunk.data, expected_id_chunk)

climada/hazard/test/test_tc_tracks_synth.py:804: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

args = (<built-in function eq>, array([ 0,  0,  1,  1,  1, -1, -1, -1,  2]), array([ 0,  0,  0,  0,  1, -1, -1, -1,  2]))
kwds = {'err_msg': '', 'header': 'Arrays are not equal', 'strict': False, 'verbose': True}

    @wraps(func)
    def inner(*args, **kwds):
        with self._recreate_cm():
>           return func(*args, **kwds)
E           AssertionError: 
E           Arrays are not equal
E           
E           Mismatched elements: 2 / 9 (22.2%)
E           Max absolute difference: 1
E           Max relative difference: 0.
E            x: array([ 0,  0,  1,  1,  1, -1, -1, -1,  2])
E            y: array([ 0,  0,  0,  0,  1, -1, -1, -1,  2])

../../../micromamba/envs/climada_env_3.9/lib/python3.9/contextlib.py:79: AssertionError

Check warning on line 0 in climada.hazard.test.test_tc_tracks_synth.TestSynthIdChunks

See this annotation in the file changed.

@github-actions github-actions / Core / Unit Test Results (3.9)

test_add_id_synth_chunks_start_over_land (climada.hazard.test.test_tc_tracks_synth.TestSynthIdChunks) failed

tests_xml/tests.xml [took 0s]
Raw output
KeyError: "['lat', 'lon'] not found in axis"
self = <climada.hazard.test.test_tc_tracks_synth.TestSynthIdChunks testMethod=test_add_id_synth_chunks_start_over_land>

    def test_add_id_synth_chunks_start_over_land(self):
        """Test _add_id_synth_chunks_shift_init for track starting over land"""
        on_land_hist = np.array([True, True, False, False, True, True, False, False])
        on_land_hist2 = np.array([False, False, False, False, True, True, False, False])
        on_land = np.array([True, False, False, False, True, True, True, False])
        pcen = np.arange(0, len(on_land))
        # expected values
        expected_id_chunk = np.array([0, 0, 0, 1, -1, -1, -1, 2])
        expected_no_chunks_land = 1
        expected_no_chunks_sea = 1
        # fist case: shifted backward
        expected_pcen = np.append(pcen[1:], pcen[-1])
        # second case: shifted forward
        expected_pcen2 = np.append(pcen[0], pcen[:-1])
        # create fake xarray with time, on_land and on_land_hist
        tc_track = dummy_track_builder({'on_land': on_land, 'on_land_hist': on_land_hist, 'central_pressure': pcen.copy()})
        tc_track2 = dummy_track_builder({'on_land': on_land, 'on_land_hist': on_land_hist2, 'central_pressure': pcen.copy()})
        # call _add_id_synth_chunks
        synth_track, no_chunks_sea, no_chunks_land, _ = tc_synth._add_id_synth_chunks_shift_init(
            tc_track, 3
        )
>       synth_track2, no_chunks_sea2, no_chunks_land2, _ = tc_synth._add_id_synth_chunks_shift_init(tc_track2, 3)

climada/hazard/test/test_tc_tracks_synth.py:757: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
climada/hazard/tc_tracks_synth.py:2395: in _add_id_synth_chunks_shift_init
    track_shift_values = track.isel(
../../../micromamba/envs/climada_env_3.9/lib/python3.9/site-packages/pandas/core/frame.py:5344: in drop
    return super().drop(
../../../micromamba/envs/climada_env_3.9/lib/python3.9/site-packages/pandas/core/generic.py:4711: in drop
    obj = obj._drop_axis(labels, axis, level=level, errors=errors)
../../../micromamba/envs/climada_env_3.9/lib/python3.9/site-packages/pandas/core/generic.py:4753: in _drop_axis
    new_axis = axis.drop(labels, errors=errors)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = Index(['time', 'on_land', 'on_land_hist', 'central_pressure', 'time_step',
       'max_sustained_wind', 'id_chunk'],
      dtype='object')
labels = array(['time', 'lat', 'lon'], dtype=object), errors = 'raise'

    def drop(
        self,
        labels: Index | np.ndarray | Iterable[Hashable],
        errors: IgnoreRaise = "raise",
    ) -> Index:
        """
        Make new Index with passed list of labels deleted.
    
        Parameters
        ----------
        labels : array-like or scalar
        errors : {'ignore', 'raise'}, default 'raise'
            If 'ignore', suppress error and existing labels are dropped.
    
        Returns
        -------
        Index
            Will be same type as self, except for RangeIndex.
    
        Raises
        ------
        KeyError
            If not all of the labels are found in the selected axis
    
        Examples
        --------
        >>> idx = pd.Index(['a', 'b', 'c'])
        >>> idx.drop(['a'])
        Index(['b', 'c'], dtype='object')
        """
        if not isinstance(labels, Index):
            # avoid materializing e.g. RangeIndex
            arr_dtype = "object" if self.dtype == "object" else None
            labels = com.index_labels_to_array(labels, dtype=arr_dtype)
    
        indexer = self.get_indexer_for(labels)
        mask = indexer == -1
        if mask.any():
            if errors != "ignore":
>               raise KeyError(f"{labels[mask].tolist()} not found in axis")
E               KeyError: "['lat', 'lon'] not found in axis"

../../../micromamba/envs/climada_env_3.9/lib/python3.9/site-packages/pandas/core/indexes/base.py:7000: KeyError

Check warning on line 0 in climada.hazard.test.test_tc_tracks_synth.TestSynthDataFit

See this annotation in the file changed.

@github-actions github-actions / Core / Unit Test Results (3.9)

test_get_fit_order (climada.hazard.test.test_tc_tracks_synth.TestSynthDataFit) failed

tests_xml/tests.xml [took 0s]
Raw output
TypeError: _get_fit_order() got an unexpected keyword argument 'var_name'
self = <climada.hazard.test.test_tc_tracks_synth.TestSynthDataFit testMethod=test_get_fit_order>

    def test_get_fit_order(self):
        """Test _get_fit_order"""
        # sample values
        pcen_vals = np.arange(880, 1000)
        pcen_pert = 15
        var_names = ['max_sustained_wind', 'radius_max_wind', "radius_oci"]
    
        # 1 for max_sustained_wind
>       self.assertEqual(tc_synth._get_fit_order(pcen=pcen_vals, central_pressure_pert=pcen_pert, var_name=var_names[0]),
                         1)
E       TypeError: _get_fit_order() got an unexpected keyword argument 'var_name'

climada/hazard/test/test_tc_tracks_synth.py:1111: TypeError

Check warning on line 0 in climada.hazard.test.test_tc_tracks_synth.TestSynthDataFit

See this annotation in the file changed.

@github-actions github-actions / Core / Unit Test Results (3.9)

test_get_fit_single_phase (climada.hazard.test.test_tc_tracks_synth.TestSynthDataFit) failed

tests_xml/tests.xml [took 0s]
Raw output
NameError: name '_get_fit_single_phase' is not defined
self = <climada.hazard.test.test_tc_tracks_synth.TestSynthDataFit testMethod=test_get_fit_single_phase>

    def test_get_fit_single_phase(self):
        """Test _get_fit_single_phase"""
    
        # sample:
        pcen = np.concatenate([np.arange(1000,900,-5), np.arange(905,990,10)])
        lons = np.repeat([-80], len(pcen))
        lats = np.repeat([30], len(pcen))
        vmax = tc._estimate_vmax(np.repeat([np.nan], len(pcen)), lons, lats, pcen)
        rmax = tc.estimate_rmw(np.repeat([np.nan], len(pcen)), pcen)
        roci = tc.estimate_roci(np.repeat([np.nan], len(pcen)), pcen)
        tc_track = dummy_track_builder({
            'central_pressure': np.concatenate([np.arange(1000,900,-5), np.arange(905,990,10)]),
            'max_sustained_wind': vmax,
            'radius_max_wind': rmax,
            'radius_oci': roci
        })
>       res = _get_fit_single_phase(tc_track, 15)
E       NameError: name '_get_fit_single_phase' is not defined

climada/hazard/test/test_tc_tracks_synth.py:1165: NameError

Check warning on line 0 in climada.hazard.test.test_tc_tracks_synth.TestSynthDataFit

See this annotation in the file changed.

@github-actions github-actions / Core / Unit Test Results (3.9)

test_prepare_data_piecewise (climada.hazard.test.test_tc_tracks_synth.TestSynthDataFit) failed

tests_xml/tests.xml [took 0s]
Raw output
NameError: name '_prepare_data_piecewise' is not defined
self = <climada.hazard.test.test_tc_tracks_synth.TestSynthDataFit testMethod=test_prepare_data_piecewise>

    def test_prepare_data_piecewise(self):
        """Test _prepare_data_piecewise"""
        # TODO
>       x = _prepare_data_piecewise(np.arange(20), (0,5,12,20))
E       NameError: name '_prepare_data_piecewise' is not defined

climada/hazard/test/test_tc_tracks_synth.py:1147: NameError