Commit 8e4a7698 authored by Friedemann Reum's avatar Friedemann Reum
Browse files

Adapt wrfchem to new plugin type datastream and renaming of flux from plural...

Adapt wrfchem to new plugin type datastream and renaming of flux from plural 'fluxes' to singular 'flux'
parent 37695f9a
Pipeline #149 failed with stages
......@@ -37,10 +37,10 @@ def read(
For each in_dates, the file where the flux is found
comp_type: string
Name of component in yaml, i.e. level above parameter.
Currently "fluxes" in my config_wrfchem_explanations.yml.
Currently "flux" in my config_wrfchem_explanations.yml.
Probably won't use it.
tracer : Plugin fluxes
Full fluxes object, with everything in the yaml. Use this
tracer : Plugin flux
Full flux object, with everything in the yaml. Use this
instead of the self in read.py because that self can be
modified. Same with write.
model: model plugin
......
......@@ -52,7 +52,7 @@ requirements = {
},
# Used for both reading and writing fluxes
"fluxes": {
"flux": {
"name": "wrfchem",
"version": "std",
"empty": False,
......@@ -65,7 +65,8 @@ requirements = {
"latcond": {
"name": "wrfchem",
"version": "icbc",
"type": "fields",
"type": "datastream",
"subtype": "field",
"empty": True,
"any": False,
"newplg": True,
......@@ -74,7 +75,8 @@ requirements = {
"inicond": {
"name": "wrfchem",
"version": "icbc",
"type": "fields",
"type": "datastream",
"subtype": "field",
"empty": True,
"any": False,
"newplg": True,
......@@ -91,7 +93,7 @@ input_arguments = {
"are already present in run_dir are skipped.\n"+ \
"namelist.input is copied separately from path " + \
"specified in argument namelist_input_file." + \
"Flux files are handled by the fluxes plugin.",
"Flux files are handled by the flux plugin.",
"default": None,
"accepted": str
},
......
......@@ -99,7 +99,7 @@ def ini_mapper(model, transform_type, general_mapper={}, backup_comps={},
)
emis = {
("fluxes", s): dict_fluxes
("flux", s): dict_fluxes
for s in model.chemistry.emis_species.attributes
}
mapper["inputs"].update(emis)
......
......@@ -17,7 +17,7 @@ def make_fluxes(self, datastore, runsubdir, datei, datef, mode):
"""Write fluxes to existing WRF flux input files
Args:
self (pycif.utils.classes.Fluxes.fluxes): Flux plugin with all
self (pycif.utils.classes.fluxes.Flux): Flux plugin with all
attributes
datastore (dict): information on flux species
runsubdir (str): directory to the current run
......@@ -36,7 +36,7 @@ def make_fluxes(self, datastore, runsubdir, datei, datef, mode):
trid: datastore[trid]
for trid in datastore
# if trid[0] in ["fluxes", "biofluxes"] # original
if trid[0] in ["fluxes"]
if trid[0] in ["flux"]
}
# List of dates for which emissions are needed
......@@ -49,7 +49,7 @@ def make_fluxes(self, datastore, runsubdir, datei, datef, mode):
# Loop on all anthropogenic and biogenic species
# If in datastore, take data, otherwise, link to original A/B EMISSIONS
# freum: again, no biofluxes
list_trid = [("fluxes", spec)
list_trid = [("flux", spec)
for spec in self.chemistry.emis_species.attributes] #\
# + [("biofluxes", spec)
# for spec in self.chemistry.bio_species.attributes]
......@@ -58,7 +58,7 @@ def make_fluxes(self, datastore, runsubdir, datei, datef, mode):
emis_type = trid[0]
# freum: again, no biofluxes
# flx_plg = self.fluxes if emis_type == "fluxes" else self.biofluxes
flx_plg = self.fluxes
flx_plg = self.flux
# freum 2021-11-02: According to Antoine, can only use flx_plg
# to access methods, not parameters in the yaml. Full plugin
# with access to parameters in yaml would be: tracer["tracer"].
......
......@@ -27,9 +27,9 @@ def native2inputs(
Args:
self: the model Plugin
input_type (str): one of 'fluxes', 'obs'
input_type (str): one of 'flux', 'obs'
datastore: data to convert
if input_type == 'fluxes', a dictionary with flux maps
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'
......@@ -60,7 +60,7 @@ def native2inputs(
if not do_simu:
return
if input_type == "fluxes":
if input_type == "flux":
# msg = "Implement fluxes here"
# logging.info(msg)
# pass
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment