ux.open_dataset currently supports structured data

Đang mở Phù hợp với người mới
#1,854 1 bình luận 0 reaction 1 người được giao Xem trên GitHub

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

@Sevans711 đang làm issue này rồi.

Từ ngày 28/10/2026.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
72/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
python
Lĩnh vực
api

Hướng nghiên cứu

Tái hiện với mcve, sau đó lần theo điểm vào công khai ux.open_dataset() và tìm nơi nó quyết định liệu đầu vào có phải là phi cấu trúc trước khi tạo một UxDataset. Thêm một kiểm tra dữ liệu có cấu trúc rõ ràng để đưa ra lỗi hoặc cảnh báo rõ ràng trỏ đến UxDataset.from_structured() hoặc UxDataset.from_xarray(), và thêm một bài kiểm thử sử dụng bộ dữ liệu lat/lon được cung cấp. Hoàn tất nghĩa là mcve không còn âm thầm trả về một UxDataset có vẻ hợp lý nữa.

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

Mô tả

bug
Version

v2026.10.0

How did you install UXarray?

Source

What happened?

ux.open_dataset() currently supports structured data (e.g. a lat/lon grid), silently returning a reasonable-looking answer. However, that is actually not intentional. For more details see: https://github.com/UXARRAY/uxarray/pull/1827#issuecomment-6450148234.

What did you expect to happen?

Because opening structured data with ux.open_dataset() is not intended to be supported and is not currently being tested, uxarray should avoid silently returning a reasonable-looking answer which might actually be wrong. So, I would expect it to crash, or at least raise a warning, when pointed at structured data.

The crash or warning message should maybe point out that the UxDataset.from_structured() or UxDataset.from_xarray() could be considered instead, as the standard entry points for loading structured data into uxarray.

Can you provide a MCVE to repoduce the bug?
import numpy as np
import xarray as xr
import uxarray as ux

ds = xr.Dataset(
    {
        "t": (("time", "lat", "lon"), np.random.rand(2, 4, 8)),
        "s": (("lat", "lon"), np.random.rand(4, 8)),
        "z": (("time",), np.ones(2)),
    },
    coords={
        "lat": ("lat", np.linspace(-80, 80, 4), {"standard_name": "latitude"}),
        "lon": ("lon", np.linspace(0, 350, 8), {"standard_name": "longitude"}),
        "time": [0, 1],
    },
)

ux.open_dataset(ds, ds)  # grid, data
# silently returns a UxDataset with sizes {'time': 2, 'n_face': 32};
# I expected a crash or at least a warning, instead.
Ngôn ngữ chính
Python
Star
231
Fork
58
Merge trung bình
5 ngày 7 giờ
Pull request đã merge (30 ngày)
18

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

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 UXARRAY/uxarray

Tất cả issue của UXARRAY/uxarray

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.