Skip to content

Commit

Permalink
Test for symmetric CPF
Browse files Browse the repository at this point in the history
  • Loading branch information
oiffrig committed Dec 12, 2024
1 parent dbe6efc commit 2c67c46
Showing 1 changed file with 169 additions and 0 deletions.
169 changes: 169 additions & 0 deletions tests/extreme/test_extreme.py
Original file line number Diff line number Diff line change
Expand Up @@ -964,6 +964,170 @@ def test_sot_nan():
dtype=np.float32,
)

cpf_val3 = np.array([0.97483208, 0.11538463, 1.0, 0.59615387, 1.0], dtype=np.float32)
cpf_ens3 = np.array(
[
[298.41162109, 297.77490234, 298.49560547, 284.96630859, 300.28857422],
[298.98931885, 298.63970947, 298.11431885, 285.0557251, 300.08111572],
[298.92805481, 297.83821106, 298.68586731, 285.07453918, 300.33039856],
[298.36506653, 297.58576965, 299.26545715, 284.41975403, 300.19514465],
[298.65716553, 297.70794678, 298.42474365, 284.6942749, 300.32513428],
[298.55947876, 297.48135376, 298.88565063, 284.35635376, 300.37588501],
[298.79774475, 298.129776, 299.27430725, 285.16688538, 300.24501038],
[298.35910034, 298.01925659, 298.97238159, 285.16964722, 300.26144409],
[298.61825562, 297.41708374, 298.62997437, 284.53427124, 300.33114624],
[298.64981079, 297.80801392, 298.47207642, 284.49942017, 300.43301392],
[298.6521759, 297.4099884, 299.6521759, 286.17756653, 300.32600403],
[298.97064209, 298.07611084, 297.93548584, 285.30267334, 300.16595459],
[298.24542236, 298.03643799, 298.86260986, 285.35479736, 299.91339111],
[298.59988403, 297.37722778, 298.33035278, 284.86550903, 300.19363403],
[299.33850098, 298.22717285, 297.9732666, 285.45178223, 300.68225098],
[297.98297119, 297.03961182, 298.33453369, 285.64703369, 300.07281494],
[298.69857788, 297.90560913, 299.19662476, 284.89974976, 300.02865601],
[299.30201721, 297.44068909, 297.80006409, 285.20045471, 300.48951721],
[298.48292542, 297.73878479, 298.32667542, 284.92237854, 300.31886292],
[298.31118774, 297.64517212, 298.97134399, 284.22720337, 300.31118774],
[298.3183136, 298.08003235, 298.84761047, 285.4589386, 300.16596985],
[298.05625916, 297.92149353, 298.69493103, 285.23204041, 300.36094666],
[298.28106689, 297.78887939, 298.29278564, 285.66192627, 300.33966064],
[298.75445557, 298.48297119, 298.02789307, 284.07086182, 300.27008057],
[298.67799377, 297.8361969, 298.23072815, 284.40846252, 300.42604065],
[298.707901, 297.942276, 298.54774475, 284.07704163, 300.13563538],
[298.59112549, 297.52471924, 298.95831299, 286.05596924, 300.24346924],
[297.94862366, 298.10487366, 299.41151428, 284.69471741, 300.21815491],
[298.3319397, 297.82022095, 298.05459595, 284.93936157, 300.32608032],
[298.49452209, 297.78553772, 298.14100647, 286.08436584, 300.17420959],
[298.56997681, 297.84146118, 298.40786743, 284.56021118, 299.92544556],
[298.66999817, 298.13093567, 298.80671692, 285.08015442, 300.18367004],
[299.13163757, 297.71757507, 298.31913757, 285.28788757, 300.39726257],
[298.48933411, 298.41120911, 298.14558411, 284.66902161, 300.27839661],
[298.72003174, 297.46417236, 298.45635986, 285.72784424, 300.12628174],
[299.39906311, 297.14320374, 298.63929749, 284.35609436, 299.91664124],
[298.5340271, 297.97738647, 298.87191772, 284.9090271, 300.28207397],
[298.11460876, 298.11070251, 298.87242126, 284.76304626, 300.40171814],
[298.13586426, 298.08703613, 298.98352051, 285.69836426, 300.28039551],
[298.35908508, 297.39228821, 299.03681946, 285.75556946, 300.05830383],
[299.00363159, 298.77706909, 298.79855347, 284.94894409, 300.10714722],
[298.83917236, 298.51690674, 299.47784424, 284.20050049, 300.32940674],
[298.58151245, 297.80221558, 299.12252808, 285.53659058, 300.38619995],
[298.59040833, 297.80329895, 297.97712708, 286.37947083, 300.10993958],
[298.55168152, 297.78410339, 298.39933777, 284.42082214, 300.12980652],
[298.29837036, 297.94485474, 299.08938599, 284.56790161, 299.83743286],
[298.81945801, 298.11242676, 298.57336426, 285.82727051, 300.22766113],
[298.64125061, 297.60023499, 298.62562561, 284.75453186, 300.18421936],
[298.18528748, 297.64231873, 298.70481873, 284.71263123, 300.2575531],
[298.79824829, 298.15567017, 298.82559204, 284.31387329, 300.29434204],
[298.22302246, 297.49841309, 298.42810059, 285.43981934, 300.12536621],
],
dtype=np.float32,
)
cpf_clim3 = np.array(
[
[297.19958496, 294.48083496, 297.19958496, 279.07458496, 298.73083496],
[297.72251892, 295.59751892, 297.59751892, 280.44126892, 299.03501892],
[297.79301453, 295.98051453, 297.73051453, 280.85551453, 299.10551453],
[297.8891449, 296.2641449, 297.7953949, 281.1391449, 299.1703949],
[297.94525146, 296.47650146, 297.85150146, 281.28900146, 299.22650146],
[297.98379517, 296.57754517, 297.89004517, 281.45254517, 299.26504517],
[298.02668762, 296.68293762, 297.90168762, 281.62043762, 299.30793762],
[298.06587219, 296.78462219, 297.94087219, 281.78462219, 299.31587219],
[298.09757996, 296.84757996, 297.97257996, 281.94132996, 299.31632996],
[298.12237549, 296.99737549, 297.99737549, 282.09112549, 299.34112549],
[298.13829041, 297.13829041, 298.04454041, 282.16954041, 299.35704041],
[298.15016174, 297.27516174, 298.05641174, 282.30641174, 299.40016174],
[298.1750946, 297.3625946, 298.0813446, 282.3938446, 299.3938446],
[298.19587708, 297.41462708, 298.10212708, 282.47712708, 299.41462708],
[298.20866394, 297.52116394, 298.11491394, 282.58366394, 299.42741394],
[298.20695496, 297.58195496, 298.14445496, 282.67570496, 299.45695496],
[298.21072388, 297.67947388, 298.14822388, 282.77322388, 299.46072388],
[298.24649048, 297.74649048, 298.18399048, 282.84024048, 299.46524048],
[298.25775146, 297.78900146, 298.19525146, 282.94525146, 299.47650146],
[298.24266052, 297.83641052, 298.21141052, 283.02391052, 299.49266052],
[298.2628479, 297.9190979, 298.2315979, 283.0753479, 299.5128479],
[298.27838135, 297.99713135, 298.24713135, 283.12213135, 299.49713135],
[298.30619812, 298.05619812, 298.24369812, 283.21244812, 299.52494812],
[298.31999207, 298.10124207, 298.25749207, 283.28874207, 299.53874207],
[298.31370544, 298.12620544, 298.25120544, 283.34495544, 299.53245544],
[298.34277344, 298.21777344, 298.28027344, 283.46777344, 299.56152344],
[298.35293579, 298.22793579, 298.29043579, 283.50918579, 299.57168579],
[298.36483765, 298.27108765, 298.30233765, 283.61483765, 299.55233765],
[298.35881042, 298.29631042, 298.32756042, 283.67131042, 299.57756042],
[298.37442017, 298.34317017, 298.34317017, 283.74942017, 299.59317017],
[298.39070129, 298.39070129, 298.35945129, 283.79695129, 299.57820129],
[298.39280701, 298.42405701, 298.36155701, 283.86155701, 299.58030701],
[298.41513062, 298.44638062, 298.38388062, 283.88388062, 299.60263062],
[298.42756653, 298.49006653, 298.39631653, 283.92756653, 299.61506653],
[298.44415283, 298.53790283, 298.41290283, 284.00665283, 299.60040283],
[298.4430542, 298.5680542, 298.4118042, 284.0368042, 299.6305542],
[298.4642334, 298.5892334, 298.4329834, 284.0892334, 299.6204834],
[298.45140076, 298.60765076, 298.45140076, 284.13890076, 299.63890076],
[298.46737671, 298.65487671, 298.43612671, 284.18612671, 299.62362671],
[298.49046326, 298.70921326, 298.45921326, 284.24046326, 299.64671326],
[298.47627258, 298.75752258, 298.47627258, 284.25752258, 299.66377258],
[298.49214172, 298.77339172, 298.49214172, 284.30464172, 299.64839172],
[298.50852966, 298.78977966, 298.47727966, 284.35227966, 299.66477966],
[298.51092529, 298.82342529, 298.51092529, 284.41717529, 299.66717529],
[298.52870178, 298.87245178, 298.52870178, 284.46620178, 299.68495178],
[298.5342865, 298.9092865, 298.5342865, 284.5030365, 299.6905365],
[298.54951477, 298.95576477, 298.54951477, 284.54951477, 299.67451477],
[298.54745483, 298.95370483, 298.54745483, 284.57870483, 299.70370483],
[298.55279541, 298.99029541, 298.55279541, 284.64654541, 299.70904541],
[298.5657196, 299.0344696, 298.5657196, 284.6907196, 299.6907196],
[298.58908081, 299.05783081, 298.58908081, 284.74533081, 299.71408081],
[298.59416199, 299.09416199, 298.59416199, 284.78166199, 299.71916199],
[298.60455322, 299.13580322, 298.60455322, 284.82330322, 299.72955322],
[298.5995636, 299.1620636, 298.5995636, 284.8808136, 299.7245636],
[298.63447571, 299.22822571, 298.60322571, 284.91572571, 299.72822571],
[298.61903381, 299.27528381, 298.61903381, 284.96278381, 299.74403381],
[298.63130188, 299.31880188, 298.63130188, 285.00630188, 299.75630188],
[298.66421509, 299.38296509, 298.66421509, 285.07046509, 299.75796509],
[298.65483093, 299.40483093, 298.65483093, 285.12358093, 299.74858093],
[298.67388916, 299.48638916, 298.67388916, 285.17388916, 299.76763916],
[298.67709351, 299.55209351, 298.67709351, 285.23959351, 299.77084351],
[298.69252014, 299.59877014, 298.69252014, 285.31752014, 299.78627014],
[298.69714355, 299.66589355, 298.72839355, 285.38464355, 299.79089355],
[298.70065308, 299.70065308, 298.73190308, 285.48190308, 299.79440308],
[298.70397949, 299.73522949, 298.73522949, 285.54772949, 299.79772949],
[298.71356201, 299.77606201, 298.74481201, 285.58856201, 299.80731201],
[298.72264099, 299.81639099, 298.75389099, 285.66014099, 299.81639099],
[298.73544312, 299.86044312, 298.76669312, 285.70419312, 299.82919312],
[298.75715637, 299.91340637, 298.78840637, 285.78840637, 299.81965637],
[298.75090027, 299.96965027, 298.78215027, 285.84465027, 299.84465027],
[298.75602722, 300.00602722, 298.78727722, 285.94352722, 299.84977722],
[298.78895569, 300.03895569, 298.82020569, 286.03895569, 299.85145569],
[298.79734802, 300.07859802, 298.82859802, 286.10984802, 299.85984802],
[298.81106567, 300.12356567, 298.81106567, 286.18606567, 299.87356567],
[298.80184937, 300.14559937, 298.83309937, 286.33309937, 299.86434937],
[298.81135559, 300.18635559, 298.84260559, 286.46760559, 299.87385559],
[298.82081604, 300.22706604, 298.85206604, 286.60206604, 299.88331604],
[298.84077454, 300.30952454, 298.87202454, 286.74702454, 299.90327454],
[298.86294556, 300.33169556, 298.89419556, 286.89419556, 299.89419556],
[298.85377502, 300.41627502, 298.91627502, 287.01002502, 299.91627502],
[298.89532471, 300.45782471, 298.92657471, 287.14532471, 299.92657471],
[298.90074158, 300.52574158, 298.93199158, 287.40074158, 299.93199158],
[298.91497803, 300.60247803, 298.94622803, 287.57122803, 299.94622803],
[298.93565369, 300.65440369, 298.96690369, 287.81065369, 299.93565369],
[298.95228577, 300.73353577, 298.98353577, 287.98353577, 299.95228577],
[298.97171021, 300.78421021, 299.00296021, 288.19046021, 299.97171021],
[298.98052979, 300.88677979, 299.01177979, 288.60552979, 299.98052979],
[298.99150085, 301.02275085, 299.05400085, 288.83525085, 299.99150085],
[299.02285767, 301.11660767, 299.05410767, 289.14785767, 299.99160767],
[299.03540039, 301.28540039, 299.09790039, 289.69165039, 300.03540039],
[299.05368042, 301.42868042, 299.08493042, 289.89743042, 300.02243042],
[299.09214783, 301.52964783, 299.12339783, 290.09214783, 300.06089783],
[299.12438965, 301.68688965, 299.12438965, 290.37438965, 300.06188965],
[299.13876343, 301.85751343, 299.17001343, 290.63876343, 300.07626343],
[299.15509033, 301.96759033, 299.18634033, 290.90509033, 300.09259033],
[299.20120239, 302.07620239, 299.23245239, 291.20120239, 300.13870239],
[299.23779297, 302.23779297, 299.26904297, 291.55029297, 300.17529297],
[299.30075073, 302.33200073, 299.33200073, 291.89450073, 300.20700073],
[299.37887573, 302.53512573, 299.37887573, 292.47262573, 300.28512573],
[299.44155884, 302.75405884, 299.50405884, 293.03530884, 300.34780884],
[299.81393433, 303.62643433, 299.93893433, 295.00143433, 300.62643433],
],
dtype=np.float32,
)


def test_cpf():
cpf = extreme.array.cpf(cpf_clim, cpf_ens, sort_clim=True)
Expand All @@ -975,6 +1139,11 @@ def test_cpf_eps():
np.testing.assert_allclose(cpf, cpf_val2)


def test_cpf_sym():
cpf = extreme.array.cpf(cpf_clim3, cpf_ens3, sort_clim=True, symmetric=True)
np.testing.assert_allclose(cpf, cpf_val3)


def test_highlevel_efi():
efi = extreme.efi(clim, ens)

Expand Down

0 comments on commit 2c67c46

Please sign in to comment.