Median values and percentiles in FISRequest

Currently, the FISRequest returns mean, min, max, stdev. Can it be extended to return median or better still user-specified percentile?

Not at the moment, but we have this in plans for the next iteration of the FIS API, planned to come in a few months.

1 Like

Hi @gmilcinski - is this now available via the statistical API? meaning, can we request median or even define custom statistical function?

Indeed, Statistical API does allow for definition of percentiles, including median. Custom statististical function is currently not supported.

See this example:

How can I implement it in Python API?
For example here:

sd = β€˜2022-05-10’ # start date
ed = β€˜2022-05-11’ # end date
sn2_ndvi_request = SentinelHubStatistical(
aggregation=SentinelHubStatistical.aggregation(
evalscript=sn2_ndvi_evalscript,
time_interval=(sd, ed),
aggregation_interval=β€œP1D”,
resolution=(0.0001, 0.0001),
),
input_data=[SentinelHubStatistical.input_data(DataCollection.SENTINEL2_L2A)],
geometry=poly,
config=config,
)

found it :slight_smile:

sd = '2022-05-10' # start date
ed = '2022-05-11' # end date


calcs = {"ndvi": {"statistics": {"default":{"percentiles":{"k":[50]}}}}}


sn2_ndvi_request = SentinelHubStatistical(
                                        aggregation=SentinelHubStatistical.aggregation(
                                        evalscript=sn2_ndvi_evalscript,
                                        time_interval=(sd, ed),
                                        aggregation_interval="P1D",
                                        resolution=(0.0001, 0.0001),
                                        ),
                                        input_data=[SentinelHubStatistical.input_data(DataCollection.SENTINEL2_L2A)],
                                        geometry=poly,
                                        config=config,
                                        calculations=calcs
                                            )

sn2_ndvi_stats = sn2_ndvi_request.get_data()[0]

It is possible to drop the β€œmin” and β€œmax”? would that reduce the number of PU?

No, Statistical API response always contains β€œmin” and β€œmax” values. However, this does not impact your PU consumption.