diff --git a/.github/workflows/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md similarity index 100% rename from .github/workflows/ISSUE_TEMPLATE/bug_report.md rename to .github/ISSUE_TEMPLATE/bug_report.md diff --git a/.github/workflows/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md similarity index 100% rename from .github/workflows/ISSUE_TEMPLATE/feature_request.md rename to .github/ISSUE_TEMPLATE/feature_request.md diff --git a/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md b/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md new file mode 100644 index 0000000..e687549 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md @@ -0,0 +1,6 @@ +## Describe your changes + + +## Related Issues +- [x] #739 +- [ ] diff --git a/.gitignore b/.gitignore index b6d3559..f609e79 100644 --- a/.gitignore +++ b/.gitignore @@ -20,3 +20,4 @@ */*/*.pyc src/modeldata +src/run.yml diff --git a/run_script.sh b/run_script.sh index edebe24..87ee999 100755 --- a/run_script.sh +++ b/run_script.sh @@ -16,18 +16,23 @@ fi FP=${1} R=0 # select run 0 or 12z D=$(date +"%Y%m%d") # date in format YYYYMMDD +####################################################################### +echo +echo echo "Hodograph Maps Run Script" -echo "Script configurations:" +echo "Version: 0.1" +echo +echo "Configurations:" echo "Model run: ${R}z" echo "Leadtime: ${FP}z" -echo "Config Date: " ${D} -echo "Today Date: " $(date) -echo "--------------------------------" +echo "Today Date: " $(date +"%d.%m.%Y") +echo +echo ####################################################################### -# load bash profile -source /etc/profile +# load bash profile and add Pythonpath +#source /etc/profile export PYTHONPATH=$(pwd):$PYTHONPATH ####################################################################### @@ -35,7 +40,7 @@ cd src store_path=$(pwd)/modeldata # rm log -rm ./log.txt +rm ./log.txt > /dev/null 2>&1 # create nwp directory and if not there a output images directory mkdir -p ${store_path} @@ -63,34 +68,34 @@ echo "Start downloading leadtime ${T}h" # single level for N in CAPE_ML CAPE_CON PS do -typeset -l nvar -nvar=${N} -wget -q ${icon_model_pfad}/${nvar}/${icon_single}${T}_${N}.grib2.bz2 -P ${store_path} 2>&1 log.txt -bzip2 -dfq ${store_path}/${icon_single}${T}_${N}.grib2.bz2 >> log.txt 2>&1 + typeset -l nvar + nvar=${N} + wget -q ${icon_model_pfad}/${nvar}/${icon_single}${T}_${N}.grib2.bz2 -P ${store_path} 2>&1 log.txt + bzip2 -dfq ${store_path}/${icon_single}${T}_${N}.grib2.bz2 >> log.txt 2>&1 done for H in 1000 950 925 900 875 850 825 800 775 700 600 500 400 300 do -for N in U V -do - typeset -l nvar - nvar=${N} - wget -q ${icon_model_pfad}/${nvar}/${icon_pressure}${T}_${H}_${N}.grib2.bz2 -P ${store_path} >> log.txt 2>&1 - bzip2 -dfq ${store_path}/${icon_pressure}${T}_${H}_${N}.grib2.bz2 >> log.txt 2>&1 -done + for N in U V + do + typeset -l nvar + nvar=${N} + wget -q ${icon_model_pfad}/${nvar}/${icon_pressure}${T}_${H}_${N}.grib2.bz2 -P ${store_path} >> log.txt 2>&1 + bzip2 -dfq ${store_path}/${icon_pressure}${T}_${H}_${N}.grib2.bz2 >> log.txt 2>&1 + done done # ifs 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}/ >> log.txt 2>&1 -wget ${ifs_index} -P ${store_path}/ >> log.txt 2>&1 +wget -q ${ifs_file} -P ${store_path}/ >> log.txt 2>&1 +wget -q ${ifs_index} -P ${store_path}/ >> log.txt 2>&1 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}/ >> log.txt 2>&1 +wget -q ${gfs_file} -P ${store_path}/ >> log.txt 2>&1 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 @@ -101,16 +106,13 @@ echo default_date: \"$(date +%Y-%m-%d)\" >> run.yml echo "Plot Hodograph Maps" # run python script - +#which python3 python3 main.py IFS >> log.txt 2>&1 python3 main.py GFS >> log.txt 2>&1 python3 main.py ICON >> log.txt 2>&1 echo "done with leadtime ${T}h on $(date)" -ls -al ./images/*${FP}.png - - - +ls -lh ./images/*${FP}.png # remove nwp files -rm -rf ${store_path} +rm -r ${store_path} diff --git a/src/main.py b/src/main.py index 4455b8c..58a0fe3 100644 --- a/src/main.py +++ b/src/main.py @@ -101,7 +101,7 @@ def main(): raise ValueError(f"Unknown input field!\n Only CAPE ML works in the moment. Argument: {args.field}") if args.Model is None: - model_obj = model.MODELIFNO("ICON EU", 1377, 657, 0.0625, "pres") + model_obj = model.MODELINFO("ICON EU", 1377, 657, 0.0625, "pres") elif "ICON" in args.Model: model_obj = model.icon_nest elif args.Model == "IFS": diff --git a/src/modelinfolib.py b/src/modelinfolib.py index e284be5..d015c2c 100644 --- a/src/modelinfolib.py +++ b/src/modelinfolib.py @@ -2,7 +2,7 @@ from datetime import datetime, date import pygrib import numpy as np -import src.utilitylib as ut +import utilitylib as ut """ # ICON Nest @@ -104,7 +104,7 @@ # --------------------------------------------------------------------------------------------------------------------- -class MODELIFNO: +class MODELINFO: def __init__(self, modelname, nlon, nlat, d_grad, levtyp): config = ut.load_yaml('config.yml') @@ -196,7 +196,7 @@ def getnlev(self): return len(self.levels) def getlevtyp(self): - return self.d_grad + return self.levtyp def getd_grad(self): return self.d_grad @@ -298,6 +298,6 @@ def open_icon_gribfile_single(self, fieldname, fp, path="./modeldata/"): # Example usage: -icon_nest = MODELIFNO("ICON Nest", 1377, 657, 0.0625, "pres") -ifs = MODELIFNO("IFS", 1440, 721, 0.25, "pres") -gfs = MODELIFNO("GFS", 1440, 721, 0.25, "pres") +icon_nest = MODELINFO("ICON Nest", 1377, 657, 0.0625, "pres") +ifs = MODELINFO("IFS", 1440, 721, 0.25, "pres") +gfs = MODELINFO("GFS", 1440, 721, 0.25, "pres") diff --git a/src/run.yml b/src/run.yml deleted file mode 100644 index 624ebd2..0000000 --- a/src/run.yml +++ /dev/null @@ -1,3 +0,0 @@ -run: 0 -fp: 15 -default_date: "2024-05-15" diff --git a/test/test_modelinfo.py b/test/test_modelinfo.py index 191250e..57f5628 100755 --- a/test/test_modelinfo.py +++ b/test/test_modelinfo.py @@ -1,7 +1,7 @@ #!/usr/bin/python3 import unittest from datetime import datetime -# project moduls +# project modul from src.modelinfolib import MODELINFO @@ -42,7 +42,7 @@ def test_getnlev(self): self.assertEqual(self.icon_nest.getnlev(), 14) def test_getlevtyp(self): - self.assertEqual(self.icon_nest.getlevtyp(), 0.0625) + self.assertEqual(self.icon_nest.getlevtyp(), "pres") def test_getd_grad(self): self.assertEqual(self.icon_nest.getd_grad(), 0.0625)