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

Stat Analysis Implementation for global-workflow #8

Open
wants to merge 47 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 39 commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
c7fa90a
Update and add scripts for analysis stats capabilities
kevindougherty-noaa Nov 20, 2024
b154521
pynorms
kevindougherty-noaa Nov 20, 2024
e3d015a
pynorms
kevindougherty-noaa Nov 20, 2024
f745d3d
update missed files
kevindougherty-noaa Nov 21, 2024
c04eb6a
update task names to include underscores
kevindougherty-noaa Nov 26, 2024
cccd670
solved issue of job not running, files in wrong directory
kevindougherty-noaa Nov 26, 2024
cfb9f25
update to include execute and finalize
kevindougherty-noaa Nov 26, 2024
899b20b
updated scripts to that run successfully
kevindougherty-noaa Dec 12, 2024
164f7e4
Merge branch 'develop' into feature/stat-analysis
kevindougherty-noaa Dec 12, 2024
3d09d46
merge develop
kevindougherty-noaa Dec 16, 2024
452aff0
Merge branch 'develop' into HEAD
kevindougherty-noaa Dec 16, 2024
840153a
update files
kevindougherty-noaa Dec 16, 2024
ae48429
fix merge conflicts
kevindougherty-noaa Dec 16, 2024
ba89a3f
Revert "updated scripts to that run successfully"
kevindougherty-noaa Dec 16, 2024
5b8e7b1
updated scripts to that run successfully
kevindougherty-noaa Dec 12, 2024
6bcd080
reverting commits that were causing issues
kevindougherty-noaa Dec 16, 2024
76e60b1
fix descrepancies with workflow/applications files
kevindougherty-noaa Dec 16, 2024
332cede
pycodestyle
kevindougherty-noaa Dec 16, 2024
74c7888
pynorms
kevindougherty-noaa Dec 16, 2024
6687c41
add snow jcb-base yaml
kevindougherty-noaa Dec 17, 2024
cb4a703
update aero jcb-base yaml to no longer include variables
kevindougherty-noaa Dec 18, 2024
d0a7a3d
small bug fixes
kevindougherty-noaa Dec 20, 2024
e1209dd
merge develop
kevindougherty-noaa Dec 20, 2024
254ccc9
merge develop
kevindougherty-noaa Jan 8, 2025
0c1ba04
update gfs_cycled.py
kevindougherty-noaa Jan 8, 2025
bec7451
update applications.py
kevindougherty-noaa Jan 8, 2025
3e50690
update gfs_cycled.py correctly
kevindougherty-noaa Jan 8, 2025
fff3e76
update workflow tasks correctly
kevindougherty-noaa Jan 8, 2025
32b8a7a
update gfs tasks
kevindougherty-noaa Jan 13, 2025
9fe7e20
updates to python scripts to handle snow ob spaces
kevindougherty-noaa Jan 27, 2025
1454c0f
fix pycodestyle issues
kevindougherty-noaa Jan 27, 2025
e05e241
Update jobs/JGLOBAL_ANALYSIS_STATS
kevindougherty-noaa Jan 28, 2025
6cfcc48
Update scripts/exglobal_analysis_stats.py
kevindougherty-noaa Jan 28, 2025
7d4b161
Update scripts/exglobal_analysis_stats.py
kevindougherty-noaa Jan 28, 2025
388c58b
basic updated suggestions i.e. variable changes, EOL, etc.
kevindougherty-noaa Jan 28, 2025
74974a9
Merge branch 'feature/stat-analysis' of https://github.com/CoryMartin…
kevindougherty-noaa Jan 28, 2025
4055c99
added checks to python scripts. fixed formatting of job
kevindougherty-noaa Jan 29, 2025
f8f6a7b
update to utilize config file in driver python script
kevindougherty-noaa Feb 14, 2025
b53a9d8
pycodestyle
kevindougherty-noaa Feb 14, 2025
69e06b8
Merge branch 'develop' into feature/stat-analysis
kevindougherty-noaa Feb 14, 2025
f75140c
remove STAT_OUTDIR from shell, need to still do it in py
CoryMartin-NOAA Feb 14, 2025
0676314
use different names for the output directory
CoryMartin-NOAA Feb 14, 2025
d8994cd
a todo note
CoryMartin-NOAA Feb 14, 2025
e1f04f3
minor change and add outdir check
kevindougherty-noaa Feb 19, 2025
3082f41
Merge branch 'develop' into feature/stat-analysis
kevindougherty-noaa Feb 20, 2025
eb6cb96
Merge branch 'develop' into feature/stat-analysis
kevindougherty-noaa Feb 20, 2025
54c6946
minor updates with name changes and new aero tar file
kevindougherty-noaa Feb 25, 2025
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
5 changes: 5 additions & 0 deletions env/HERA.env
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,11 @@ elif [[ "${step}" = "atmanlfv3inc" ]]; then
export NTHREADS_ATMANLFV3INC=${NTHREADSmax}
export APRUN_ATMANLFV3INC="${APRUN_default} --cpus-per-task=${NTHREADS_ATMANLFV3INC}"

