Skip to content

Remove intensity_thres attribute from Hazard class - #1065

Merged
ValentinGebhart merged 11 commits into
developfrom
feature/remove_intensity_thres
Jul 31, 2025
Merged

Remove intensity_thres attribute from Hazard class#1065
ValentinGebhart merged 11 commits into
developfrom
feature/remove_intensity_thres

removed class attributes from StormEurope and TropCyclone and removed…

3468a7e
Select commit
Loading
Failed to load commit list.
Jenkins - WCR / Tests / Declarative: Post Actions failed Jul 22, 2025 in 0s

failed: 2, passed: 245

failed: 2, passed: 245

Details

climada_petals.engine.test.test_supplychain.TestCalcFunctions.test_calc_G

AssertionError: 
Arrays are not equal

Mismatched elements: 13 / 36 (36.1%)
Max absolute difference: 2.22044605e-16
Max relative difference: 3.37541541e-16
 x: array([[1.423409, 0.317306, 0.638291, 0.222662, 0.183514, 0.      ],
       [0.930453, 1.423665, 1.07374 , 0.333346, 0.227085, 0.      ],
       [0.290909, 0.33534 , 1.336252, 0.164457, 0.11572 , 0.      ],...
 y: array([[1.423409, 0.317306, 0.638291, 0.222662, 0.183514, 0.      ],
       [0.930453, 1.423665, 1.07374 , 0.333346, 0.227085, 0.      ],
       [0.290909, 0.33534 , 1.336252, 0.164457, 0.11572 , 0.      ],...
Stack trace
self = <climada_petals.engine.test.test_supplychain.TestCalcFunctions testMethod=test_calc_G>

    def test_calc_G(self):
        # Test calc_G with DataFrame
        G = calc_G(self.expected_B)
        pd.testing.assert_frame_equal(G, self.expected_G)
    
        # Test calc_G with NumPy array
        G = calc_G(self.expected_B.values)
>       np.testing.assert_array_equal(G, self.expected_G.values)

../../../../petals_branches/branches/develop/workspace/climada_petals/engine/test/test_supplychain.py:346: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

args = (<built-in function eq>, array([[1.42340915, 0.31730629, 0.63829071, 0.22266223, 0.18351388,
        0.        ],
    ...380406,
        0.        ],
       [0.        , 0.        , 0.        , 0.        , 0.        ,
        1.        ]]))
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: 13 / 36 (36.1%)
E           Max absolute difference: 2.22044605e-16
E           Max relative difference: 3.37541541e-16
E            x: array([[1.423409, 0.317306, 0.638291, 0.222662, 0.183514, 0.      ],
E                  [0.930453, 1.423665, 1.07374 , 0.333346, 0.227085, 0.      ],
E                  [0.290909, 0.33534 , 1.336252, 0.164457, 0.11572 , 0.      ],...
E            y: array([[1.423409, 0.317306, 0.638291, 0.222662, 0.183514, 0.      ],
E                  [0.930453, 1.423665, 1.07374 , 0.333346, 0.227085, 0.      ],
E                  [0.290909, 0.33534 , 1.336252, 0.164457, 0.11572 , 0.      ],...

../../../../../miniforge3/envs/climada_env/lib/python3.11/contextlib.py:81: AssertionError

climada_petals.engine.test.test_supplychain.TestCalcFunctions.test_calc_x_from_G

AssertionError: 
Arrays are not equal

Mismatched elements: 1 / 6 (16.7%)
Max absolute difference: 1.13686838e-13
Max relative difference: 1.29041463e-16
 x: array([[ 881.010142],
       [1466.125505],
       [ 874.24751 ],...
 y: array([[ 881.010142],
       [1466.125505],
       [ 874.24751 ],...
Stack trace
self = <climada_petals.engine.test.test_supplychain.TestCalcFunctions testMethod=test_calc_x_from_G>

    def test_calc_x_from_G(self):
        # Test calc_x_from_G with DataFrame
        x = calc_x_from_G(self.expected_G,self.va_changed)
        pd.testing.assert_frame_equal(x, self.expected_x_changed)
    
        # Test calc_x_from_G with NumPy array
        x = calc_x_from_G(self.expected_G.values, self.va_changed.values)
>       np.testing.assert_array_equal(x, self.expected_x_changed.values)

../../../../petals_branches/branches/develop/workspace/climada_petals/engine/test/test_supplychain.py:355: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

args = (<built-in function eq>, array([[ 881.01014159],
       [1466.1255047 ],
       [ 874.2475102 ],
       [1107.92630703...     [1466.1255047 ],
       [ 874.2475102 ],
       [1107.92630703],
       [ 731.62276217],
       [   0.        ]]))
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: 1 / 6 (16.7%)
E           Max absolute difference: 1.13686838e-13
E           Max relative difference: 1.29041463e-16
E            x: array([[ 881.010142],
E                  [1466.125505],
E                  [ 874.24751 ],...
E            y: array([[ 881.010142],
E                  [1466.125505],
E                  [ 874.24751 ],...

../../../../../miniforge3/envs/climada_env/lib/python3.11/contextlib.py:81: AssertionError