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:
  • osvdir (str) – the directory to write the orbit files to

  • timeout (int or tuple or None) – the timeout in seconds for downloading OSV files as provided to requests.get()

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

check a server for files

Parameters:
  • sensor (str or list[str]) –

    The S1 mission(s):

    • ’S1A’

    • ’S1B’

    • [‘S1A’, ‘S1B’]

  • osvtype (str or list[str]) – the type of orbit files required

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

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

  • url_option (int) –

    the OSV download URL option

Returns:

the product dictionary of the remote OSV files, with href

Return type:

list[dict]

clean_res()[source]

delete all RES files for whose date a POE file exists

date(file, datetype)[source]

extract a date from an OSV file name

Parameters:
  • file (str) – the OSV file

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

Returns:

a time stamp in the format YYYYmmddTHHMMSS

Return type:

str

getLocals(osvtype='POE')[source]

get a list of local files of specific type

Parameters:

osvtype ({'POE', 'RES'}) – the type of orbit files required

Returns:

a selection of local OSV files

Return type:

list[str]

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 (str) –

    The S1 mission:

    • ’S1A’

    • ’S1B’

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

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

Returns:

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

Return type:

str

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

return the latest date of locally existing POE/RES files

Parameters:
  • osvtype ({'POE', 'RES'}) – the type of orbit files required

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

Returns:

a timestamp in format YYYYmmddTHHMMSS

Return type:

str

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

return the earliest date of locally existing POE/RES files

Parameters:
  • osvtype ({'POE', 'RES'}) – the type of orbit files required

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

Returns:

a timestamp in format YYYYmmddTHHMMSS

Return type:

str

retrieve(products, pbar=False)[source]

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

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

  • pbar (bool) – add a progressbar?

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

sort a list of OSV files by a specific date type

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

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

Returns:

the input OSV files sorted by the defined date

Return type:

list[str]

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 (pyroSAR.drivers.SAFE) – the Sentinel-1 scene object

  • method (str) –

    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

../_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.