Issue with vertcross function when using Fortran-order data from .npy files
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 38/100
Direzione di ricerca
Inizia dal punto di ingresso di vertcross e riproduci il ValueError segnalato con dati in ordine Fortran caricati tramite np.load. Confronta questo comportamento con np.ascontiguousarray(vorticity); il lavoro è completato quando vertcross gestisce correttamente l’input oppure documenta e segnala chiaramente il requisito relativo all’ordine dei dati.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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.
- Lingua principale
- Python
- Stelle
- 498
- Fork
- 178
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di NCAR/wrf-python
-
NCAR/wrf-python#309 · 1 assegnatario ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 38/100
NCAR/wrf-python#307 · 5 commenti ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
NCAR/wrf-python#286 · 3 commenti ·
-
Windows builds and testing Aperta
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
NCAR/wrf-python#282 · 1 commento ·
-
PyPI releases Aperta
NCAR/wrf-python#274 · 5 commenti · 1 reazione · 1 assegnatario ·
Tutte le issue di NCAR/wrf-python
Issue simili
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
stephrobert/dsoxlab#238 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
sublimehq/package_control#1780 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
nwg-piotr/nwg-displays#145 ·