Source code for pycif.plugins.models.lmdz_acc.io.inputs.params
import calendar
import pandas as pd
[docs]
def make_totinput(self, runsubdir, datei, mode, footprint="F"):
"""Makes a totinput file, storing the main simulation parameters:
- number of effective tracers
- using SACS (T) or not (F)
- spliting of dynamic timestep
- spliting of physical timestep
- read start file (T) or not (F)
- forward (T) or backward (F)
- output diagnostics
- output wfunc or not (T or F)
- if footprint (to change number of days 28 to 30..)
- ndayloc, number of days in the month
- convOH = T if vmr or F if molec/cm3
- conv_scheme =
- physic = T if run physics
"""
with open(f"{runsubdir}/totinput", "w") as f:
nbtr = self.chemistry.nspecies
sacs = "T" if self.do_chemistry else "F"
start = (
"T"
if mode in ["fwd", "tl"]
or (mode == "adj" and datei != self.subsimu_dates[-2])
else "F"
)
forward = "T" if mode in ["fwd", "tl"] else "F"
diag = 0
wfunc = "F"
convOH = (
"T"
if getattr(
getattr(
getattr(
getattr(self, "chemistry", None), "prescrconcs", None
),
"OH",
None,
),
"convOH",
True,
)
else "F"
)
physic = "T" if getattr(self, "physic", True) else "F"
compressed_phystoke = "T" if self.compressed_phystoke else "F"
save_q = "F" if self.no_trajq else "T"
dump_chemical_sink = "T" if (self.dump_chemical_sink and mode == "fwd") else "F"
# Convection scheme, default is Tiedke
conv_scheme = {"TK": 2, "KE": 3, "KE-Therm": 30}[self.conv_scheme]
# Period flux in hours
periodflux = int(
pd.to_timedelta(self.flx_tresol).total_seconds() / 3600)
# Number of days in the month
nday = calendar.monthrange(datei.year, datei.month)[1]
month = datei.month
year = datei.year
for var in [
nbtr,
sacs,
self.domain.dsplit,
self.domain.psplit,
start,
forward,
diag,
wfunc,
footprint,
nday,
convOH,
periodflux,
nday,
month,
year,
conv_scheme,
physic,
compressed_phystoke,
save_q,
dump_chemical_sink,
]:
f.write(str(var) + "\n")