Skip to content

Commit

Permalink
Leap days in future runs or non-existent (#60)
Browse files Browse the repository at this point in the history
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 <[email protected]>

Signed-off-by: Kasra Keshavarz <[email protected]>
  • Loading branch information
kasra-keshavarz authored Jun 26, 2024
1 parent 5d1a10e commit 6b0f0af
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions scripts/gwf-ncar-conus_ii/conus_ii.sh
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,14 @@ for yr in $yearsRange; do
# current timestamp formatted to conform to CONUSII naming convention
toDateFormatted=$(date --date "$toDate" "+$format")

# ignore leap days
day=$(date --date "$toDate" "+%m%d")
if [[ "$day" == "0229" ]]; then
toDate=$(date --date "$toDate 1hours") # current time-step
toDateUnix=$(date --date "$toDate" +"%s") # current UNIX EPOCH
continue
fi

# copy files to $cache
cp "${datasetDir}/${yr}/${fileStruct}_${toDateFormatted}" \
"${cacheDir}/${yr}/${fileStruct}_${toDateFormatted}"
Expand Down Expand Up @@ -469,10 +477,10 @@ for yr in $yearsRange; do
-d "$lonVar","$lonLimsIdx" \
"$cacheDir/$yr/$f2" "$cacheDir/$yr/$f2"; do

echo "$(basename $0): Process killed: restarting process" >$2
echo "$(basename $0): Process killed: restarting process" >$2
sleep 5;
done

done

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


# check the $timeScale variable
case "${timeScale,,}" in

Expand Down

0 comments on commit 6b0f0af

Please sign in to comment.