Source code for pycif.plugins.models.dalecbethy.io.native2inputs
from logging import warning
from .inputs.make_forcing import make_meteo, make_static
[docs]
def native2inputs(
self,
datastore,
input_type,
datei,
datef,
runsubdir,
mode="fwd",
onlyinit=False,
do_simu=True,
check_transforms=False,
**kwargs,
):
"""Converts data at the model data resolution to D&B-compatible input
files.
Mirrors ``pycif.plugins.models.chimere.io.native2inputs.native2inputs``:
dispatches on ``input_type`` to a dedicated ``make_<type>`` function.
``"meteo"`` (D&B's ``input/dynforcing.nc``) and ``"dalecbethy_static"``
(``input/staticforcing.nc``) are wired so far, per ``required_inputs``
in the package ``__init__.py`` (see the ``ini_mapper.py`` TODO for the
still-unwired ``"dalecbethy_param"`` component type).
Args:
self: the dalecbethy model Plugin.
datastore: data to convert.
input_type (str): the component type to convert; ``"meteo"`` and
``"dalecbethy_static"`` are handled.
datei, datef: date interval of the sub-simulation.
runsubdir (str): sub-directory for the current simulation.
mode (str): running mode: one of 'fwd', 'adj' and 'tl'.
onlyinit (bool): unused, kept for interface compatibility.
do_simu (bool): if False, the simulation does not need to be run.
check_transforms (bool): unused, kept for interface compatibility.
**kwargs: unused, kept for interface compatibility.
"""
if not do_simu:
return
if input_type == "dalecbethy_static":
make_static(self, datastore, runsubdir, mode, datei, datef)
elif input_type == "meteo":
make_meteo(self, datastore, runsubdir, mode, datei, datef)
else:
warning(f"dalecbethy does not recognize required type: {input_type}")