Skip to content

Commit

Permalink
Merge pull request #79 from IMMM-SFA/feature/64-bit-integers
Browse files Browse the repository at this point in the history
force 64 bit integer when reading reservoir database
  • Loading branch information
thurber authored Feb 2, 2022
2 parents 84952cd + 419a7c8 commit 1bdfa0e
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion mosartwmpy/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.2.4"
__version__ = "0.2.6"
4 changes: 2 additions & 2 deletions mosartwmpy/plotting/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,14 +170,14 @@ def plot_reservoir(
inflow_variable = next((o for o in model.config.get('simulation.output') if
o.get('variable', '') == 'channel_inflow_upstream'), {}).get('name', None)
outflow_variable = next((o for o in model.config.get('simulation.output') if
o.get('variable', '') == 'channel_outflow_downstream'), {}).get('name', None)
o.get('variable', '') == 'runoff_land'), {}).get('name', None)
results = xr.open_mfdataset(f"{model.config.get('simulation.output_path')}/{model.name}/*.nc")[
[storage_variable, inflow_variable, outflow_variable]]

df = pd.DataFrame(index=results.time)
df['storage'] = results[storage_variable].isel(lat=ilat, lon=ilon).values.flatten() / 1e6
df['inflow'] = results[inflow_variable].isel(lat=ilat, lon=ilon).values.flatten() * 24 * 60 * 60 / 1e6
df['outflow'] = results[outflow_variable].isel(lat=ilat, lon=ilon).values.flatten() * -1 * 24 * 60 * 60 / 1e6
df['outflow'] = results[outflow_variable].isel(lat=ilat, lon=ilon).values.flatten() * 24 * 60 * 60 / 1e6
if start is not None:
df = df[df.index >= start]
if end is not None:
Expand Down
2 changes: 1 addition & 1 deletion mosartwmpy/reservoirs/grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def load_reservoirs(self, config: Benedict, parameters: Parameters) -> None:
# drop nan grid ids
self.reservoir_dependency_database = self.reservoir_dependency_database[self.reservoir_dependency_database.grid_cell_id.notna()]
# set to integer
self.reservoir_dependency_database = self.reservoir_dependency_database.astype(int)
self.reservoir_dependency_database = self.reservoir_dependency_database.astype(np.int64)

# create a numba typed dict with key = <grid cell id> and value = <list of reservoir_ids that feed the cell>
self.grid_index_to_reservoirs_map = Dict.empty(
Expand Down

0 comments on commit 1bdfa0e

Please sign in to comment.