Source code for pycif.plugins.models.dalecbethy.ini_periods

import pandas as pd

from logging import info


[docs] def ini_periods(self, **kwargs): """Define D&B's temporal splitting variables. Sets ``subsimu_dates``, ``tstep_dates`` and ``input_dates`` following the ``template``/``satwetch4`` convention. .. warning:: TODO for a D&B developer: D&B's simulation window (``yyyymmdd_start``/``yyyymmdd_end``) and internal hourly time step are **compiled into the executable** via ``src/dimensions.f90`` (itself generated from ``util/templates/dimensions.f90.template`` by ``util/model_setup.py`` at ``make`` time, see ``compile.py``). D&B therefore cannot, as of today, be split into several independently-run pyCIF sub-simulations without triggering a recompilation for each one (unlike e.g. CHIMERE, which reads its simulation window from a runtime namelist). Until this is resolved (either by adding a runtime override to D&B, or by re-triggering :func:`~.compile.compile` for every sub-period), this function defines a single sub-simulation spanning the full ``[datei, datef]`` pyCIF window, and internal time steps at hourly resolution (D&B's native resolution, see ``src/dimensions.f90``: ``nhour = nday*24``), regardless of ``output_resolution``. Args: self: the dalecbethy model Plugin. **kwargs: unused. """ info( "D&B sub-simulations are initialized as one single sub-simulation " "covering the full simulation window (see ini_periods.py TODO: " "the D&B simulation window is presently compiled into the " "executable)." ) self.subsimu_dates = [self.datei, self.datef] self.tstep_dates = {} self.input_dates = {} for dd0, dd1 in zip(self.subsimu_dates[:-1], self.subsimu_dates[1:]): # D&B's native internal time step is hourly (src/dimensions.f90); # output is available at hourly or daily resolution depending on # 'output_resolution' (see io/outputs2native.py). self.tstep_dates[dd0] = pd.date_range( dd0, dd1, freq="1d").to_pydatetime() self.input_dates[dd0] = pd.date_range( dd0, dd1, freq="1h").to_pydatetime()