Sentinel-1 Tools

OSV

interface for management of S1 Orbit State Vector (OSV) files

removeGRDBorderNoise

Mask out Sentinel-1 image border noise.

class pyroSAR.S1.OSV(osvdir=None, timeout=300)[source]

Bases: object

interface for management of S1 Orbit State Vector (OSV) files

input is a directory which is supposed to contain, or already contains, OSV files. Two subdirectories are expected and created otherwise: one for Precise Orbit Ephemerides (POE) named POEORB and one for Restituted Orbit (RES) files named RESORB

Using method match() the corresponding POE (priority) or RES file is returned for a timestamp. Timestamps are always handled in the format YYYYmmddTHHMMSS.

Parameters:
catch(sensor, osvtype='POE', start=None, stop=None, url_option=1)[source]

check a server for files

Parameters:
  • sensor (Literal['S1A', 'S1B', 'S1C', 'S1D'] | list[Literal['S1A', 'S1B', 'S1C', 'S1D']]) – The S1 satellite(s)

  • osvtype (Literal['POE', 'RES']) – the type of orbit files required

  • start (str | None) – the date to start searching for files in format YYYYmmddTHHMMSS

  • stop (str | None) – the date to stop searching for files in format YYYYmmddTHHMMSS

  • url_option (int) –

    the OSV download URL option

Return type:

list[dict[str, Any]]

Returns:

the product dictionary of the remote OSV files, with href

clean_res()[source]

delete all RES files for whose date a POE file exists

Return type:

None

date(file, datetype)[source]

extract a date from an OSV file name

Parameters:
  • file (str) – the OSV file

  • datetype (Literal['publish', 'start', 'stop']) – one of three possible date types contained in the OSV filename

Return type:

str

Returns:

a time stamp in the format YYYYmmddTHHMMSS

getLocals(osvtype='POE')[source]

get a list of local files of specific type

Parameters:

osvtype (Literal['POE', 'RES']) – the type of orbit files required

Return type:

list[str]

Returns:

a selection of local OSV files

match(sensor, timestamp, osvtype='POE')[source]

return the corresponding OSV file for the provided sensor and time stamp. The file returned is one which covers the acquisition time and, if multiple exist, the one which was published last. In case a list of options is provided as osvtype, the file of higher accuracy (i.e. POE over RES) is returned.

Parameters:
  • sensor (Literal['S1A', 'S1B', 'S1C', 'S1D']) – The S1 satellite

  • timestamp (str) – the time stamp in the format ‘YYYmmddTHHMMSS’

  • osvtype (Literal['POE', 'RES'] | list[Literal['POE', 'RES']]) – the type of orbit files required; either ‘POE’, ‘RES’ or a list of both

Return type:

str | None

Returns:

the best matching orbit file (overlapping time plus latest publication date)

maxdate(osvtype='POE', datetype='stop')[source]

return the latest date of locally existing POE/RES files

Parameters:
  • osvtype (Literal['POE', 'RES']) – the type of orbit files required

  • datetype (Literal['publish', 'start', 'stop']) – one of three possible date types contained in the OSV filename

Return type:

str | None

Returns:

a timestamp in format YYYYmmddTHHMMSS

mindate(osvtype='POE', datetype='start')[source]

return the earliest date of locally existing POE/RES files

Parameters:
  • osvtype (Literal['POE', 'RES']) – the type of orbit files required

  • datetype (Literal['publish', 'start', 'stop']) – one of three possible date types contained in the OSV filename

Return type:

str | None

Returns:

a timestamp in format YYYYmmddTHHMMSS

retrieve(products, pbar=False)[source]

download a list of product dictionaries into the respective subdirectories, i.e. POEORB or RESORB

Parameters:
  • products (list[dict[str, Any]]) – a list of remotely existing OSV product dictionaries as returned by method catch()

  • pbar (bool) – add a progressbar?

Return type:

None

sortByDate(files, datetype='start')[source]

sort a list of OSV files by a specific date type

Parameters:
  • files (list[str]) – some OSV files

  • datetype (Literal['publish', 'start', 'stop']) – one of three possible date types contained in the OSV filename

Return type:

list[str]

Returns:

the input OSV files sorted by the defined date

pyroSAR.S1.removeGRDBorderNoise(scene, method='pyroSAR')[source]

Mask out Sentinel-1 image border noise. This function implements the method for removing GRD border noise as published by ESA [2] and implemented in SNAP and additionally adds further refinement of the result using an image border line simplification approach. In this approach the border between valid and invalid pixels is first simplified using the poly-line vertex reduction method by Visvalingam and Whyatt [4]. The line segments of the new border are then shifted until all pixels considered invalid before the simplification are again on one side of the line. See image below for further clarification.

Parameters:
  • scene (ID) – the Sentinel-1 scene object

  • method (Literal['pyroSAR', 'ESA']) –

    the border noise removal method to be applied; one of the following:

    • ’ESA’: the pure implementation as described by ESA

    • ’pyroSAR’: the ESA method plus the custom pyroSAR refinement

Return type:

None

../_images/S1_bnr.png

Demonstration of the border noise removal for a vertical left image border. The area under the respective lines covers pixels considered valid, everything above will be masked out. The blue line is the result of the noise removal as recommended by ESA, in which a lot of noise is still present. The red line is the over-simplified result using the Visvalingam-Whyatt method. The green line is the final result after further correcting the VW-simplified result.