Thanks for your quick response.
I am using below code:
def fetch_bands(date,full_geometry,config):
evalscript = “”"
//VERSION=3
function setup() {
return {
input: [{
bands: ["B02", "B03", "B04", "B08","dataMask"],
units: "DN"
}],
output: {
bands: 5,
sampleType: "INT16"
}
};
}
function updateOutputMetadata(scenes, inputMetadata, outputMetadata) {
outputMetadata.userData = { "norm_factor": inputMetadata.normalizationFactor }
}
function evaluatePixel(sample) {
if (sample.dataMask > 0) {
return [sample.B08,sample.B04, sample.B03, sample.B02,sample.dataMask]
}
}
"""
#print(date)
#print("#########")
request_multitype = SentinelHubRequest(
evalscript=evalscript,
input_data=[
SentinelHubRequest.input_data(
data_collection=DataCollection.SENTINEL2_L2A,
time_interval=(date, date + timedelta(days = 0)),
mosaicking_order=MosaickingOrder.LEAST_CC,
)
],
responses=[
SentinelHubRequest.output_response("default", MimeType.TIFF),
SentinelHubRequest.output_response("userdata", MimeType.JSON),
],
geometry=full_geometry,
#size=(512, 512),
#bbox=bbox,
#size=betsiboka_size,
config=config,
)
# print out information
multi_data = request_multitype.get_data()[0]
# normalize image
img = multi_data["default.tif"]
norm_factor = multi_data["userdata.json"]["norm_factor"]
img_float32 = img * norm_factor
#print(full_geometry)
return img_float32
Here instead of bounding box I am using geometry (sample below)
POLYGON ((76.1397489532828 18.3132526409186, 76.1401244625449 18.3132551872813, 76.140499971807 18.3132344980834, 76.1404697969556 18.3128725958676, 76.1403356865048 18.3125266077297, 76.1398914456367 18.3126068184727, 76.1395283415914 18.3125504799785, 76.1396503821015 18.3130094631094, 76.1397489532828 18.3132526409186))
So I want DN values for this area only? Can you please suggest if above approach is fine or is there any other better approach to do the same?