Skip to content

Commit

Permalink
Preslevel (#2)
Browse files Browse the repository at this point in the history
* Pressure Levels for ICON

* GFS and IFS as model

* Code improvements

* smaller changes

* add new examples

* Experiments with colors

* Add test

* pyyaml is missing

* lint
  • Loading branch information
mammatus95 authored Apr 21, 2024
1 parent e9dc14b commit 9edf076
Show file tree
Hide file tree
Showing 23 changed files with 490 additions and 647 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/python-nose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Unittest

on:
push:
branches: [ "main", "modellevel", "preslevel", "lint" ]

jobs:
build-linux:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Set up Python 3.11
uses: actions/setup-python@v3
with:
python-version: '3.11'
- name: Install dependencies
run: |
pip3 install --upgrade pip
pip3 install -r requirements.txt
- name: Run tests with nose2
run: |
cd test
nose2
9 changes: 5 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
# ignore ALL .log files

.ipynb_checkpoints/
*/.ipynb_checkpoints/
**__pycache__

**.ipynb_checkpoints/


*/*.png
*/*/*.png
Expand All @@ -16,5 +18,4 @@
*/*.pyc
*/*/*.pyc

src/invariant
src/iconnest
src/modeldata
22 changes: 10 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ You need to addg Conda initialization to your etc/profile, as well.

![Example](images/example.png)

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

![Map of Soundings](images/soundingmap_example.png)
![Map of Hodographs GFS](images/hodographmap_GFS.png)


## How to run
Expand All @@ -29,24 +29,22 @@ bash download_script.sh
conda activate HodographMaps

# Plot Hodograph
python3 main.py Basic

# Plot Soundings
python3 main.py Sounding

python3 main.py IFS
python3 main.py GFS
python3 main.py ICON
cd images
```

## Datasource
- [ICON Nest](https://opendata.dwd.de/weather/nwp/icon-eu/)
- [IFS](https://www.ecmwf.int/en/forecasts/datasets/open-data)
- [GFS (NOAA)](https://www.nco.ncep.noaa.gov/pmb/products/gfs/)

## Cartopy?

- https://github.com/mammatus95/cartopy
- https://scitools.org.uk/cartopy/docs/latest/#

## 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

This project is licensed under the terms of the MIT license. See the [LICENSE](LICENSE) file for details.
1 change: 1 addition & 0 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ dependencies:
- pygrib
- netcdf4
- pyyaml
- nose2=0.9.2
Binary file modified images/example.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/hodographmap_GFS.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/hodographmap_IFS.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/hodographmap_area.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed images/soundingmap_example.png
Binary file not shown.
8 changes: 8 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
numpy
matplotlib
cartopy
requests
pygrib
netcdf4
pyyaml
nose2==0.9.2
Binary file removed src/__pycache__/kinematiclib.cpython-311.pyc
Binary file not shown.
5 changes: 1 addition & 4 deletions src/config.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
levels: [74,20]
steps: 1 # level steps
program_mode : Basic # Test Basic

hodomap : True
soundmap : True

threshold: 0

Expand All @@ -16,4 +14,3 @@ customize: # east de
lat1: 50.1
lat2: 54.8

# 10.77, 18.92, 49.80, 55.06
52 changes: 37 additions & 15 deletions src/download_script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,54 +4,76 @@ source /etc/profile

conda activate HodographMaps

store_path=$(pwd)/iconnest
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
R=15

# Path of the icon nest on the opendata-sever
model_pfad=https://opendata.dwd.de/weather/nwp/icon-eu/grib/$(printf "%02d" "$R")
icon_model_pfad=https://opendata.dwd.de/weather/nwp/icon-eu/grib/$(printf "%02d" "$R")
# Path the ifs on the opendata-sever
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")
D=20240415

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


#######################################################################
# 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")_
icon_single=icon-eu_europe_regular-lat-lon_single-level_${D}$(printf "%02d" "$R")_
icon_pressure=icon-eu_europe_regular-lat-lon_pressure-level_${D}$(printf "%02d" "$R")_




for X in 15 #9 12 15 18 21 24 27 30 33 36 39 42 45 48 51 54 57 60
for X 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")
# single level
for N in CAPE_ML CAPE_CON PS
do
typeset -l nvar
nvar=${N}
wget -q ${model_pfad}/${nvar}/${regular_single}${T}_${N}.grib2.bz2 -P ${store_path}
bzip2 -dfq ${store_path}/${regular_single}${T}_${N}.grib2.bz2
wget -q ${icon_model_pfad}/${nvar}/${icon_single}${T}_${N}.grib2.bz2 -P ${store_path}
bzip2 -dfq ${store_path}/${icon_single}${T}_${N}.grib2.bz2
done

for H in {20..74}
for H in 1000 950 925 900 875 850 825 800 775 700 600 500 400 300 250 200
do
for N in U V T QV P
for N in U V
do
typeset -l nvar
nvar=${N}
wget -q ${model_pfad}/${nvar}/${regular_model}${T}_${H}_${N}.grib2.bz2 -P ${store_path}
bzip2 -dfq ${store_path}/${regular_model}${T}_${H}_${N}.grib2.bz2
wget -q ${icon_model_pfad}/${nvar}/${icon_pressure}${T}_${H}_${N}.grib2.bz2 -P ${store_path}
bzip2 -dfq ${store_path}/${icon_pressure}${T}_${H}_${N}.grib2.bz2
done
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
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

# 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
echo run: ${R} > run.yml
echo fp: ${X} >> run.yml
Expand All @@ -65,4 +87,4 @@ do
done

# remove nwp files
rm -rf ${store_path}
#rm -rf ${store_path}
Loading

0 comments on commit 9edf076

Please sign in to comment.