Skip to content
Snippets Groups Projects
Commit d4c96eed authored by Martin Lange's avatar Martin Lange
Browse files

dirty fix for output grid orientation and daily time step

parent 32019d7c
No related branches found
No related tags found
No related merge requests found
......@@ -11,6 +11,7 @@ from finam.modules.visual import time_series
from finam_mhm_module import Mhm
from matplotlib import pyplot as plt
def grid_select(grid):
col, row = 3, 5
return grid[col + row * 5]
......
......@@ -2,10 +2,11 @@
FINAM mHM module.
"""
from datetime import datetime
import mhm_pybind as mp
from finam.core.sdk import ATimeComponent, Output
import mhm_pybind as mp
import numpy as np
from finam.core.interfaces import ComponentStatus
from finam.core.sdk import ATimeComponent, Output
from finam.data.grid import Grid, GridSpec
......@@ -35,14 +36,14 @@ class Mhm(ATimeComponent):
# set time
year, month, day, hour = mp.run.current_time()
print("time", year, month, day, hour)
if hour == -1:
if hour < 0:
hour = 0
self._time = datetime(year=year, month=month, day=day, hour=hour)
# get grid info
ncols, nrows, ncells, xll, yll, cell_size, no_data = mp.get.l1_domain_info()
self.no_data = no_data
self.gridspec = GridSpec(
ncols=ncols, nrows=nrows, cell_size=cell_size, xll=xll, yll=yll
ncols=nrows, nrows=ncols, cell_size=cell_size, xll=xll, yll=yll
)
self.outputs["runoff"] = Output()
self._status = ComponentStatus.INITIALIZED
......@@ -54,7 +55,7 @@ class Mhm(ATimeComponent):
data=Grid(
spec=self.gridspec,
no_data=self.no_data,
data=runoff.filled().reshape(-1),
data=np.fliplr(runoff.filled()).reshape(-1, order="F"),
),
time=self.time,
)
......@@ -82,7 +83,7 @@ class Mhm(ATimeComponent):
data=Grid(
spec=self.gridspec,
no_data=self.no_data,
data=runoff.filled().reshape(-1),
data=np.fliplr(runoff.filled()).reshape(-1, order="F"),
),
time=self.time,
)
......
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