Skip to content

Commit

Permalink
fixing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
BaptisteVandecrux committed Nov 8, 2024
1 parent 0b9aca2 commit b2be7ce
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion tests/unit/bufr_export/tx_l3_test1.csv
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
time,p_u,p_l,t_u,t_l,rh_u,rh_u_cor,qh_u,rh_l,rh_l_cor,qh_l,wspd_u,wspd_l,wdir_u,wdir_l,wspd_x_u,wspd_y_u,wspd_x_l,wspd_y_l,dsr,dsr_cor,usr,usr_cor,albedo,dlr,ulr,cc,t_surf,dlhf_u,dlhf_l,dshf_u,dshf_l,z_boom_u,z_boom_l,precip_u,precip_u_cor,precip_u_rate,precip_l,precip_l_cor,precip_l_rate,t_i_1,t_i_2,t_i_3,t_i_4,t_i_5,t_i_6,t_i_7,t_i_8,t_i_9,t_i_10,t_i_11,tilt_x,tilt_y,rot,gps_lat,gps_lon,gps_alt,gps_time,gps_hdop,batt_v,fan_dc_u,fan_dc_l,t_rad,p_i,t_i,rh_i,rh_i_cor,wspd_i,wdir_i,wspd_x_i,wspd_y_i,msg_i,msg_lat,msg_lon
time,p_u,p_l,t_u,t_l,rh_u,rh_u_wrt_ice_or_water,qh_u,rh_l,rh_l_wrt_ice_or_water,qh_l,wspd_u,wspd_l,wdir_u,wdir_l,wspd_x_u,wspd_y_u,wspd_x_l,wspd_y_l,dsr,dsr_cor,usr,usr_cor,albedo,dlr,ulr,cc,t_surf,dlhf_u,dlhf_l,dshf_u,dshf_l,z_boom_u,z_boom_l,precip_u,precip_u_cor,precip_u_rate,precip_l,precip_l_cor,precip_l_rate,t_i_1,t_i_2,t_i_3,t_i_4,t_i_5,t_i_6,t_i_7,t_i_8,t_i_9,t_i_10,t_i_11,tilt_x,tilt_y,rot,gps_lat,gps_lon,gps_alt,gps_time,gps_hdop,batt_v,fan_dc_u,fan_dc_l,t_rad,p_i,t_i,rh_i,rh_i_cor,wspd_i,wdir_i,wspd_x_i,wspd_y_i,msg_i,msg_lat,msg_lon
2023-12-01 00:00:00,784.5,785.8,-16.32,-16.3,77.87,91.2846,1.0583,80.1,93.8804,1.0887,16.33,15.27,113.2,122.8,15.0095,-6.4331,12.8355,-8.2719,-1.9282,0.0,0.5033,0.0,,182.6197,241.7566,0.3205,-17.134,-1.6006,1.6393,30.3492,31.1479,4.1967,2.946,129.4,136.5924,0.0,304.0,315.0223,0.0,,-8.33,-7.41,-6.43,-5.9,-5.64,-5.51,-6.01,,,-12.46,0.6404,0.8809,218.9,66.482488,-46.29424,2135.0,21.0,0.9,12.72,35.15,11.81,-16.44,-213.9,-16.4,82.0,96.2012,15.48,122.3,13.0847,-8.2718,0.0,66.5026,-46.33518
2023-12-01 01:00:00,784.1,785.5,-15.82,-15.92,76.17,88.8564,1.0798,78.75,91.956,1.1052,15.85,14.83,112.3,126.2,14.6646,-6.0144,11.9672,-8.7587,-2.0466,0.0,0.7549,0.0,,178.4223,242.0001,0.2567,-17.034,-0.5022,2.1859,43.1898,40.0931,4.2047,2.9472,129.4,136.5924,0.0,304.0,315.0223,0.0,,-8.33,-7.41,-6.43,-5.9,-5.64,-5.51,-6.01,,,-12.46,0.631,0.5809,225.6,66.482471,-46.29426,2124.0,10022.0,0.73,12.74,30.55,11.82,-16.06,-214.4,-16.2,79.4,92.9691,15.28,118.8,13.39,-7.3612,0.0,66.5026,-46.33518
2023-12-01 02:00:00,784.1,785.5,-15.55,-15.6,76.88,89.4484,1.1146,79.15,92.1345,1.1408,15.55,14.57,117.1,129.6,13.8428,-7.0837,11.2264,-9.2873,-2.0272,0.0,0.6131,0.0,,182.2089,243.3796,0.2862,-16.6921,-0.5438,2.18,40.0149,38.6836,4.1981,2.9441,129.4,136.5924,0.0,304.0,315.0223,0.0,,-8.33,-7.41,-6.43,-5.9,-5.64,-5.51,-6.01,,,-12.46,0.3333,0.8761,231.1,66.482326,-46.294294,2121.0,20021.0,1.04,12.73,30.8,12.34,-15.74,-214.5,-15.6,79.0,91.9599,14.63,138.5,9.6941,-10.9572,0.0,66.50363,-46.20806
Expand Down
34 changes: 17 additions & 17 deletions tests/unit/test_value_clippping.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,32 +198,32 @@ def test_circular_dependencies(self):
check_dtype=True,
)

