Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions scripts/katana/katana.slurm
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,17 @@
module load miniforge
mamba activate katana

START_YEAR=2019
START_MONTH=10

## Update these variables with the actual paths ##
INPUT_DIR=/path/to/HRRR
KATANA_OUTPUT_DIR=/path/to/katana/output/

## Update path to katana ini file ##
KATANA_INI=/path/to/katana.ini
## -------------------------------------------- ##

# Extract variables from ini file.
START_DATE=$(grep -E '^start_date' "$KATANA_INI" | cut -d':' -f2 | awk '{$1=$1;print}')
START_YEAR=$(echo "$START_DATE" | cut -d'-' -f1)
START_MONTH=$(echo "$START_DATE" | cut -d'-' -f2)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor suggestion to make these calls a little simpler and have you tried to use a date parse to get to year and month. Pseudo code:

year=$(date -d "$START_DATE" +%Y)
month=$(date -d "$START_DATE" +%m)

INPUT_DIR=$(grep -E '^hrrr_directory' "$KATANA_INI" | cut -d':' -f2 | awk '{$1=$1;print}')
KATANA_OUTPUT_DIR=$(grep -E '^out_location' "$KATANA_INI" | cut -d':' -f2 | awk '{$1=$1;print}')

for MONTH in {0..11}; do
START=($(date -d "${START_MONTH}/01/${START_YEAR} + ${MONTH} month" "+%m %Y"))
END=($(date -d "${START_MONTH}/01/${START_YEAR} + $((MONTH + 1)) month" "+%m %Y"))
Expand Down