diff --git a/scripts/exgdas_global_marine_analysis_vrfy.py b/scripts/exgdas_global_marine_analysis_vrfy.py index 53d0f660b..b6965d381 100755 --- a/scripts/exgdas_global_marine_analysis_vrfy.py +++ b/scripts/exgdas_global_marine_analysis_vrfy.py @@ -23,6 +23,9 @@ import xarray as xr import cartopy import cartopy.crs as ccrs +import gen_eva_obs_yaml +import marine_eva_post +import subprocess def plot_config(grid_file=[], data_file=[], @@ -100,12 +103,17 @@ 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') +HOMEgfs = os.getenv('HOMEgfs') + + ####################################### # INCREMENT ####################################### @@ -189,3 +197,31 @@ 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') +marinetemplate = os.path.join(evadir, '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 +# 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') + +gen_eva_obs_yaml.gen_eva_obs_yaml(varyaml, marinetemplate, 'preevayamls') + +files = os.listdir('preevayamls') +for file in files: + infile = os.path.join('preevayamls', file) + marine_eva_post.marine_eva_post(infile, 'evayamls', diagdir) + +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) diff --git a/ush/eva/gen_eva_obs_yaml.py b/ush/eva/gen_eva_obs_yaml.py index 18a7a7818..5ec301b09 100755 --- a/ush/eva/gen_eva_obs_yaml.py +++ b/ush/eva/gen_eva_obs_yaml.py @@ -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 = {