Statistical API with data fusion for 2 different days

Hello!

We are trying to understand how could we build a script for Statistical API that leverages data fusion to combine two satellites but also a different day for each of those.

To be more specific, we would like for that script to combine data from Sentinel 2 L2A from a specific day with data from Planet from the next day (e.g. Jan 3 Sentinel 2 + Jan 4 Planet)

One way we thought it could work was building the data and aggregation payloads like this:

"data": [
  {
    "dataFilter": {
      "timeRange": {
        "from": "2023-01-03T00:00:00Z",
        "to": "2023-01-04T23:59:59Z"
      }
    },
    "id": "l2a",
    "type": "sentinel-2-l2a"
  },
  {
    "dataFilter": {
      "timeRange": {
        "from": "2023-01-04T00:00:00Z",
        "to": "2023-01-05T23:59:59Z"
      }
    },
    "id": "planet",
    "type": "byoc-***"
  }
]
"aggregation": {
  "timeRange": {
    "from": "2023-01-03T00:00:00Z",
    "to": "2023-01-05T23:59:59Z"
  },
  "aggregationInterval": {
    "of": "P1D"
  },
  "width": 512,
  "height": 733.85
}

The evaluate function pixel right now is just returning some bands to check:

function evaluatePixel(samples) {
  const l2a = samples.l2a
  const planet = samples.planet

  const B11 = l2a[0].B11
  const l2aDataMask = l2a[0].dataMask

  const NIR = getPlanetReflectanceUnit(planet[0].NIR)
  const RedEdge = getPlanetReflectanceUnit(planet[0].RedEdge)
  const planetDataMask = planet[0].dataMask

  return {
    l2a: [B11],
    planet: [NIR, RedEdge],
    dataMask: [l2aDataMask, planetDataMask],
  }
}

But this is not working as expected. So to be sure, a couple of questions about this:

  • When using Stats API, do time ranges within dataFilter in the data array work?
  • If we expand the aggregation time range to whole Jan month, we get two interval outputs, one for Jan 3 and one for Jan 8. This matches the dates S2 has available, why is it outputting only those? Should both satellites be present in a day to get a stats output for said day?
  • If by default mosaicking SIMPLE is set, why are we accessing a band like this samples.l2a[0].B11? What does the l2a array contain?

After more reading, we think that we should use mosaicking ORBIT and maybe preProcessScenes as well to filter out the exact dates we want for each satellite. Any ideas how we should approach this?

Are there any examples using Statistical API + Data Fusion + mosaicking ORBIT or TILE? We’ve read many docs and watched the webinars, but yet haven’t found anything.

Thanks in advance!

Hi Matias,

Thanks for the question, at the present time, there are no examples that use Statistical API + Data Fusion + mosaicking ORBIT or TILE.

Currently, when using Data Fusion and Mosaicking Statistical API returns statistics for all the dates for which the first requested data collection (in the request body) is available, regardless of availability of other requested data collections.

This means that in your case, both satellites need to be present in a day for you to return statistics for that date. This is a behaviour that we are looking to fix, but there is no set timescale for this.

Hey!

So just to be clear, right now it’s not possible in any way to do what we want right?
Even if we change the order, requesting first the Planet data collection?

If we request first Planet data collection and second Sentinel 2, would that match both dates? And if that matches both dates, could we use, for example, Jan 3 Sentinel-2 info combined with Jan 4 Planet info to get the stats of that fusion?

If this is not possible, we have the understanding that we can at least accomplish a visual result of this with the Process API right? Meaning we could combine Jan 3 Sentinel-2 with Jan 4 Planet to have a new heatmap image with the evaluated pixels. Is that possible?

Thanks!

Hi Matias,

Yes, I believe that is the case, that it is not currently possible. However, Data Fusion is fully supported in Process API so you can certainly achieve a result via this method.

Best, Will

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.