Skip to content

Commit

Permalink
Create JEDI class (NOAA-EMC#2805)
Browse files Browse the repository at this point in the history
This PR creates a PyGFS class called JEDI, which is to be instantiated
everytime a JEDI application is run. The AtmAnalysis and AtmEnsAnalysis
classes are no longer children of the Analysis class, but rather direct
children of the Task class. They each have a JEDI object as an
attribute, which is used to run either the variational/ensemble DA JEDI
applications or the FV3 increment converter JEDI application, depending
on which job they are created for (e.g. atmanlvar vs. atmanlfv3inc). The
intention is that a later PR will apply this framework to all analysis
task, and the PyGFS Analysis class will be removed.
  • Loading branch information
DavidNew-NOAA committed Sep 7, 2024
1 parent b8080cd commit 49f697a
Show file tree
Hide file tree
Showing 20 changed files with 602 additions and 286 deletions.
8 changes: 5 additions & 3 deletions parm/archive/enkf.yaml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,14 @@ enkf:
"radstat.ensmean"] %}
{% else %}
{% if lobsdiag_forenkf %}
{% set da_files = ["atmens_observer.yaml",
"atmens_solver.yaml",
{% set da_files = ["atmensanlobs.yaml",
"atmensanlsol.yaml",
"atmensanlfv3inc.yaml",
"atminc.ensmean.nc",
"atmensstat"] %}
{% else %}
{% set da_files = ["atmens.yaml",
{% set da_files = ["atmensanlletkf.yaml",
"atmensanlfv3inc.yaml",
"atminc.ensmean.nc",
"atmensstat"] %}
{% endif %}
Expand Down
3 changes: 2 additions & 1 deletion parm/archive/gdas.yaml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ gdas:

# Analysis state
{% if DO_JEDIATMVAR %}
- "{{ COMIN_ATMOS_ANALYSIS | relpath(ROTDIR) }}/{{ head }}atmvar.yaml"
- "{{ COMIN_ATMOS_ANALYSIS | relpath(ROTDIR) }}/{{ head }}atmanlvar.yaml"
- "{{ COMIN_ATMOS_ANALYSIS | relpath(ROTDIR) }}/{{ head }}atmanlfv3inc.yaml"
- "{{ COMIN_ATMOS_ANALYSIS | relpath(ROTDIR) }}/{{ head }}atmstat"
{% else %}
- "{{ COMIN_ATMOS_ANALYSIS | relpath(ROTDIR) }}/{{ head }}gsistat"
Expand Down
3 changes: 2 additions & 1 deletion parm/archive/gfsa.yaml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ gfsa:

# State data
{% if DO_JEDIATMVAR %}
- "{{ COMIN_ATMOS_ANALYSIS | relpath(ROTDIR) }}/{{ head }}atmvar.yaml"
- "{{ COMIN_ATMOS_ANALYSIS | relpath(ROTDIR) }}/{{ head }}atmanlvar.yaml"
- "{{ COMIN_ATMOS_ANALYSIS | relpath(ROTDIR) }}/{{ head }}atmanlfv3inc.yaml"
- "{{ COMIN_ATMOS_ANALYSIS | relpath(ROTDIR) }}/{{ head }}atmstat"
{% else %}
- "{{ COMIN_ATMOS_ANALYSIS | relpath(ROTDIR) }}/{{ head }}gsistat"
Expand Down
6 changes: 5 additions & 1 deletion parm/config/gfs/config.atmensanl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@
echo "BEGIN: config.atmensanl"

export JCB_BASE_YAML="${PARMgfs}/gdas/atm/jcb-base.yaml.j2"
export JCB_ALGO_YAML=@JCB_ALGO_YAML@
if [[ ${lobsdiag_forenkf} = ".false." ]] ; then
export JCB_ALGO_YAML=@JCB_ALGO_YAML_LETKF@
else
export JCB_ALGO_YAML=@JCB_ALGO_YAML_OBS@
fi

export INTERP_METHOD='barycentric'

Expand Down
3 changes: 2 additions & 1 deletion parm/config/gfs/yaml/defaults.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ atmanl:
IO_LAYOUT_Y: 1

atmensanl:
JCB_ALGO_YAML: "${PARMgfs}/gdas/atm/jcb-prototype_lgetkf.yaml.j2"
JCB_ALGO_YAML_LETKF: "${PARMgfs}/gdas/atm/jcb-prototype_lgetkf.yaml.j2"
JCB_ALGO_YAML_OBS: "${PARMgfs}/gdas/atm/jcb-prototype_lgetkf_observer.yaml.j2"
LAYOUT_X_ATMENSANL: 8
LAYOUT_Y_ATMENSANL: 8
IO_LAYOUT_X: 1
Expand Down
2 changes: 2 additions & 0 deletions scripts/exglobal_atm_analysis_finalize.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,6 @@

# Instantiate the atm analysis task
AtmAnl = AtmAnalysis(config)

# Finalize JEDI variational analysis
AtmAnl.finalize()
12 changes: 7 additions & 5 deletions scripts/exglobal_atm_analysis_fv3_increment.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python3
# exglobal_atm_analysis_fv3_increment.py
# This script creates an AtmAnalysis object
# and runs the init_fv3_increment and fv3_increment methods
# and runs the initialize_fv3inc and execute methods
# which convert the JEDI increment into an FV3 increment
import os

Expand All @@ -17,7 +17,9 @@
# Take configuration from environment and cast it as python dictionary
config = cast_strdict_as_dtypedict(os.environ)

# Instantiate the atm analysis task
AtmAnl = AtmAnalysis(config)
AtmAnl.init_fv3_increment()
AtmAnl.fv3_increment()
# Instantiate the atm analysis object
AtmAnl = AtmAnalysis(config, 'atmanlfv3inc')

# Initialize and execute FV3 increment converter
AtmAnl.initialize_jedi()
AtmAnl.execute(config.APRUN_ATMANLFV3INC)
7 changes: 5 additions & 2 deletions scripts/exglobal_atm_analysis_initialize.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,8 @@
config = cast_strdict_as_dtypedict(os.environ)

# Instantiate the atm analysis task
AtmAnl = AtmAnalysis(config)
AtmAnl.initialize()
AtmAnl = AtmAnalysis(config, 'atmanlvar')

# Initialize JEDI variational analysis
AtmAnl.initialize_jedi()
AtmAnl.initialize_analysis()
6 changes: 4 additions & 2 deletions scripts/exglobal_atm_analysis_variational.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,7 @@
config = cast_strdict_as_dtypedict(os.environ)

# Instantiate the atm analysis task
AtmAnl = AtmAnalysis(config)
AtmAnl.variational()
AtmAnl = AtmAnalysis(config, 'atmanlvar')

# Execute JEDI variational analysis
AtmAnl.execute(config.APRUN_ATMANLVAR, ['fv3jedi', 'variational'])
2 changes: 2 additions & 0 deletions scripts/exglobal_atmens_analysis_finalize.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,6 @@

# Instantiate the atmens analysis task
AtmEnsAnl = AtmEnsAnalysis(config)

# Finalize ensemble DA analysis
AtmEnsAnl.finalize()
12 changes: 7 additions & 5 deletions scripts/exglobal_atmens_analysis_fv3_increment.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python3
# exglobal_atmens_analysis_fv3_increment.py
# This script creates an AtmEnsAnalysis object
# and runs the init_fv3_increment and fv3_increment methods
# and runs the initialize_fv3inc and execute methods
# which convert the JEDI increment into an FV3 increment
import os

Expand All @@ -17,7 +17,9 @@
# Take configuration from environment and cast it as python dictionary
config = cast_strdict_as_dtypedict(os.environ)

# Instantiate the atmens analysis task
AtmEnsAnl = AtmEnsAnalysis(config)
AtmEnsAnl.init_fv3_increment()
AtmEnsAnl.fv3_increment()
# Instantiate the atmens analysis object
AtmEnsAnl = AtmEnsAnalysis(config, 'atmensanlfv3inc')

# Initialize and execute JEDI FV3 increment converter
AtmEnsAnl.initialize_jedi()
AtmEnsAnl.execute(config.APRUN_ATMENSANLFV3INC)
10 changes: 8 additions & 2 deletions scripts/exglobal_atmens_analysis_initialize.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,11 @@
config = cast_strdict_as_dtypedict(os.environ)

# Instantiate the atmens analysis task
AtmEnsAnl = AtmEnsAnalysis(config)
AtmEnsAnl.initialize()
if not config.lobsdiag_forenkf:
AtmEnsAnl = AtmEnsAnalysis(config, 'atmensanlletkf')
else:
AtmEnsAnl = AtmEnsAnalysis(config, 'atmensanlobs')

# Initialize JEDI ensemble DA analysis
AtmEnsAnl.initialize_jedi()
AtmEnsAnl.initialize_analysis()
10 changes: 6 additions & 4 deletions scripts/exglobal_atmens_analysis_letkf.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/usr/bin/env python3
# exglobal_atmens_analysis_letkf.py
# This script creates an AtmEnsAnalysis object
# and runs the letkf method
# which executes the global atm local ensemble analysis
# and runs the execute method which executes
# the global atm local ensemble analysis
import os

from wxflow import Logger, cast_strdict_as_dtypedict
Expand All @@ -18,5 +18,7 @@
config = cast_strdict_as_dtypedict(os.environ)

# Instantiate the atmens analysis task
AtmEnsAnl = AtmEnsAnalysis(config)
AtmEnsAnl.letkf()
AtmEnsAnl = AtmEnsAnalysis(config, 'atmensanlletkf')

# Execute the JEDI ensemble DA analysis
AtmEnsAnl.execute(config.APRUN_ATMENSANLLETKF, ['fv3jedi', 'localensembleda'])
7 changes: 4 additions & 3 deletions scripts/exglobal_atmens_analysis_obs.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
config = cast_strdict_as_dtypedict(os.environ)

# Instantiate the atmens analysis task
AtmEnsAnl = AtmEnsAnalysis(config)
AtmEnsAnl.init_observer()
AtmEnsAnl.observe()
AtmEnsAnl = AtmEnsAnalysis(config, 'atmensanlobs')

# Initialize and execute JEDI ensembler DA analysis in observer mode
AtmEnsAnl.execute(config.APRUN_ATMENSANLOBS, ['fv3jedi', 'localensembleda'])
8 changes: 5 additions & 3 deletions scripts/exglobal_atmens_analysis_sol.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
config = cast_strdict_as_dtypedict(os.environ)

# Instantiate the atmens analysis task
AtmEnsAnl = AtmEnsAnalysis(config)
AtmEnsAnl.init_solver()
AtmEnsAnl.solve()
AtmEnsAnl = AtmEnsAnalysis(config, 'atmensanlsol')

# Initialize and execute JEDI ensemble DA analysis in solver mode
AtmEnsAnl.initialize_jedi()
AtmEnsAnl.execute(config.APRUN_ATMENSANLSOL, ['fv3jedi', 'localensembleda'])
1 change: 1 addition & 0 deletions ush/python/pygfs/jedi/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from .jedi import Jedi
Loading

0 comments on commit 49f697a

Please sign in to comment.