Geographic Information Systems Asked by cordoba27 on May 11, 2021
I want to access SO2 data from Sentinel-5P on Google Earth Engine and get the mean values over a period of two years. According to the documentation (https://developers.google.com/earth-engine/datasets/catalog/COPERNICUS_S5P_OFFL_L3_SO2), the spatial resolution "for most products […] is 3.5x7km²".
Is there a way of extracting the data with this native spatial resolution to Google Drive?
I tried setting the scale using projection().nominalScale(), but the output was erroneous (the spatial resolution was approximately 100x100km²). This is the code I am using:
var sentinel5p = ee.ImageCollection('COPERNICUS/S5P/OFFL/L3_SO2')
.select('SO2_column_number_density')
.filterDate('2019-01-01', '2020-12-31')
.filterBounds(geometry);
var mean = sentinel5p.mean();
var output = mean.toFloat();
var native_resolution = output.projection().nominalScale();
Export.image.toDrive(
{
image: output,
folder: 'MyFolder',
description: 'output',
scale: native_resolution.getInfo(),
region: geometry
}
);
Whenever you perform a reduction on an image collection, such as sentinel5p.mean()
, the result does not have the default projection from the input. This is because image collections often have images with many different projections (because satellites may pass over the same location from different angles, producing different pixel grids), and Earth Engine's .projection()
does not attempt to list the entire collection to check if they all have the same projection.
Thus, var native_resolution = output.projection().nominalScale();
does not get you the native resolution of Sentinel-5P — rather, the composite's default projection is the generic WGS 84 1-degree-per-unit, so the number is just the figure of 111 km/degree at the Earth's equator.
In this case, it appears that Sentinel-5P images of different areas do have the same projection — I examined some samples to check:
var list = sentinel5p.toList(3);
print(list.map(function (image) {
return ee.Image(image).projection();
}));
So, in order to find the nominal scale, you need to use the projection of one of the images, not the composite.
var native_resolution = sentinel5p.first().projection().nominalScale();
print(native_resolution);
This prints a value of 1113 m, which is smaller than you're expecting — but remember that this is the figure of meters per stored image pixel, whereas the original data is in a different grid with a different orientation. We can even see this. Here's a closeup of part of the mean composite (limited to only a few images):
The smallest jagged edges visible at the mask reflect the 1.1 km pixel resolution of the images stored in Earth Engine (that is, I've zoomed in past the resolution of the image). The larger solid color rectangles reflect the resolution of the original sensor data — which you can see falls onto several different grids with different aspect ratios.
If you export using the scale and projection from sentinel5p.first()
then you will get an image that contains all of this information, but it will be blocky as above. If you export using a larger scale
number, you'll have fewer pixels (and thus slightly less of the original spatial information) but you'll be closer to the sampling resolution of the actual data. It's up to you to choose what your application actually needs.
But in neither case will you get an image which has pixels of 3.5 × 7 km resolution, because that's not what the dataset that has been stored in Earth Engine actually contains — it's been processed to have a consistent projection rather than to follow the satellite's sensor's swath.
Correct answer by Kevin Reid on May 11, 2021
From documentation you can see that the spatial resolution is a string type.
Since in GEE you can specify the spatial resolution quite easily, I suggest just specifying the scale manually in the export function like this:
Export.image.toDrive(
{
image: output,
folder: 'MyFolder',
description: 'output',
scale: 24500,
region: geometry
}
);
The scale is in meters/pixel.
Answered by AdoMath on May 11, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP