Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Better handling of "cube math" like `cube1 / cube2`

Đang mở
#748 0 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 1 ngày

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

Từ ngày 10/3/2025.

Đánh giá

Issue này chưa được đánh giá.

Mô tả

api compliancy bug feature request technical debt usability

The python client has since long a compelling "band math" feature, e.g.:

red = s2cube.band("B04")
nir = s2cube.band("B08")
ndvi = (nir - red) / (nir + red)

which is translated to a reduce_dimension along band dimension with the appropriate reducer.

User however also naively try to use these kind of math expressions without using the .band() method, e.g.:

cube3 = cube1 / cube2

Which kind of works: it will produce a merge_cubes operation with an overlap resolver set to "divide" in this case.
As discussed in https://github.com/Open-EO/openeo-processes/issues/280 this is unfortunately a dangerous approach because it will give unexpected results in situations without 100% overlap

Alternative approach: use merge_cubes without overlap resolver to "stack" bands of both cubes in a single cube and do apply_dimension to combine the bands as desired to a new cube. This would involve quite a bit more steps, but will result in more correct calculation:

  • before merge: rename bands to ensure 0 overlap. Also: if there are no bands yet: make sure there are
  • merge_cubes explicitly without overlap resolver to make sure bands are stacked
  • use apply_dimension (or maybe reduce_dimension in some cases) to implement the desired operation
  • remame bands again to what the user expects

Quite vital to get this working is that band name handling is correct and in line with how it works backend-side. This might be a bit challenging with load_stac use cases where band detection can be a bit fuzzy.

other related issues:

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

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

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

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 Open-EO/openeo-python-client

Tất cả issue của Open-EO/openeo-python-client

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.