Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

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

未关闭
#748 0 条评论 0 个 reaction 已指派 1 人 在 GitHub 查看

维护者通常 1 天内回复

@soxofaan 已经在做这个了。

开始于 2025年3月10日。

评估

这个 Issue 还没有评估数据。

描述

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:

主要语言
Python
星标
219
派生
56
平均合并
2 天 21 小时
30 天内合并 PR
9

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

Open-EO/openeo-python-client 的其他 Issue

查看 Open-EO/openeo-python-client 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。