Skip to content

Commit

Permalink
relative path to pngs
Browse files Browse the repository at this point in the history
  • Loading branch information
guillaumevernieres committed Feb 10, 2025
1 parent c8482d5 commit 4a3ea35
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 12 deletions.
2 changes: 1 addition & 1 deletion utils/soca/fig_gallery/index_vrfy_marine.html.j2
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,7 @@ window.onclick = function(event) {
var month = document.getElementById('inputMonth').value;
var day = document.getElementById('inputDay').value;
var hour = document.getElementById('inputHour').value;
var inputPath = "{{ path_to_vrfy }}/gdas."+year+month+day+"."+hour+"/vrfy/";
var inputPath = "./gdas."+year+month+day+"."+hour+"/vrfy/";
var woaTEMPpath = "/scratch1/NCEPDEV/da/Mindo.Choi/sandbox/marine_vrfy/comparison/WOA23/bkg/Temp/images/"+year+month+"/";
var ostiaSEAICEpath = "/scratch1/NCEPDEV/da/Mindo.Choi/sandbox/marine_vrfy/comparison/OSTIA/"
Expand Down
29 changes: 22 additions & 7 deletions utils/soca/fig_gallery/run_vrfy.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,10 @@ def generate_jobcard(template_path, output_path, context):
config = yaml.safe_load(template.render(pslot=template_dict["pslot"]))

# Iterate over the date range
pdys = []
for pdy in iterate_pdy_range(config['start_pdy'], config['end_pdy']):
context = copy.deepcopy(config)
pdys.append(pdy)
for cyc in config["cycs"]:
# Update the cycle's date
context.update({"pdy": pdy, "cyc": cyc})
Expand All @@ -85,8 +87,23 @@ def generate_jobcard(template_path, output_path, context):
# Submit the plotting job
subprocess.run(f"sbatch {jobcard}", shell=True)

# Create the list of years, months, and days from pdys
pdys = sorted(pdys)
years = list(set([pdy[:4] for pdy in pdys]))
months = list(set([pdy[4:6] for pdy in pdys]))
days = list(set([pdy[6:] for pdy in pdys]))

# make sure the elements of years, months, and days are unique
years = list(set(years))
months = list(set(months))
days = list(set(days))

# sort the years, months, and days
years.sort()
months.sort()
days.sort()

# Create the HTML document
# copy the HTML resource files from marine_vrfy_display to the output directory
srcdir = os.path.join(context['homegdas'], 'utils', 'soca', 'fig_gallery', 'marine_vrfy_display')
dstdir = context['vrfyout']
os.makedirs(dstdir, exist_ok=True)
Expand All @@ -95,13 +112,11 @@ def generate_jobcard(template_path, output_path, context):
output_html = os.path.join(dstdir, 'index.html')

# define the html context
# TODO(G): get lsts from the list of cycles
html_context = {
'year_list': ["2021"],
'month_list': ["07"],
'day_list': ["01", "02", "03", "04", "05", "06", "07", "08"],
'pslot': "cp4.01",
'path_to_vrfy': context['vrfyout']
'year_list': years,
'month_list': months,
'day_list': days,
'pslot': template_dict["pslot"],
}

# render the html
Expand Down
6 changes: 3 additions & 3 deletions utils/soca/fig_gallery/vrfy_config.yaml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
pslot: "nomlb"
start_pdy: '20210701'
end_pdy: '20210701'
cycs: ["00"] #, "06", "12", "18"]
end_pdy: '20210708'
cycs: ["00", "06", "12", "18"]
run: "gdas"
homegdas: "/work2/noaa/da/gvernier/runs/mlb/GDASApp"
base_exp_path: "/work2/noaa/da/gvernier/runs/mlb/{{ pslot }}/COMROOT/{{ pslot }}"
vrfyout: "/work2/noaa/da/gvernier/runs/mlb/test-verif/{{ pslot }}"
plot_ensemble_b: "OFF"
plot_parametric_b: "OFF"
plot_background: "OFF"
plot_increment: "ON"
plot_increment: "OFF"
plot_analysis: "OFF"
eva_plots: "OFF"
qos: "batch"
Expand Down
2 changes: 1 addition & 1 deletion utils/soca/fig_gallery/vrfy_jobcard.sh.j2
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@ export PLOT_INCREMENT={{ plot_increment | default("ON") }}
export PLOT_ANALYSIS={{ plot_analysis | default("OFF") }}
export PLOT_ANALYSIS={{ plot_analysis | default("OFF") }}
export EVA_PLOTS={{ eva_plots | default("OFF") }}
export VRFYOUT="{{ vrfyout | default("./vrfyout") }}"

# Define and export the environment variables
export cyc="{{ cyc }}"
export RUN="{{ run | default("gdas") }}"
export PSLOT="{{ pslot }}"
export PDY="{{ pdy }}"
export VRFYOUT="{{ vrfyout | default("./vrfyout") }}"/${RUN}.${PDY}.${cyc}

# Define base experiment path
BASE_EXP_PATH="{{ base_exp_path }}" # path to the gdas.pdy directory
Expand Down

0 comments on commit 4a3ea35

Please sign in to comment.