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 #7

Open
wants to merge 116 commits into
base: feature/anlstat
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 8 commits
Commits
Show all changes
116 commits
Select commit Hold shift + click to select a range
92626a7
add anlstat config file and update config.resources
kevindougherty-noaa Sep 12, 2024
5a881a7
Add python files that use new JEDI format
kevindougherty-noaa Sep 12, 2024
d575072
pycodestyle
kevindougherty-noaa Sep 12, 2024
1635908
update appropriate py file
kevindougherty-noaa Sep 12, 2024
dee996e
pycodestyle
kevindougherty-noaa Sep 12, 2024
2d7d6e4
add line to include anlstat
kevindougherty-noaa Sep 16, 2024
eb476e3
add most updated scripts for debugging
kevindougherty-noaa Oct 4, 2024
1cf5f7b
scripts updated to run copy successfully
kevindougherty-noaa Oct 8, 2024
4083728
add gunzip
kevindougherty-noaa Oct 8, 2024
e12b28b
update to fix shellnorms
kevindougherty-noaa Oct 8, 2024
52c7bfc
update to fix shellnorms pt. 2
kevindougherty-noaa Oct 8, 2024
ebfcf41
add ob space stat yaml and update Python script
kevindougherty-noaa Oct 16, 2024
ac83f07
update paths
kevindougherty-noaa Oct 17, 2024
1ebc6e5
pycodestyle
kevindougherty-noaa Oct 17, 2024
4dfbbb7
adding to keep track of paths
kevindougherty-noaa Oct 23, 2024
e79353f
Revert "adding to keep track of paths"
kevindougherty-noaa Oct 23, 2024
4d4a538
Merge branch 'develop' into feature/anlstat-kd-2
kevindougherty-noaa Oct 24, 2024
9644e99
Merge remote-tracking branch 'Davids-fork/feature/jcb-obsbias' into f…
kevindougherty-noaa Oct 24, 2024
7db0c4b
update all changes in sorc
kevindougherty-noaa Oct 24, 2024
b0c2216
Merge branch 'feature/anlstat' into feature/anlstat-kd-2
kevindougherty-noaa Oct 24, 2024
3b2c4e2
Quick updated to Jenkins (health check) launch script (#3033)
TerrenceMcGuinness-NOAA Oct 24, 2024
f710d0f
Fix to make sure bkg_list.yaml isn't loaded directly in marine JCB base
DavidNew-NOAA Oct 24, 2024
215188a
pynorms
DavidNew-NOAA Oct 24, 2024
cbf1c6f
pynorms
DavidNew-NOAA Oct 24, 2024
54223bf
pynorms
DavidNew-NOAA Oct 24, 2024
ec9e68a
Merge branch 'develop' into feature/jcb-obsbias
DavidNew-NOAA Oct 24, 2024
abdbe31
Update gdas hash
DavidNew-NOAA Oct 24, 2024
58737cb
CI update to shell environment with HOMEgfs to HOME_GFS for systems t…
TerrenceMcGuinness-NOAA Oct 24, 2024
cbe619c
Adding back accidentally deleted line
DavidNew-NOAA Oct 25, 2024
a43ab27
Merge branch 'develop' into feature/jcb-obsbias
DavidNew-NOAA Oct 25, 2024
39d0b8b
Add ability to add tag to pslots with generate_workflows (#3036)
WalterKolczynski-NOAA Oct 25, 2024
ced71a6
Merge branch 'develop' into feature/jcb-obsbias
DavidNew-NOAA Oct 25, 2024
2fdfaa5
Update gdas.cd (#2978)
guillaumevernieres Oct 26, 2024
b56f633
CI jekninsfile update hotfix (#3038)
TerrenceMcGuinness-NOAA Oct 28, 2024
064b4c1
Merge branch 'develop' into feature/jcb-obsbias
DavidNew-NOAA Oct 28, 2024
272bced
Update GDAS hash
DavidNew-NOAA Oct 28, 2024
00f567c
GitHub Actions Pipeline Updates for Self-Hosted Runners on PW (#3018)
TerrenceMcGuinness-NOAA Oct 29, 2024
e291ff1
Merge branch 'develop' into feature/jcb-obsbias
DavidNew-NOAA Oct 29, 2024
a3f9877
update scripts for new JEDI scripts
kevindougherty-noaa Oct 29, 2024
fc2c5ea
Disabling hyper-threading (#2965)
AntonMFernando-NOAA Oct 30, 2024
5bb3f86
Fix wave restarts and GEFS FHOUT/FHMAX (#3009)
WalterKolczynski-NOAA Oct 30, 2024
0b3304e
Add run and finalize methods to marine LETKF task (#2944)
AndrewEichmann-NOAA Oct 30, 2024
f4e380a
Update global jdas enkf diag job with COMIN/COMOUT for COM prefix (#2…
mingshichen-noaa Oct 30, 2024
1cc4078
Make wxflow links static instead of from link_workflow (#3008)
WalterKolczynski-NOAA Oct 31, 2024
5a8a5aa
Fix the name of the TC tracker filenames in archive.py (#3030)
DavidHuber-NOAA Oct 31, 2024
2444b72
Merge branch 'develop' into feature/jcb-obsbias
DavidNew-NOAA Oct 31, 2024
39915e4
Update gdas hash
DavidNew-NOAA Oct 31, 2024
ca8cd7a
Auto provisioning of PW clusters from GitHub CI added (#3051)
TerrenceMcGuinness-NOAA Oct 31, 2024
ef1c1e1
Move Jedi object initialization dictionaries into YAML files for AtmA…
DavidNew-NOAA Oct 31, 2024
5fa0ed1
Move marine bmat JEDI config to YAML file
DavidNew-NOAA Oct 31, 2024
5e8bd8e
pynorms
DavidNew-NOAA Oct 31, 2024
f4606bf
Merge branch 'develop' into feature/jcb-obsbias
DavidNew-NOAA Oct 31, 2024
6f311af
Minor change to retrigger GW CI
DavidNew-NOAA Oct 31, 2024
d95630a
Add more ocean variables for post-processing in GEFS (#2995)
EricSinsky-NOAA Nov 1, 2024
d7a58cc
Address Walter's comments
DavidNew-NOAA Nov 1, 2024
23e2fc2
Merge branch 'develop' into feature/jcb-obsbias
DavidNew-NOAA Nov 1, 2024
0b9ca3b
pynorms
DavidNew-NOAA Nov 1, 2024
1e6a40f
pynorms
DavidNew-NOAA Nov 1, 2024
874db59
Update gdas hash
DavidNew-NOAA Nov 1, 2024
5e867df
GitHub CI Pipeline update for debugging forked PR support (#3056)
TerrenceMcGuinness-NOAA Nov 1, 2024
19eca3f
Revert "GitHub CI Pipeline update for debugging forked PR support" (#…
KateFriedman-NOAA Nov 1, 2024
5bde649
PW CI pipeline update5 ready for review so it can be merged and teste…
TerrenceMcGuinness-NOAA Nov 1, 2024
75c3c67
Update workflow pipeline (#3060)
TerrenceMcGuinness-NOAA Nov 1, 2024
c667ffa
Update to action workflow pipeline in default repo for development (#…
TerrenceMcGuinness-NOAA Nov 1, 2024
152bb45
Update to action workflow pipeline in default repo for development (…
TerrenceMcGuinness-NOAA Nov 1, 2024
e179122
Update GDAS hash
DavidNew-NOAA Nov 3, 2024
2551081
Merge branch 'develop' into feature/jcb-obsbias
DavidNew-NOAA Nov 3, 2024
fbda568
Update gdas hash and revert accidentally changes gfs_utils hash
DavidNew-NOAA Nov 3, 2024
c18e2f2
Small, mostly asthetic changes
DavidNew-NOAA Nov 3, 2024
482f2f3
Address requested changes
DavidNew-NOAA Nov 6, 2024
e59e883
pynorms
DavidNew-NOAA Nov 6, 2024
d4227c0
Fix bug Russ found
DavidNew-NOAA Nov 6, 2024
7ac6ccb
Forgot a line
DavidNew-NOAA Nov 6, 2024
8781c44
Update ush/python/pygfs/jedi/jedi.py
DavidNew-NOAA Nov 6, 2024
227718c
Update ush/python/pygfs/jedi/jedi.py
DavidNew-NOAA Nov 6, 2024
c7f9d15
Log errors before raising exceptions
DavidNew-NOAA Nov 6, 2024
3d2b713
Make validation of JEDI class configuration dictionary more robust
DavidNew-NOAA Nov 6, 2024
f30d4d9
pynorms+
DavidNew-NOAA Nov 6, 2024
eb6744c
Fill in missing code for tar archive extraction
DavidNew-NOAA Nov 6, 2024
b35ec83
pynorms
DavidNew-NOAA Nov 6, 2024
727b615
updates for scripts that run
kevindougherty-noaa Nov 6, 2024
cfc8b90
Update GDAS hash
DavidNew-NOAA Nov 6, 2024
b03967d
Update gdas hash
DavidNew-NOAA Nov 6, 2024
8d2a913
Update gdas hash
DavidNew-NOAA Nov 6, 2024
62cba25
Forgot to remove old execute methods
DavidNew-NOAA Nov 6, 2024
dd6736f
Get rid of execute_vtscales method
DavidNew-NOAA Nov 6, 2024
a6fd65a
pynorms
DavidNew-NOAA Nov 6, 2024
81bbcf9
pynorms
kevindougherty-noaa Nov 7, 2024
1eb62f3
Update snow obs processing job (#3055)
jiaruidong2017 Nov 9, 2024
3f68397
Update JGDAS ENKF ECEN job (#3050)
mingshichen-noaa Nov 9, 2024
a1dcfdf
Merge branch 'develop' into feature/jcb-obsbias
DavidNew-NOAA Nov 12, 2024
e6df3b3
CI GitHub pipeline (hotfix) update for fetching repo name (#3084)
TerrenceMcGuinness-NOAA Nov 12, 2024
1872499
Remove RUNDIRS before running CI cases to cover re-run events (#3076)
TerrenceMcGuinness-NOAA Nov 13, 2024
c5aab41
Merge branch 'develop' into feature/jcb-obsbias
DavidNew-NOAA Nov 13, 2024
c2d6c7d
update scripts to new working g-w
kevindougherty-noaa Nov 13, 2024
3e78e58
Move machine-based options from config.base to host files (#3053)
DavidHuber-NOAA Nov 13, 2024
c1f521a
Merge branch 'develop' into feature/jcb-obsbias
RussTreadon-NOAA Nov 13, 2024
57c8aa3
SFS Runs at C96mx100 (#2960)
NeilBarton-NOAA Nov 13, 2024
ec92f00
Merge branch 'develop' into feature/jcb-obsbias
RussTreadon-NOAA Nov 14, 2024
8b87f15
Try to fix marineanlletkf
DavidNew-NOAA Nov 14, 2024
b6f0f98
updated sorc/gdas.cd hash
kevindougherty-noaa Nov 14, 2024
e2fec9f
merge develop
kevindougherty-noaa Nov 14, 2024
ca2ca8a
merge David's Jedi fork into mine
kevindougherty-noaa Nov 14, 2024
42904ba
Follow example of ORION.env for HERCULUS.env marineanlletkf
DavidNew-NOAA Nov 14, 2024
6bde6ac
Update JGDAS ENKF POST job (#3090)
mingshichen-noaa Nov 15, 2024
a9522f6
Fixed bug in orion resource allocation
DavidNew-NOAA Nov 15, 2024
7e6207f
Merge branch 'develop' into feature/jcb-obsbias
DavidNew-NOAA Nov 15, 2024
4a89bf4
Update APRUN commands in WCOSS2 env
DavidNew-NOAA Nov 15, 2024
408893c
Update
DavidNew-NOAA Nov 15, 2024
78c989c
update (#2)
DavidNew-NOAA Nov 15, 2024
4695fd7
Update gdas hash
DavidNew-NOAA Nov 15, 2024
bb6257b
Update gdas_fv3jedi_ver
RussTreadon-NOAA Nov 15, 2024
3209bea
Enable tapering of atm ens perts at the model top (#3097)
CatherineThomas-NOAA Nov 15, 2024
32534bb
Merge branch 'develop' into feature/jcb-obsbias
aerorahul Nov 15, 2024
040d0f0
update gdas.cd and merge David's fork
kevindougherty-noaa Nov 18, 2024
ce14a79
add updated scripts for new jedi class changes
kevindougherty-noaa Nov 19, 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: 7 additions & 1 deletion jobs/JGLOBAL_ANALYSIS_STATS
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,18 @@
##############################################
# Set variables used in the script
##############################################

# shellcheck disable=SC2153
GDATE=$(date --utc +%Y%m%d%H -d "${PDY} ${cyc} - ${assim_freq} hours")
gPDY=${GDATE:0:8}
Fixed Show fixed Hide fixed
gcyc=${GDATE:8:2}
Fixed Show fixed Hide fixed
GDUMP="gdas"
Fixed Show fixed Hide fixed

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

# Generate COM variables from templates
YMD=${PDY} HH=${cyc} declare_from_tmpl -rx COM_OBS COM_CHEM_ANALYSIS

###############################################################
# Run relevant script
Expand Down
13 changes: 13 additions & 0 deletions parm/config/gfs/config.anlstat
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash -x

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

echo "BEGIN: config.anlstat"

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

export JEDIEXE=${HOMEgfs}/sorc/gdas.cd/build/bin/ioda-stats.x

echo "END: config.anlstat"
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 esnowrecen"
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 @@ -707,6 +707,14 @@ case ${step} in
memory="48GB"
;;

"anlstat")
walltime="00:30:00"
ntasks=1
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
19 changes: 13 additions & 6 deletions scripts/exglobal_analysis_stats.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
#!/usr/bin/env python3
# exglobal_analysis_stats.py
# This script will run the OOPS/JEDI code to

# exglobal_stat_analysis.py
# This script creates an StatAnalysis class
# and runs the initialize method
# which create and stage the runtime directory
# and create the YAML configuration
# for a global stat analysis
import os

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

# Initialize root logger
logger = Logger(level='DEBUG', colored_log=True)
Expand All @@ -16,5 +19,9 @@
# Take configuration from environment and cast it as python dictionary
config = cast_strdict_as_dtypedict(os.environ)

# placeholder
print('Do nothing right now!')
# Instantiate the atm analysis task
StatAnl = StatAnalysis(config, 'statanlvar')

# Initialize JEDI variational analysis
StatAnl.initialize_jedi()
StatAnl.initialize_analysis()
1 change: 1 addition & 0 deletions sorc/link_workflow.sh
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,7 @@ if [[ -d "${HOMEgfs}/sorc/gdas.cd/build" ]]; then
"gdas_socahybridweights.x" \
"gdasapp_land_ensrecenter.x" \
"bufr2ioda.x" \
"ioda-stats.x" \
"calcfIMS.exe" \
"apply_incr.exe" )
for gdasexe in "${JEDI_EXE[@]}"; do
Expand Down
133 changes: 133 additions & 0 deletions ush/python/pygfs/task/stat_analysis.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
#!/usr/bin/env python3

import os
import glob
import gzip
import tarfile
from logging import getLogger
from pprint import pformat
from typing import Optional, Dict, Any

from wxflow import (AttrDict,
FileHandler,
add_to_datetime, to_fv3time, to_timedelta, to_YMDH,
Task,
parse_j2yaml, save_as_yaml,
logit)
from pygfs.jedi import Jedi

logger = getLogger(__name__.split('.')[-1])


class StatAnalysis(Task):
"""
Class for JEDI-based global stat analysis tasks
"""
@logit(logger, name="StatAnalysis")
def __init__(self, config: Dict[str, Any], yaml_name: Optional[str] = None):
"""
Constructor global stat analysis task

This method will construct a global stat analysis task.
This includes:
- extending the task_config attribute AttrDict to include parameters required for this task
- instantiate the Jedi attribute object

Parameters
----------
config: Dict
dictionary object containing task configuration
yaml_name: str, optional
name of YAML file for JEDI configuration

Returns
----------
None
"""
super().__init__(config)

_res = int(self.task_config.CASE[1:])
# _res_anl = int(self.task_config.CASE_ANL[1:])
_window_begin = add_to_datetime(self.task_config.current_cycle, -to_timedelta(f"{self.task_config.assim_freq}H") / 2)
print(_window_begin)

# Create a local dictionary that is repeatedly used across this class
local_dict = AttrDict(
{
'npx_ges': _res + 1,
'npy_ges': _res + 1,
'npz_ges': self.task_config.LEVS - 1,
'npz': self.task_config.LEVS - 1,
#'npx_anl': _res_anl + 1,
#'npy_anl': _res_anl + 1,
'npz_anl': self.task_config.LEVS - 1,
'ATM_WINDOW_BEGIN': _window_begin,
'ATM_WINDOW_LENGTH': f"PT{self.task_config.assim_freq}H",
'OPREFIX': f"{self.task_config.RUN}.t{self.task_config.cyc:02d}z.",
'APREFIX': f"{self.task_config.RUN}.t{self.task_config.cyc:02d}z.",
'GPREFIX': f"gdas.t{self.task_config.previous_cycle.hour:02d}z."
}
)

# Extend task_config with local_dict
self.task_config = AttrDict(**self.task_config, **local_dict)

# Create JEDI object
self.jedi = Jedi(self.task_config, yaml_name)

@logit(logger)
def initialize_jedi(self):
"""Initialize JEDI application

This method will initialize a JEDI application used in the global stat analysis.
This includes:
- generating and saving JEDI YAML config
- linking the JEDI executable

Parameters
----------
None

Returns
----------
None
"""

# get JEDI-to-FV3 increment converter config and save to YAML file
logger.info(f"Generating JEDI YAML config: {self.jedi.yaml}")
self.jedi.set_config(self.task_config)
logger.debug(f"JEDI config:\n{pformat(self.jedi.config)}")

# save JEDI config to YAML file
logger.debug(f"Writing JEDI YAML config to: {self.jedi.yaml}")
save_as_yaml(self.jedi.config, self.jedi.yaml)

# link JEDI executable
logger.info(f"Linking JEDI executable {self.task_config.JEDIEXE} to {self.jedi.exe}")
self.jedi.link_exe(self.task_config)

@logit(logger)
def initialize_analysis(self) -> None:
"""
Initialize a global stat analysis

This method will initialize a global stat analysis.
This includes:
- copying stat files

Parameters
----------
None

Returns
----------
None
"""
super().initialize()

logger.info(f"Copying files to {self.task_config.DATA}/stats")

aerostat = os.path.join(self.task_config.COM_CHEM_ANALYSIS, f"{self.task_config['APREFIX']}aerostat")
dest = os.path.join(self.task_config.DATA, "stats")
statlist = [[aerostat, dest]]
FileHandler({'copy': statlist}).sync()
1 change: 1 addition & 0 deletions workflow/applications/applications.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ def __init__(self, conf: Configuration) -> None:
self.do_verfozn = base.get('DO_VERFOZN', True)
self.do_verfrad = base.get('DO_VERFRAD', True)
self.do_vminmon = base.get('DO_VMINMON', True)
self.do_anlstat = base.get('DO_ANLSTAT', True)
self.do_tracker = base.get('DO_TRACKER', True)
self.do_genesis = base.get('DO_GENESIS', True)
self.do_genesis_fsu = base.get('DO_GENESIS_FSU', False)
Expand Down
Loading