Skip to content

Commit

Permalink
Experiments with colors
Browse files Browse the repository at this point in the history
  • Loading branch information
mammatus95 committed Apr 21, 2024
1 parent a37d4f1 commit c4a4c82
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 19 deletions.
5 changes: 4 additions & 1 deletion src/download_script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ mkdir -p ./images

# select run
R=0
R=15

# Path of the icon nest on the opendata-sever
icon_model_pfad=https://opendata.dwd.de/weather/nwp/icon-eu/grib/$(printf "%02d" "$R")
# Path the ifs on the opendata-sever
Expand All @@ -21,6 +23,7 @@ gfs_model_pfad=https://nomads.ncep.noaa.gov/pub/data/nccf/com/gfs/prod

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

echo "Run: " ${R}
echo "Date: " $(date)
Expand All @@ -35,7 +38,7 @@ icon_pressure=icon-eu_europe_regular-lat-lon_pressure-level_${D}$(printf "%02d"



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
Expand Down
30 changes: 15 additions & 15 deletions src/plotlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
from matplotlib.colors import LinearSegmentedColormap # ListedColormap, BoundaryNorm,
from matplotlib.colors import LinearSegmentedColormap, ListedColormap # BoundaryNorm,

# cartopy
import cartopy.crs as crs
Expand Down Expand Up @@ -112,9 +112,9 @@ def two_plots(projection=crs.EuroPP(), lon1=3.56, lon2=16.5, lat1=46.2, lat2=55.
# create colormap for CAPE field
clevs = np.array([50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 1000,
1100, 1200, 1300, 1400, 1500, 1600, 1700, 1800, 1900, 2000])
cmap = LinearSegmentedColormap.from_list("", ["green", "yellow", "orange", "red", "darkred", "darkmagenta"])
cmap2 = LinearSegmentedColormap.from_list("", ["gold", "orange", "darkorange", "red", "darkred", "darkmagenta"])

# cmap = LinearSegmentedColormap.from_list("", ["green", "yellow", "orange", "red", "darkred", "darkmagenta"])
cmap = LinearSegmentedColormap.from_list("", ["lightgoldenrodyellow", "orange", "red"])
cmap = ListedColormap(cmap(np.linspace(0, 1, 256))[8:255])
# ---------------------------------------------------------------------------------------------------------------------


Expand All @@ -126,7 +126,7 @@ def test_plot(cape_fld, lats, lons, hour, run, titel='CAPE'):
lat :
lon :
hour :
run :
run :
Returns:
--------
Expand All @@ -149,7 +149,7 @@ def test_plot(cape_fld, lats, lons, hour, run, titel='CAPE'):
# ---------------------------------------------------------------------------------------------------------------------


def hodopoint(point, u, v, pres_levels, ax, width=0.1, clim=40, proj='polar', smooth=False):
def hodopoint(point, u, v, pres_levels, ax, width=0.1, clim=50, proj='polar', smooth=False):
"""
Parameters:
------------
Expand Down Expand Up @@ -203,9 +203,9 @@ def hodopoint(point, u, v, pres_levels, ax, width=0.1, clim=40, proj='polar', sm
# plot data
idx_low = pres_levels.index(850)
idx_mid = pres_levels.index(600)
ax2.plot(wdir[:idx_low+1:1], spd[:idx_low+1:1], 'r-', lw=1.5)
ax2.plot(wdir[idx_low:idx_mid+1:1], spd[idx_low:idx_mid+1:1], 'g-', lw=1.5)
ax2.plot(wdir[idx_mid:], spd[idx_mid:], 'b-', lw=1.5)
ax2.plot(wdir[:idx_low+1:1], spd[:idx_low+1:1], '-', color='darkmagenta', lw=1.5)
ax2.plot(wdir[idx_low:idx_mid+1:1], spd[idx_low:idx_mid+1:1], '-', color='navy', lw=1.5)
ax2.plot(wdir[idx_mid:], spd[idx_mid:], '-', color='darkgreen', lw=1.5)
ax2.scatter(0, 0, c="k", s=10, marker='x', alpha=0.75)

# ---------------------------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -250,9 +250,9 @@ def basic_plot(model_obj, cape_fld, u, v, lats, lons, hour, threshold=10., imfmt
ax.annotate("CAPE ML(contour plot)", xy=(0.8, -0.07), xycoords='axes fraction', fontsize=14)
ax.annotate(r'in $J/kg$', xy=(0.8, -0.1), xycoords='axes fraction', fontsize=14)

ax.annotate('1000-850 hPa in red', xy=(0.02, -0.03), xycoords='axes fraction', fontsize=13)
ax.annotate(' 850-600 hPa in green', xy=(0.02, -0.06), xycoords='axes fraction', fontsize=13)
ax.annotate(' 600-250 hPa in blue', xy=(0.02, -0.09), xycoords='axes fraction', fontsize=13)
ax.annotate('1000-850 hPa in magenta', xy=(0.02, -0.03), xycoords='axes fraction', fontsize=13)
ax.annotate(' 850-600 hPa in blue', xy=(0.02, -0.06), xycoords='axes fraction', fontsize=13)
ax.annotate(' 600-300 hPa in green', xy=(0.02, -0.09), xycoords='axes fraction', fontsize=13)
ax.annotate("grey circles are 10 and 30m/s", xy=(0.02, -0.12), xycoords='axes fraction', fontsize=13)

name = f"./images/hodographmap_{model_name}_{hour}.{imfmt}"
Expand Down Expand Up @@ -288,9 +288,9 @@ def basic_plot_custarea(model_obj, cape_fld, u, v, lats, lons, hour, threshold=1
ax.annotate("CAPE ML(contour plot)", xy=(0.8, -0.07), xycoords='axes fraction', fontsize=14)
ax.annotate(r'in $J/kg$', xy=(0.8, -0.1), xycoords='axes fraction', fontsize=14)

ax.annotate('1000-850 hPa in red', xy=(0.02, -0.03), xycoords='axes fraction', fontsize=13)
ax.annotate(' 850-600 hPa in green', xy=(0.02, -0.06), xycoords='axes fraction', fontsize=13)
ax.annotate(' 600-250 hPa in blue', xy=(0.02, -0.09), xycoords='axes fraction', fontsize=13)
ax.annotate('1000-850 hPa in magenta', xy=(0.02, -0.025), xycoords='axes fraction', fontsize=13)
ax.annotate(' 850-600 hPa in blue', xy=(0.02, -0.05), xycoords='axes fraction', fontsize=13)
ax.annotate(' 600-300 hPa in green', xy=(0.02, -0.075), xycoords='axes fraction', fontsize=13)
ax.annotate("grey circles are 10 and 30m/s", xy=(0.02, -0.11), xycoords='axes fraction', fontsize=13)

name = f"./images/hodographmap_area_{model_name.replace(' ', '_')}_{hour}.{imfmt}"
Expand Down
6 changes: 3 additions & 3 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-09"
run: 15
fp: 3
default_date: "2024-04-15"

0 comments on commit c4a4c82

Please sign in to comment.