Skip to content

Commit

Permalink
Merge pull request #41
Browse files Browse the repository at this point in the history
Cache subgrid files in preproc
  • Loading branch information
wdeconinck authored Nov 26, 2024
2 parents 3a9e27d + ca79426 commit 0f70ac3
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 3 deletions.
19 changes: 17 additions & 2 deletions share/ecwam/scripts/ecwam_run_create_bathymetry.sh
Original file line number Diff line number Diff line change
Expand Up @@ -136,11 +136,13 @@ fi

cat reference_levels >> for_md5
md5=$(cat for_md5 | md5sum | awk '{print $1}')
WAM_TOPO=v${ecwam_bathymetry_version}/bathymetry_${wamresol}_nfre${wamnfre}_${wambathy}_${md5}

# Only double-precision files are cached
WAM_TOPO=v${ecwam_bathymetry_version}/bathymetry_dp_${wamresol}_nfre${wamnfre}_${wambathy}_${md5}

subgrid_files=()
for ip in 0 1 2; do
subgrid_files+=(v${ecwam_bathymetry_version}/wam_grib_subgrid_${ip}_${wamnfre}_${wambathy}_${md5})
subgrid_files+=(v${ecwam_bathymetry_version}/wam_grib_subgrid_dp_${wamresol}_${ip}_${wamnfre}_${wambathy}_${md5})
done

grid_files_found=true
Expand All @@ -158,6 +160,15 @@ else
echo "\n\n\t File ${DATA_DIR}/data/bathymetry/${WAM_TOPO} and/or subgrid files were not found\n"
echo "\t They need to be computed from the $wambathy data set\n"

# We update the file names with the current precision to ensure we never accidentally
# cache single-precision files
WAM_TOPO=v${ecwam_bathymetry_version}/bathymetry_${ecwam_prec}_${wamresol}_nfre${wamnfre}_${wambathy}_${md5}

subgrid_files=()
for ip in 0 1 2; do
subgrid_files+=(v${ecwam_bathymetry_version}/wam_grib_subgrid_${ecwam_prec}_${wamresol}_${ip}_${wamnfre}_${wambathy}_${md5})
done

if [[ $wambathy = "ETOPO1" ]] ; then
echo "\n\n\t Getting ETOPO1 data set\n"
log ${SCRIPTS_DIR}/ecwam_retrieve.sh ${ETOPO1} ${DATA_DIR}/${ETOPO1}
Expand Down Expand Up @@ -235,6 +246,10 @@ EOF
mv wam_topo_${cwamresol} ${DATA_DIR}/data/bathymetry/${WAM_TOPO}

for ip in 0 1 2; do
if [[ ! -r wam_grib_subgrid_${ip} ]] ; then
echo "\n\n\t File wam_grib_subgrid_${ip} does not exist\n\n"
abort 9
fi
mv wam_grib_subgrid_${ip} ${DATA_DIR}/data/bathymetry/${subgrid_files[$ip]}
done

Expand Down
5 changes: 4 additions & 1 deletion share/ecwam/scripts/ecwam_runtime.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ SCRIPTS_DIR="$( cd $( dirname "${BASH_SOURCE[0]}" ) && pwd -P )"

# Version of topography result, to be increased when results for same run would be different.
# e.g. when a bug is fixed.
export ecwam_bathymetry_version=1
export ecwam_bathymetry_version=2

ECWAM_CACHE_PATH_DEFAULT=${HOME}/cache/ecwam
[[ ${HPCPERM} ]] && ECWAM_CACHE_PATH_DEFAULT=${HPCPERM}/cache/ecwam
Expand Down Expand Up @@ -55,3 +55,6 @@ export DR_HOOK_ASSERT_MPI_INITIALIZED=0

# export python interpreter
export ECWAM_PYTHON_INTERP=@ECWAM_PYTHON_INTERP@

# export ecWAM precision
export ecwam_prec=@prec@
33 changes: 33 additions & 0 deletions tests/etopo1_oper_an_fc_O320.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,3 +83,36 @@ validation:
maximum: 0.7470872982664355E+01
relative_tolerance: 1.e-14
hashes: ['0x401DE22C86F4741A']

single_precision:

# initial analysis time
- name: swh
time: 2022-12-31 12:00:00
average: 0.1334386110305786E+01
relative_tolerance: 1.e-6
hashes: ['0x3FF559A540000000']

# initial forecast time
- name: swh
time: 2023-01-01 00:00:00
average: 0.1522688865661621E+01
relative_tolerance: 1.e-6
hashes: ['0x3FF85CEF00000000']

# 6h into forcast
- name: swh
time: 2023-01-01 06:00:00
average: 0.1602301239967346E+01
relative_tolerance: 1.e-6
hashes: ['0x3FF9A306A0000000']
- name: swh
time: 2023-01-01 06:00:00
minimum: 0.1733699254691601E-01
relative_tolerance: 1.e-6
hashes: ['0x3F91C0C9E0000000']
- name: swh
time: 2023-01-01 06:00:00
maximum: 0.7470870018005371E+01
relative_tolerance: 1.e-6
hashes: ['0x401DE22BC0000000']

0 comments on commit 0f70ac3

Please sign in to comment.