Trying to download Sentinel-5P data returns images full of NaNs

Hello everyone,

We are trying to download data from Sentinel-5P using the Sentinel Hub Python interface. The problem is that depending on the time interval we give we retrieve images with data or images full of NaN, even though in EO Browser we can check that there is available data for our area of interest.

For instance, if we use the time interval (‘2023-03-01’, ‘2023-03-05’) we retrieve images with data, but if we use the time time interval (‘2023-03-01’, ‘2023-03-06’) we don’t.

I show the code here.

script = """
            //VERSION=3
            function setup() {
                return {
                    input: [{
                        bands: ["CO","dataMask"],
                        units: "DN"
                    }],
                    output: {
                        bands: 2,
                        sampleType: "FLOAT32"
                    }
                };
            }

            function evaluatePixel(sample) {
                return [sample.CO,sample.dataMask];
            }
        """

request_bands = SentinelHubRequest(
	data_folder='downloads',
	evalscript=script,
	input_data=[
		SentinelHubRequest.input_data(
			data_collection=data_collection,
			time_interval=time
		)
	],
	responses=[
		SentinelHubRequest.output_response('default', MimeType.TIFF)
	],
	bbox=bbox,
	size=bbox_to_dimensions(bbox, resolution=5000),
	config=config
)

request_bands.save_data()

If we open the downloaded mosaic with rasterio, we can see the following for the “valid” time interval:

array([[[0.03212024, 0.03212024, 0.03895947],
        [0.03337331, 0.03337331, 0.0407076 ],
        [0.03435842, 0.03435842,        nan]],

       [[1.        , 1.        , 1.        ],
        [1.        , 1.        , 1.        ],
        [1.        , 1.        , 0.        ]]], dtype=float32)

But we can see this with the “invalid” time interval:

array([[[nan, nan, nan],
        [nan, nan, nan],
        [nan, nan, nan]],

       [[ 0.,  0.,  0.],
        [ 0.,  0.,  0.],
        [ 0.,  0.,  0.]]], dtype=float32)

Hi @fran ,

It is by design as the S5P coverage should be almost daily and you should request the date you are interested in. Please see the documentation for more details.

1 Like

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.