Hi, I have a question regarding the calculation of the reflectance standard deviation of a pixel: I’m currently working with spyder, but the standard deviation I obtain with the function “sd” is (very) different from the one I obtain by downloading them. Is there any problem with the NaN ingestion?
I paste below the code I’m using.
import openeo
from openeo.processes import is_nan, not_, sd, lte
import numpy as np
# %% Initialization
connection = openeo.connect("https://openeo.cloud")
connection.authenticate_oidc()
# Input variables
temp_ext = ["2020-01-31", "2020-12-31"] # fix temporal range
spat_extent={"west": 11.577, "south": 44.871, "east": 11.617, "north": 44.911} # fix spatial range
band=["B08"] # choose NIR band
maskband=["CLD","CLP"] # choose cloud mask bands
maskthr=50 # choose mask threshold
filt= (np.ones([5,5])/25).tolist() # create kernel weights
# S2 datacube
datacube = connection.load_collection(collection_id = "SENTINEL2_L1C_SENTINELHUB", spatial_extent = spat_extent, temporal_extent = temp_ext, bands = band,properties={"eo:cloud_cover": lambda x: lte(x, 70)}) # extract datacube of S2 L1C only if cloud cover <70
# mask datacube
mask0 = connection.load_collection(collection_id = "SENTINEL2_L2A_SENTINELHUB", spatial_extent = spat_extent, temporal_extent = temp_ext, bands = maskband,properties={"eo:cloud_cover": lambda x: lte(x, 70)}) # extract S2 L1C cloud probability
mask0 = mask0 >= maskthr
mask0 = mask0.band(maskband[0]).logical_or(mask0.band(maskband[1]))
mask0 = mask0.resample_cube_spatial(datacube)
# masking data
datacube=datacube.mask(mask0) # filter cloud mask
# %% CW mask calculation
s=datacube.apply_dimension(process='sd',dimension='t') # calculate S2 temporal standard deviation
s.download("std.nc", format="netcdf")
datacube.download("test.nc", format="netcdf")