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

Unexpected results for EVI process graph #171

Closed
m-mohr opened this issue May 23, 2022 · 3 comments
Closed

Unexpected results for EVI process graph #171

m-mohr opened this issue May 23, 2022 · 3 comments

Comments

@m-mohr
Copy link
Member

m-mohr commented May 23, 2022

I have the following process graph, which is meant to compute a monthly EVI value over a single year, which I'd like to have in a single file.

{
  "process_graph": {
    "1": {
      "arguments": {
        "data": {
          "from_node": "reduce_dimension_TDTKX9963G"
        },
        "period": "month",
        "reducer": {
          "process_graph": {
            "2": {
              "arguments": {
                "data": {
                  "from_parameter": "data"
                }
              },
              "process_id": "mean",
              "result": true
            }
          }
        }
      },
      "process_id": "aggregate_temporal_period"
    },
    "2": {
      "arguments": {
        "data": {
          "from_node": "3"
        },
        "dimension": "t",
        "process": {
          "process_graph": {
            "2": {
              "arguments": {
                "data": {
                  "from_parameter": "data"
                }
              },
              "process_id": "array_create",
              "result": true
            }
          }
        },
        "target_dimension": "bands"
      },
      "process_id": "apply_dimension"
    },
    "3": {
      "arguments": {
        "data": {
          "from_node": "1"
        },
        "label": "1",
        "name": "bands",
        "type": "bands"
      },
      "process_id": "add_dimension"
    },
    "load_collection_LUCZT2231M": {
      "arguments": {
        "bands": [
          "B08",
          "B04",
          "B02"
        ],
        "id": "SENTINEL2_L2A",
        "properties": {},
        "spatial_extent": {
          "east": 6.646557,
          "north": 50.82171,
          "south": 50.811346,
          "west": 6.631536
        },
        "temporal_extent": [
          "2018-01-01",
          "2019-01-01"
        ]
      },
      "description": "B08 = NIR, B04 = RED, B02 = BLUE",
      "process_id": "load_collection"
    },
    "reduce_dimension_TDTKX9963G": {
      "arguments": {
        "data": {
          "from_node": "load_collection_LUCZT2231M"
        },
        "dimension": "bands",
        "reducer": {
          "process_graph": {
            "6rgsd17e7": {
              "arguments": {
                "x": -7.5,
                "y": {
                  "from_node": "e5n3z9bta"
                }
              },
              "process_id": "multiply"
            },
            "72xvdpkex": {
              "arguments": {
                "x": {
                  "from_node": "v8dynjn0c"
                },
                "y": {
                  "from_node": "axbzqj0r0"
                }
              },
              "process_id": "add"
            },
            "7rz81lmvj": {
              "arguments": {
                "data": {
                  "from_parameter": "data"
                },
                "index": 0
              },
              "process_id": "array_element"
            },
            "8ftvtyz1w": {
              "arguments": {
                "x": {
                  "from_node": "7rz81lmvj"
                },
                "y": {
                  "from_node": "lg832392l"
                }
              },
              "process_id": "subtract"
            },
            "axbzqj0r0": {
              "arguments": {
                "x": 6,
                "y": {
                  "from_node": "lg832392l"
                }
              },
              "process_id": "multiply"
            },
            "e5n3z9bta": {
              "arguments": {
                "data": {
                  "from_parameter": "data"
                },
                "index": 2
              },
              "process_id": "array_element"
            },
            "el6umyy2u": {
              "arguments": {
                "x": 2.5,
                "y": {
                  "from_node": "8ftvtyz1w"
                }
              },
              "process_id": "multiply"
            },
            "lg832392l": {
              "arguments": {
                "data": {
                  "from_parameter": "data"
                },
                "index": 1
              },
              "process_id": "array_element"
            },
            "pzpe4qrxw": {
              "arguments": {
                "x": {
                  "from_node": "72xvdpkex"
                },
                "y": {
                  "from_node": "6rgsd17e7"
                }
              },
              "process_id": "add"
            },
            "v8amok3l5": {
              "arguments": {
                "x": {
                  "from_node": "el6umyy2u"
                },
                "y": {
                  "from_node": "pzpe4qrxw"
                }
              },
              "process_id": "divide",
              "result": true
            },
            "v8dynjn0c": {
              "arguments": {
                "x": 1,
                "y": {
                  "from_node": "7rz81lmvj"
                }
              },
              "process_id": "add"
            }
          }
        }
      },
      "description": "Formula is:\n2.5 * (NIR - RED) / (1 + NIR + 6*RED + -7.5*BLUE)",
      "process_id": "reduce_dimension"
    },
    "save_result_ZZGVZ2715G": {
      "arguments": {
        "data": {
          "from_node": "2"
        },
        "format": "GTiff"
      },
      "process_id": "save_result",
      "result": true
    }
  }
}

There are some issues and strange things happening:

  1. The resulting values are not only between -1 and 1, but are usually between -0.1 and 3. Why?
  2. The resulting metadata has only a single band in the metadata although it should have 12.
  3. Why do I need to use add_dimension although I would expect that apply_dimension creates it? See apply_dimension: 'No band dimension' although meant to be created automatically #169
@m-mohr m-mohr changed the title Weird results for EVI process graph Unexpected results for EVI process graph May 23, 2022
@jdries
Copy link
Contributor

jdries commented Jun 24, 2022

EVI expects bands to be in the 0..1 range, wheras our digital numbers are 0..10000.
Could you try dividing band values by 10000 before computing EVI?

@m-mohr
Copy link
Member Author

m-mohr commented Jun 24, 2022

That should explain issue 1, but haven't checked yet. We should figure out a way to document this so that people are aware of the value ranges. We discussed this a couple of times already, so finally opened a dedicated issue for it: https://github.com/openEOPlatform/architecture-docs/issues/237

@soxofaan
Copy link
Member

related: last week I updated the "Getting started" page for python client, which originally also included wrong EVI calculation (because of missing digital number rescaling).
Proper rescaling is mentioned here: https://open-eo.github.io/openeo-python-client/basics.html#band-math

@m-mohr m-mohr closed this as completed Oct 19, 2022
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

3 participants