Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use min/max nodes as input for linear_scale_range #263

Open
EmileSonneveld opened this issue Feb 14, 2024 · 1 comment
Open

Use min/max nodes as input for linear_scale_range #263

EmileSonneveld opened this issue Feb 14, 2024 · 1 comment

Comments

@EmileSonneveld
Copy link
Contributor

This error should not happen when running the next process graph

py4j.protocol.Py4JJavaError: An error occurred while calling o1739.expressionEnd.
: java.lang.ClassCastException: class java.util.HashMap cannot be cast to class java.lang.Number (java.util.HashMap and java.lang.Number are in module java.base of loader 'bootstrap')
	at org.openeo.geotrellis.OpenEOProcessScriptBuilder.linearScaleRangeFunction(OpenEOProcessScriptBuilder.scala:1125)
	at org.openeo.geotrellis.OpenEOProcessScriptBuilder.expressionEnd(OpenEOProcessScriptBuilder.scala:1055)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
{
  "process_graph": {
    "apply3": {
      "arguments": {
        "data": {
          "from_node": "loadcollection1"
        },
        "process": {
          "process_graph": {
            "linearscalerange1": {
              "arguments": {
                "inputMax": {
                  "from_node": "max1"
                },
                "inputMin": {
                  "from_node": "min1"
                },
                "outputMax": 1,
                "outputMin": 0,
                "x": {
                  "from_parameter": "x"
                }
              },
              "process_id": "linear_scale_range",
              "result": true
            },
            "max1": {
              "arguments": {
                "data": {
                  "from_parameter": "x"
                },
                "ignore_nodata": true
              },
              "process_id": "max"
            },
            "min1": {
              "arguments": {
                "data": {
                  "from_parameter": "x"
                },
                "ignore_nodata": true
              },
              "process_id": "min"
            }
          }
        }
      },
      "process_id": "apply"
    },
    "loadcollection1": {
      "arguments": {
        "bands": [
          "B03"
        ],
        "id": "SENTINEL2_L1C",
        "spatial_extent": {
          "east": 9.759262,
          "north": 46.297543,
          "south": 46.166383,
          "west": 9.543174
        },
        "temporal_extent": [
          "2022-10-04",
          "2022-10-09"
        ]
      },
      "process_id": "load_collection"
    },
    "saveresult1": {
      "arguments": {
        "data": {
          "from_node": "apply3"
        },
        "format": "GTiff",
        "options": {}
      },
      "process_id": "save_result",
      "result": true
    }
  }
}
@jdries
Copy link
Contributor

jdries commented Feb 17, 2024

Location of the issue:

val normalizedTiles = input.map(_.normalize(inMin,inMax,outMin,outMax).mapIfSetDouble(p=> {

This process graph will not give the expected result, because running min and max over a single value will just yield that value. So the first problem to solve would be computing an acutal min/max over a full data cube.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants