Skip to content

Integrates risk trajectories within climada - #1037

Closed
spjuhel wants to merge 119 commits into
developfrom
feature/risk_trajectory
Closed

Integrates risk trajectories within climada#1037
spjuhel wants to merge 119 commits into
developfrom
feature/risk_trajectory

Uses ImpactFreqCurve for RPs instead of legacy code

4a4b08c
Select commit
Loading
Failed to load commit list.
Sign in for the full log view
GitHub Actions / Core / Unit Test Results (3.12) failed Dec 18, 2025 in 0s

6 fail, 1 skipped, 904 pass in 6m 2s

  1 files  ±0    1 suites  ±0   6m 2s ⏱️ -17s
911 tests ±0  904 ✅  - 6  1 💤 ±0  6 ❌ +6 
922 runs  ±0  915 ✅  - 6  1 💤 ±0  6 ❌ +6 

Results for commit 4a4b08c. ± Comparison against earlier commit 57f981b.

Annotations

Check warning on line 0 in climada.trajectories.test.test_riskperiod.TestCalcRiskMetricsPeriod_TopLevel

See this annotation in the file changed.

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

test_calc_freq_curve (climada.trajectories.test.test_riskperiod.TestCalcRiskMetricsPeriod_TopLevel) failed

tests_xml/tests.xml [took 0s]
Raw output
TypeError: calc_freq_curve() missing 1 required positional argument: 'frequency_unit'
self = <test_riskperiod.TestCalcRiskMetricsPeriod_TopLevel testMethod=test_calc_freq_curve>

    def test_calc_freq_curve(self):
>       results = calc_freq_curve(
            imp_mat_intrpl=csr_matrix(
                [
                    [0.1, 0, 0],
                    [1, 0, 0],
                    [10, 0, 0],
                ]
            ),
            frequency=np.array([0.5, 0.05, 0.005]),
            return_per=[10, 50, 100],
        )
E       TypeError: calc_freq_curve() missing 1 required positional argument: 'frequency_unit'

climada/trajectories/test/test_riskperiod.py:999: TypeError

Check warning on line 0 in climada.trajectories.test.test_riskperiod.TestCalcRiskMetricsPeriod_TopLevel

See this annotation in the file changed.

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

test_calc_per_date_rps (climada.trajectories.test.test_riskperiod.TestCalcRiskMetricsPeriod_TopLevel) failed

tests_xml/tests.xml [took 0s]
Raw output
TypeError: calc_per_date_rps() missing 1 required positional argument: 'frequency_unit'
self = <test_riskperiod.TestCalcRiskMetricsPeriod_TopLevel testMethod=test_calc_per_date_rps>

    def test_calc_per_date_rps(self):
        base_imp = csr_matrix(
            [
                [0.1, 0, 0],
                [1, 0, 0],
                [10, 0, 0],
            ]
        )
>       results = calc_per_date_rps(
            [base_imp, base_imp * 2, base_imp * 4],
            frequency=np.array([0.5, 0.05, 0.005]),
            return_periods=[10, 50, 100],
        )
E       TypeError: calc_per_date_rps() missing 1 required positional argument: 'frequency_unit'

climada/trajectories/test/test_riskperiod.py:1020: TypeError

Check warning on line 0 in climada.trajectories.test.test_riskperiod.TestCalcRiskMetricsPeriod_TopLevel

See this annotation in the file changed.

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

test_per_date_return_periods_H0V0 (climada.trajectories.test.test_riskperiod.TestCalcRiskMetricsPeriod_TopLevel) failed

tests_xml/tests.xml [took 0s]
Raw output
AssertionError: 'Y' != [10, 50]
self = <test_riskperiod.TestCalcRiskMetricsPeriod_TopLevel testMethod=test_per_date_return_periods_H0V0>
mock_calc_per_date_rps = <MagicMock name='calc_per_date_rps' id='139799271667904'>

    @patch("climada.trajectories.riskperiod.calc_per_date_rps")
    def test_per_date_return_periods_H0V0(self, mock_calc_per_date_rps):
        mock_calc_per_date_rps.return_value = 1
        result = self.calc_risk_period.per_date_return_periods_H0V0([10, 50])
    
        actual_arg0 = mock_calc_per_date_rps.call_args[0][0]
        expected_arg0 = self.calc_risk_period.imp_mats_H0V0
    
        actual_arg1 = mock_calc_per_date_rps.call_args[0][1]
        expected_arg1 = self.calc_risk_period.snapshot_start.hazard.frequency
    
        actual_arg2 = mock_calc_per_date_rps.call_args[0][2]
        expected_arg2 = [10, 50]
    
        assert_sparse_matrix_array_equal(actual_arg0, expected_arg0)
        np.testing.assert_array_equal(actual_arg1, expected_arg1)
>       self.assertEqual(actual_arg2, expected_arg2)
E       AssertionError: 'Y' != [10, 50]

climada/trajectories/test/test_riskperiod.py:907: AssertionError

Check warning on line 0 in climada.trajectories.test.test_riskperiod.TestCalcRiskMetricsPeriod_TopLevel

See this annotation in the file changed.

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

