Skip to content
Snippets Groups Projects
Verified Commit 7013704f authored by David Hoese's avatar David Hoese
Browse files

Fix accumulated precipitation using wrong units

Data comes from instrument in inches but was being used as millimeters
parent f755c3ac
No related branches found
No related tags found
No related merge requests found
...@@ -39,6 +39,11 @@ def get_data(input_files): ...@@ -39,6 +39,11 @@ def get_data(input_files):
frame = pd.DataFrame(_get_data(input_files)) frame = pd.DataFrame(_get_data(input_files))
frame = frame.set_index('stamp') frame = frame.set_index('stamp')
frame = frame.mask(frame == -99999.).fillna(value=np.nan) frame = frame.mask(frame == -99999.).fillna(value=np.nan)
for col_name in frame.columns:
if col_name in schema.unit_conversions:
conv_func = schema.unit_conversions[col_name]
frame[col_name] = conv_func(frame[col_name])
return frame return frame
......
...@@ -241,7 +241,7 @@ database = dict( ...@@ -241,7 +241,7 @@ database = dict(
'accumulated_precipitation', 'accumulated_precipitation',
'accum_precip', 'accum_precip',
'Precipitation accumulated since 0Z', 'Precipitation accumulated since 0Z',
'mm', 'mm', # data comes from instrument as inches but we typically want millimeters
'0', '0',
'254', '254',
None, None,
...@@ -273,3 +273,6 @@ database_dict = {k: v._asdict() for k, v in database.items()} ...@@ -273,3 +273,6 @@ database_dict = {k: v._asdict() for k, v in database.items()}
met_vars = {'air_temp', 'dewpoint', 'rh', 'solar_flux', 'pressure', 'precip', 'accum_precip', met_vars = {'air_temp', 'dewpoint', 'rh', 'solar_flux', 'pressure', 'precip', 'accum_precip',
'wind_speed', 'wind_dir', 'gust'} 'wind_speed', 'wind_dir', 'gust'}
engr_vars = set(database.keys()) - met_vars engr_vars = set(database.keys()) - met_vars
unit_conversions = {}
unit_conversions['accum_precip'] = lambda x: x * 25.4
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment