Source code for pycif.plugins.models.wrfchem.io.native2inputs

import logging

from .inputs.make_endconcs import make_endconcs
from .inputs.make_fluxes import make_fluxes
from .inputs.make_inicond import make_inicond
from .inputs.make_latcond import make_latcond
from .....utils.check.errclass import CifNotImplementedError


[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 model compatible input files. Args: self: the model Plugin input_type (str): one of 'flux', 'obs' datastore: data to convert if input_type == 'flux', a dictionary with flux maps if input_type == 'obs', a pandas dataframe with the observations datei, datef: date interval of the sub-simulation mode (str): running mode: one of 'fwd', 'adj' and 'tl' runsubdir (str): sub-directory for the current simulation workdir (str): the directory of the whole pycif simulation VERSION HISTORY 2021-10-06 freum Added code for namelist and model 2021-10-01 aberchet Defined ddi and ddf before call to make_fluxes 2021-09-09 freum Temporarily replaced NotImplementedErrors with logging.info to run WRF with preprocessed input data 2021-08-17 freum Original modified from models/lmdz """ # freum: need this? # if datastore is None: # datastore = {} # If mode is "fwd" or "tl" but onlyinit is True, # it means that we are initializing an adjoint by running backward # the adjoint pipeline if mode in ["tl", "fwd"] and onlyinit: mode = "adj" if mode not in ["fwd"]: raise CifNotImplementedError(f"mode '{mode}' not implemented") # freum: Don't know if I need this, TM5 kept it, keeping it for now if not do_simu: return if input_type == "flux": # msg = "Implement fluxes here" # logging.info(msg) # pass ddi = min(datei, datef) ddf = max(datei, datef) make_fluxes(self, datastore, runsubdir, ddi, ddf, mode) # Deals with initial conditions elif input_type == "inicond": ddi = min(datei, datef) make_inicond(self, datastore, runsubdir, ddi, mode) elif input_type == "latcond": ddi = min(datei, datef) make_latcond(self, datastore, runsubdir, ddi, mode) elif input_type=="endconcs": ddi = min(datei, datef) make_endconcs(self, datastore, runsubdir, ddi, mode) else: msg = f"No method implemented for input type '{input_type}'." logging.info(msg)
# raise NotImplementedError(msg)