Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Issue with vertcross function when using Fortran-order data from .npy files

Aperta
#262 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
38/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
numpy, python
Ambito
data

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:
  1. Load vorticity data counted by wrfout (e.g., vorticity) from a .npy file:

    vorticity = np.load("vorticity.npy")
    
  2. Attempt to use vertcross to perform vertical interpolation:

    vs_cross = vertcross(vorticity, z, ...)
    
  3. 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

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di NCAR/wrf-python

Tutte le issue di NCAR/wrf-python

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.