-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b6aef1c
commit 4c56b7d
Showing
5 changed files
with
317 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#!/bin/bash | ||
|
||
set -x | ||
|
||
case_dir=/work2/noaa/gsienkf/weihuang/jedi/case_study | ||
|
||
output=1 | ||
|
||
var_list=(sfc_ps sfcship_ps sondes_ps) | ||
|
||
#gridfile=regrid/lonlat_sfc-letkf-nbc.nc | ||
gridfile=regrid/lonlat_sfc-letkf.nc | ||
if [ ! -f ${gridfile} ] | ||
then | ||
cd regrid | ||
rm -f fv3latlon.nc | ||
#interp.sh ${case_dir}/sfc-letkf/analysis.2/increment/ | ||
interp.sh ${case_dir}/sfc-letkf/analysis/increment/ | ||
cd .. | ||
mv regrid/fv3latlon.nc ${gridfile} | ||
fi | ||
|
||
for j in ${!var_list[@]} | ||
do | ||
obsfile=${case_dir}/sfc-letkf/gsiobs/${var_list[$j]}_obs_2020011006_0000.nc4 | ||
if [ -f ${obsfile} ] | ||
then | ||
python new-obs-jedi.py \ | ||
--output=${output} \ | ||
--casename=sfc-letkf_${var_list[$j]} \ | ||
--varname=T \ | ||
--gridfile=${gridfile} \ | ||
--obsfile=${obsfile} | ||
fi | ||
done | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
from matplotlib.patches import Rectangle | ||
import matplotlib.pyplot as plt | ||
import matplotlib.colors as mcolors | ||
|
||
|
||
def plot_colortable(colors, title, sort_colors=True, emptycols=0): | ||
|
||
cell_width = 212 | ||
cell_height = 22 | ||
swatch_width = 48 | ||
margin = 12 | ||
topmargin = 40 | ||
|
||
# Sort colors by hue, saturation, value and name. | ||
if sort_colors is True: | ||
by_hsv = sorted((tuple(mcolors.rgb_to_hsv(mcolors.to_rgb(color))), | ||
name) | ||
for name, color in colors.items()) | ||
names = [name for hsv, name in by_hsv] | ||
else: | ||
names = list(colors) | ||
|
||
n = len(names) | ||
ncols = 4 - emptycols | ||
nrows = n // ncols + int(n % ncols > 0) | ||
|
||
width = cell_width * 4 + 2 * margin | ||
height = cell_height * nrows + margin + topmargin | ||
dpi = 72 | ||
|
||
fig, ax = plt.subplots(figsize=(width / dpi, height / dpi), dpi=dpi) | ||
fig.subplots_adjust(margin/width, margin/height, | ||
(width-margin)/width, (height-topmargin)/height) | ||
ax.set_xlim(0, cell_width * 4) | ||
ax.set_ylim(cell_height * (nrows-0.5), -cell_height/2.) | ||
ax.yaxis.set_visible(False) | ||
ax.xaxis.set_visible(False) | ||
ax.set_axis_off() | ||
ax.set_title(title, fontsize=24, loc="left", pad=10) | ||
|
||
for i, name in enumerate(names): | ||
row = i % nrows | ||
col = i // nrows | ||
y = row * cell_height | ||
|
||
swatch_start_x = cell_width * col | ||
text_pos_x = cell_width * col + swatch_width + 7 | ||
|
||
ax.text(text_pos_x, y, name, fontsize=14, | ||
horizontalalignment='left', | ||
verticalalignment='center') | ||
|
||
ax.add_patch( | ||
Rectangle(xy=(swatch_start_x, y-9), width=swatch_width, | ||
height=18, facecolor=colors[name], edgecolor='0.7') | ||
) | ||
|
||
return fig | ||
|
||
plot_colortable(mcolors.BASE_COLORS, "Base Colors", | ||
sort_colors=False, emptycols=1) | ||
plot_colortable(mcolors.TABLEAU_COLORS, "Tableau Palette", | ||
sort_colors=False, emptycols=2) | ||
|
||
plot_colortable(mcolors.CSS4_COLORS, "CSS Colors") | ||
|
||
# Optionally plot the XKCD colors (Caution: will produce large figure) | ||
# xkcd_fig = plot_colortable(mcolors.XKCD_COLORS, "XKCD Colors") | ||
# xkcd_fig.savefig("XKCD_Colors.png") | ||
|
||
plt.show() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,203 @@ | ||
diagnostics: | ||
|
||
# Data read | ||
# --------- | ||
- data: | ||
type: IodaObsSpace | ||
datasets: | ||
- name: experiment | ||
filenames: | ||
- OBSFILE | ||
groups: | ||
- name: ObsValue | ||
variables: &variables [VARNAME] | ||
- name: hofx_y_mean_xb0 | ||
- name: PreQC | ||
- name: GsiHofXBc | ||
- name: GsiEffectiveQC | ||
- name: MetaData | ||
|
||
transforms: | ||
|
||
# Generate omb for GSI | ||
- transform: arithmetic | ||
new name: experiment::ObsValueMinushofx_y_mean_xb0::${variable} | ||
equals: experiment::ObsValue::${variable}-experiment::hofx_y_mean_xb0::${variable} | ||
for: | ||
variable: *variables | ||
|
||
# Generate omb for JEDI | ||
- transform: arithmetic | ||
new name: experiment::ObsValueMinusHofx::${variable} | ||
equals: experiment::ObsValue::${variable}-experiment::GsiHofXBc::${variable} | ||
for: | ||
variable: *variables | ||
|
||
# Generate hofx that passed QC for JEDI | ||
- transform: accept where | ||
new name: experiment::hofxPassedQc::${variable} | ||
starting field: experiment::GsiHofXBc::${variable} | ||
where: | ||
- experiment::GsiEffectiveQC::${variable} == 0 | ||
for: | ||
variable: *variables | ||
|
||
# Generate GSI hofx that passed JEDI QC | ||
- transform: accept where | ||
new name: experiment::hofx_y_mean_xb0PassedQc::${variable} | ||
starting field: experiment::hofx_y_mean_xb0::${variable} | ||
where: | ||
- experiment::GsiEffectiveQC::${variable} == 0 | ||
for: | ||
variable: *variables | ||
|
||
# Generate omb that passed QC for JEDI | ||
- transform: accept where | ||
new name: experiment::ObsValueMinushofxPassedQc::${variable} | ||
starting field: experiment::ObsValueMinusHofx::${variable} | ||
where: | ||
- experiment::GsiEffectiveQC::${variable} == 0 | ||
for: | ||
variable: *variables | ||
|
||
# Generate omb that passed QC for GSI | ||
- transform: accept where | ||
new name: experiment::ObsValueMinushofx_y_mean_xb0PassedQc::${variable} | ||
starting field: experiment::ObsValueMinushofx_y_mean_xb0::${variable} | ||
where: | ||
- experiment::GsiEffectiveQC::${variable} == 0 | ||
for: | ||
variable: *variables | ||
|
||
graphics: | ||
|
||
# JEDI h(x) vs Observations | ||
# ------------------------- | ||
- batch figure: | ||
variables: *variables | ||
figure: | ||
layout: [1,1] | ||
title: 'Observations vs. JEDI h(x) | CASENAME | ${variable_title}' | ||
output name: PLOTDIR/${variable}/jedi_hofx_vs_obs_${variable}.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::GsiHofXBc::${variable} | ||
markersize: 5 | ||
color: 'black' | ||
label: 'JEDI h(x) versus obs (all obs)' | ||
- type: Scatter | ||
x: | ||
variable: experiment::ObsValue::${variable} | ||
y: | ||
variable: experiment::hofxPassedQc::${variable} | ||
markersize: 5 | ||
color: 'red' | ||
label: 'JEDI h(x) versus obs (passed QC in JEDI)' | ||
|
||
# GSI h(x) vs Observations | ||
# ------------------------- | ||
- batch figure: | ||
variables: *variables | ||
figure: | ||
layout: [1,1] | ||
title: 'Observations vs. GSI h(x) | CASENAME | ${variable_title}' | ||
output name: PLOTDIR/${variable}/gsi_hofx_vs_obs_${variable}.png | ||
plots: | ||
- add_xlabel: 'Observation Value' | ||
add_ylabel: 'GSI 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} | ||
markersize: 5 | ||
color: 'black' | ||
label: 'GSI h(x) versus obs (all obs)' | ||
- type: Scatter | ||
x: | ||
variable: experiment::ObsValue::${variable} | ||
y: | ||
variable: experiment::hofx_y_mean_xb0PassedQc::${variable} | ||
markersize: 5 | ||
color: 'red' | ||
label: 'GSI h(x) versus obs (passed QC in JEDI)' | ||
|
||
# JEDI h(x) vs GSI h(x) | ||
# --------------------- | ||
|
||
- batch figure: | ||
variables: *variables | ||
figure: | ||
layout: [1,1] | ||
title: 'JEDI h(x) vs. GSI h(x) | CASENAME | ${variable_title}' | ||
output name: PLOTDIR/${variable}/gsi_hofx_vs_jedi_hofx_${variable}.png | ||
bbox_inches: 'tight' | ||
plots: | ||
- add_xlabel: 'GSI h(x)' | ||
add_ylabel: 'JEDI h(x)' | ||
add_grid: | ||
add_legend: | ||
loc: 'upper left' | ||
layers: | ||
- type: Scatter | ||
x: | ||
variable: experiment::hofx_y_mean_xb0::${variable} | ||
y: | ||
variable: experiment::GsiHofXBc::${variable} | ||
markersize: 5 | ||
color: 'black' | ||
label: 'JEDI h(x) versus GSI h(x)' | ||
- type: Scatter | ||
x: | ||
variable: experiment::hofx_y_mean_xb0PassedQc::${variable} | ||
y: | ||
variable: experiment::hofxPassedQc::${variable} | ||
markersize: 5 | ||
color: 'red' | ||
label: 'JEDI h(x) versus GSI h(x) (passed QC in JEDI)' | ||
|
||
# JEDI omb vs GSI omb | ||
# --------------------- | ||
|
||
- batch figure: | ||
variables: *variables | ||
figure: | ||
layout: [1,1] | ||
title: 'JEDI omb vs. GSI omb| CASENAME | ${variable_title}' | ||
output name: PLOTDIR/${variable}/gsi_omb_vs_jedi_omb_${variable}.png | ||
plots: | ||
- add_xlabel: 'GSI observation minus h(x)' | ||
add_ylabel: 'JEDI observation minus h(x)' | ||
add_grid: | ||
add_legend: | ||
loc: 'upper left' | ||
layers: | ||
- type: Scatter | ||
x: | ||
variable: experiment::ObsValueMinushofx_y_mean_xb0::${variable} | ||
y: | ||
variable: experiment::ObsValueMinusHofx::${variable} | ||
markersize: 5 | ||
color: 'black' | ||
label: 'GSI omb vs JEDI omb (all obs)' | ||
- type: Scatter | ||
x: | ||
variable: experiment::ObsValueMinushofx_y_mean_xb0PassedQc::${variable} | ||
y: | ||
variable: experiment::ObsValueMinushofxPassedQc::${variable} | ||
markersize: 5 | ||
color: 'red' | ||
label: 'GSI omb vs JEDI omb (passed QC in JEDI)' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters