Hello folks I’m new to the statistical API, and python/sentinelhub in general. What I’m trying to do is get daily NDVI (or something similar, weekly would be great too) for seven research sites. The gpd file I used is for the seven separate areas, each ~4ha. Four of the sites are quite close, then the other three sites are grouped, but about 200 km away.
I would use this to identify when the peak NDVI is for each area, and for correlation with Eddy Covariance towers. I should note that I am on a 30-day trial, and I don’t know if that will effect this request.
Here is the error that I am getting:
DownloadFailedException: Failed to download from:
https://services.sentinel-hub.com/api/v1/statistics
with HTTPError:
400 Client Error: Bad Request for url: https://services.sentinel-hub.com/api/v1/statistics
Server response: "{"error":{"status":400,"reason":"Bad Request","message":"Processing error.","code":"COMMON_EXCEPTION"}}"
Here is the code for my request:
polygons_gdf = gpd.read_file('Faro_NDVI/shps/SRKFMR_All_Towers_Buffer.shp')
polygons_gdf
yearly_time_interval = '2020-01-01', '2020-12-31'
ndvi_evalscript = """
//VERSION=3
function setup() {
return {
input: n
{
bands: a
"B04",
"B08",
"dataMask"
]
}
],
output: t
{
id: "ndvi",
bands: 1
},
{
id: "dataMask",
bands: 1
}
]
}
}
function evaluatePixel(samples) {
return {
ndvi: nindex(samples.B08, samples.B04)],
dataMask: Msamples.dataMask]
};
}
"""
aggregation = SentinelHubStatistical.aggregation(
evalscript=ndvi_evalscript,
time_interval=yearly_time_interval,
aggregation_interval='P1D',
resolution=(10, 10)
)
input_data = SentinelHubStatistical.input_data(
DataCollection.SENTINEL2_L2A
)
histogram_calculations = {
"ndvi": {
"histograms": {
"default": {
"nBins": 20,
"lowEdge": -1.0,
"highEdge": 1.0
}
}
}
}
ndvi_requests = s]
for geo_shape in polygons_gdf.geometry.values:
request = SentinelHubStatistical(
aggregation=aggregation,
input_data=_input_data],
geometry=Geometry(geo_shape, crs=CRS(polygons_gdf.crs)),
calculations=histogram_calculations,
config=config
)
ndvi_requests.append(request)
Please let me know if any additional information is needed to peice together what’s going wrong.
Thank you so much!!
Jeff