-
Notifications
You must be signed in to change notification settings - Fork 168
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds jjob and other necessities for marine LETKF task (#2564)
Adds jjob, rocoto script, config file, and other necessities for new marine LETKF task. Partially addresses NOAA-EMC/GDASApp#1091
- Loading branch information
1 parent
2c50fbd
commit bb93005
Showing
8 changed files
with
224 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
#!/bin/bash | ||
source "${HOMEgfs}/ush/preamble.sh" | ||
source "${HOMEgfs}/ush/jjob_header.sh" -e "ocnanalletkf" -c "base ocnanal ocnanalletkf" | ||
|
||
############################################## | ||
# Set variables used in the script | ||
############################################## | ||
# Ignore possible spelling error (nothing is misspelled) | ||
# shellcheck disable=SC2153 | ||
GDATE=$(date --utc +%Y%m%d%H -d "${PDY} ${cyc} - ${assim_freq} hours") | ||
|
||
gPDY=${GDATE:0:8} | ||
gcyc=${GDATE:8:2} | ||
|
||
YMD=${gPDY} HH=${gcyc} declare_from_tmpl -rx \ | ||
COM_OCEAN_HISTORY_PREV:COM_OCEAN_HISTORY_TMPL \ | ||
COM_ICE_HISTORY_PREV:COM_ICE_HISTORY_TMPL | ||
|
||
############################################## | ||
# Begin JOB SPECIFIC work | ||
############################################## | ||
|
||
############################################################### | ||
# Run relevant script | ||
|
||
EXSCRIPT=${GDASOCNLETKFPY:-${HOMEgfs}/scripts/exgdas_global_marine_analysis_letkf.py} | ||
${EXSCRIPT} | ||
status=$? | ||
[[ ${status} -ne 0 ]] && exit "${status}" | ||
|
||
############################################## | ||
# End JOB SPECIFIC work | ||
############################################## | ||
|
||
############################################## | ||
# Final processing | ||
############################################## | ||
if [[ -e "${pgmout}" ]] ; then | ||
cat "${pgmout}" | ||
fi | ||
|
||
########################################## | ||
# Remove the Temporary working directory | ||
########################################## | ||
cd "${DATAROOT}" || exit 1 | ||
[[ "${KEEPDATA}" = "NO" ]] && rm -rf "${DATA}" | ||
|
||
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#! /usr/bin/env bash | ||
|
||
source "${HOMEgfs}/ush/preamble.sh" | ||
|
||
############################################################### | ||
# Source UFSDA workflow modules | ||
. "${HOMEgfs}/ush/load_ufsda_modules.sh" | ||
status=$? | ||
[[ ${status} -ne 0 ]] && exit "${status}" | ||
|
||
export job="ocnanalletkf" | ||
export jobid="${job}.$$" | ||
|
||
############################################################### | ||
# Setup Python path for GDASApp ush | ||
PYTHONPATH="${PYTHONPATH:+${PYTHONPATH}:}${HOMEgfs}/ush/python" | ||
export PYTHONPATH | ||
|
||
############################################################### | ||
# Execute the JJOB | ||
"${HOMEgfs}/jobs/JGDAS_GLOBAL_OCEAN_ANALYSIS_LETKF" | ||
status=$? | ||
exit "${status}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/bin/bash | ||
|
||
########## config.ocnanalletkf ########## | ||
# Ocn Analysis specific | ||
|
||
echo "BEGIN: config.ocnanalletkf" | ||
|
||
# Get task specific resources | ||
. "${EXPDIR}/config.resources" ocnanalletkf | ||
|
||
echo "END: config.ocnanalletkf" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/usr/bin/env python3 | ||
# exgdas_global_marine_analysis_letkf.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 | ||
from pygfs.task.marine_letkf 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 marine letkf task | ||
MarineLetkf = MarineLETKF(config) | ||
MarineLetkf.initialize() | ||
MarineLetkf.run() | ||
MarineLetkf.finalize() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
#!/usr/bin/env python3 | ||
|
||
from logging import getLogger | ||
from pygfs.task.analysis import Analysis | ||
from typing import Dict | ||
from wxflow import (chdir, | ||
logit, | ||
Task) | ||
|
||
logger = getLogger(__name__.split('.')[-1]) | ||
|
||
|
||
class MarineLETKF(Analysis): | ||
""" | ||
Class for global ocean and sea ice analysis LETKF task | ||
""" | ||
|
||
@logit(logger, name="MarineLETKF") | ||
def __init__(self, config: Dict) -> None: | ||
"""Constructor for ocean and sea ice LETKF 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 and sea ice LETKF task | ||
Parameters: | ||
------------ | ||
None | ||
Returns: | ||
-------- | ||
None | ||
""" | ||
|
||
logger.info("initialize") | ||
|
||
@logit(logger) | ||
def run(self): | ||
"""Method run for ocean and sea ice LETKF task | ||
Parameters: | ||
------------ | ||
None | ||
Returns: | ||
-------- | ||
None | ||
""" | ||
|
||
logger.info("run") | ||
|
||
chdir(self.runtime_config.DATA) | ||
|
||
@logit(logger) | ||
def finalize(self): | ||
"""Method finalize for ocean and sea ice LETKF task | ||
Parameters: | ||
------------ | ||
None | ||
Returns: | ||
-------- | ||
None | ||
""" | ||
|
||
logger.info("finalize") |