Skip to content

Commit

Permalink
Pick the relevant changes for the deterministic from PR NOAA-EMC#2033
Browse files Browse the repository at this point in the history
…for PR NOAA-EMC#2199
  • Loading branch information
jiaruidong2017 committed Jan 17, 2024
1 parent 9046d97 commit 8603933
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 9 deletions.
3 changes: 2 additions & 1 deletion jobs/rocoto/landanl.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ export jobid="${job}.$$"
###############################################################
# setup python path for workflow utilities and tasks
wxflowPATH="${HOMEgfs}/ush/python:${HOMEgfs}/ush/python/wxflow/src"
PYTHONPATH="${PYTHONPATH:+${PYTHONPATH}:}${wxflowPATH}"
gdasappPATH="${HOMEgfs}/sorc/gdas.cd/iodaconv/src:${HOMEgfs}/sorc/gdas.cd/build/lib/python3.7"
PYTHONPATH="${PYTHONPATH:+${PYTHONPATH}:}${wxflowPATH}:${gdasappPATH}"
export PYTHONPATH

###############################################################
Expand Down
6 changes: 6 additions & 0 deletions parm/config/gfs/config.landanl
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ fi
export OBS_YAML_DIR=${HOMEgfs}/sorc/gdas.cd/parm/land/obs/config/
export OBS_LIST=${HOMEgfs}/sorc/gdas.cd/parm/land/obs/lists/${obs_list_name}

# Prepare IMS snow observations
export FIMS_NML_TMPL="${HOMEgfs}/sorc/gdas.cd/parm/land/prep/fims.nml.j2"
export IMS_OBS_LIST="${HOMEgfs}/sorc/gdas.cd/parm/land/prep/prep_ims.yaml"
export CALCFIMSEXE="${HOMEgfs}/exec/calcfIMS.exe"
export IMS2IODACONV="${HOMEgfs}/ush/imsfv3_scf2ioda.py"

# Name of the JEDI executable and its yaml template
export JEDIEXE="${HOMEgfs}/exec/fv3jedi_letkf.x"
export JEDIYAML="${HOMEgfs}/sorc/gdas.cd/parm/land/letkfoi/letkfoi.yaml"
Expand Down
4 changes: 0 additions & 4 deletions parm/config/gfs/config.preplandobs
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,5 @@ echo "BEGIN: config.preplandobs"

export GTS_OBS_LIST="${HOMEgfs}/sorc/gdas.cd/parm/land/prep/prep_gts.yaml"
export BUFR2IODAX="${HOMEgfs}/exec/bufr2ioda.x"
export FIMS_NML_TMPL="${HOMEgfs}/sorc/gdas.cd/parm/land/prep/fims.nml.j2"
export IMS_OBS_LIST="${HOMEgfs}/sorc/gdas.cd/parm/land/prep/prep_ims.yaml"
export CALCFIMSEXE="${HOMEgfs}/exec/calcfIMS.exe"
export IMS2IODACONV="${HOMEgfs}/ush/imsfv3_scf2ioda.py"

echo "END: config.preplandobs"
2 changes: 0 additions & 2 deletions scripts/exglobal_prep_land_obs.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,3 @@
# Instantiate the land prepare task
LandAnl = LandAnalysis(config)
LandAnl.prepare_GTS()
if f"{ LandAnl.runtime_config.cyc }" == '18':
LandAnl.prepare_IMS()
47 changes: 45 additions & 2 deletions ush/python/pygfs/task/land_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def __init__(self, config):
'npz': self.config.LEVS - 1,
'LAND_WINDOW_BEGIN': _window_begin,
'LAND_WINDOW_LENGTH': f"PT{self.config['assim_freq']}H",
'OPREFIX': f"{self.runtime_config.RUN}.t{self.runtime_config.cyc:02d}z.",
'OPREFIX': f"{self.runtime_config.CDUMP}.t{self.runtime_config.cyc:02d}z.",
'APREFIX': f"{self.runtime_config.RUN}.t{self.runtime_config.cyc:02d}z.",
'jedi_yaml': _letkfoi_yaml
}
Expand Down Expand Up @@ -187,6 +187,7 @@ def prepare_IMS(self) -> None:
os.symlink(exe_src, exe_dest)

# execute CALCFIMSEXE to calculate IMS snowdepth
os.chdir(localconf.DATA)
exe = Executable(self.task_config.APRUN_CALCFIMS)
exe.add_default_arg(os.path.join(localconf.DATA, os.path.basename(exe_src)))
logger.info(f"Executing {exe}")
Expand Down Expand Up @@ -244,7 +245,12 @@ def initialize(self) -> None:
Instance of the LandAnalysis object
"""

super().initialize()
# Stage observations
obs_dict = self.get_obs_dict()
FileHandler(obs_dict).sync()

# link jedi executable to run directory
self.link_jediexe()

# create a temporary dict of all keys needed in this method
localconf = AttrDict()
Expand Down Expand Up @@ -307,6 +313,10 @@ def execute(self) -> None:
for key in keys:
localconf[key] = self.task_config[key]

logger.info("Generating IMS snow OBS")
if f"{ self.runtime_config.cyc }" == '18':
self.prepare_IMS()

logger.info("Creating ensemble")
self.create_ensemble(localconf.SNOWDEPTHVAR,
localconf.BESTDDEV,
Expand Down Expand Up @@ -369,6 +379,39 @@ def finalize(self) -> None:
inclist.append([src, dest])
FileHandler({'copy': inclist}).sync()

@logit(logger)
def get_obs_dict(self) -> None:
"""Compile a dictionary of observation files to copy
This method uses the OBS_LIST configuration variable to generate a dictionary
from a list of YAML files that specify what observation files are to be
copied to the run directory from the observation input directory
Parameters
----------
Returns
----------
obs_dict: Dict
a dictionary containing the list of observation files to copy for FileHandler
"""
logger.debug(f"OBS_LIST: {self.task_config['OBS_LIST']}")
obs_list_config = parse_j2yaml(self.task_config["OBS_LIST"], self.task_config)
logger.debug(f"obs_list_config: {obs_list_config}")
# get observers from master dictionary
observers = obs_list_config['observers']
copylist = []
for ob in observers:
obfile = ob['obs space']['obsdatain']['engine']['obsfile']
basename = os.path.basename(obfile)
if 'ims_snow' not in obfile:
copylist.append([os.path.join(self.task_config['COM_OBS'], basename), obfile])
obs_dict = {
'mkdir': [os.path.join(self.runtime_config['DATA'], 'obs')],
'copy': copylist
}
return obs_dict

@staticmethod
@logit(logger)
def get_bkg_dict(config: Dict) -> Dict[str, List[str]]:
Expand Down

0 comments on commit 8603933

Please sign in to comment.