Skip to content

Commit

Permalink
Release Version 0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
mammatus95 committed Apr 9, 2024
1 parent 977ab27 commit 3567490
Show file tree
Hide file tree
Showing 9 changed files with 58 additions and 146 deletions.
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,15 @@ conda env create -f environment.yml
conda activate HodographMaps
```

You need to addg Conda initialization to your etc/profile, as well.

## Example Image

![Example](images/example.png)

![Map of Hodographs](images/hodographmap_ce_9.png)
![Map of Hodographs](images/hodographmap_area.png)

![Map of Soundings](images/soundingmap_ce_9.png)
![Map of Soundings](images/soundingmap_example.png)


## How to run
Expand All @@ -32,6 +33,8 @@ python3 main.py Basic

# Plot Soundings
python3 main.py Sounding

cd images
```

## Cartopy?
Expand All @@ -42,6 +45,7 @@ python3 main.py Sounding
## Datasource
- ICON Nest: https://opendata.dwd.de/weather/nwp/icon-eu/
- IFS: https://www.ecmwf.int/en/forecasts/datasets/open-data
- GFS: https://www.nco.ncep.noaa.gov/pmb/products/gfs/

## License

Expand Down
Binary file removed images/hodographmap_ce_9.png
Binary file not shown.
Binary file removed images/soundingmap_ce_9.png
Binary file not shown.
4 changes: 0 additions & 4 deletions src/config.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
run: 0
fp: 36
default_date: "2024-04-08"

levels: [74,20]
steps: 1 # level steps

Expand Down
31 changes: 0 additions & 31 deletions src/creategridinfo.py

This file was deleted.

68 changes: 23 additions & 45 deletions src/download_script.sh
Original file line number Diff line number Diff line change
@@ -1,68 +1,38 @@
#!/bin/bash

#source /etc/profile

#python3=/home/mammatus95/Dokumente/miniconda3/bin/python3
#conda activate HodographMaps

source /etc/profile

conda activate HodographMaps

store_path=$(pwd)/iconnest
inv_path=$(pwd)/invariant

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

#select run
# select run
R=0
#Path of the icon nest on the opendata-sever
# Path of the icon nest on the opendata-sever
model_pfad=https://opendata.dwd.de/weather/nwp/icon-eu/grib/$(printf "%02d" "$R")
#date
# date
D=$(date +"%Y%m%d")

echo "ICON EU NEST Run: " ${R}
echo "Date: " $(date)
echo "------------------------"
cd ${path_icon}
echo "--------------------------------"


#######################################################################
#name of the model files
# name of the model files
regular_single=icon-eu_europe_regular-lat-lon_single-level_${D}$(printf "%02d" "$R")_
regular_pressure=icon-eu_europe_regular-lat-lon_pressure-level_${D}$(printf "%02d" "$R")_
regular_model=icon-eu_europe_regular-lat-lon_model-level_${D}$(printf "%02d" "$R")_
invariant=icon-eu_europe_regular-lat-lon_time-invariant_${D}$(printf "%02d" "$R")_

[ -f "gitter_icon" ] || python3 creategridinfo.py

# get files with wget
if [ ! -f "./invariant/lon.nc" ]; then
wget -q ${model_pfad}/rlat/${invariant}RLAT.grib2.bz2 -P ${inv_path}
wget -q ${model_pfad}/rlon/${invariant}RLON.grib2.bz2 -P ${inv_path}
bzip2 -dfq ${inv_path}/${invariant}RLAT.grib2.bz2
bzip2 -dfq ${inv_path}/${invariant}RLON.grib2.bz2
cdo -s -f nc4 -copy ${invariant}RLON.grib2 lon.nc
cdo -s -f nc4 -copy ${invariant}RLAT.grib2 lat.nc
cdo -s -f nc4 -remapbil,gitter_icon2 lon.nc intlon.nc
cdo -s -f nc4 -remapbil,gitter_icon2 lat.nc intlat.nc
rm -f ${invariant}RLON.grib2 ${invariant}RLAT.grib2
fi
#if [ ! -f "hhl3D.nc" ]; then
#wget -q ${model_pfad}/hhl/${invariant}HHL.grib2.bz2 -P ${path_icon} #some chances take place
#wget -q ${model_pfad}/hsurf/${invariant}HSURF.grib2.bz2 -P ${path_icon}
#bzip2 -dfq ${invariant}HHL.grib2.bz2
#bzip2 -dfq ${invariant}HSURF.grib2.bz2
#cdo -s -f nc4 -sub ${invariant}HHL.grib2 ${invariant}HSURF.grib2 hhlhsurf3D.nc
#cdo -s -f nc4 -copy ${invariant}HHL.grib2 hhl3D.nc
#rm -f ${invariant}HHL.grib2 ${invariant}HSURF.grib2
#fi



for X in 36 #9 #12 15 18 21 24 27 30 33 36 39 42 45 48 51 54 57 60
for X in 15 #9 12 15 18 21 24 27 30 33 36 39 42 45 48 51 54 57 60
do
cd ${path_icon}
T=$(printf "%03d" "$X")
#single level
# single level
for N in CAPE_ML CAPE_CON PS
do
typeset -l nvar
Expand All @@ -82,9 +52,17 @@ do
done
done

#rm -f
python3 main.py $(pwd)/Basic --fp ${X} --run ${R} --date $(date)
# write run.yml
echo run: ${R} > run.yml
echo fp: ${X} >> run.yml
echo default_date: \"$(date +%Y-%m-%d)\" >> run.yml

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

echo "done with leadtime ${T}h on $(date)"
done

# remove nwp files
rm -rf ${store_path}
9 changes: 5 additions & 4 deletions src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ def run(program_mode, fieldname, rundate, model_run, fp):

def main():
config = ut.load_yaml('config.yml')
run_config = ut.load_yaml('run.yml')

# command line arguments
parser = argparse.ArgumentParser(description="Hodograph Maps")
Expand Down Expand Up @@ -161,21 +162,21 @@ def main():
exit(-1)

if args.date is None:
rundate = datetime.strptime(config["default_date"], "%Y-%m-%d")
rundate = datetime.strptime(run_config["default_date"], "%Y-%m-%d")
else:
rundate = datetime.strptime(args.date, "%Y-%m-%d")

if args.fp is None:
fp = config["fp"]
fp = run_config["fp"]
else:
fp = args.fp

if args.run is None:
model_run = config["run"]
model_run = run_config["run"]
else:
model_run = args.run

if args.mode != "Test" or args.mode != "Sounding" or args.mode != "Basic" or args.mode != "Nixon":
if args.mode != "Test" and args.mode != "Sounding" and args.mode != "Basic" and args.mode != "Nixon":
print("Unknown Mode. Exit program.")
exit(0)
else:
Expand Down
81 changes: 21 additions & 60 deletions src/modelinfolib.py
Original file line number Diff line number Diff line change
@@ -1,75 +1,38 @@
#!/usr/bin/python3
"""
# COSMO-REA2
points = 564720 #(724x780)
nlon = 724
nlat = 780
nlev = 50
lonmin = -7.5
lonmax = 5.514
latmin = -6.0
latmax = 8.022
##gradients
d_grad = 0.018
#nortpole
#north_lon=
#noth_lat=
# COSMO-RE6
points = 698752 #(848x824)
nlon = 848
nlat = 824
nlev = 40
lonmin = -28.403
lonmax = 18.182
latmin = -23.403
latmax = 21.862
##gradients
d_grad = 0.055
#nortpole
#north_lon=
#noth_lat=
# ICON Nest
points = 904689 #(1377x657)
points = 904689
nlon = 1377
nlat = 657
nlev = 51
lonmin = -23.5
lonmax = 45.0
latmin = 29.5
latmax = 70.5
##gradients
d_grad = 0.0625
# COSMO D2
points = 466116 #(651x716)
nlon = 651
nlat = 716
nlev = 65
lonmin = -7.5
lonmax = 5.5
latmin = -6.3
latmax = 8.0
#gradients
d_grad = 0.02
#nortpole
north_lon=-170
noth_lat=40
# ERAINTERIM
points=115680 #(480x241)
nlon=480
nlat=241
nlev=23
lonmin = -180.0
lonmax = 179.25
# IFS
points = 405900
nlon = 900
nlat = 451
nlev =
lonmin = 0
lonmax = 359
latmin = -90
latmax = 90
d_grad = 0.75
d_grad = 0.4
# GFS
points = 1038240
nlon = 1440
nlat = 721
nlev =
lonmin = 0
lonmax = 359
latmin = -90
latmax = 90
d_grad = 0.25
"""


Expand Down Expand Up @@ -122,5 +85,3 @@ def getd_grad(self):

# Example usage:
icon_nest = MODELIFNO(1377, 657, 0.0625, 54, "model") # lowest 74 and we download till 20
cosmo_d2 = MODELIFNO(651, 716, 0.02, 65, "model")
ifs = MODELIFNO(450, 900, 0.4, 10, "pres")
3 changes: 3 additions & 0 deletions src/run.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
run: 0
fp: 15
default_date: "2024-04-09"

0 comments on commit 3567490

Please sign in to comment.