Python API Documentation

A list of tutorials in the form of python notebooks are available in the Examples section.

Sentinel-1

class sentinel1.Sentinel1(id=None, backend_url=None)[source]

Allows you to compute Sentinel-1 analysis ready data

__init__(id=None, backend_url=None)[source]

Create an instance of the sentinel1.Sentinel1

Parameters

id (str, optional) – unique id of your compute instance. If not specified, automatically generates a unique ID

set_output_crs(output_crs)[source]

Set the desired output CRS.

set self.output_crs to a specified EPSG code as an int. self.output_crs will define the EPSG of the output returned by Sentinel1.compute_ard()

Parameters

output_crs (int) – Desired output CRS number. By default the value 4326 is used.

Examples

>>> sentinel1 = Sentinel1()
>>> sentinel1.set_output_crs(3857)
>>> output = sentinel1.compute_ard(aoi, start_date, end_date)
output data will be in EPSG: 3857 instead of the default 4326
set_output_resolution(resolution)[source]

Set the desired output resolution.

This module uses the Interferometric Wide swath (IW) mode of level 1 Ground Range Detected (GRD) Sentinel 1 data. This provides a native pixel resolution of 10m x 10m. Please keep this native resolution in mind when up or downscaling the output ARD resolution.

set self.output_resolution to a specified output resolution in meters²/pixel. self.output_resolution will define the resolution of the output returned by Sentinel1.compute_ard()

Parameters

resolution (int) – desired output resolution. By default 10 meters²/pixel

Examples

>>> sentinel1 = Sentinel1()
>>> sentinel1.set_output_resolution(8)
>>> output = sentinel1.compute_ard(aoi, start_date, end_date)
output data resolution will be 8 meters²/pixel
enable_local_output(local_output_path='./generated')[source]

Enables the local output option.

sets self.save_to_local to True and sets self.local_output_path to the desired local output path string. The output will be saved in the specified directory.

Parameters

local_output_path (str) – path to local directory. By default ./generated

Examples

>>> sentinel1 = Sentinel1()
>>> sentinel1.enable_local_output()
>>> output = sentinel1.compute_ard(aoi, start_date, end_date)
compute_ard() will save the result and metadata in the ./generated folder
disable_local_output()[source]

Disables the local output option.

sets self.save_to_local to False The output will no longer be saved in the specified local directory.

Examples

>>> sentinel1 = Sentinel1()
>>> sentinel1.enable_local_output()
>>> sentinel1.disable_local_output()
>>> output = sentinel1.compute_ard(aoi, start_date, end_date)
results will be returned as a :py:class:`Sentinel1Result`.
compute_ard(aoi: Any, start_date: Union[str, datetime.date], end_date: Union[str, datetime.date], data_coverage=100, mosaic=True) sentinel1.Sentinel1Result[source]

Compute sentinel 1 ARD using the specified options.

This method computes Sentinel 1 data for the specified area and time of interest. you can use the other methods of the Sentinel1 in order to customize the behavior of this method.

Pre-processing steps are applied to the S1 data at this stage through the Snappy Graph Processing Framework (GPF) tool. Given here are the processing steps, and the GPF parameters used.

1. Border noise removal
GPF “Remove-GRD-Border-Noise” process set to True, with the “borderLimit” set to 2000, and the “trimThreshold” set to 0.5
2. Thermal noise removal
GPF “removeThermalNoise” process set to True
3. Radiometric calibration
GPF “outputSigmaBand” set to True, and “outputImageScaleInDb” set to False
4. Terrain correction
GPF options of:
“demName” set to “SRTM 3Sec”
“demResamplingMethod” set to “BILINEAR_INTERPOLATION”
“imgResamplingMethod” set to “BILINEAR_INTERPOLATION”
”saveProjectedLocalIncidenceAngle” set to True
“saveSelectedSourceBand” set to True
“pixelSpacingInMeter” set to “resolution”)
“alignToStandardGrid” set to True)
“standardGridOriginX” and “standardGridOriginY” set to 0
The “mapProjection” was set using the following projection:
proj = (
‘GEOGCS[“WGS84(DD)”,’
‘DATUM[“WGS84”,’
‘SPHEROID[“WGS84”, 6378137.0, 298.257223563]],’
‘PRIMEM[“Greenwich”, 0.0],’
‘UNIT[“degree”, 0.017453292519943295],’
‘AXIS[“Geodetic longitude”, EAST],’
‘AXIS[“Geodetic latitude”, NORTH]]’
)
Parameters
  • aoi (dict) – geojson feature or feature collection dictionary containing a polygon.

  • start_date (Union[str, datetime.date]) – defines the computation start date

  • end_date (Union[str, datetime.date]) – defines the computation end date

  • data_coverage (int) – Minimum required cover percentage.(by default 100% of coverage is required)

Returns

Sentinel1Result Sentinel1Result.ok is True if success and False otherwise. When

Raises

ValueError – input is invalid.

static load_ard_from_local(id: str, root_dir: str = './generated')[source]

Load a previous ARD computation result from local disk.

Parameters
  • id (str) – previously computed ARD id.

  • root_dir (str) – root directory where the ARD computation results are stored.

Returns

Sentinel1Result

Sentinel-1 Result

class sentinel1.Sentinel1Result(ok=True, reason=None)[source]

Class containing the result of Sentinel1.compute_ard()

ok

Sentinel1Result.ok is True when Sentinel1.compute_ard() returns usable data, False otherwise.

Type

bool

reason

Provides additional information when Sentinel1Result.ok is false and result is not accessible. if Sentinel1Result.ok is True, Sentinel1Result.reason will be None.

Type

str, None

items

List contraining Sentinel1ResultItem

Type

list

property status: pandas.core.frame.DataFrame

Returns the status for each scene as a DataFrame

Returns

DataFrame containing the status for each scene.

Raises

RuntimeError – Result not OK. when Sentinel1Result.ok is False

property dataset: xarray.core.dataset.Dataset

Returns a Dataset containing all the Items.

Returns

Dataset containing all the Items.

Raises

RuntimeError – Result not OK. when Sentinel1Result.ok is False

get_scene_metadata(as_dataframe=False) Union[pandas.core.frame.DataFrame, List[dict]][source]

Returns the metadata for each scene as a list or a DataFrame

Parameters

as_dataframe (bool) – (default is False) if set to True, returns the scene metadata as a DataFrame instead of a list.

Returns

List[dict] containing the scene metadata as dictionary for each available scenes. if as_dataframe is True, returns is as pd.DataFrame instead.

Sentinel-1 Result Item

class sentinel1.Sentinel1ResultItem(date, status, scene_metadata, data=None, reason=None, file_path=None, bucket_path=None)[source]

Class representing one result item from Sentinel1.compute_ard()

_redesign_dataset(ds)[source]

Reformat the metadata from the geotiff to a dict

__str__()[source]

Returns a formated representation of the result Item

get_scene_metadata() List[dict][source]

Allows you to access the scene metadata

get_processing_status() dict[source]

Returns multiple information about the processing status of this scene