Skip to content

Commit

Permalink
Merge pull request #183 from UW-Hydro/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
arbennett authored Sep 27, 2019
2 parents 61c9314 + d8c6907 commit 64c4de3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 2 additions & 0 deletions metsim/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,8 @@ def read_netcdf(data_handle, domain=None,
if k in list(ds.dims.keys())})

if 'time' in ds.coords:
if isinstance(ds.indexes['time'], xr.CFTimeIndex):
ds['time'] = ds.indexes['time'].to_datetimeindex()
ds['time'] = (ds.indexes['time'] -
pd.Timedelta('11H59M59S')).round('D')

Expand Down
8 changes: 4 additions & 4 deletions metsim/metsim.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ def met_data(self):
if constant_vars:
da_template = self._met_data[list(self._met_data)[0]]
for var in constant_vars.keys():
self._met_data[var] = xr.full_like(da_template,
self._met_data[var] = xr.full_like(da_template,
float(constant_vars[var]))

self._validate_force_times(force_times=self._met_data['time'])
Expand Down Expand Up @@ -289,9 +289,9 @@ def run(self):

delayed_objs = [wrap_run_slice(self.params, write_locks, dslice)
for dslice in self.slices]

self.progress_bar(
dask.compute(delayed_objs, num_workers=self.params['num_workers']))
persisted = dask.persist(delayed_objs, num_workers=self.params['num_workers'])
self.progress_bar(persisted)
dask.compute(persisted)
self.logger.info('Cleaning up...')
try:
self._client.cluster.close()
Expand Down

0 comments on commit 64c4de3

Please sign in to comment.