Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds jjob and other necessities for marine LETKF task #2564

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
bc0f7d3
inital commit of ocn letkf
AndrewEichmann-NOAA May 2, 2024
4cbc978
change recsources
AndrewEichmann-NOAA May 3, 2024
0591749
Merge branch 'develop' into feature/ocn-letkf
AndrewEichmann-NOAA May 3, 2024
faee5e5
tweaks
AndrewEichmann-NOAA May 6, 2024
c101002
Merge branch 'develop' into feature/ocn-letkf
AndrewEichmann-NOAA May 7, 2024
6cbf203
move from gdasapp
AndrewEichmann-NOAA May 7, 2024
20312fb
removing spurious refs to centering
AndrewEichmann-NOAA May 7, 2024
2f9ed0a
move from gdasapp
AndrewEichmann-NOAA May 7, 2024
1105ea4
Merge branch 'develop' into feature/ocn-letkf
AndrewEichmann-NOAA May 9, 2024
19a6901
review tweaks
AndrewEichmann-NOAA May 9, 2024
f5b4ba9
Update jobs/rocoto/ocnanalletkf.sh
AndrewEichmann-NOAA May 9, 2024
6d13137
Update jobs/rocoto/ocnanalletkf.sh
AndrewEichmann-NOAA May 9, 2024
7c5083b
Update jobs/JGDAS_GLOBAL_OCEAN_ANALYSIS_LETKF
AndrewEichmann-NOAA May 9, 2024
6551a5b
tweaks
AndrewEichmann-NOAA May 9, 2024
0cbef4b
Merge branch 'develop' into feature/ocn-letkf
AndrewEichmann-NOAA May 9, 2024
ade109a
swap in analysis class
AndrewEichmann-NOAA May 9, 2024
1220c0e
Merge branch 'develop' into feature/ocn-letkf
AndrewEichmann-NOAA May 10, 2024
0f1040c
Merge branch 'develop' into feature/ocn-letkf
AndrewEichmann-NOAA May 10, 2024
5fb0a68
comment changes
AndrewEichmann-NOAA May 10, 2024
44f914b
Merge branch 'feature/ocn-letkf' of github.com:AndrewEichmann-NOAA/gl…
AndrewEichmann-NOAA May 10, 2024
0bb9cdd
Merge branch 'develop' into feature/ocn-letkf
AndrewEichmann-NOAA May 13, 2024
903abc8
Merge branch 'develop' into feature/ocn-letkf
AndrewEichmann-NOAA May 14, 2024
4f20c8a
corrected comment
AndrewEichmann-NOAA May 15, 2024
f884622
Merge branch 'develop' into feature/ocn-letkf
AndrewEichmann-NOAA May 15, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions env/HERA.env
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,14 @@ elif [[ "${step}" = "ocnanalecen" ]]; then
[[ ${NTHREADS_OCNANALECEN} -gt ${nth_max} ]] && export NTHREADS_OCNANALECEN=${nth_max}
export APRUN_OCNANALECEN="${launcher} -n ${npe_ocnanalecen} --cpus-per-task=${NTHREADS_OCNANALECEN}"

elif [[ "${step}" = "ocnanalletkf" ]]; then

nth_max=$((npe_node_max / npe_node_ocnanalletkf))

export NTHREADS_OCNANALLETKF=${nth_ocnanalletkf:-${nth_max}}
[[ ${NTHREADS_OCNANALLETKF} -gt ${nth_max} ]] && export NTHREADS_OCNANALLETKF=${nth_max}
export APRUN_OCNANALLETKF="${launcher} -n ${npe_ocnanalletkf} --cpus-per-task=${NTHREADS_OCNANALLETKF}"

elif [[ "${step}" = "anal" ]] || [[ "${step}" = "analcalc" ]]; then

export MKL_NUM_THREADS=4
Expand Down
8 changes: 8 additions & 0 deletions env/ORION.env
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,14 @@ elif [[ "${step}" = "ocnanalecen" ]]; then
[[ ${NTHREADS_OCNANALECEN} -gt ${nth_max} ]] && export NTHREADS_OCNANALECEN=${nth_max}
export APRUN_OCNANALECEN="${launcher} -n ${npe_ocnanalecen} --cpus-per-task=${NTHREADS_OCNANALECEN}"

elif [[ "${step}" = "ocnanalletkf" ]]; then

nth_max=$((npe_node_max / npe_node_ocnanalletkf))

export NTHREADS_OCNANALLETKF=${nth_ocnanalletkf:-${nth_max}}
[[ ${NTHREADS_OCNANALLETKF} -gt ${nth_max} ]] && export NTHREADS_OCNANALLETKF=${nth_max}
export APRUN_OCNANALLETKF="${launcher} -n ${npe_ocnanalletkf} --cpus-per-task=${NTHREADS_OCNANALLETKF}"

elif [[ "${step}" = "anal" ]] || [[ "${step}" = "analcalc" ]]; then

export MKL_NUM_THREADS=4
Expand Down
48 changes: 48 additions & 0 deletions jobs/JGDAS_GLOBAL_OCEAN_ANALYSIS_LETKF
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#!/bin/bash
AndrewEichmann-NOAA marked this conversation as resolved.
Show resolved Hide resolved
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")
Fixed Show fixed Hide fixed

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
23 changes: 23 additions & 0 deletions jobs/rocoto/ocnanalletkf.sh
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}"
11 changes: 11 additions & 0 deletions parm/config/gfs/config.ocnanalletkf
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"
31 changes: 30 additions & 1 deletion parm/config/gfs/config.resources
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ if (( $# != 1 )); then
echo "waveinit waveprep wavepostsbs wavepostbndpnt wavepostbndpntbll wavepostpnt"
echo "wavegempak waveawipsbulls waveawipsgridded"
echo "postsnd awips gempak npoess"
echo "ocnanalprep prepoceanobs ocnanalbmat ocnanalrun ocnanalecen ocnanalchkpt ocnanalpost ocnanalvrfy"
echo "ocnanalprep prepoceanobs ocnanalbmat ocnanalrun ocnanalecen ocnanalletkf ocnanalchkpt ocnanalpost ocnanalvrfy"
exit 1

fi
Expand Down Expand Up @@ -456,6 +456,35 @@ case ${step} in
export memory_ocnanalecen
;;

"ocnanalletkf")
npes=16
case ${OCNRES} in
"025")
npes=480
memory_ocnanalletkf="96GB"
;;
"050")
npes=16
memory_ocnanalletkf="96GB"
;;
"500")
npes=16
memory_ocnanalletkf="24GB"
;;
*)
echo "FATAL ERROR: Resources not defined for job ${job} at resolution ${OCNRES}"
exit 4
esac

export wtime_ocnanalletkf="00:10:00"
export npe_ocnanalletkf=${npes}
export nth_ocnanalletkf=1
export is_exclusive=True
export npe_node_ocnanalletkf=$(( npe_node_max / nth_ocnanalletkf ))
export memory_ocnanalletkf
;;


"ocnanalchkpt")
export wtime_ocnanalchkpt="00:10:00"
export npe_ocnanalchkpt=1
Expand Down
24 changes: 24 additions & 0 deletions scripts/exgdas_global_marine_analysis_letkf.py
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()
72 changes: 72 additions & 0 deletions ush/python/pygfs/task/marine_letkf.py
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")
Loading