API Documentation
Configuration
Stores GDAL configuration options for the current process. |
|
Returns a dictionary of additional parameters for pyroSAR.snap.util.geocode based on processing configurations provided by the config file. |
|
Returns the content of a config file as a dictionary. |
- ERS_NRB.config.gdal_conf(config)[source]
Stores GDAL configuration options for the current process.
- ERS_NRB.config.geocode_conf(config)[source]
Returns a dictionary of additional parameters for pyroSAR.snap.util.geocode based on processing configurations provided by the config file.
Processing
Ancillary Functions
Metadata
Extraction
Calculates the performance estimates specified in CARD4L NRB 1.6.9 for all noise power images for the current MGRS tile. |
|
Uses a pyroSAR metadata handler to get the parsed manifest and annotation XML data as a dictionary. |
|
Find a pattern in each annotation file provided and returns a list of results converted in |
|
Returns a metadata dictionary, which is generated from the ID of a product scene using a regular expression pattern and from a measurement GeoTIFF file of the same product scene using spatialist's Raster class. |
|
Creates a dictionary containing metadata for a product scene, as well as its source scenes. |
|
Creates a single spatialist.vector.Vector object from a list of footprint coordinates of source scenes. |
- ERS_NRB.metadata.extract.calc_performance_estimates(files, ref_tif)[source]
Calculates the performance estimates specified in CARD4L NRB 1.6.9 for all noise power images for the current MGRS tile.
- Parameters
- Returns
out – Dictionary containing the calculated estimates for each available polarization.
- Return type
- ERS_NRB.metadata.extract.convert_id_coordinates(coords, stac=False)[source]
Converts a list of coordinate pairs as retrieved by pyroSAR’s identify function to either envelop and center for usage in the XML metadata files or bbox and geometry for usage in STAC metadata files. The latter is returned if the optional parameter ‘stac’ is set to True, else the former is returned.
- Parameters
coords (list[tuple(float, float)]) – List of coordinate pairs as retrieved by pyroSAR.drivers.identify from source scenes
stac (bool, optional) – If set to True, bbox and geometry are returned for usage in STAC Items. If set to False (default) envelop and center are returned for usage in XML metadata files.
- Returns
envelop (str) – Acquisition footprint coordinates for the XML field ‘multiExtentOf’ in ‘eop:Footprint’
center (str) – Acquisition center coordinates for the XML field ‘centerOf’ in ‘eop:Footprint’
Notes
If stac=True the following parameters are returned instead of envelop and center:
- bbox: list[float]
Acquisition bounding box for usage in STAC Items. Formatted in accordance with RFC 7946, section 5: https://datatracker.ietf.org/doc/html/rfc7946#section-5
- geometry: GeoJSON Geometry Object
Acquisition footprint geometry for usage in STAC Items. Formatted in accordance with RFC 7946, section 3.1.: https://datatracker.ietf.org/doc/html/rfc7946#section-3.1
- ERS_NRB.metadata.extract.convert_spatialist_extent(extent)[source]
Converts the extent of a spatialist vector object to bbox and geometry as required for the usage in STAC Items: https://github.com/radiantearth/stac-spec/blob/master/item-spec/item-spec.md#item-fields
- Parameters
extent (dict) – The extent of a vector object as returned by spatialist.vector.Vector.extent
- Returns
bbox (list[float]) – Formatted in accordance with RFC 7946, section 5: https://datatracker.ietf.org/doc/html/rfc7946#section-5
geometry (GeoJSON Geometry Object) – Formatted in accordance with RFC 7946, section 3.1.: https://datatracker.ietf.org/doc/html/rfc7946#section-3.1
- ERS_NRB.metadata.extract.etree_from_sid(sid)[source]
Uses a pyroSAR metadata handler to get the parsed manifest and annotation XML data as a dictionary.
- Parameters
sid (pyroSAR.drivers.ID subclass object) – A pyroSAR metadata handler generated with pyroSAR.drivers.identify.
- Returns
A dictionary containing the parsed etree.ElementTree objects for the manifest and annotation XML files.
- Return type
- ERS_NRB.metadata.extract.find_in_annotation(annotation_dict, pattern, single=False, out_type=None)[source]
Find a pattern in each annotation file provided and returns a list of results converted in
- Parameters
annotation_dict (dict) – A dict of annotation files in the form: {‘swath ID’: lxml.etree._Element object}
pattern (str) – The pattern to search for in each annotation file.
single (bool) – If True, the results found in each annotation file are expected to be the same and therefore only a single value will be returned instead of a dict. Default is False.
out_type (str, optional) – Output type to convert the results to. Can be one of the following: str (default) float int
- Returns
out – A dict of the results containing a list for each of the annotation files. I.e., {‘swath ID’: list[str, float or int]}
- Return type
- ERS_NRB.metadata.extract.get_prod_meta(product_id, tif, src_scenes)[source]
Returns a metadata dictionary, which is generated from the ID of a product scene using a regular expression pattern and from a measurement GeoTIFF file of the same product scene using spatialist’s Raster class.
- Parameters
- Returns
A dictionary containing metadata for the product scene.
- Return type
- ERS_NRB.metadata.extract.get_uid_sid(filepath)[source]
Returns the unique identifier of a Sentinel-1 scene and a pyroSAR metadata handler generated using pyroSAR.drivers.identify
- Parameters
filepath (str) – Filepath pointing to a Sentinel-1 scene.
- Returns
uid (str) – The last four characters of a Sentinel-1 filename, which is the unique identifier of the scene.
sid (pyroSAR.drivers.ID subclass object) – A pyroSAR metadata handler for the scene generated with pyroSAR.drivers.identify.
- ERS_NRB.metadata.extract.meta_dict(config, target, src_scenes, src_files, proc_time)[source]
Creates a dictionary containing metadata for a product scene, as well as its source scenes. The dictionary can then be utilized by metadata.xmlparser and metadata.stacparser to generate XML and STAC JSON metadata files, respectively.
- Parameters
config (dict) – Dictionary of the parsed config parameters for the current process.
target (str) – A path pointing to the root directory of a product scene.
src_scenes (list[str]) – A list of paths pointing to the source scenes of the product.
src_files (list[str]) – A list of paths pointing to the SNAP processed datasets of the product.
proc_time (datetime.datetime) – The datetime object used to generate the unique product identifier from.
- Returns
meta – A dictionary containing an extensive collection of metadata for product as well as source scenes.
- Return type
STAC
Function to generate product-level metadata for an NRB target product in STAC compliant JSON format. |
|
Function to generate source-level metadata for an NRB target product in STAC compliant JSON format. |
- ERS_NRB.metadata.stacparser.main(meta, target, tifs)[source]
Wrapper for source_json and product_json.
- ERS_NRB.metadata.stacparser.product_json(meta, target, tifs)[source]
Function to generate product-level metadata for an NRB target product in STAC compliant JSON format.