Skip to content
45 changes: 44 additions & 1 deletion scripts/exgdas_global_marine_analysis_vrfy.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import xarray as xr
import cartopy
import cartopy.crs as ccrs
import subprocess


def plot_config(grid_file=[], data_file=[],
Expand Down Expand Up @@ -100,12 +101,18 @@ def plot_zonal_slice(config):


comout = os.getenv('COMOUT')
data = os.getenv('DATA')
cyc = os.getenv('cyc')
bcyc = str((int(cyc) - 3) % 24)

# TODO: do not write to COM, instead dump figures in DATA and copy to COM.
grid_file = os.path.join(comout, 'gdas.t'+bcyc+'z.ocngrid.nc')

# for eva
diagdir = os.path.join(comout, 'diags')
project_source_dir = os.getenv('PROJECT_SOURCE_DIR')
Comment thread
AndrewEichmann-NOAA marked this conversation as resolved.
Outdated
HOMEgfs = os.getenv('HOMEgfs')


#######################################
# INCREMENT
#######################################
Expand Down Expand Up @@ -189,3 +196,39 @@ def plot_zonal_slice(config):
# Sea surface height
config.update({'variable': 'ave_ssh', 'bounds': [0, 0.1]})
plot_horizontal_slice(config)

#######################################
# eva plots

evadir = os.path.join(HOMEgfs, 'sorc', 'gdas.cd', 'ush', 'eva')
yamlgen = os.path.join(evadir, 'gen_eva_obs_yaml.py')
marinetemplate = os.path.join(evadir, 'marine_gdas_plots.yaml')
marinepost = os.path.join(evadir, 'marine_eva_post.py')
varyaml = os.path.join(comout, 'yaml', 'var.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(comout)
if not os.path.exists('preevayamls'):
os.makedirs('preevayamls')
if not os.path.exists('evayamls'):
os.makedirs('evayamls')

# mama, i'm sorry
Comment thread
AndrewEichmann-NOAA marked this conversation as resolved.
Outdated
runlist = [yamlgen, '-i', varyaml,
'-t', marinetemplate,
'-o', 'preevayamls']

subprocess.run(runlist, check=True)
Comment thread
AndrewEichmann-NOAA marked this conversation as resolved.
Outdated

files = os.listdir('preevayamls')
for file in files:
infile = os.path.join('preevayamls', file)
runlist = [marinepost, '-i', infile, '-o', 'evayamls', '-d', diagdir]
subprocess.run(runlist, check=True)
Comment thread
AndrewEichmann-NOAA marked this conversation as resolved.
Outdated

files = os.listdir('evayamls')
for file in files:
infile = os.path.join('evayamls', file)
print('running eva on', infile)
subprocess.run(['eva', infile], check=True)
Comment thread
CoryMartin-NOAA marked this conversation as resolved.
2 changes: 1 addition & 1 deletion ush/eva/gen_eva_obs_yaml.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def gen_eva_obs_yaml(inputyaml, templateyaml, outputdir):
# now loop over all observation spaces in input JEDI YAML file
for obsspace in evaobs:
name = obsspace['name']
cycle = obsspace['diagfile'].split('_')[-2]
cycle = obsspace['diagfile'].split('.')[-2]
logging.info(f'Now processing: {name}')
# get the dictionary of replacements set up
replacements = {
Expand Down