Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ plot_parametric_b: "OFF"
plot_background: "OFF"
plot_increment: "ON"
plot_analysis: "OFF"
plot_letkf_ensemble: "OFF"
eva_plots: "ON"
eva_letkf_plots: "OFF"
qos: "batch"
hpc: "hercules"
eva_module: "EVA/orion"
Expand Down
84 changes: 80 additions & 4 deletions applications/cycle_diagnostics/vrfy_script.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@

# for eva
diagdir = os.path.join(comout, 'diags')
HOMEgdas = os.getenv('HOMEgdas')
letkfdiagdir = os.path.join(comout, 'letkf', 'diags')
HOMEgdasmv = os.getenv('HOMEgdasmv')

# Get flags from environment variables (set in the bash driver)
plot_ensemble_b = os.getenv('PLOT_ENSEMBLE_B', 'OFF').upper() == 'ON'
Expand All @@ -78,6 +79,7 @@
plot_increment = os.getenv('PLOT_INCREMENT', 'OFF').upper() == 'ON'
plot_analysis = os.getenv('PLOT_ANALYSIS', 'OFF').upper() == 'ON'
eva_plots = os.getenv('EVA_PLOTS', 'OFF').upper() == 'ON'
eva_letkf_plots = os.getenv('EVA_LETKF_PLOTS', 'OFF').upper() == 'ON'

# output directory
vrfyout = os.getenv('VRFYOUT', './vrfyout')
Expand Down Expand Up @@ -257,7 +259,54 @@
'u': [-1.0, 1.0],
'v': [-1.0, 1.0]},
colormap='nipy_spectral',
vrfyout=os.path.join(vrfyout, 'vrfy', 'letkf_bkg_mean'))] # ocean mean ensemble background
vrfyout=os.path.join(vrfyout, 'vrfy', 'letkf_bkg_mean')), # ocean mean ensemble background
plotConfig(grid_file=grid_file,
data_file=os.path.join(comout, 'letkf', f'enkfgdas.ice.t{cyc}z.ensmean_post.nc'),
variables_horiz={'aice_h': [0.0, 1.0]},
colormap='jet',
projs=['North', 'South', 'Global'],
vrfyout=os.path.join(vrfyout, 'vrfy', 'letkf_ana_mean')), # sea ice mean ensemble analysis
plotConfig(grid_file=grid_file,
layer_file=layer_file,
data_file=os.path.join(comout, 'letkf', f'enkfgdas.ocean.t{cyc}z.ensmean_post.nc'),
lats=np.arange(-60, 60, 10),
lons=np.arange(-280, 80, 30),
variables_zonal={'Temp': [-1.8, 34.0],
'Salt': [32, 40],
'u': [-1.0, 1.0],
'v': [-1.0, 1.0]},
variables_meridional={'Temp': [-1.8, 34.0],
'Salt': [32, 40],
'u': [-1.0, 1.0],
'v': [-1.0, 1.0]},
variables_horiz={'ave_ssh': [-1.8, 1.3],
'Temp': [-1.8, 34.0],
'Salt': [32, 40],
'u': [-1.0, 1.0],
'v': [-1.0, 1.0]},
colormap='nipy_spectral',
vrfyout=os.path.join(vrfyout, 'vrfy', 'letkf_ana_mean')), # ocean mean ensemble analysis
plotConfig(grid_file=grid_file,
layer_file=layer_file,
data_file=os.path.join(comout, 'letkf', f'enkfgdas.ocean.t{cyc}z.ensmean_incr.nc'),
lats=np.arange(-60, 60, 10),
lons=np.arange(-280, 80, 30),
variables_zonal={'Temp': [-0.5, 0.5],
'Salt': [-0.1, 0.1]},
variables_horiz={'Temp': [-0.5, 0.5],
'Salt': [-0.1, 0.1],
'ave_ssh': [-0.1, 0.1]},
variables_meridional={'Temp': [-0.5, 0.5],
'Salt': [-0.1, 0.1]},
colormap='seismic',
vrfyout=os.path.join(vrfyout, 'vrfy', 'letkf_incr_mean')), # ocean mean LETKF increment
plotConfig(grid_file=grid_file,
data_file=os.path.join(comout, 'letkf', f'enkfgdas.ice.t{cyc}z.ensmean_incr.nc'),
lats=np.arange(-60, 60, 10),
variables_horiz={'aice_h': [-0.2, 0.2]},
colormap='seismic',
projs=['North', 'South'],
vrfyout=os.path.join(vrfyout, 'vrfy', 'letkf_incr_mean'))] # sea ice mean LETKF increment
configs.extend(config_letkf)

# Background plotting configuration
Expand Down Expand Up @@ -356,8 +405,8 @@ def plot_marine_vrfy(config):

# Run EVA
if eva_plots:
evadir = os.path.join(HOMEgdas)
marinetemplate = os.path.join(evadir, 'marine_gdas_plots.yaml')
evadir = os.path.join(HOMEgdasmv)
marinetemplate = os.path.join(evadir, 'configs', 'marine_gdas_plots.yaml')
varyaml = os.path.join(comout, 'yaml', 'var.yaml')

# it would be better to refrence the dirs explicitly with the comout path
Expand All @@ -381,6 +430,33 @@ def plot_marine_vrfy(config):
print('running eva on', infile)
subprocess.run(['eva', infile], check=True)

# Run EVA on LETKF diags
if eva_letkf_plots:
evadir = os.path.join(HOMEgdasmv)
marinetemplate = os.path.join(evadir, 'configs', 'marine_letkf_gdas_plots.yaml')
letkfyaml = os.path.join(comout, 'letkf', 'letkf.yaml')

# it would be better to refrence the dirs explicitly with the comout path
# but eva doesn't allow for specifying output directories
os.chdir(os.path.join(vrfyout, 'vrfy'))
if not os.path.exists('preevayamls_letkf'):
os.makedirs('preevayamls_letkf')
if not os.path.exists('evayamls_letkf'):
os.makedirs('evayamls_letkf')

gen_eva_obs_yaml.gen_eva_obs_yaml(letkfyaml, marinetemplate, 'preevayamls_letkf')

files = os.listdir('preevayamls_letkf')
for file in files:
infile = os.path.join('preevayamls_letkf', file)
marine_eva_post.marine_eva_post(infile, 'evayamls_letkf', letkfdiagdir)

files = os.listdir('evayamls_letkf')
for file in files:
infile = os.path.join('evayamls_letkf', file)
print('running eva on', infile)
subprocess.run(['eva', infile], check=True)

#######################################
# calculate diag statistics
#######################################
Expand Down
222 changes: 222 additions & 0 deletions configs/marine_letkf_gdas_plots.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,222 @@
# template YAML file to create EVA YAML files
# based on obs spaces listed in JEDI YAML files
datasets:
- name: experiment
type: IodaObsSpace
filenames:
- @FILENAME@
@CHANNELSKEY@
groups:
- name: ObsValue
variables: &variables @VARIABLES@
- name: ObsError
- name: ombg
- name: oman
- name: hofx_y_mean_xb0
- name: EffectiveQC0
- name: MetaData
- name: PreQC
transforms:

# bkg
- transform: arithmetic
new name: experiment::bkg::${variable}
equals: experiment::ObsValue::${variable}-experiment::ombg::${variable}
for:
variable: *variables

# Generate omb that passed QC for JEDI
- transform: accept where
new name: experiment::OmBQC::${variable}
starting field: experiment::ombg::${variable}
where:
- experiment::EffectiveQC0::${variable} == 0
for:
variable: *variables

# Generate oma that passed QC for JEDI
- transform: accept where
new name: experiment::OmAQC::${variable}
starting field: experiment::oman::${variable}
where:
- experiment::EffectiveQC0::${variable} == 0
for:
variable: *variables

# Generate oma that passed QC for JEDI
- transform: accept where
new name: experiment::hofxQC::${variable}
starting field: experiment::hofx_y_mean_xb0::${variable}
where:
- experiment::EffectiveQC0::${variable} == 0
for:
variable: *variables





graphics:

plotting_backend: Emcpy
figure_list:

# ---------- Map Plots ----------
# Map plot of OmBQC
# --------

