Add a drop_outer option to .where()

Aperta
#11,883 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
48/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
python
Ambito
data

Direzione di ricerca

Start by reading the implementation and tests for .where() to understand how drop=True currently handles coordinate labels. Then assess how an outer-only trim could preserve internal NaN gaps and coordinate spacing; the issue does not name specific files or tests. Done means a drop_outer option trims only outer all-NaN regions while retaining internal gaps.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

enhancement
Is your feature request related to a problem?

Currently, .where() supports drop=True, which removes coordinate labels where all values are NaN. However, this also removes internal rows or columns of NaN values, which can disrupt the structure of regularly spaced arrays.

Describe the solution you'd like

It would be useful to have an additional option, perhaps drop_outer=True, which only removes outer coordinate labels where all values are NaN, effectively trimming the array to the smallest bounding region containing valid data while preserving internal gaps and coordinate spacing.

Describe alternatives you've considered

This is relatively easy to achieve using .isel(dim=slice(...)) after calling .where() with drop=False, but it would be very helpful to have this functionality built into .where().

Additional context

No response

Lingua principale
Python
Stelle
4.2k
Fork
1.5k
Merge medio
2g 21h
PR unite (30g)
74

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

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 pydata/xarray

Tutte le issue di pydata/xarray

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.