Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • afid.nur-kholis/finam-mhm
  • FINAM/finam-mhm
2 results
Show changes
Commits on Source (1)
......@@ -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,
)
......