elif [[ "${step}" = "anlstat" ]]; then
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we will need similar entries for the other machines when this goes into a PR, not just HERA

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kevindougherty-noaa we need FOO.env files for each supported machine (GAEA, HERCULES, ORION, WCOSS2) not just HERA


export NTHREADS_ANLSTAT=${NTHREADSmax}
export APRUN_ANLSTAT="${APRUN_default} --cpus-per-task=${NTHREADS_ANLSTAT}"

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

export NTHREADS_PREPOBSAERO=${NTHREADS1}
Expand Down
42 changes: 42 additions & 0 deletions jobs/JGLOBAL_ANALYSIS_STATS
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#! /usr/bin/env bash

source "${HOMEgfs}/ush/preamble.sh"
source "${HOMEgfs}/ush/jjob_header.sh" -e "anlstat" -c "base anlstat"

##############################################
# Set variables used in the script
##############################################


##############################################
# Begin JOB SPECIFIC work
##############################################

# Generate COM variables from templates
YMD=${PDY} HH=${cyc} declare_from_tmpl -rx COMIN_OBS:COM_OBS_TMPL \
COMOUT_CONF:COM_CONF_TMPL \
COMIN_ATMOS_ANALYSIS:COM_ATMOS_ANALYSIS_TMPL \
COMIN_OCEAN_ANALYSIS:COM_OCEAN_ANALYSIS_TMPL \
COMIN_CHEM_ANALYSIS:COM_CHEM_ANALYSIS_TMPL \
COMIN_SNOW_ANALYSIS:COM_SNOW_ANALYSIS_TMPL
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to double check to make sure these work.


###############################################################
# Run relevant script

EXSCRIPT=${ANLSTATSPY:-${SCRgfs}/exglobal_analysis_stats.py}
${EXSCRIPT}
status=$?
[[ ${status} -ne 0 ]] && exit "${status}"

##############################################
# End JOB SPECIFIC work
##############################################

##############################################
# Final processing
##############################################
if [[ -e "${pgmout}" ]] ; then
cat "${pgmout}"
fi

exit 0
18 changes: 18 additions & 0 deletions jobs/rocoto/anlstat.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#! /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="anlstat"
export jobid="${job}.$$"

###############################################################
# Execute the JJOB
"${HOMEgfs}/jobs/JGLOBAL_ANALYSIS_STATS"
status=$?
exit "${status}"
18 changes: 18 additions & 0 deletions parm/config/gfs/config.anlstat
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash -x

########## config.anlstat ##########
# Analysis Stat

echo "BEGIN: config.anlstat"

# Get task specific resources
source "${EXPDIR}/config.resources" anlstat