test_per_date_return_periods_H0V1 (climada.trajectories.test.test_riskperiod.TestCalcRiskMetricsPeriod_TopLevel) failed

tests_xml/tests.xml [took 0s]
Raw output
AssertionError: 'Y' != [10, 50]
self = <test_riskperiod.TestCalcRiskMetricsPeriod_TopLevel testMethod=test_per_date_return_periods_H0V1>
mock_calc_per_date_rps = <MagicMock name='calc_per_date_rps' id='139799275202096'>

    @patch("climada.trajectories.riskperiod.calc_per_date_rps")
    def test_per_date_return_periods_H0V1(self, mock_calc_per_date_rps):
        mock_calc_per_date_rps.return_value = 1
        result = self.calc_risk_period.per_date_return_periods_H0V1([10, 50])
    
        actual_arg0 = mock_calc_per_date_rps.call_args[0][0]
        expected_arg0 = self.calc_risk_period.imp_mats_H0V1
    
        actual_arg1 = mock_calc_per_date_rps.call_args[0][1]
        expected_arg1 = self.calc_risk_period.snapshot_start.hazard.frequency
    
        actual_arg2 = mock_calc_per_date_rps.call_args[0][2]
        expected_arg2 = [10, 50]
    
        assert_sparse_matrix_array_equal(actual_arg0, expected_arg0)
        np.testing.assert_array_equal(actual_arg1, expected_arg1)
>       self.assertEqual(actual_arg2, expected_arg2)
E       AssertionError: 'Y' != [10, 50]

climada/trajectories/test/test_riskperiod.py:945: AssertionError

Check warning on line 0 in climada.trajectories.test.test_riskperiod.TestCalcRiskMetricsPeriod_TopLevel

See this annotation in the file changed.

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

test_per_date_return_periods_H1V0 (climada.trajectories.test.test_riskperiod.TestCalcRiskMetricsPeriod_TopLevel) failed

tests_xml/tests.xml [took 0s]
Raw output
AssertionError: 'Y' != [10, 50]
self = <test_riskperiod.TestCalcRiskMetricsPeriod_TopLevel testMethod=test_per_date_return_periods_H1V0>
mock_calc_per_date_rps = <MagicMock name='calc_per_date_rps' id='139799267284016'>

    @patch("climada.trajectories.riskperiod.calc_per_date_rps")
    def test_per_date_return_periods_H1V0(self, mock_calc_per_date_rps):
        mock_calc_per_date_rps.return_value = 1
        result = self.calc_risk_period.per_date_return_periods_H1V0([10, 50])
    
        actual_arg0 = mock_calc_per_date_rps.call_args[0][0]
        expected_arg0 = self.calc_risk_period.imp_mats_H1V0
    
        actual_arg1 = mock_calc_per_date_rps.call_args[0][1]
        expected_arg1 = self.calc_risk_period.snapshot_end.hazard.frequency
    
        actual_arg2 = mock_calc_per_date_rps.call_args[0][2]
        expected_arg2 = [10, 50]
    
        assert_sparse_matrix_array_equal(actual_arg0, expected_arg0)
        np.testing.assert_array_equal(actual_arg1, expected_arg1)
>       self.assertEqual(actual_arg2, expected_arg2)
E       AssertionError: 'Y' != [10, 50]

climada/trajectories/test/test_riskperiod.py:926: AssertionError

Check warning on line 0 in climada.trajectories.test.test_riskperiod.TestCalcRiskMetricsPeriod_TopLevel

See this annotation in the file changed.

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

test_per_date_return_periods_H1V1 (climada.trajectories.test.test_riskperiod.TestCalcRiskMetricsPeriod_TopLevel) failed

tests_xml/tests.xml [took 0s]
Raw output
AssertionError: 'Y' != [10, 50]
self = <test_riskperiod.TestCalcRiskMetricsPeriod_TopLevel testMethod=test_per_date_return_periods_H1V1>
mock_calc_per_date_rps = <MagicMock name='calc_per_date_rps' id='139799275193744'>

    @patch("climada.trajectories.riskperiod.calc_per_date_rps")
    def test_per_date_return_periods_H1V1(self, mock_calc_per_date_rps):
        mock_calc_per_date_rps.return_value = 1
        result = self.calc_risk_period.per_date_return_periods_H1V1([10, 50])
    
        actual_arg0 = mock_calc_per_date_rps.call_args[0][0]
        expected_arg0 = self.calc_risk_period.imp_mats_H1V1
    
        actual_arg1 = mock_calc_per_date_rps.call_args[0][1]
        expected_arg1 = self.calc_risk_period.snapshot_end.hazard.frequency
    
        actual_arg2 = mock_calc_per_date_rps.call_args[0][2]
        expected_arg2 = [10, 50]
    
        assert_sparse_matrix_array_equal(actual_arg0, expected_arg0)
        np.testing.assert_array_equal(actual_arg1, expected_arg1)
>       self.assertEqual(actual_arg2, expected_arg2)
E       AssertionError: 'Y' != [10, 50]

climada/trajectories/test/test_riskperiod.py:964: AssertionError