From 435eb6687aaa76e0a3b4f820519a0ae214b803e7 Mon Sep 17 00:00:00 2001 From: AndrewEichmann-NOAA <58948505+AndrewEichmann-NOAA@users.noreply.github.com> Date: Fri, 3 May 2024 13:28:44 -0400 Subject: [PATCH] Initial commit of marine letkf stubs (#1090) Adds stubs and ctest for marine LETKF task. Co-dependent on global-workflow PR https://github.com/NOAA-EMC/global-workflow/pull/2564 Addresses https://github.com/NOAA-EMC/GDASApp/issues/1091 --- .../exgdas_global_marine_analysis_letkf.py | 25 ++++++ test/soca/gw/CMakeLists.txt | 1 + ush/soca/marine_letkf.py | 90 +++++++++++++++++++ 3 files changed, 116 insertions(+) create mode 100755 scripts/exgdas_global_marine_analysis_letkf.py create mode 100644 ush/soca/marine_letkf.py diff --git a/scripts/exgdas_global_marine_analysis_letkf.py b/scripts/exgdas_global_marine_analysis_letkf.py new file mode 100755 index 000000000..97e6b1279 --- /dev/null +++ b/scripts/exgdas_global_marine_analysis_letkf.py @@ -0,0 +1,25 @@ +#!/usr/bin/env python3 +# exgdas_global_marine_analysis_ecen.py +# This script creates an MarineLETKF class +# and runs the initialize, run, and finalize methods +# which currently are stubs +import os + +from wxflow import Logger, cast_strdict_as_dtypedict +# TODO (AFE): change to from pygfs.task.marine_recenter import MarineLETKF +from soca.marine_recenter import MarineLETKF + +# Initialize root logger +logger = Logger(level='DEBUG', colored_log=True) + + +if __name__ == '__main__': + + # Take configuration from environment and cast it as python dictionary + config = cast_strdict_as_dtypedict(os.environ) + + # Instantiate the aerosol analysis task + MarineLetkf = MarineLETKF(config) + MarineLetkf.initialize() + MarineLetkf.run() + MarineLetkf.finalize() diff --git a/test/soca/gw/CMakeLists.txt b/test/soca/gw/CMakeLists.txt index 0d9d81237..524428de0 100644 --- a/test/soca/gw/CMakeLists.txt +++ b/test/soca/gw/CMakeLists.txt @@ -46,6 +46,7 @@ set(jjob_list "JGLOBAL_PREP_OCEAN_OBS" "JGDAS_GLOBAL_OCEAN_ANALYSIS_BMAT" "JGDAS_GLOBAL_OCEAN_ANALYSIS_RUN" "JGDAS_GLOBAL_OCEAN_ANALYSIS_ECEN" +# "JGDAS_GLOBAL_OCEAN_ANALYSIS_LETKF" "JGDAS_GLOBAL_OCEAN_ANALYSIS_CHKPT" "JGDAS_GLOBAL_OCEAN_ANALYSIS_POST") # TODO(WaterPeople) Add back to the list of tested jobs once fixed diff --git a/ush/soca/marine_letkf.py b/ush/soca/marine_letkf.py new file mode 100644 index 000000000..20ef0c0b6 --- /dev/null +++ b/ush/soca/marine_letkf.py @@ -0,0 +1,90 @@ +#!/usr/bin/env python3 + +from datetime import datetime, timedelta +import f90nml +from logging import getLogger +import os +from soca import bkg_utils +from typing import Dict +import ufsda +from ufsda.stage import soca_fix +from wxflow import (AttrDict, + chdir, + Executable, + FileHandler, + logit, + parse_j2yaml, + Task, + Template, + TemplateConstants, + WorkflowException, + YAMLFile) + +logger = getLogger(__name__.split('.')[-1]) + + +class MarineLETKF(Task): + """ + Class for global ocean analysis recentering task + """ + + @logit(logger, name="MarineLETKF") + def __init__(self, config: Dict) -> None: + """Constructor for ocean recentering task + Parameters: + ------------ + config: Dict + configuration, namely evironment variables + Returns: + -------- + None + """ + + logger.info("init") + super().__init__(config) + + @logit(logger) + def initialize(self): + """Method initialize for ocean recentering task + Parameters: + ------------ + None + Returns: + -------- + None + """ + + logger.info("initialize") + RUN = self.runtime_config.RUN + gcyc = self.runtime_config.gcyc + + @logit(logger) + def run(self): + """Method run for ocean recentering task + Parameters: + ------------ + None + Returns: + -------- + None + """ + + logger.info("run") + + chdir(self.runtime_config.DATA) + + @logit(logger) + def finalize(self): + """Method finalize for ocean recentering task + Parameters: + ------------ + None + Returns: + -------- + None + """ + + logger.info("finalize") + + RUN = self.runtime_config.RUN + cyc = self.runtime_config.cyc