Issue with vertcross function when using Fortran-order data from .npy files
还没有人认领这个 Issue。
评估
调研方向
从 vertcross 入口开始,使用由 np.load 加载的 Fortran-order 数据复现报告的 ValueError。将该行为与 np.ascontiguousarray(vorticity) 进行比较;完成的标准是 vertcross 能正确处理输入,或清楚地记录并报告其对数据顺序的要求。
由索引模型根据 Issue 内容生成。
描述
I encountered an issue when using the vertcross function from the wrf-python package to perform vertical interpolation on data stored in a .npy file. Specifically, when I load the .npy file , the data is stored in Fortran-order (column-major) format by default.
The vertcross function seems to require C-order (row-major) data storage format to work correctly. When passing Fortran-order data, I received a ValueError: invalid shape for argument 1 (got (38,), expected (360,)), which suggests a misinterpretation of the data shape due to the storage format mismatch.
Steps to Reproduce:
-
Load vorticity data counted by wrfout (e.g., vorticity) from a
.npyfile:vorticity = np.load("vorticity.npy") -
Attempt to use vertcross to perform vertical interpolation:
vs_cross = vertcross(vorticity, z, ...) -
Encounter the error: ValueError: invalid shape for argument 1 (got (38,), expected (360,))
The vertcross function should work correctly when the data is in Fortran-order (which is the default when reading .npy files). If the function requires C-order, it would be helpful to include a clear message in the documentation or provide an automatic conversion inside the function.
solution:
Manually converting the data to C-order format using np.ascontiguousarray() resolves the issue:
vorticity = np.ascontiguousarray(vorticity)
vs_cross = vertcross(vorticity, z, ...)
It would be helpful if the vertcross function could automatically handle Fortran-order data or provide better error handling or documentation related to data format expectations.
- 主要语言
- 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
-
agent-ready documentation needs-triage
难度 1/5 1-3 小时 新手友好度 88/100
-
documentation
难度 1/5 1 小时以内 新手友好度 91/100
-
workflow-status page template still says reusable workflows are "triggered only by workflow_call:" 未关闭
难度 1/5 1 小时以内 新手友好度 92/100
-
instance instance add
难度 1/5 1 小时以内 新手友好度 72/100
searxng/searx-instances#939 · 1 条评论 ·
-
area-deployment area-integrations triage:bot-seen
难度 2/5 半天 新手友好度 86/100