Skip to content
Snippets Groups Projects
Commit 94d5d61b authored by Christoph Knote's avatar Christoph Knote
Browse files

Lines

parent a231c34d
No related branches found
No related tags found
No related merge requests found
......@@ -129,7 +129,7 @@ def plevel_map(t, nc, output_path, plevel, phi_contour_intervals=np.arange(400,
plt.savefig(output_path, bbox_inches='tight', pad_inches=0.1)
plt.close()
def sfc_map(t, nc, get_var_fun, levels, ticks, label, pois, output_path, cmap="viridis", extend='both'):
def sfc_map(t, nc, get_var_fun, levels, ticks, label, pois, lois_function, output_path, cmap="viridis", extend='both'):
#
var = get_var_fun(nc)
u, v = getvar(nc, 'uvmet10')
......@@ -157,9 +157,7 @@ def sfc_map(t, nc, get_var_fun, levels, ticks, label, pois, output_path, cmap="v
transform=ccrs.PlateCarree())
plt.clabel(cs, fmt='%1.0f', fontsize=8)
#
ax.coastlines(linewidth=0.3, zorder=2)
countries = cfeature.NaturalEarthFeature(category='cultural', name='admin_0_countries', scale='50m')
ax.add_feature(countries, facecolor='none', edgecolor='black', linewidth=0.3, zorder=3)
lois_function(ax)
#
nb = 10
brsb = ax.barbs(to_np(lons[::nb,::nb]), to_np(lats[::nb,::nb]),
......
......@@ -22,12 +22,26 @@ import pois
import netCDF4
from wrf import getvar
import numpy as np
import cartopy.feature as cfeature
times = [ args.date + datetime.timedelta(hours=t) for t in range(0, args.fcst_time_hours, args.interval_hours) ]
# for calculating delta precip
prec_prev = None
def lois_function_europe(ax, cfeature):
ax.coastlines(linewidth=0.3, zorder=2)
countries = cfeature.NaturalEarthFeature(category='cultural', name='admin_0_countries', scale='50m')
ax.add_feature(countries, facecolor='none', edgecolor='black', linewidth=0.3, zorder=3)
def lois_function_southern_germany(ax, cfeature):
ax.coastlines(linewidth=0.3, zorder=2)
countries = cfeature.NaturalEarthFeature(category='cultural', name='admin_0_countries', scale='10m')
ax.add_feature(countries, facecolor='none', edgecolor='black', linewidth=0.3, zorder=3)
regions = cfeature.NaturalEarthFeature(category='cultural', name='admin_1_countries', scale='10m')
ax.add_feature(countries, facecolor='none', edgecolor='black', linewidth=0.1, zorder=3)
for t in times:
input_path_d01 = t.strftime(args.wrf_data_fpath_pattern).format(domain=1)
input_path_d02 = t.strftime(args.wrf_data_fpath_pattern).format(domain=2)
......@@ -54,18 +68,18 @@ for t in times:
# output_path=t.strftime(args.plot_fpath_pattern).format(plot='T', domain=1))
# Ozone
for domain, nc_d, poilist in zip([1,2],[nc_d01, nc_d02], [pois.capitals, pois.southern_germany]):
for domain, nc_d, poilist, loifun in zip([1,2],[nc_d01, nc_d02], [pois.capitals, pois.southern_germany], [ lois_function_europe, lois_function_southern_germany]):
sfc_map(t, nc_d, lambda nc: getvar(nc, 'o3')[0,:,:] * 1e3,
levels=range(0, 160, 10),
ticks=range(0, 150, 20),
label="Ozone (ground level) [ppbv]", pois=poilist,
label="Ozone (ground level) [ppbv]", pois=poilist, lois_function=loifun,
output_path=t.strftime(args.plot_fpath_pattern).format(plot='O3', domain=domain),
extend='max')
# NO2
sfc_map(t, nc_d, lambda nc: getvar(nc, 'no2')[0,:,:] * 1e3,
levels=range(0, 110, 10),
ticks=range(0, 110, 20),
label="NO$_2$ (ground level) [ppbv]", pois=poilist,
label="NO$_2$ (ground level) [ppbv]", pois=poilist, lois_function=loifun,
output_path=t.strftime(args.plot_fpath_pattern).format(plot='NO2', domain=domain),
extend='max')
# PM
......@@ -78,19 +92,19 @@ for t in times:
# sfc_map(t, nc_d, lambda nc: get_pm(nc, bins=[1]),
# levels=range(0, 130, 10),
# ticks=range(0, 130, 20),
# label="UFP (ground level) [$\mu$g m$^{{-3}}$]", pois=poilist,
# label="UFP (ground level) [$\mu$g m$^{{-3}}$]", pois=poilist, lois_function=loifun,
# output_path=t.strftime(args.plot_fpath_pattern).format(plot='UFP', domain=domain),
# extend='max')
sfc_map(t, nc_d, lambda nc: get_pm(nc, bins=[1,2,3]),
levels=range(0, 130, 10),
ticks=range(0, 130, 20),
label="PM$_{{2.5}}$ (ground level) [$\mu$g m$^{{-3}}$]", pois=poilist,
label="PM$_{{2.5}}$ (ground level) [$\mu$g m$^{{-3}}$]", pois=poilist, lois_function=loifun,
output_path=t.strftime(args.plot_fpath_pattern).format(plot='PM2_5', domain=domain),
extend='max')
sfc_map(t, nc_d, lambda nc: get_pm(nc, bins=[1,2,3,4]),
levels=range(0, 130, 10),
ticks=range(0, 130, 20),
label="PM$_{{10}}$ (ground level) [$\mu$g m$^{{-3}}$]", pois=poilist,
label="PM$_{{10}}$ (ground level) [$\mu$g m$^{{-3}}$]", pois=poilist, lois_function=loifun,
output_path=t.strftime(args.plot_fpath_pattern).format(plot='PM10', domain=domain),
extend='max')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment