Wrong wind direction of vertcross
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 35/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- matplotlib, numpy, python
- Lĩnh vực
- data-visualization
Hướng nghiên cứu
Tái hiện ví dụ bằng cách sử dụng vertcross, interplevel và matplotlib.quiver, sau đó so sánh các thành phần của mặt cắt với biểu đồ gió ngang ở độ cao 15 km. Bắt đầu bằng việc kiểm tra tài liệu vertcross và mọi kiểm thử hoặc phần triển khai liên quan; công việc được hoàn thành khi giải thích hoặc sửa được sự chênh lệch về hướng và ghi lại một phương pháp vẽ biểu đồ đã được xác minh.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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!
- Ngôn ngữ chính
- Python
- Star
- 498
- Fork
- 178
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của NCAR/wrf-python
-
NCAR/wrf-python#309 · 1 người được giao ·
-
Windows builds on conda-forge Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 38/100
NCAR/wrf-python#307 · 5 bình luận ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
NCAR/wrf-python#286 · 3 bình luận ·
-
Windows builds and testing Đang mở
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
NCAR/wrf-python#282 · 1 bình luận ·
-
PyPI releases Đang mở
NCAR/wrf-python#274 · 5 bình luận · 1 reaction · 1 người được giao ·
Tất cả issue của NCAR/wrf-python
Issue tương tự
-
agent-ready documentation needs-triage
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 88/100
-
documentation
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 91/100
-
workflow-status page template still says reusable workflows are "triggered only by workflow_call:" Đang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 92/100
-
Add https://search.jeremyh.xyz/ Đang mởinstance instance add
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 72/100
searxng/searx-instances#939 · 1 bình luận ·
-
area-deployment area-integrations triage:bot-seen
Độ khó 2/5 Nửa ngày Mức phù hợp với người mới 86/100