Hi everyone,
I’m looking to make a function using the NDVI from S2, in order to get a very simple kind of harvest monitoring, where I would like to translate the NDVI values into information, such as, which state is the vegetation at (greening, browning). In the end, the user will have an idea of NDVI trending, in order to know if harvest period is coming, for example.
For now I’m using the max ndvi function present in the custom scripts repository for the last 2/ months, aggregated in 15 days - does anyone has any suggestion on how to integrate such function on the script? Would this be possible on statistical api?
Thanks in advance!
Base script:
curl -X POST https://services.sentinel-hub.com/api/v1/statistics
-H 'Content-Type: application/json'
-d '{
"input": {
"bounds": {
"bbox": x
35.3190435045249,
-5.448226300909312,
35.323560495475114,
-5.443729699090689
]
},
"data": a
{
"dataFilter": {},
"type": "sentinel-2-l2a"
}
]
},
"aggregation": {
"timeRange": {
"from": "2021-10-25T00:00:00Z",
"to": "2022-01-25T23:59:59Z"
},
"aggregationInterval": {
"of": "P15D",
"lastIntervalBehavior": "SHORTEN"
},
"width": 256,
"height": 169.666,
"evalscript": "//VERSION=3\nfunction setup() {\n return {\n input: u{\n bands: d\n \"B04\",\n \"B08\",\n \"SCL\",\n \"dataMask\"\n ]\n }],\n output: u\n {\n id: \"data\",\n bands: 3\n },\n {\n id: \"scl\",\n sampleType: \"INT8\",\n bands: 1\n },\n {\n id: \"dataMask\",\n bands: 1\n }]\n };\n}\n\nfunction evaluatePixel(samples) {\n let index = (samples.B08 - samples.B04) / (samples.B08+samples.B04);\n return {\n data: tindex, samples.B08, samples.B04],\n dataMask: ssamples.dataMask],\n scl: csamples.SCL]\n };\n}\n"
},
"calculations": {
"default": {}
}
}'