Skip to content

Commit 6b0f0af

Browse files
Leap days in future runs or non-existent (#60)
Another difference between historical and future runs of GWF-NCAR WRF-CONUS-II runs are the leap days. While in historical runs leap days exists, in future runs these days are non-existent. This commit takes care of this difference in data processing and extraction of this dataset. Reported-by: Kasra Keshavarz <kasra.keshavarz1@ucalgary.ca> Signed-off-by: Kasra Keshavarz <kasra.keshavarz1@ucalgary.ca>
1 parent 5d1a10e commit 6b0f0af

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

scripts/gwf-ncar-conus_ii/conus_ii.sh

+10-3
Original file line numberDiff line numberDiff line change
@@ -437,6 +437,14 @@ for yr in $yearsRange; do
437437
# current timestamp formatted to conform to CONUSII naming convention
438438
toDateFormatted=$(date --date "$toDate" "+$format")
439439

440+
# ignore leap days
441+
day=$(date --date "$toDate" "+%m%d")
442+
if [[ "$day" == "0229" ]]; then
443+
toDate=$(date --date "$toDate 1hours") # current time-step
444+
toDateUnix=$(date --date "$toDate" +"%s") # current UNIX EPOCH
445+
continue
446+
fi
447+
440448
# copy files to $cache
441449
cp "${datasetDir}/${yr}/${fileStruct}_${toDateFormatted}" \
442450
"${cacheDir}/${yr}/${fileStruct}_${toDateFormatted}"
@@ -469,10 +477,10 @@ for yr in $yearsRange; do
469477
-d "$lonVar","$lonLimsIdx" \
470478
"$cacheDir/$yr/$f2" "$cacheDir/$yr/$f2"; do
471479

472-
echo "$(basename $0): Process killed: restarting process" >$2
480+
echo "$(basename $0): Process killed: restarting process" >$2
473481
sleep 5;
474482
done
475-
483+
476484
done
477485

478486
# increment time-step by one unit
@@ -499,7 +507,6 @@ for yr in $yearsRange; do
499507
# sorting files to make sure the time-series is correct
500508
IFS=$'\n' files=($(sort <<<"${files[*]}")); unset IFS
501509

502-
503510
# check the $timeScale variable
504511
case "${timeScale,,}" in
505512

0 commit comments

Comments
 (0)