Add a drop_outer option to .where()

Đang mở
#11,883 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
48/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
python
Lĩnh vực
data

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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

Ngôn ngữ chính
Python
Star
4.2k
Fork
1.5k
Merge trung bình
2 ngày 21 giờ
Pull request đã merge (30 ngày)
74

Chuẩn bị môi trường

Mở trong Codespaces

Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của pydata/xarray

Tất cả issue của pydata/xarray

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.