Error in vertical interpolation on a 3D grid
还没有人认领这个 Issue。
评估
调研方向
从 681 行附近 specialdec.py 中的 interplevel 调用和验证开始。将报告的 height_levels 形状 (10, 159, 154) 与 Z 形状 (49, 159, 154) 进行比较,并确定 3D 垂直层级的预期维度。完成的标准是:报告的插值情况得到一致处理,或所需的输入形状得到明确确立。
由索引模型根据 Issue 内容生成。
描述
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!!!
- 主要语言
- Python
- 星标
- 498
- 派生
- 178
- PR 合并指标
- 30 天内没有已合并 PR
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 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 一周以上 新手友好度 25/100
NCAR/wrf-python#282 · 1 条评论 ·
-
PyPI releases 未关闭
NCAR/wrf-python#274 · 5 条评论 · 1 个 reaction · 已指派 1 人 ·
相似的 Issue
-
bug priority:low
难度 2/5 1-3 小时 新手友好度 76/100
CyberAgent/psd2svg#436 ·
-
area/install-update comp/cli comp/desktop P3 sweeper:risk-compatibility type/bug
难度 2/5 1-3 小时 新手友好度 86/100
NousResearch/hermes-agent#122386 · 1 条评论 ·
-
ai-generated
难度 2/5 1-3 小时 新手友好度 78/100
-
难度 2/5 1-3 小时 新手友好度 78/100
vllm-project/production-stack#1105 ·
-
难度 2/5 1-3 小时 新手友好度 88/100