Skip to content

Commit 42f64c1

Browse files
committed
Set altitude to be 0 for ACTRIS when it is unefined
1 parent 7cad13e commit 42f64c1

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

providentia/actris.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -921,7 +921,7 @@ def get_data(self, files, var, actris_parameter, target_start_date, target_end_d
921921
value = [float(val) if val != b'' else np.nan for val in value]
922922
elif key in ['altitude', 'sampling_height']:
923923
value = [float(val.decode('utf-8').replace('m', '').strip())
924-
if val != b'' else np.nan for val in value]
924+
if val != b'' and val != b'nan' else 0 for val in value]
925925
else:
926926
value = [val.decode('utf-8', errors="replace") for val in value]
927927
combined_ds[key] = xr.Variable(data=value, dims=('station'))
@@ -935,7 +935,7 @@ def get_data(self, files, var, actris_parameter, target_start_date, target_end_d
935935
if ('altitude' in combined_ds.keys()) and ('sampling_height' in combined_ds.keys()):
936936
value = combined_ds['altitude'].values + combined_ds['sampling_height'].values
937937
combined_ds['measurement_altitude'] = xr.Variable(data=value, dims=('station'))
938-
938+
939939
# add units for lat and lon
940940
# TODO: Check attrs geospatial_lat_units and geospatial_lon_units
941941
combined_ds.latitude.attrs['units'] = 'degrees_north'

0 commit comments

Comments
 (0)