Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
ch-reck authored May 2, 2023
1 parent 64ca8d7 commit f79a921
Showing 1 changed file with 23 additions and 22 deletions.
45 changes: 23 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,35 +4,36 @@ Table controlled Earth Observation metadata extractor and STAC tool
*NOTE: the code for this repository will soon be published.*

## Usage
Example call (recommended only for quick testing, not recommended for mass execution)
```bash
S1_DATA=//path/LTA-RFP-1_SampleSentinelProducts/SENTINEL-1
./metadata_extract.py Sentinel-1-Metadata_v2.csv L1 $S1_DATA/S1A_IW_GRDH_1SDV_20200121T201716_20200121T201741_030903_038C0F_DAEC.SAFE.zip
```
Example calls
* Dump of extracted metadata from a SAFE.zip package
```bash
src/metadata_extract/extract.py --scene tests/data/S1A_IW_GRDH_1SDV_20220621T075323_20220621T075348_043758_053961_0000.SAFE.zip \
--mapping src/metadata_extract/mappings/S1_L1L2.csv
```
* Format the metadata using a jinja2 template - tool automatically determines sentinel-1, 2 or 3 product types following the file naming conventions and selects extraction mapping and output template
```
src/metadata_extract/metadata_extract.py --scene tests/data/S2A_MSIL1C_20230216T044851_N0509_R076_T46UEU_20230216T000000.SAFE.zip
```

* Mappings for S5p L2 and L3 are also included, but requires using --mapping and --template parameters
```
src/metadata_extract/extract.py --scene tests/data/S5P_OFFL_L2__O3_____20200303T013547_20200303T031717_12367_01_010107_20200306T053811.nc \
--mapping src/metadata_extract/mappings/S5P_TROPOMI_L2.csv \
--template src/metadata_extract/templates/s5p_l2_stack.j2
```

## Capabilities
* Loading of CSV xpath file is now separated (see function load_xpath)
* Read directly from zip and tar file based on file extension
* File path within CSV xpath file can include regular expression to find metadata xml file
* Xpath statement in CSV file supports now static/fixed values (example "=SENTINEL-2"): This value needs to start with an equals sign (=)
* Load CSV xpath file only once in mass execution
* Loading of CSV mapping file
* Read directly from zip, tar, tar.gz, tgz, nc based on file extension
* XPath extension functions

## Important to know
* Coordinates are in the format "Latitude,Longitude" (this is the default order for Sentinel-1 metadata). Points are separated by space. This order needs be reversed for GeoJSON output (e.g., for geoserver product.json/granules.json)

## Example execution in Python
```python
import sentinel_metadata_extract as sentinel_metadata

scene = '/mnt/data/esa-lta-rfp1/SENTINEL-2/S2B_OPER_MSI_L1C_TL_MPS__20191001T112642_A013418_T34UGA_N02.08.tar'
xpath_file = './Sentinel-2-Metadata_v2.csv'
xpath_csv_column = 'TL'

xpathQueries = sentinel_metadata.load_xpath(xpath_file, xpath_csv_column)
data = sentinel_metadata.extract(scene, xpathQueries)
```
from metadata_extract/extract import extract
extracted_metadata = extract(args.scene, mappings_file, dictFiller)
pprint.pprint(extracted_metadata, width=120)
## Example mass execution with Python
```bash
./example_extract.py ./Sentinel-1-Metadata_v2.csv L1 example_extract_s1.txt
```

0 comments on commit f79a921

Please sign in to comment.