export JEDI_CONFIG_YAML="${PARMgfs}/gdas/anlstat_jedi_config.yaml.j2"
export STAT_BASE_CONFIG_YAML="${PARMgfs}/config/gfs/yaml/stat_base_config.yaml.j2"
export JCB_BASE_YAML="${PARMgfs}/gdas/stat/aero/jcb-base.yaml.j2"
export JCB_ALGO_YAML="${PARMgfs}/gdas/jcb-algorithms/anlstat.yaml.j2"
export JEDIEXE=${HOMEgfs}/sorc/gdas.cd/build/bin/ioda-stats.x
export STAT_OUTDIR="${COMOUT}/${net}/${run.yyyymmdd}/${hh}/products/stats/"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this gets replaced by COMOUT_ATMOS_ANALYSIS_STATS etc. or something similar


echo "END: config.anlstat"
8 changes: 8 additions & 0 deletions parm/config/gfs/config.base
Original file line number Diff line number Diff line change
Expand Up @@ -495,6 +495,14 @@ if [[ ${DO_JEDIATMVAR} = "YES" ]]; then
export DO_VERFOZN="NO" # Ozone data assimilation monitoring
export DO_VERFRAD="NO" # Radiance data assimilation monitoring
export DO_VMINMON="NO" # GSI minimization monitoring
export DO_ANLSTAT="YES" # JEDI-based analysis statistics
else
export DO_VERFOZN="YES" # Ozone data assimilation monitoring
export DO_VERFRAD="YES" # Radiance data assimilation monitoring
export DO_VMINMON="YES" # GSI minimization monitoring
if [[ ${DO_AERO} = "YES" || ${DO_JEDIOCNVAR} = "YES" || ${DO_JEDISNOWDA} = "YES " ]]; then
export DO_ANLSTAT="YES" # JEDI-based analysis statistics
fi
fi

# If starting ICs that are not at cycle hour
Expand Down
10 changes: 9 additions & 1 deletion parm/config/gfs/config.resources
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ if (( $# != 1 )); then
echo "atmensanlinit atmensanlobs atmensanlsol atmensanlletkf atmensanlfv3inc atmensanlfinal"
echo "snowanl esnowanl"
echo "prepobsaero aeroanlinit aeroanlvar aeroanlfinal aeroanlgenb"
echo "anal sfcanl analcalc analdiag fcst echgres"
echo "anal sfcanl analcalc analdiag anlstat fcst echgres"
echo "upp atmos_products"
echo "tracker genesis genesis_fsu"
echo "verfozn verfrad vminmon fit2obs metp arch cleanup"
Expand Down Expand Up @@ -717,6 +717,14 @@ case ${step} in
memory="48GB"
;;

"anlstat")
walltime="00:30:00"
ntasks=1
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

noting here I need to parallelize this

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

threads_per_task=1
tasks_per_node=$(( max_tasks_per_node / threads_per_task ))
memory="24GB"
;;

"sfcanl")
walltime="00:20:00"
ntasks=${ntiles:-6}
Expand Down
14 changes: 14 additions & 0 deletions parm/config/gfs/yaml/stat_base_config.yaml.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
aero:
ob spaces:
- name: viirs_npp
input file: "diag_viirs_npp_{{ current_cycle | to_YMDH }}.nc4"
output file: "viirs_npp_{{ current_cycle | to_YMDH }}_output_aod.nc"
- name: viirs_n20
input file: "diag_viirs_n20_{{ current_cycle | to_YMDH }}.nc4"
output file: "viirs_n20_{{ current_cycle | to_YMDH }}_output_aod.nc"

