Skip to content

Commit

Permalink
Addressing last date error with RDRS script
Browse files Browse the repository at this point in the history
The RDRS script now retries as many times as necessary to produce the
final files. However, this used to also valid when the file did not
exists. This commit resolves this issue, and assure if a date beyond the
last file available is given to the script, this is corrected.

Signed-off-by: Kasra Keshavarz <[email protected]>
  • Loading branch information
kasra-keshavarz committed Mar 18, 2024
1 parent 479300d commit a1921ed
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions scripts/eccc-rdrs/rdrs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,13 @@ load_core_modules
# Extract dataset files
# =====================
# define necessary dates
# Assure the end-date is not beyond 2018-12-30
endDateInt=$(date --date="$endDate" +"%Y%m%d")
if [[ $endDateInt -gt "20181230" ]]; then
endDate="2018-12-30T23:00:00"
fi

# assign proper variables for dates
startYear=$(date --date="$startDate" +"%Y") # start year (first folder)
endYear=$(date --date="$endDate" +"%Y") # end year (last folder)
yearsRange=$(seq $startYear $endYear)
Expand All @@ -244,6 +251,7 @@ toDate="$startDate"
toDateUnix="$(unix_epoch "$toDate")"
endDateUnix="$(unix_epoch "$endDate")"

# iterate over the years
for yr in $yearsRange; do
# creating yearly directory
mkdir -p "$outputDir/$yr" # output directory
Expand Down

0 comments on commit a1921ed

Please sign in to comment.