@@ -55,11 +55,11 @@ def __init__(self, xp, device, file_name="t_hum_p_data.csv"):
5555
5656 d = read_data_file (self .file_name )
5757
58- self .t = xp .asarray (d ["t" ]. astype ( np . float32 ) , device = device )
59- self .td = xp .asarray (d ["td" ]. astype ( np . float32 ) , device = device )
60- self .r = xp .asarray (d ["r" ]. astype ( np . float32 ) , device = device )
61- self .q = xp .asarray (d ["q" ]. astype ( np . float32 ) , device = device )
62- self .p = xp .asarray (d ["p" ]. astype ( np . float32 ) , device = device )
58+ self .t = xp .asarray (d ["t" ], device = device )
59+ self .td = xp .asarray (d ["td" ], device = device )
60+ self .r = xp .asarray (d ["r" ], device = device )
61+ self .q = xp .asarray (d ["q" ], device = device )
62+ self .p = xp .asarray (d ["p" ], device = device )
6363
6464
6565# high level method call
@@ -179,8 +179,8 @@ def test_saturation_vapour_pressure_1(xp, device, phase):
179179
180180 d = read_data_file (ref_file )
181181
182- t = xp .asarray (d ["t" ]. astype ( np . float32 ) , device = device )
183- v_ref = xp .asarray (d [phase ]. astype ( np . float32 ) , device = device )
182+ t = xp .asarray (d ["t" ], device = device )
183+ v_ref = xp .asarray (d [phase ], device = device )
184184
185185 svp = thermo .array .saturation_vapour_pressure (t , phase = phase )
186186 assert xp .allclose (svp , v_ref )
@@ -219,9 +219,9 @@ def test_saturation_mixing_ratio(phase, xp, device):
219219 # save_test_reference(ref_file, o)
220220
221221 d = read_data_file (ref_file )
222- t = xp .asarray (d ["t" ]. astype ( np . float32 ) , device = device )
223- p = xp .asarray (d ["p" ]. astype ( np . float32 ) , device = device )
224- v_ref = xp .asarray (d [phase ]. astype ( np . float32 ) , device = device )
222+ t = xp .asarray (d ["t" ], device = device )
223+ p = xp .asarray (d ["p" ], device = device )
224+ v_ref = xp .asarray (d [phase ], device = device )
225225
226226 mr = thermo .array .saturation_mixing_ratio (t , p , phase = phase )
227227 assert xp .allclose (mr , v_ref )
@@ -243,9 +243,9 @@ def test_saturation_specific_humidity(phase, xp, device):
243243 # save_test_reference(ref_file, o)
244244
245245 d = read_data_file (ref_file )
246- t = xp .asarray (d ["t" ]. astype ( np . float32 ) , device = device )
247- p = xp .asarray (d ["p" ]. astype ( np . float32 ) , device = device )
248- v_ref = xp .asarray (d [phase ]. astype ( np . float32 ) , device = device )
246+ t = xp .asarray (d ["t" ], device = device )
247+ p = xp .asarray (d ["p" ], device = device )
248+ v_ref = xp .asarray (d [phase ], device = device )
249249
250250 q = thermo .array .saturation_specific_humidity (t , p , phase = phase )
251251 assert xp .allclose (q , v_ref )
@@ -262,8 +262,8 @@ def test_saturation_vapour_pressure_slope(phase, xp, device):
262262 # save_test_reference(ref_file, o)
263263
264264 d = read_data_file (ref_file )
265- t = xp .asarray (d ["t" ]. astype ( np . float32 ) , device = device )
266- v_ref = xp .asarray (d [phase ]. astype ( np . float32 ) , device = device )
265+ t = xp .asarray (d ["t" ], device = device )
266+ v_ref = xp .asarray (d [phase ], device = device )
267267
268268 svp = thermo .array .saturation_vapour_pressure_slope (t , phase = phase )
269269 assert xp .allclose (svp , v_ref )
@@ -285,9 +285,9 @@ def test_saturation_mixing_ratio_slope_1(phase, xp, device):
285285 # save_test_reference(ref_file, o)
286286
287287 d = read_data_file (ref_file )
288- t = xp .asarray (d ["t" ]. astype ( np . float32 ) , device = device )
289- p = xp .asarray (d ["p" ]. astype ( np . float32 ) , device = device )
290- v_ref = xp .asarray (d [phase ]. astype ( np . float32 ) , device = device )
288+ t = xp .asarray (d ["t" ], device = device )
289+ p = xp .asarray (d ["p" ], device = device )
290+ v_ref = xp .asarray (d [phase ], device = device )
291291
292292 svp = thermo .array .saturation_mixing_ratio_slope (t , p , phase = phase )
293293 assert xp .allclose (svp , v_ref )
@@ -323,9 +323,9 @@ def test_saturation_specific_humidity_slope_1(phase, xp, device):
323323 # save_test_reference(ref_file, o)
324324
325325 d = read_data_file (ref_file )
326- t = xp .asarray (d ["t" ]. astype ( np . float32 ) , device = device )
327- p = xp .asarray (d ["p" ]. astype ( np . float32 ) , device = device )
328- v_ref = xp .asarray (d [phase ]. astype ( np . float32 ) , device = device )
326+ t = xp .asarray (d ["t" ], device = device )
327+ p = xp .asarray (d ["p" ], device = device )
328+ v_ref = xp .asarray (d [phase ], device = device )
329329
330330 svp = thermo .array .saturation_specific_humidity_slope (t , p , phase = phase )
331331 assert xp .allclose (svp , v_ref )
@@ -349,8 +349,8 @@ def test_temperature_from_saturation_vapour_pressure_1(xp, device):
349349 ref_file = "sat_vp.csv"
350350 d = read_data_file (ref_file )
351351
352- svp = xp .asarray (d ["water" ]. astype ( np . float32 ) , device = device )
353- v_ref = xp .asarray (d ["t" ]. astype ( np . float32 ) , device = device )
352+ svp = xp .asarray (d ["water" ], device = device )
353+ v_ref = xp .asarray (d ["t" ], device = device )
354354
355355 t = thermo .array .temperature_from_saturation_vapour_pressure (svp )
356356 assert xp .allclose (t , v_ref , equal_nan = True )
@@ -721,11 +721,11 @@ def test_ept(method, xp, device):
721721 ref = read_data_file (ref_file )
722722
723723 pt = thermo .array .ept_from_dewpoint (data .t , data .td , data .p , method = method )
724- v_ref = xp .asarray (ref [method + "_td" ]. astype ( np . float32 ) , device = device )
724+ v_ref = xp .asarray (ref [method + "_td" ], device = device )
725725 assert xp .allclose (pt , v_ref ), f"td { method = } "
726726
727727 pt = thermo .array .ept_from_specific_humidity (data .t , data .q , data .p , method = method )
728- v_ref = xp .asarray (ref [method + "_q" ]. astype ( np . float32 ) , device = device )
728+ v_ref = xp .asarray (ref [method + "_q" ], device = device )
729729 assert xp .allclose (pt , v_ref ), f"q { method = } "
730730
731731
@@ -744,7 +744,7 @@ def test_saturation_ept(method, xp, device):
744744 ref = read_data_file (ref_file )
745745
746746 pt = thermo .array .saturation_ept (data .t , data .p , method = method )
747- v_ref = xp .asarray (ref [method ]. astype ( np . float32 ) , device = device )
747+ v_ref = xp .asarray (ref [method ], device = device )
748748 assert xp .allclose (pt , v_ref ), f"{ method = } "
749749
750750
@@ -765,12 +765,12 @@ def test_temperature_on_moist_adiabat(ept_method, t_method, xp, device):
765765 # save_test_reference(ref_file, o)
766766
767767 ref = read_data_file (ref_file )
768- ept = xp .asarray (ref ["ept" ]. astype ( np . float32 ) , device = device )
769- p = xp .asarray (ref ["p" ]. astype ( np . float32 ) , device = device )
768+ ept = xp .asarray (ref ["ept" ], device = device )
769+ p = xp .asarray (ref ["p" ], device = device )
770770
771771 pt = thermo .array .temperature_on_moist_adiabat (ept , p , ept_method = ept_method , t_method = t_method )
772- v_ref = xp .asarray (ref [f"{ ept_method } _{ t_method } " ]. astype ( np . float32 ) , device = device )
773- assert xp .allclose (pt , v_ref , equal_nan = True , rtol = 1e-4 ), f"{ ept_method = } { t_method = } "
772+ v_ref = xp .asarray (ref [f"{ ept_method } _{ t_method } " ], device = device )
773+ assert xp .allclose (pt , v_ref , equal_nan = True ), f"{ ept_method = } { t_method = } "
774774
775775
776776@pytest .mark .parametrize ("xp, device" , NAMESPACE_DEVICES )
@@ -798,15 +798,15 @@ def test_wet_bulb_temperature(ept_method, t_method, xp, device):
798798 data .t , data .td , data .p , ept_method = ept_method , t_method = t_method
799799 )
800800
801- v_ref = xp .asarray (ref [f"{ ept_method } _{ t_method } _td" ]. astype ( np . float32 ) , device = device )
802- assert xp .allclose (pt , v_ref , rtol = 1e-01 , atol = 0 , equal_nan = True ), f"td { ept_method = } { t_method = } "
801+ v_ref = xp .asarray (ref [f"{ ept_method } _{ t_method } _td" ], device = device )
802+ assert xp .allclose (pt , v_ref , rtol = 1e-03 , atol = 0 , equal_nan = True ), f"td { ept_method = } { t_method = } "
803803
804804 pt = thermo .array .wet_bulb_temperature_from_specific_humidity (
805805 data .t , data .q , data .p , ept_method = ept_method , t_method = t_method
806806 )
807807
808- v_ref = xp .asarray (ref [f"{ ept_method } _{ t_method } _q" ]. astype ( np . float32 ) , device = device )
809- assert xp .allclose (pt , v_ref , rtol = 1e-01 , atol = 0 , equal_nan = True ), f"q { ept_method = } { t_method = } "
808+ v_ref = xp .asarray (ref [f"{ ept_method } _{ t_method } _q" ], device = device )
809+ assert xp .allclose (pt , v_ref , rtol = 1e-03 , atol = 0 , equal_nan = True ), f"q { ept_method = } { t_method = } "
810810
811811
812812@pytest .mark .parametrize ("xp, device" , NAMESPACE_DEVICES )
@@ -838,14 +838,14 @@ def test_wet_bulb_potential_temperature(ept_method, t_method, xp, device):
838838 data .t , data .td , data .p , ept_method = ept_method , t_method = t_method
839839 )
840840
841- v_ref = xp .asarray (ref [f"{ ept_method } _{ t_method } _td" ]. astype ( np . float32 ) , device = device )
841+ v_ref = xp .asarray (ref [f"{ ept_method } _{ t_method } _td" ], device = device )
842842 assert xp .allclose (pt , v_ref , rtol = 1e-03 , atol = 0 , equal_nan = True ), f"td { ept_method = } { t_method = } "
843843
844844 pt = thermo .array .wet_bulb_potential_temperature_from_specific_humidity (
845845 data .t , data .q , data .p , ept_method = ept_method , t_method = t_method
846846 )
847847
848- v_ref = xp .asarray (ref [f"{ ept_method } _{ t_method } _q" ]. astype ( np . float32 ) , device = device )
848+ v_ref = xp .asarray (ref [f"{ ept_method } _{ t_method } _q" ], device = device )
849849 assert xp .allclose (pt , v_ref , rtol = 1e-03 , atol = 0 , equal_nan = True ), f"q { ept_method = } { t_method = } "
850850
851851
0 commit comments