def test_rh_corrected(self):
def test_rh_adjusted(self):
variable_config = pd.DataFrame(
columns=["field", "lo", "hi", "OOL"],
data=[
["rh_u", 0, 150, "rh_u_cor"],
["rh_u_cor", 0, 150, ""],
["rh_u", 0, 150, "rh_u_wrt_ice_or_water"],
["rh_u_wrt_ice_or_water", 0, 150, ""],
],
).set_index("field")

rows_input = []
rows_expected = []
# All values are within the expected range
rows_input.append(dict(rh_u=42, rh_u_cor=43))
rows_expected.append(dict(rh_u=42, rh_u_cor=43))
# rh_u is below range, but rh_u_cor is within range. Both should be flagged due to the OOL relationship
rows_input.append(dict(rh_u=-10, rh_u_cor=3))
rows_expected.append(dict(rh_u=np.nan, rh_u_cor=np.nan))
# rh_u is within range, but rh_u_cor is below range; rh_u_cor should be flagged
rows_input.append(dict(rh_u=54, rh_u_cor=-4))
rows_expected.append(dict(rh_u=54, rh_u_cor=np.nan))
# rh_u is above range, but rh_u_cor is within range. Both should be flagged due to the OOL relationship
rows_input.append(dict(rh_u=160, rh_u_cor=120))
rows_expected.append(dict(rh_u=np.nan, rh_u_cor=np.nan))
# rh_u is within range, but rh_u_cor is above range; rh_u_cor should be flagged
rows_input.append(dict(rh_u=100, rh_u_cor=255))
rows_expected.append(dict(rh_u=100, rh_u_cor=np.nan))
rows_input.append(dict(rh_u=42, rh_u_wrt_ice_or_water=43))
rows_expected.append(dict(rh_u=42, rh_u_wrt_ice_or_water=43))
# rh_u is below range, but rh_u_wrt_ice_or_water is within range. Both should be flagged due to the OOL relationship
rows_input.append(dict(rh_u=-10, rh_u_wrt_ice_or_water=3))
rows_expected.append(dict(rh_u=np.nan, rh_u_wrt_ice_or_water=np.nan))
# rh_u is within range, but rh_u_wrt_ice_or_water is below range; rh_u_wrt_ice_or_water should be flagged
rows_input.append(dict(rh_u=54, rh_u_wrt_ice_or_water=-4))
rows_expected.append(dict(rh_u=54, rh_u_wrt_ice_or_water=np.nan))
# rh_u is above range, but rh_u_wrt_ice_or_water is within range. Both should be flagged due to the OOL relationship
rows_input.append(dict(rh_u=160, rh_u_wrt_ice_or_water=120))
rows_expected.append(dict(rh_u=np.nan, rh_u_wrt_ice_or_water=np.nan))
# rh_u is within range, but rh_u_wrt_ice_or_water is above range; rh_u_wrt_ice_or_water should be flagged
rows_input.append(dict(rh_u=100, rh_u_wrt_ice_or_water=255))
rows_expected.append(dict(rh_u=100, rh_u_wrt_ice_or_water=np.nan))

# Prepare the data
df_input = pd.DataFrame(rows_input, dtype=float)
Expand Down

0 comments on commit b2be7ce

Please sign in to comment.