Skip to content

Commit 135a506

Browse files
committed
Add LPI #8
1 parent 362eb0b commit 135a506

File tree

10 files changed

+38
-24
lines changed

10 files changed

+38
-24
lines changed

.github/workflows/greetings.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@ jobs:
1212
- uses: actions/first-interaction@v1
1313
with:
1414
repo-token: ${{ secrets.GITHUB_TOKEN }}
15-
issue-message: "Message that will be displayed on users' first issue"
16-
pr-message: "Message that will be displayed on users' first pull request"
15+
issue-message: "Thanks for you suggestions to improve the project further."
16+
pr-message: "Thanks for interest in the project. We will review the pull request as quickly as possible."

.gitignore

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,13 @@
66

77
**log.txt
88

9-
*/*.png
10-
*/*/*.png
9+
**.png
10+
**.svg
11+
**.gif
1112

12-
*/*.svg
13-
*/*/*.svg
13+
**.log
14+
**.pyc
1415

15-
*.log
16-
*/*.log
17-
18-
*.pyc
19-
*/*.pyc
20-
*/*/*.pyc
2116

2217
src/modeldata
2318
src/run.yml

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ You need to addg Conda initialization to your etc/profile, as well.
1818

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

21-
![Map of Hodographs GFS](images/hodographmap_GFS.png)
21+
![Map of Hodographs GFS](images/GFS.gif)
2222

2323

2424
## How to run

images/GFS.gif

1.45 MB
Loading

images/ICON.gif

1.66 MB
Loading

run_script.sh

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ fi
1414

1515

1616
FP=${1}
17-
R=0 # select run 0 or 12z
17+
R=00 # select run 0 or 12z
1818
D=$(date +"%Y%m%d") # date in format YYYYMMDD
1919
#######################################################################
2020

@@ -66,7 +66,7 @@ echo "Start downloading leadtime ${T}h"
6666

6767
# ICON
6868
# single level
69-
for N in CAPE_ML CAPE_CON PS
69+
for N in CAPE_ML CAPE_CON PS LPI_CON_MAX
7070
do
7171
typeset -l nvar
7272
nvar=${N}
@@ -107,13 +107,16 @@ echo default_date: \"$(date +%Y-%m-%d)\" >> run.yml
107107
echo "Plot Hodograph Maps"
108108
# run python script
109109
#which python3
110+
python3 main.py ICON >> log.txt 2>&1
110111
python3 main.py IFS >> log.txt 2>&1
111112
python3 main.py GFS >> log.txt 2>&1
112-
python3 main.py ICON >> log.txt 2>&1
113-
114-
echo "done with leadtime ${T}h on $(date)"
115-
ls -lh ./images/*${FP}.png
116113

117114
rm run.yml
118115
# remove nwp files
119116
rm -r ${store_path}
117+
118+
echo "done with leadtime ${T}h on $(date)"
119+
cd ..
120+
mkdir -p ./results_img
121+
mv ./src/images/*${FP}.png ./results_img
122+
ls -lh ./results_img/*${FP}.png

src/config.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ hodomap : True
66

77
threshold: 0
88

9+
lpi: True
10+
911
fontsize: 14
1012
titlesize: 18
1113

src/down_script.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ do
4747
echo "Start downloading leadtime ${T}h"
4848
# ICON
4949
# single level
50-
for N in CAPE_ML CAPE_CON PS
50+
for N in CAPE_ML CAPE_CON PS LPI_CON_MAX
5151
do
5252
typeset -l nvar
5353
nvar=${N}

src/main.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,14 @@ def run_plots(model_obj, fp):
6060
print(f"u_mean by lvl: {np.nanmean(u_fld, axis=(1, 2))}")
6161
plotlib.basic_plot(model_obj, cape_fld, u_fld, v_fld, lats, lons, fp,
6262
threshold=config["threshold"])
63-
plotlib.basic_plot_custarea(model_obj, cape_fld, u_fld, v_fld, lats, lons, fp,
63+
64+
# Create a 2D array filled with NaNs
65+
lpi_fld = np.full(cape_fld.shape, np.nan)
66+
if config["lpi"] is True:
67+
lpi_fld, _, _ = model_obj.open_icon_gribfile_single("LPI_CON_MAX", fp, path="./modeldata/")
68+
69+
70+
plotlib.basic_plot_custarea(model_obj, cape_fld, lpi_fld, u_fld, v_fld, lats, lons, fp,
6471
threshold=config["threshold"])
6572
else:
6673
print("Wrong command line argument")

src/plotlib.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ def basic_plot(model_obj, cape_fld, u, v, lats, lons, hour, threshold=10., imfmt
260260
plt.close()
261261

262262

263-
def basic_plot_custarea(model_obj, cape_fld, u, v, lats, lons, hour, threshold=10., imfmt="png"):
263+
def basic_plot_custarea(model_obj, cape_fld, lpi_fld, u, v, lats, lons, hour, threshold=10., imfmt="png"):
264264
pres_levels = model_obj.getlevels()
265265
model_name = model_obj.getname()
266266
start = model_obj.getrun()
@@ -275,6 +275,12 @@ def basic_plot_custarea(model_obj, cape_fld, u, v, lats, lons, hour, threshold=1
275275
wx = ax.contourf(lons, lats, cape_fld[:, :], levels=clevs, transform=crs.PlateCarree(),
276276
cmap=cmap, extend='max', alpha=0.4, antialiased=True)
277277

278+
# LPI contours
279+
lpi_levs = np.array([50, 500])
280+
cs = plt.contour(lons, lats, lpi_fld[:,:], levels=lpi_levs, transform=crs.PlateCarree(), colors='darkred', linewidths=1.4)
281+
fmt = '%.f'
282+
plt.clabel(cs, fontsize=9, inline=1, fmt=fmt)
283+
278284
for i in range(340, 400, 5):
279285
for j in range(555, 665, 5):
280286
if np.mean(cape_fld[i-1:i+1, j-1:j+1]) > threshold:
@@ -285,8 +291,9 @@ def basic_plot_custarea(model_obj, cape_fld, u, v, lats, lons, hour, threshold=1
285291
cax = fig.add_axes([0.44, 0.03, 0.35, 0.05])
286292
fig.colorbar(wx, cax=cax, orientation='horizontal')
287293

288-
ax.annotate("CAPE ML(contour plot)", xy=(0.8, -0.07), xycoords='axes fraction', fontsize=14)
289-
ax.annotate(r'in $J/kg$', xy=(0.8, -0.1), xycoords='axes fraction', fontsize=14)
294+
ax.annotate("CAPE ML(contour plot)", xy=(0.8, -0.03), xycoords='axes fraction', fontsize=14)
295+
ax.annotate(r'in $J/kg$', xy=(0.8, -0.06), xycoords='axes fraction', fontsize=14)
296+
ax.annotate("LPI (darkred contours)", xy=(0.8, -0.1), xycoords='axes fraction', fontsize=14)
290297

291298
ax.annotate('1000-850 hPa in magenta', xy=(0.02, -0.025), xycoords='axes fraction', fontsize=13)
292299
ax.annotate(' 850-600 hPa in blue', xy=(0.02, -0.05), xycoords='axes fraction', fontsize=13)

0 commit comments

Comments
 (0)