get.sh - UK-FVCOM-Usergroup/uk-fvcom GitHub Wiki

Place the ecmwf_era-interim_templates into a templates subdirectory.

You also need to download the https://software.ecmwf.int/wiki/display/WEBAPI/Access+ECMWF+Public+Datasets and place in a src subdirectory.

#!/usr/bin/env bash

Batch download the ERA-Interim data necessary for WRF.

set -eu

DATADIR=$(pwd)/ERA-Interim/ PYTHONPATH=$PYTHONPATH:$(pwd)/src

if [ ! -d "$DATADIR" ]; then mkdir -p "$DATADIR" fi

years=({2000..2002})

for year in $years; do

# Get a year +/- a couple of days either side.
START_DATE=$((year - 1))1230
END_DATE=$((year + 1))0102
mkdir -p ${DATADIR}/$year

for type in "sfc" "ml" "pl" "pv"; do
    sed -e s/START_DATE/${START_DATE}/g -e s/END_DATE/${END_DATE}/g templates/era-interim_$type.py > ${DATADIR}/$year/GetERAI-${START_DATE}-${END_DATE}-$type.py
    python ${DATADIR}/$year/GetERAI-${START_DATE}-${END_DATE}-$type.py
    count=1
    ftype=$(echo $type | tr "[a-z]" "[A-Z]")
    for res in CHANGEME$ftype*; do
        mv $res ${DATADIR}/$year/ERAI-${START_DATE}-${END_DATE}-$type$count.grb
        count=$((count + 1))
    done
done

done

⚠️ **GitHub.com Fallback** ⚠️