Wrong wind direction of vertcross
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 35/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 停滞
- 技術スタック
- matplotlib, numpy, python
調査の方向性
vertcross、interplevel、matplotlib.quiver を使って例を再現し、その後、断面の成分を 15 km の水平風プロットと比較します。まず vertcross のドキュメントと、関連するテストまたは実装を確認します。方向の不一致を説明または修正し、検証済みのプロット方法を文書化できれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Background
Hi, all,
I'm trying to plot the wind quiver on the crosssection. But, I find the wind direction is wrong. Here're the details.
Read data and vertcross
import numpy as np
from wrf import getvar, interplevel, ALL_TIMES, CoordPair, vertcross, to_np, latlon_coords
from netCDF4 import Dataset
import matplotlib.pyplot as plt
data_dir = '../data/wrfchem/wrfout/20200901/lnox_500/'
file = data_dir+'wrfout_d04_2020-09-01_05:00:00_subset'
ncfile = Dataset(file)
# set cross
start_lon = 118.6
end_lon = 119
start_lat = 32.1
end_lat = 31.7
start_point = CoordPair(lat=start_lat, lon=start_lon)
end_point = CoordPair(lat=end_lat, lon=end_lon)
# get vars
u = getvar(ncfile, 'ua')
v = getvar(ncfile, 'va')
w = getvar(ncfile, 'wa')
wspd = getvar(ncfile, 'uvmet_wspd_wdir')
dbz = getvar(ncfile, 'dbz')
z = getvar(ncfile, 'z', units='km')
# vertcross and subset to 0-17 km
cross_u = vertcross(u, z, wrfin=ncfile, start_point=start_point, end_point=end_point, latlon=True, meta=True).sel(vertical=slice(0, 17))
cross_v = vertcross(v, z, wrfin=ncfile, start_point=start_point, end_point=end_point, latlon=True, meta=True).sel(vertical=slice(0, 17))
cross_w = vertcross(w, z, wrfin=ncfile, start_point=start_point, end_point=end_point, latlon=True, meta=True).sel(vertical=slice(0, 17))
cross_dbz = vertcross(dbz, z, wrfin=ncfile, start_point=start_point, end_point=end_point, latlon=True, meta=True).sel(vertical=slice(0, 17))
cross_wspd = vertcross(wspd, z, wrfin=ncfile, start_point=start_point, end_point=end_point, latlon=True, meta=True).sel(vertical=slice(0, 17))
# get xlabels
coord_pairs = to_np(cross_dbz.coords["xy_loc"])
xticks = np.arange(coord_pairs.shape[0])
xlabels = [pair.latlon_str() for pair in to_np(coord_pairs)]
fig, ax = plt.subplots(figsize=(10, 6))
ax.set_xticks(xticks[::20])
ax.set_xticklabels(['(' +s.replace(',', '\n') + ')' for s in xlabels[::20]], fontsize=4) # rotation
# plot wind
xs = np.arange(0, cross_w.shape[-1], 1)
ys = to_np(cross_w.coords['vertical'])
step = 2
# plot dbz
m = ax.contourf(xs[::step],
ys[::step],
to_np(cross_dbz[::step, ::step]),
cmap='Reds'
)
q = ax.quiver(xs[::step],
ys[::step],
to_np(cross_u[::step, ::step]+cross_v[::step, ::step]),
to_np(cross_w[::step, ::step])
)
plt.colorbar(m, label='dBZ')
plt.savefig('./cross.jpg', dpi=300)
Result:

Wind interpolated to 15 km
# Get the lat/lon coordinates
lats, lons = latlon_coords(u)
zlevel = 15 # km
u_zlevel = interplevel(u, z, zlevel)
v_zlevel = interplevel(v, z, zlevel)
step = 10
fig, ax = plt.subplots(figsize=(10, 6))
q = plt.quiver(to_np(lons[::step,::step]), to_np(lats[::step,::step]),
to_np(u_zlevel[::step, ::step]), to_np(v_zlevel[::step, ::step])
)
qk = plt.quiverkey(q, 1, 1.05, 10, r'$10 m/s}$', labelpos='E')
plt.plot([start_lon, end_lon], [start_lat, end_lat], '-r')
plt.title('Wind at 15 km level')
plt.savefig('./zlev.jpg', dpi=300)

Problem
As you can see, the wind at the 15 km level should blow from the start point to the endpoint.
But, the 15 km wind in the crosssection is the opposite.
Is there anything wrong with my method?
Thanks in advance!
- 主要言語
- Python
- スター
- 498
- フォーク
- 178
- PR マージ指標
- 30日以内にマージされた PR はありません
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
NCAR/wrf-python のほかの issue
-
NCAR/wrf-python#309 · 担当者 1 名 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 38/100
NCAR/wrf-python#307 · コメント 5 件 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
NCAR/wrf-python#286 · コメント 3 件 ·
-
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
NCAR/wrf-python#282 · コメント 1 件 ·
-
PyPI releases オープン
NCAR/wrf-python#274 · コメント 5 件 · リアクション 1 件 · 担当者 1 名 ·
NCAR/wrf-python の issue をすべて見る
似ている issue
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
stephrobert/dsoxlab#238 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
sublimehq/package_control#1780 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
nwg-piotr/nwg-displays#145 ·