Skip to content
Extraits de code Groupes Projets
Valider 22dda0d5 rédigé par Dries De Bièvre's avatar Dries De Bièvre
Parcourir les fichiers

small change to s1_gee

parent c482d32a
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
%% Cell type:markdown id: tags:
# Load Sentinel-1 GRD
The Sentinel-1 mission provides data from a dual-polarization C-band Synthetic Aperture Radar (SAR) instrument at 5.405GHz (C band). This collection includes the S1 Ground Range Detected (GRD) scenes, processed using the Sentinel-1 Toolbox to generate a calibrated, ortho-corrected product. The collection is updated daily. New assets are ingested within two days after they become available.
All information concerning *Sentinel-1 SAR GRD: C-band Synthetic Aperture Radar Ground Range Detected* are available [here](https://developers.google.com/earth-engine/datasets/catalog/COPERNICUS_S1_GRD)
%% Cell type:markdown id: tags:
```javascript
// Load Sentinel-1 GRD
var sentinel_1 = ee.ImageCollection("COPERNICUS/S1_GRD");
// Print properties of the first image in the collection
print(sentinel_1.first().getInfo());
%% Cell type:markdown id: tags:
Earth Engine uses the following preprocessing steps (as implemented by the Sentinel-1 Toolbox) to derive the backscatter coefficient in each pixel ([source](https://developers.google.com/earth-engine/guides/sentinel1)) :
1. Apply orbit file
- Updates orbit metadata with a restituted orbit file (or a precise orbit file if the restituted one is not available).
2. GRD border noise removal
- Removes low intensity noise and invalid data on scene edges.
3. Thermal noise removal
- Removes additive noise in sub-swaths to help reduce discontinuities between sub-swaths for scenes in multi-swath acquisition modes.
4. Radiometric calibration
- Computes backscatter intensity using sensor calibration parameters in the GRD metadata.
5. Terrain correction (orthorectification)
- Converts data from ground range geometry, which does not take terrain into account, to σ° using the SRTM 30 meter DEM or the ASTER DEM for high latitudes (greater than 60° or less than -60°).
6. Converstion to dB
- The final terrain-corrected values are converted to decibels via log scaling (10*log10(x)) because it can vary by several orders of magnitude?
%% Cell type:markdown id: tags:
> **📝 Note:**
> - Radiometric Terrain Flattening is not being applied due to artifacts on mountain slopes.
> - Sentinel-1 SLC data cannot currently be ingested, as Earth Engine does not support images with complex values due to inability to average them during pyramiding without losing phase information.
%% Cell type:markdown id: tags:
For more information about these pre-processing steps, please refer to the [Sentinel-1 Pre-processing article](https://developers.google.com/earth-engine/guides/sentinel1). For further advice on working with Sentinel-1 imagery, see [Guido Lemoine's tutorial](https://developers.google.com/earth-engine/tutorials/community/sar-basics) on SAR basics and [Mort Canty's tutorial](https://developers.google.com/earth-engine/tutorials/community/detecting-changes-in-sentinel-1-imagery-pt-1) on SAR change detection.
%% Cell type:markdown id: tags:
## Filter Sentinel-1 data
Using the .filter() function, you can filter the image collection based on
* Instrument mode (IW / EW/ SM)
* Polarisation (VV/ VH/ HH/ HV)
* Orbit direction (ascending/ descending)
* Date
* Area
**Comparison of the instrument modes**
| Mode | Swath Width | Resolution (m) | Best Use Case |
|-------|------------|----------------|---------------|
| **IW** | 250 km | 5 × 20 | Land monitoring, interferometry (primary mode) |
| **EW** | 400 km | 20 × 40 | Ocean, sea ice, oil spill monitoring |
| **SM** | 375 km | 5 × 5 | High-res monitoring, disaster response |
%% Cell type:markdown id: tags:
```javascript
// Define time period, polarisation and orbit direction
var startDate = '2019-01-01';
var endDate = '2019-12-31';
var polarisation = 'VV';
var orbitDirection = 'DESCENDING';
var instrument = 'IW';
// Import FAO Administrative boundaries
var fao_level0 = ee.FeatureCollection("FAO/GAUL/2015/level0");
var fao_level1 = ee.FeatureCollection("FAO/GAUL/2015/level1");
// Obtain Belgium boundary
var belgium = fao_level0.filter("ADM0_NAME == 'Belgium'");
// Obtain Walloon Region boundary
var wallonia = fao_level1.filter("ADM1_CODE == 602");
// Select S1 IW images in area of interest and time period
var s1_filter = sentinel_1
.filter(ee.Filter.eq('instrumentMode', instrument))
.filter(ee.Filter.listContains('transmitterReceiverPolarisation', polarisation))
.select(polarisation)
.filter(ee.Filter.eq('orbitProperties_pass', orbitDirection))
.filterDate(startDate, endDate)
.filterBounds(belgium);
// Print properties of the image collection
print(s1_filter.getInfo())
%% Cell type:markdown id: tags:
## Compute S1 composites
Reducers are the way to aggregate data over time, space, bands, arrays and other data structures in Earth Engine. The `ee.Reducer` class specifies how data is aggregated. The reducers in this class can specify a simple statistic to use for the aggregation (e.g. minimum, maximum, mean, median, standard deviation, etc.), or a more complex summary of the input data (e.g. histogram, linear regression, list).
Reductions may occur over :
- **time (`imageCollection.reduce()`),**
- space (`image.reduceRegion()`, `image.reduceNeighborhood()`),
- bands (`image.reduce()`),
- attribute space of a `FeatureCollection`** (`featureCollection.reduceColumns()` or `FeatureCollection` methods that start with `aggregate_`).
Consider the example of needing to take the median over a time series of images represented by an `ImageCollection`. To reduce an `ImageCollection`, use `imageCollection.reduce()`. This reduces the collection of images to an individual image. Specifically, the output is computed pixel-wise, such that each pixel in the output is composed of the median value of all the images in the collection at that location. To get other statistics, such as mean, sum, variance, an arbitrary percentile, etc., the appropriate reducer should be selected and applied.
%% Cell type:markdown id: tags:
> **📝 Note:**
> For basic statistics like min, max, mean, etc., `ImageCollection` has shortcut methods like `min()`, `max()`, `mean()`, etc. They function in exactly the same way as calling `reduce()`, except the resultant band names will not have the name of the reducer appended.
%% Cell type:markdown id: tags:
**To composite images in an `ImageCollection`, use `imageCollection.reduce()`. This will composite all the images in the collection to a single image representing, for example, the min, max, mean or standard deviation of the images.**
%% Cell type:markdown id: tags:
![reducer](Reduce_ImageCollection.png)
%% Cell type:markdown id: tags:
```javascript
// Compute mean over a period and clip to the ROI extent
var startPeriod = '2019-01-01';
var endPeriod = '2019-03-31';
var s1_median = s1_filter
.filterDate(startPeriod, endPeriod)
.reduce(ee.Reducer.median())
.clip(belgium);
// Compute standard deviation over a period and clip to the ROI extent
var s1_std = s1_filter
.filterDate(startPeriod, endPeriod)
.reduce(ee.Reducer.stdDev())
.clip(belgium);
print(s1_median.getInfo());
%% Cell type:markdown id: tags:
## Visualisation
Results can be visualised in the 'map' window of GEE.
%% Cell type:markdown id: tags:
```javascript
// Center the map on your ROI
Map.centerObject(belgium, 12);
// Visualise the composites (mean and standard deviation)
Map.addLayer(s1_median, {min: -25, max: 5}, 'yearly mean');
Map.addLayer(s1_std, {min: 0, max: 4}, 'yearly std');
%% Cell type:markdown id: tags:
## Export results to Google Drive
%% Cell type:markdown id: tags:
```javascript
// Get projection of the original image
var projection = s1_filter.first().projection().getInfo();
// Export the image, specifying the CRS, transform, and region.
Export.image.toDrive({
image: s1_median,
description: 'mean_Q1_belgium',
folder: 'LBRAT2104',
crs: projection.crs, // The base coordinate reference system of this projection (e.g. 'EPSG:4326')
crsTransform: projection.transform, // The transform between projected coordinates and the base coordinate system
region: belgium
});
%% Cell type:markdown id: tags:
## Composites over multiple time periods
You can also iterate over months and years to compute a monthly mean/median composite for a given region of interest.
The .map() function works like a for-loop. It is used to iterate over all **years** and **months** and compute a composite.
%% Cell type:markdown id: tags:
```javascript
// List of months
var months = ee.List.sequence(1, 12);
print("Months : ",months);
// List of years
var years = ee.List.sequence(2019, 2019);
print("Years : ",years);
// Use .map() to compute monthly composite and clip them to the ROI
var monthly_median = ee.ImageCollection.fromImages(
years.map(function (y) {
return months.map(function (m) {
return s1_filter
.filter(ee.Filter.calendarRange(y, y, 'year'))
.filter(ee.Filter.calendarRange(m, m, 'month'))
.reduce(ee.Reducer.median())
.set('year',y)
.set('month',m);
});
})
.flatten())
.map(function(image){return image.clip(belgium)});
%% Cell type:markdown id: tags:
You can use the `.filter()` function on the `year` and `month` property to filter for a composite of a particular month.
%% Cell type:markdown id: tags:
```javascript
var monthly_mean_sept2019 = monthly_mean.filter(ee.Filter.eq('year', 2019))
.filter(ee.Filter.eq('month', 9));
print(monthly_mean_sept2019.first());
%% Cell type:markdown id: tags:
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter