как установить уровень на python, потому что я не могу отобразить заданный уровень на температуру, но я могу установить другой параметр - PullRequest
0 голосов
/ 05 марта 2020
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.cm import get_cmap
from netCDF4 import Dataset
from wrf import to_np, getvar, smooth2d, get_basemap, latlon_coords, interplevel

from netCDF4 import Dataset
ncfile = Dataset("wrfout_d01_2019-12-30_00_00_00")
T=getvar(ncfile, "T2")
max_T = np.max(T)

lev=np.arange(290,306,2)

for time in range (0,25):
xx = int(time)
T = getvar(ncfile, "T2",xx)

# Smooth the sea level pressure since it tends to be noisy near the mountains
smooth_tc = smooth2d(T, 3)

# Get the latitude and longitude points
lats, lons = latlon_coords(T)

# Get the basemap object
bm = get_basemap(T)

# Create a figure
fig = plt.figure(figsize=(12,9))

# Add geographic outlines
bm.drawcoastlines(linewidth=3)
bm.drawstates(linewidth=3)
bm.drawcountries(linewidth=3)

# Convert the lats and lons to x and y.  Make sure you convert the lats and lons to
# numpy arrays via to_np, or basemap crashes with an undefined RuntimeError.
x, y = bm(to_np(lons), to_np(lats))

# Draw the contours and filled contours
CS = bm.contour(x, y, to_np(smooth_tc), 9,colors="black")
plt.clabel(CS, inline=1, fontsize=10)
bm.contourf(x, y, to_np(smooth_tc), 9, cmap=get_cmap("inferno"))

# Add a color bar
plt.colorbar(shrink=.62)
plt.title("Temperature (K) - T" + str(xx))
plt.show()

#fig.savefig('d01_PSFC_'+str(xx) +'.png')

Это пример графика

enter image description here

Когда я излагаю температуру, шкала отличается для каждого изображения, тогда как когда я рисую влажность или количество осадков, шкала то же.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...