Skip to content

Commit

Permalink
Bug fix download script #3
Browse files Browse the repository at this point in the history
  • Loading branch information
mammatus95 committed May 2, 2024
1 parent aae9928 commit 2b41f96
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 27 deletions.
60 changes: 35 additions & 25 deletions src/download_script.sh
Original file line number Diff line number Diff line change
@@ -1,17 +1,31 @@
#!/bin/bash

source /etc/profile
# run
# conda activate HodographMaps
# first!

# change configuration here
R=0 # select run 0 or 12z
D=$(date +"%Y%m%d") # date in format YYYYMMDD
D=20240502 # date in format YYYYMMDD

echo "Hodograph Maps"
echo "Script configurations:"
echo "Model run: " ${R}
echo "Date: " ${D}
echo "Today Date: " $(date)
echo "--------------------------------"

conda activate HodographMaps
#######################################################################
# load bash profile
source /etc/profile

store_path=$(pwd)/modeldata

# create nwp directory and if not there a output images directory
mkdir -p ${store_path}
mkdir -p ./images

# select run
R=0

# Path of the icon nest on the opendata-sever
icon_model_pfad=https://opendata.dwd.de/weather/nwp/icon-eu/grib/$(printf "%02d" "$R")
Expand All @@ -20,13 +34,6 @@ ifs_model_pfad=https://data.ecmwf.int/forecasts #/20240406/00z/ifs/0p4-beta/oper
# Path the gfs on the opendata-sever
gfs_model_pfad=https://nomads.ncep.noaa.gov/pub/data/nccf/com/gfs/prod

# date
D=$(date +"%Y%m%d")

echo "Run: " ${R}
echo "Date: " $(date)
echo "--------------------------------"


#######################################################################
# name of the model files
Expand All @@ -35,10 +42,10 @@ icon_pressure=icon-eu_europe_regular-lat-lon_pressure-level_${D}$(printf "%02d"




for X in 3 #9 12 15 18 21 24 27 30 33 36 39 42 45 48 51 54 57 60
for fp in 3 #9 12 15 18 21 24 27 30 33 36 39 42 45 48 51 54 57 60
do
T=$(printf "%03d" "$X")
echo "Start downloading fp" ${fp}
T=$(printf "%03d" "$fp")
# single level
for N in CAPE_ML CAPE_CON PS
do
Expand All @@ -60,26 +67,29 @@ do
done

# ifs
ifs_file=${ifs_model_pfad}/${D}/$(printf "%02d" "$R")z/ifs/0p25/oper/${D}$(printf "%02d" "$R")0000-${X}h-oper-fc.grib2
ifs_index=${ifs_model_pfad}/${D}/$(printf "%02d" "$R")z/ifs/0p25/oper/${D}$(printf "%02d" "$R")0000-${X}h-oper-fc.grib2
ifs_file=${ifs_model_pfad}/${D}/$(printf "%02d" "$R")z/ifs/0p25/oper/${D}$(printf "%02d" "$R")0000-${fp}h-oper-fc.grib2
ifs_index=${ifs_model_pfad}/${D}/$(printf "%02d" "$R")z/ifs/0p25/oper/${D}$(printf "%02d" "$R")0000-${fp}h-oper-fc.index
wget ${ifs_file} -P ${store_path}/
wget ${ifs_index} -P ${store_path}/
mv ${store_path}/${D}$(printf "%02d" "$R")0000-${X}h-oper-fc.grib2 ${store_path}/ifs_$(printf "%02d" "$R")z_${D}_f${T}.grib2
mv ${store_path}/${D}$(printf "%02d" "$R")0000-${X}h-oper-fc.index ${store_path}/ifs_$(printf "%02d" "$R")z_${D}_f${T}.index
mv ${store_path}/${D}$(printf "%02d" "$R")0000-${fp}h-oper-fc.grib2 ${store_path}/ifs_$(printf "%02d" "$R")z_${D}_f${T}.grib2
mv ${store_path}/${D}$(printf "%02d" "$R")0000-${fp}h-oper-fc.index ${store_path}/ifs_$(printf "%02d" "$R")z_${D}_f${T}.index

# gfs
gfs_file=${gfs_model_pfad}/gfs.${D}/$(printf "%02d" "$R")/atmos/gfs.t$(printf "%02d" "$R")z.pgrb2.0p25.f${T}
wget ${gfs_file} -P ${store_path}/
mv ${store_path}/gfs.t$(printf "%02d" "$R")z.goessimpgrb2.0p25.f${T} ${store_path}/gfs_$(printf "%02d" "$R")z_${D}_f${T}.grib2

# write run.yml
mv ${store_path}/gfs.t$(printf "%02d" "$R")z.pgrb2.0p25.f${T} ${store_path}/gfs_$(printf "%02d" "$R")z_${D}_f${T}.grib2
# Plot Hodograph
# write run.yml configuration
echo run: ${R} > run.yml
echo fp: ${X} >> run.yml
echo fp: ${fp} >> run.yml
echo default_date: \"$(date +%Y-%m-%d)\" >> run.yml

# runt python script
python3 main.py Basic
# python3 main.py Basic --fp ${X} --run ${R} --date $(date +%Y-%m-%d)
echo "Plot Hodograph Maps"
# run python script

python3 main.py IFS
python3 main.py GFS
python3 main.py ICON

echo "done with leadtime ${T}h on $(date)"
done
Expand Down
4 changes: 2 additions & 2 deletions src/run.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
run: 0
fp: 15
default_date: "2024-04-22"
fp: 3
default_date: "2024-05-02"

0 comments on commit 2b41f96

Please sign in to comment.