Skip to content

Commit

Permalink
Merge pull request #194 from arbennett/fix/release_2.1.2
Browse files Browse the repository at this point in the history
Revert "Revert "Bugfix/vp backfill""
  • Loading branch information
arbennett committed Oct 18, 2019
2 parents 5ae305e + d1c65f0 commit 2804446
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions metsim/disaggregate.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ def disaggregate(df_daily: pd.DataFrame, params: dict,
if 'wind' in df_daily:
df_disagg['wind'] = wind(df_daily['wind'].values, ts, params)

return df_disagg.fillna(method='ffill')
return df_disagg.fillna(method='ffill').fillna(method='bfill')


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

# Account for situations where vapor pressure is higher than
Expand Down
2 changes: 1 addition & 1 deletion metsim/metsim.py
Original file line number Diff line number Diff line change
Expand Up @@ -582,7 +582,7 @@ def _validate_setup(self):
errs.append("Output variable list must not be empty")

# Check output variables are valid
daily_out_vars = ['t_min', 't_max', 'prec', 'vapor_pressure',
daily_out_vars = ['t_min', 't_max', 't_day', 'prec', 'vapor_pressure',
'shortwave', 'tskc', 'pet', 'wind']
out_var_check = ['temp', 'prec', 'shortwave', 'vapor_pressure',
'air_pressure', 'rel_humid', 'spec_humid',
Expand Down
4 changes: 2 additions & 2 deletions metsim/tests/test_metsim.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ def test_disaggregation_values():
# The location we will test against
loc = (1, 4)

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


@pytest.mark.parametrize('kind', ['ascii', 'bin', 'nc',
@pytest.mark.parametrize('kind', ['ascii', 'bin', 'nc',
'constant_vars_ascii',
'constant_vars_bin',
'constant_vars_nc'])
Expand Down

0 comments on commit 2804446

Please sign in to comment.