snow:
ob spaces:
- name: ims_snow
input file: "diag_ims_snow_{{ current_cycle | to_YMDH }}.nc"
output file: "ims_snow_{{ current_cycle | to_YMDH }}_output_snow.nc"
22 changes: 22 additions & 0 deletions parm/gdas/anlstat_jedi_config.yaml.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
aero:
rundir: '{{ DATA }}'
exe_src: '{{ JEDIEXE }}'
mpi_cmd: '{{ APRUN_ANLSTAT }}'
stat_file_path: '{{ COMIN_CHEM_ANALYSIS }}'
stat_file_name: 'aerostat'
# jedi_args: None
jcb_base_yaml: '{{ PARMgfs }}/gdas/stat/aero/jcb-base.yaml.j2'
jcb_algo_yaml: '{{ JCB_ALGO_YAML }}'
jcb_algo: 'anlstat'
base_config: '{{ STAT_BASE_CONFIG_YAML }}'
snow:
rundir: '{{ DATA }}'
exe_src: '{{ JEDIEXE }}'
mpi_cmd: '{{ APRUN_ANLSTAT }}'
stat_file_path: '{{ COMIN_SNOW_ANALYSIS }}'
stat_file_name: 'snowstat.tgz'
# jedi_args: None
jcb_base_yaml: '{{ PARMgfs }}/gdas/stat/snow/jcb-base.yaml.j2'
jcb_algo_yaml: '{{ JCB_ALGO_YAML }}'
jcb_algo: 'anlstat'
base_config: '{{ STAT_BASE_CONFIG_YAML }}'
22 changes: 22 additions & 0 deletions parm/gdas/stat/aero/jcb-base.yaml.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Search path for model and obs for JCB
# -------------------------------------
algorithm_path: "{{PARMgfs}}/gdas/jcb-algorithms"
app_path_algorithm: "{{PARMgfs}}/gdas/jcb-gdas/algorithm/obstats/aero"

# Assimilation window
# -------------------
window_begin: "{{ STAT_WINDOW_BEGIN | to_isotime }}"
window_YMDH: "{{ STAT_WINDOW_BEGIN | to_YMDH }}"
window_length: "{{ STAT_WINDOW_LENGTH }}"
bound_to_include: begin

stat_current_cycle_iso: "{{ current_cycle | to_isotime }}"
stat_current_cycle_YMDH: "{{ current_cycle | to_YMDH }}"

# Inputted list of ob spaces
# --------------------------
obspaces: {{ OBSPACES_LIST }}

# Obspace variable things
# -----------------------
aero_obsdatain_path: "{{ DATA }}"
22 changes: 22 additions & 0 deletions parm/gdas/stat/snow/jcb-base.yaml.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Search path for model and obs for JCB
# -------------------------------------
algorithm_path: "{{PARMgfs}}/gdas/jcb-algorithms"
app_path_algorithm: "{{PARMgfs}}/gdas/jcb-gdas/algorithm/obstats/snow"

# Assimilation window
# -------------------
window_begin: "{{ STAT_WINDOW_BEGIN | to_isotime }}"
window_YMDH: "{{ STAT_WINDOW_BEGIN | to_YMDH }}"
window_length: "{{ STAT_WINDOW_LENGTH }}"
bound_to_include: begin

stat_current_cycle_iso: "{{ current_cycle | to_isotime }}"
stat_current_cycle_YMDH: "{{ current_cycle | to_YMDH }}"

# Inputted list of ob spaces
# --------------------------
obspaces: {{ OBSPACES_LIST }}

# Obspace variable things
# -----------------------
snow_obsdatain_path: "{{ DATA }}"
37 changes: 37 additions & 0 deletions scripts/exglobal_analysis_stats.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/usr/bin/env python3

# exglobal_stat_analysis.py
# This script creates a StatAnalysis class
# and runs the initialize, execute, and finalize
# methods which create and stage the runtime directory
# and create the YAML configuration
# to produce summary statistics from the analysis
import os

from wxflow import Logger, cast_strdict_as_dtypedict
from pygfs.task.stat_analysis import StatAnalysis

# 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 atm analysis task
StatAnl = StatAnalysis(config)

# Create list based on DA components
StatAnl.task_config['STAT_ANALYSES'] = []
if StatAnl.task_config.DO_AERO:
StatAnl.task_config['STAT_ANALYSES'].append('aero')
if StatAnl.task_config.DO_JEDISNOWDA:
StatAnl.task_config['STAT_ANALYSES'].append('snow')

# Initialize JEDI variational analysis
StatAnl.initialize()
for anl in StatAnl.task_config.STAT_ANALYSES:
StatAnl.execute(anl)
StatAnl.finalize(anl)
Loading