- batch figure:
variables: *variables
@CHANNELSKEY@
dynamic options:
- type: vminvmaxcmap
data variable: experiment::OmBQC::${variable}
figure:
layout: [1,1]
figure size: [20,10]
title: 'Ensemble mean OmB post QC | @NAME@ @CYCLE@ | ${variable_title}'
output name: map_plots_letkf/@NAME@/${variable}/@CHANNELVAR@/@NAME@_${variable}@CHANNELVAR@OmBQC.png
tight_layout: true
plots:
- mapping:
projection: plcarr
domain: global
add_map_features: ['coastline']
add_grid:
add_colorbar:
label: '${variable}'
layers:
- type: MapScatter
longitude:
variable: experiment::MetaData::longitude
latitude:
variable: experiment::MetaData::latitude
data:
variable: experiment::OmBQC::${variable}
@CHANNELKEY@
markersize: 0.01
label: '$(variable)'
colorbar: true
# below may need to be edited/removed
cmap: 'seismic'
vmin: ${dynamic_vmin}
vmax: ${dynamic_vmax}


# Histogram plots
# ---------------

# OmA pre and post QC
- batch figure:
variables: *variables
figure:
layout: [1,1]
title: 'Ensemble mean OmA pre- and post QC | @NAME@ | ${variable_title}'
output name: histograms_letkf/@NAME@/${variable}/oma_pre_post_qc_${variable}.png
plots:
- add_xlabel: 'Observation minus anl pre- and post-QC'
add_ylabel: 'Count'
add_legend:
loc: 'upper left'
statistics:
fields:
- field_name: experiment::OmAQC::${variable}
xloc: 0.5
yloc: -0.10
kwargs:
fontsize: 6
statistics_variables:
- n
- min
- mean
- max
- std
layers:
- type: Histogram
data:
variable: experiment::OmAQC::${variable}
color: 'blue'
label: 'OmA (post QC)'
bins: 100
alpha: 0.5
- type: Histogram
data:
variable: experiment::oman::${variable}
color: 'red'
label: 'OmA (pre QC)'
bins: 100
alpha: 0.5

# diff between OmA and OmB
- batch figure:
variables: *variables
figure:
layout: [1,1]
title: 'Ensemble mean OmA and OmB, post-QC | @NAME@ | ${variable_title}'
output name: histograms_letkf/@NAME@/${variable}/oma_omb_histogram_${variable}.png
plots:
- add_xlabel: 'OmA and OmB post-QC'
add_ylabel: 'Count'
add_legend:
loc: 'upper left'
statistics:
fields:
- field_name: experiment::OmAQC::${variable}
xloc: 0.5
yloc: -0.10
kwargs:
fontsize: 6
statistics_variables:
- n
- min
- mean
- max
- std
layers:
- type: Histogram
data:
variable: experiment::OmAQC::${variable}
color: 'blue'
label: 'OmA (post QC)'
bins: 100
alpha: 0.5
- type: Histogram
data:
variable: experiment::OmBQC::${variable}
color: 'red'
label: 'OmB (post QC)'
bins: 100
alpha: 0.5

- batch figure:
variables: *variables
@CHANNELSKEY@
figure:
layout: [1,1]
title: 'Observations vs. ensemble mean JEDI h(x) | @NAME@ @CYCLE@ | ${variable_title}'
output name: observation_scatter_plots_letkf/jedi_hofx_vs_obs_@CYCLE@_@NAME@_${variable}@CHANNELVAR@.png
plots:
- add_xlabel: 'Observation Value'
add_ylabel: 'JEDI h(x)'
add_grid:
add_legend:
loc: 'upper left'
layers:
- type: Scatter
x:
variable: experiment::ObsValue::${variable}
y:
variable: experiment::hofx_y_mean_xb0::${variable}
@CHANNELKEY@
markersize: 1
color: 'black'
label: 'JEDI h(x) versus obs (all obs)'
- type: Scatter
x:
variable: experiment::ObsValue::${variable}
y:
variable: experiment::hofxQC::${variable}
@CHANNELKEY@
markersize: 1
color: 'red'
label: 'JEDI h(x) versus obs (passed QC in JEDI)'
2 changes: 2 additions & 0 deletions configs/vrfy_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ plot_parametric_b: "OFF"
plot_background: "OFF"
plot_increment: "ON"
plot_analysis: "OFF"
plot_letkf_ensemble: "OFF"
eva_plots: "ON"
eva_letkf_plots: "OFF"
qos: "batch"
hpc: "hercules"
eva_module: "EVA/orion"
Loading