Metadata
Extraction
Calculate the Equivalent Number of Looks (ENL) for a linear-scaled backscatter measurement GeoTIFF file. |
|
Calculates the performance estimates specified in CARD4L NRB 1.6.9 for all noise power images if available. |
|
Evaluate the types of a metadata dictionary as extracted by e.g. |
|
Get geometry information for usage in STAC and XML metadata from a |
|
Gets the header size of a GeoTIFF file in bytes. |
|
Creates a single |
- cesard.metadata.extract.calc_enl(tif, block_size=30, return_arr=False, decimals=2)[source]
Calculate the Equivalent Number of Looks (ENL) for a linear-scaled backscatter measurement GeoTIFF file. The calculation is performed block-wise for the entire image and by default the median ENL value is returned.
- Parameters:
tif (
str) – The path to a linear-scaled backscatter measurement GeoTIFF file.block_size (
int) –- The block size to use for the calculation. Remainder pixels are discarded,
if the array dimensions are not evenly divisible by the block size. Default is 30, which calculates ENL for 30x30 pixel blocks.
return_arr (
bool) – If True, the calculated ENL array is returned. Default is False.decimals (
int) – Number of decimal places to round the calculated ENL value to. Default is 2.
- Raises:
RuntimeError – if the input array contains only NaN values
- Return type:
- Returns:
If return_enl_arr=True, an array of ENL values is returned. Otherwise, the median ENL value is returned. If the ENL array contains only NaN and return_enl_arr=False, the return value is None.
References
[1]
- cesard.metadata.extract.calc_performance_estimates(files, decimals=2)[source]
Calculates the performance estimates specified in CARD4L NRB 1.6.9 for all noise power images if available.
- Parameters:
- Returns:
out – Dictionary containing the calculated estimates for each available polarization.
- Return type:
- cesard.metadata.extract.evaluate_types(meta)[source]
Evaluate the types of a metadata dictionary as extracted by e.g.
s1ard.metadata.extract.meta_dict(). Currently allowed:
- cesard.metadata.extract.geometry_from_vec(vectorobject)[source]
Get geometry information for usage in STAC and XML metadata from a
spatialist.vector.Vectorobject.
- cesard.metadata.extract.get_header_size(tif)[source]
Gets the header size of a GeoTIFF file in bytes. The code used in this function and its helper function _get_block_offset were extracted from the following source:
Copyright (c) 2017, Even Rouault
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
- Parameters:
tif (
str) – A path to a GeoTIFF file of the currently processed ARD product.- Returns:
The size of all IFD headers of the GeoTIFF file in bytes.
- Return type:
header_size
- cesard.metadata.extract.vec_from_srccoords(coord_list, crs, layername='polygon')[source]
Creates a single
Vectorobject from a list of footprint coordinates of source scenes.- Parameters:
coord_list (
list[list[tuple[float,float]]]) – List containing for each source scene a list of coordinate pairs as retrieved from the metadata stored in anIDobject.crs (
int|str) – the coordinate reference system of the provided coordinates.layername (
str) – the layer name of the output vector object
- Return type:
- Returns:
the vector object
XML
Wrapper for |
|
Function to generate product-level metadata for an ARD product in OGC 10-157r4 compliant XML format. |
|
Function to generate source-level metadata for an ARD product in OGC 10-157r4 compliant XML format. |
- cesard.metadata.xml.parse(meta, target, assets, exist_ok=False)[source]
Wrapper for
source_xml()andproduct_xml().- Parameters:
meta (
dict[str,dict[str,Any]]) – Metadata dictionary generated by the satellite-specific ARD packages, e.g.s1ard.metadata.extract.meta_dict().target (
str) – A path pointing to the root directory of a product scene.assets (
list[str]) – List of paths to all GeoTIFF and VRT assets of the currently processed ARD product.exist_ok (
bool) – Do not create files if they already exist?
- Return type:
- cesard.metadata.xml.product_xml(meta, target, assets, nsmap, ard_ns, exist_ok=False)[source]
Function to generate product-level metadata for an ARD product in OGC 10-157r4 compliant XML format.
- Parameters:
meta (
dict[str,dict[str,Any]]) – Metadata dictionary generated by the satellite-specific ARD packages, e.g.s1ard.metadata.extract.meta_dict().target (
str) – A path pointing to the root directory of a product scene.assets (
list[str]) – List of paths to all GeoTIFF and VRT assets of the currently processed ARD product.nsmap (
dict[str,str]) – Dictionary listing abbreviation (key) and URI (value) of all necessary XML namespaces.ard_ns (
str) – Abbreviation of the ARD namespace. E.g., s1-nrb for the NRB ARD product.exist_ok (
bool) – Do not create files if they already exist?
- Return type:
- cesard.metadata.xml.source_xml(meta, target, nsmap, ard_ns, exist_ok=False)[source]
Function to generate source-level metadata for an ARD product in OGC 10-157r4 compliant XML format.
- Parameters:
meta (
dict[str,dict[str,Any]]) – Metadata dictionary generated by the satellite-specific ARD packages, e.g.s1ard.metadata.extract.meta_dict().target (
str) – A path pointing to the root directory of a product scene.nsmap (
dict[str,str]) – Dictionary listing abbreviation (key) and URI (value) of all necessary XML namespaces.ard_ns (
str) – Abbreviation of the ARD namespace. E.g., s1-nrb for the NRB ARD product.exist_ok (
bool) – Do not create files if they already exist?
- Return type:
STAC
Wrapper for |
|
Function to generate product-level metadata for an ARD product in STAC compliant JSON format. |
|
Function to generate source-level metadata for an ARD product in STAC compliant JSON format. |
- cesard.metadata.stac.parse(meta, target, assets, exist_ok=False)[source]
Wrapper for
source_json()andproduct_json().- Parameters:
meta (
dict[str,dict[str,Any]]) – Metadata dictionary generated by the satellite-specific ARD packages, e.g.s1ard.metadata.extract.meta_dict().target (
str) – A path pointing to the root directory of a product scene.assets (
list[str]) – List of paths to all GeoTIFF and VRT assets of the currently processed ARD product.exist_ok (
bool) – Do not create files if they already exist?
- Return type:
- cesard.metadata.stac.product_json(meta, target, assets, exist_ok=False)[source]
Function to generate product-level metadata for an ARD product in STAC compliant JSON format.
- Parameters:
meta (
dict[str,dict[str,Any]]) – Metadata dictionary generated by the satellite-specific ARD packages, e.g.s1ard.metadata.extract.meta_dict().target (
str) – A path pointing to the root directory of a product scene.assets (
list[str]) – List of paths to all GeoTIFF and VRT assets of the currently processed ARD product.exist_ok (
bool) – Do not create files if they already exist?
- Return type: