-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathvrfy_jobcard.sh.j2
56 lines (47 loc) · 2.41 KB
/
vrfy_jobcard.sh.j2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/bin/bash
#SBATCH --job-name={{ job_name | default("marine_vrfy") }} # Assign a name to the job (customize as needed)
#SBATCH --account={{ account | default("da-cpu") }}
#SBATCH --qos={{ qos | default("debug") }}
{% set OUTPUT = "vrfy_jobcard." + pslot + "." + pdy + "." + cyc + ".log" %}
#SBATCH --output={{ OUTPUT }}
#SBATCH --nodes={{ nodes | default(1) }} # Request 1 node
#SBATCH --tasks={{ ntasks | default(20) }} # Request total tasks (processors across nodes)
{% set HPC = hpc | default("hera") %}
{% if HPC == "hera" %}
#SBATCH --partition={{ partition | default("hera") }} # Specify the partition (cluster)
{% endif %}
#SBATCH --mem={{ memory | default("24GB") }} # Request memory
#SBATCH --time={{ walltime | default("00:30:00") }} # Set the walltime limit
# Define HOMEgdas
export HOMEgdas="{{ homegdas }}"
# Load EVA module
module use ${HOMEgdas}/modulefiles
module load {{ eva_module | default("EVA/hera") }}
# Set PYTHONPATH using HOMEgfs
export PYTHONPATH="${HOMEgdas}:$PYTHONPATH"
# Set flags to control plotConfig in the Python script
export PLOT_ENSEMBLE_B={{ plot_ensemble_b | default("OFF") }}
export PLOT_PARAMETRIC_B={{ plot_parametric_b | default("ON") }}
export PLOT_BACKGROUND={{ plot_background | default("ON") }}
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") }}
# 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
# Calculate previous date and cycle
PREV_CYC=$(date -d "{{ pdy }} {{ cyc }} -6 hours" +"%Y%m%d %H")
PREV_PDY=$(echo $PREV_CYC | cut -d' ' -f1)
PREV_CYC_HOUR=$(echo $PREV_CYC | cut -d' ' -f2)
# Define and export environment variables with paths
export COM_OCEAN_ANALYSIS="${BASE_EXP_PATH}/gdas.{{ pdy }}/{{ cyc }}/analysis/ocean"
export COM_ICE_HISTORY_PREV="${BASE_EXP_PATH}/gdas.${PREV_PDY}/${PREV_CYC_HOUR}/model/ice/history"
export COM_OCEAN_HISTORY_PREV="${BASE_EXP_PATH}/gdas.${PREV_PDY}/${PREV_CYC_HOUR}/model/ocean/history"
# Execute Marine Verify Analysis
python3 ${HOMEgdas}/vrfy_script.py