@@ -23,11 +23,9 @@ def test_fill_missing_data(generate_silly_vt_dataset):
2323 """
2424 ds = generate_silly_vt_dataset
2525 ds ["temp" ][0 , 0 , 6 :10 , 0 ] = np .nan
26- ds .temp .attrs = {"units" :"C" }
26+ ds .temp .attrs = {"units" : "C" }
2727 ds = rgd .fill_missing_data (ds , "silly_depth" , fill = "f" )
28- assert (
29- ds .temp .attrs == {"units" :"C" }
30- ) # Assert that attributes are retained
28+ assert ds .temp .attrs == {"units" : "C" } # Assert that attributes are retained
3129 assert (
3230 ds ["temp" ][0 , 0 , 6 :10 , 0 ] == (ds ["temp" ][0 , 0 , 5 , 0 ])
3331 ).all () # Assert if we are forward filling in time
@@ -41,7 +39,7 @@ def test_add_or_update_time_dim(generate_silly_vt_dataset):
4139 ds = generate_silly_vt_dataset
4240
4341 ds = rgd .add_or_update_time_dim (ds , xr .DataArray ([0 ]))
44- assert ds .time .attrs == {"units" :"days" } # Assert that attributes are retained
42+ assert ds .time .attrs == {"units" : "days" } # Assert that attributes are retained
4543 assert ds ["time" ].values == [0 ] # Assert time is added
4644 assert ds ["temp" ].dims [0 ] == "time" # Check time is first dim
4745
@@ -50,7 +48,7 @@ def test_generate_dz(generate_silly_vt_dataset):
5048 ds = generate_silly_vt_dataset
5149
5250 dz = rgd .generate_dz (ds , "silly_depth" )
53- assert ds .time .attrs == {"units" :"days" } # Assert that attributes are retained
51+ assert ds .time .attrs == {"units" : "days" } # Assert that attributes are retained
5452 z = np .linspace (0 , 1000 , 10 )
5553 dz_check = np .full (z .shape , z [1 ] - z [0 ])
5654 assert (
@@ -62,11 +60,10 @@ def test_add_secondary_dimension(get_curvilinear_hgrid, generate_silly_vt_datase
6260 ds = generate_silly_vt_dataset
6361 hgrid = get_curvilinear_hgrid
6462
65-
6663 # N/S Boundary
6764 coords = rgd .coords (hgrid , "north" , "segment_002" )
6865 ds = rgd .add_secondary_dimension (ds , "temp" , coords , "segment_002" )
69- assert ds .time .attrs == {"units" :"days" } # Assert that attributes are retained
66+ assert ds .time .attrs == {"units" : "days" } # Assert that attributes are retained
7067 assert ds ["temp" ].dims == (
7168 "silly_lat" ,
7269 "ny_segment_002" ,
@@ -110,10 +107,8 @@ def test_add_secondary_dimension(get_curvilinear_hgrid, generate_silly_vt_datase
110107def test_vertical_coordinate_encoding (generate_silly_vt_dataset ):
111108 ds = generate_silly_vt_dataset
112109
113-
114-
115110 ds = rgd .vertical_coordinate_encoding (ds , "temp" , "segment_002" , "silly_depth" )
116- assert ds .time .attrs == {"units" :"days" } # Assert that attributes are retained
111+ assert ds .time .attrs == {"units" : "days" } # Assert that attributes are retained
117112
118113 assert "nz_segment_002_temp" in ds ["temp" ].dims
119114 assert "nz_segment_002_temp" in ds
@@ -126,7 +121,7 @@ def test_generate_layer_thickness(generate_silly_vt_dataset):
126121 ds = generate_silly_vt_dataset
127122 ds ["temp" ] = ds ["temp" ].transpose ("time" , "silly_depth" , "silly_lat" , "silly_lon" )
128123 ds = rgd .generate_layer_thickness (ds , "temp" , "segment_002" , "silly_depth" )
129- assert ds .time .attrs == {"units" :"days" } # Assert that attributes are retained
124+ assert ds .time .attrs == {"units" : "days" } # Assert that attributes are retained
130125
131126 assert "dz_temp" in ds
132127 assert ds ["dz_temp" ].dims == ("time" , "nz_temp" , "ny_segment_002" , "nx_segment_002" )
@@ -242,7 +237,7 @@ def test_mask_dataset(get_curvilinear_hgrid):
242237 ds ["temp" ] = ds ["temp" ].expand_dims ("y" , axis = 0 )
243238 ds ["temp" ] = ds ["temp" ].expand_dims ("nz_temp" , axis = 0 )
244239 ds ["temp" ] = ds ["temp" ].expand_dims ("time" , axis = 0 )
245- ds .temp .attrs = {"units" :"C" }
240+ ds .temp .attrs = {"units" : "C" }
246241 fill_value = 36
247242 ds = rgd .mask_dataset (
248243 ds ,
@@ -252,7 +247,7 @@ def test_mask_dataset(get_curvilinear_hgrid):
252247 x_dim_name = "t_points_x" ,
253248 fill_value = fill_value ,
254249 )
255- assert ds .temp .attrs == {"units" :"C" }
250+ assert ds .temp .attrs == {"units" : "C" }
256251
257252 assert (
258253 np .isnan (ds ["temp" ][0 , 0 , 0 ][start_ind * 2 + 2 ]) == False
0 commit comments