Skip to content

Commit d1c65f0

Browse files
committed
Revert "Revert "Bugfix/vp backfill""
This reverts commit 242b097.
1 parent 5ae305e commit d1c65f0

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

metsim/disaggregate.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ def disaggregate(df_daily: pd.DataFrame, params: dict,
109109
if 'wind' in df_daily:
110110
df_disagg['wind'] = wind(df_daily['wind'].values, ts, params)
111111

112-
return df_disagg.fillna(method='ffill')
112+
return df_disagg.fillna(method='ffill').fillna(method='bfill')
113113

114114

115115
def set_min_max_hour(tiny_rad_fract: np.array, yday: np.array, n_days: int,
@@ -514,7 +514,7 @@ def vapor_pressure(vp_daily: np.array, temp: np.array, t_t_min: np.array,
514514
"""
515515
# Linearly interpolate the values
516516
interp = scipy.interpolate.interp1d(t_t_min, vp_daily / cnst.MBAR_PER_BAR,
517-
fill_value='extrapolate')
517+
bounds_error=False)
518518
vp_disagg = interp(ts * np.arange(0, n_out))
519519

520520
# Account for situations where vapor pressure is higher than

metsim/metsim.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -582,7 +582,7 @@ def _validate_setup(self):
582582
errs.append("Output variable list must not be empty")
583583

584584
# Check output variables are valid
585-
daily_out_vars = ['t_min', 't_max', 'prec', 'vapor_pressure',
585+
daily_out_vars = ['t_min', 't_max', 't_day', 'prec', 'vapor_pressure',
586586
'shortwave', 'tskc', 'pet', 'wind']
587587
out_var_check = ['temp', 'prec', 'shortwave', 'vapor_pressure',
588588
'air_pressure', 'rel_humid', 'spec_humid',

metsim/tests/test_metsim.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ def test_disaggregation_values():
235235
# The location we will test against
236236
loc = (1, 4)
237237

238-
def check_data(out, good, tol=0.02):
238+
def check_data(out, good, tol=0.03):
239239
assert isinstance(out, pd.DataFrame)
240240
for var in ms.params['out_vars']:
241241
# Check to make sure each variable has normalized
@@ -276,7 +276,7 @@ def check_data(out, good, tol=0.02):
276276
ds.close()
277277

278278

279-
@pytest.mark.parametrize('kind', ['ascii', 'bin', 'nc',
279+
@pytest.mark.parametrize('kind', ['ascii', 'bin', 'nc',
280280
'constant_vars_ascii',
281281
'constant_vars_bin',
282282
'constant_vars_nc'])

0 commit comments

Comments
 (0)