Open-EO / Open-EO/openeo-python-client

Math processes on the top-level / multiple save_results in process

Open
#609 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Python
Stars
217
Forks
56
Avg merge
1d 22h
Merged PRs (30d)
2

Description

Hi,

I have Python client code:

import openeo
from openeo.processes import power

connection = openeo.connect("https://earthengine.openeo.org").authenticate_basic("group2", "test123")

aoi = {
  "type": "Polygon",
  "coordinates": [
    [[-7.664532, 38.543869], [-7.689248, 38.141037], [-7.159228, 38.151837], [-7.11289, 38.554609], [-7.664532, 38.543869]]
  ]
}

EPSG = 32629

data = connection.load_collection(
  collection_id = "COPERNICUS/S2_SR_HARMONIZED",
  spatial_extent = aoi,
  temporal_extent = ["2019-06-27T00:00:00Z", "2019-07-04T00:00:00Z"],
  bands = ["B1", "B2", "B3", "B4"]
)

# If we get multiple images (should not happen for the given extent), compute the mean
# Divide by 10000 to convert from DN to reflectance values
data = data.mean_time() / 10000

# Assign the indivdual bands to variables
B1 = data.band("B1")
B2 = data.band("B2")
B3 = data.band("B3")
B4 = data.band("B4")

# Density of cyanobacteria
cyanobacteria = 115530 * power((B3 * B4) / B2, 2.38)
save1 = cyanobacteria.save_result(
  format = "GTIFF",
  options = {
    "name": "cyanobacteria",
    "metadata": {
      "bands": [ { "statistics": { "minimum": 0, "maximum": 100 } } ]
    },
    "epsgCode": EPSG
  }
)

Unfortunately, I get the following error once I run result1 = connection.execute(save1):

Preflight process graph validation raised: [ProcessArgumentInvalid] The argument 'base' in process 'power' (namespace: n/a) is invalid: Schema for result 'reducedimension2' not compatible

Looking at the generated JSON, this is not overly surprising anymore:

grafik

Why does the client put power and multiply on the top-level? It works flawlessly with the divide by 10000 in apply.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the issue with the Python client code and inspect the generated process graph passed to connection.execute(save1). Compare how power and multiply are placed with the working divide-by-10000 expression and review the process-graph construction around these operations. Done means the generated graph passes preflight validation for the shown expression.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.