aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Jonas Gunz <himself@jonasgunz.de> 2023-08-02 13:06:00 +0200
committerGravatar Jonas Gunz <himself@jonasgunz.de> 2023-08-02 13:06:00 +0200
commit417df67b59017cd8272926be628898874348b8da (patch)
tree002e120ac8f58b66302cc324f1b7f1e0160ec856
parent002d189b2d16a32f9d8b9b0858c3e21417b77170 (diff)
downloadmeteo_toolbox-417df67b59017cd8272926be628898874348b8da.tar.gz
icon_download
-rwxr-xr-xicon_download.sh41
1 files changed, 41 insertions, 0 deletions
diff --git a/icon_download.sh b/icon_download.sh
new file mode 100755
index 0000000..d461b48
--- /dev/null
+++ b/icon_download.sh
@@ -0,0 +1,41 @@
+#!/bin/bash
+
+# http://opendata.dwd.de/weather/nwp/icon-d2/grib/00/t/icon-d2_germany_regular-lat-lon_pressure-level_2023080200_000_1000_t.grib2.bz2
+
+# <BASE>/<RUN>/<PARAMETER>/icon-d2_regular-lat-lon_pressure-level_<INIT>_<OFFSET>_<LEVEL>_<PARAMETER>
+
+OUTDIR=dwd_icon-d2
+MODEL=icon-d2
+MODEL_LONG=icon-d2_germany
+BASE="http://opendata.dwd.de/weather/nwp"
+
+RUN="00"
+PARAMETERS=( "t" )
+PRESSURE_LEVELS=( "1000" "975" "950" "850" "700" "600" "500" "400" "300" "250" "200" )
+OFFSETS=( "000" )
+DATE=$(date +%Y%m%d)
+
+mkdir -p $OUTDIR
+
+echo -n > "$OUTDIR/index.txt"
+
+for PARAMETER in ${PARAMETERS[@]}; do
+ for OFFSET in ${OFFSETS[@]}; do
+ for LEVEL in ${PRESSURE_LEVELS[@]}; do
+ URL="$BASE/$MODEL/grib/$RUN/$PARAMETER/${MODEL_LONG}_regular-lat-lon_pressure-level_${DATE}${RUN}_${OFFSET}_${LEVEL}_${PARAMETER}.grib2.bz2"
+ BNAME=$(basename "$URL")
+ echo Getting "$URL"
+ echo "$BNAME" >> $OUTDIR/index.txt
+ wget -q --directory-prefix=$OUTDIR "$URL"
+
+ done
+ done
+done
+
+echo Done downloading. Decompressing...
+
+for F in $OUTDIR/*.grib2.bz2; do
+ bzip2 -df "$F"
+done
+
+echo Done.