Error in vertical interpolation on a 3D grid
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 35/100
Hướng nghiên cứu
Bắt đầu với lệnh gọi interplevel và phần kiểm tra hợp lệ trong specialdec.py quanh dòng 681. So sánh shape height_levels được báo cáo (10, 159, 154) với shape của Z (49, 159, 154), và xác định các chiều dự kiến cho các mức thẳng đứng 3D. Hoàn tất nghĩa là trường hợp nội suy được báo cáo được xử lý nhất quán hoặc shape đầu vào bắt buộc được xác lập rõ ràng.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Hello all,
I'm trying to vertically interpolate few variables on a 3D grid. I have created 10 vertical levels between the 5m to mixing height. The height_levels are defined separately for each grid point. It is a 3D array with shape (10,159,154), where 159 are the latitudes and 154 are the longitudes.
num_levels= 10
for t in range(len(ds['Time'])):
pblh_t = ds['PBLH'].isel(Time=t).values
height_levels = np.logspace(np.log10(5), np.log10(pblh_t), num_levels)
field = ds[var].isel(Time=t)
Z = ds['Z_center'].isel(Time=t)
interpolated_data = interplevel(field, Z, height_levels)
The shape and the dimension of field and Z is matching exactly. However, this code is giving the following error:
File ~/miniconda3/envs/spyder-env/lib/python3.9/site-packages/wrf/specialdec.py:685 in func_wrapper
"the same leftmost and rightmost "
ValueError: argument 1 and 2 must have the same leftmost and rightmost dimensions.
If i give a list of values to interpolate, for example: height_levels = [50, 100,200,300]. code works fine and give the results without any error.
on inspecting the specialdec.py file, following are the lines which are raising the error
line:681
if is2dlev:
if levels.ndim != 2:
if (levels.shape[0:-2] != z.shape[0:-3] or
levels.shape[-2:] != z.shape[-2:]):
raise ValueError("argument 1 and 2 must have "
"the same leftmost and rightmost "
"dimensions")
For my case, levels.shape[-2:] = z.shape[-2:]),
height_levels.shape[-2:]
Out[99]: (159, 154)
Z.shape[-2:]
Out[100]: (159, 154)
but,
height_levels.shape[0:-2]
Out[101]: (10,)
Z.shape[0:-3]
Out[102]: ()
Z.shape[0:-3] is empty since the Z has only 3 dimensions (49,159,154). Here, 49 is the number of the model levels.
Can anyone please help me fix this.
Thank you for your time!!!
- 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ự
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
stephrobert/dsoxlab#238 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
sublimehq/package_control#1780 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
nwg-piotr/nwg-displays#145 ·