# source:
#   type: swift
#   kwargs:
#     username: !env '${OS_USERNAME_DOWNLOAD}'
#     password: !env '${OS_PASSWORD_DOWNLOAD}'
#     tenant_name: !env '${OS_TENANT_NAME_DOWNLOAD}'
#     tenant_id: !env '${OS_TENANT_ID_DOWNLOAD}'
#     region_name: !env '${OS_REGION_NAME_DOWNLOAD}'
#     auth_url: !env '${OS_AUTH_URL_DOWNLOAD}'
#     auth_version: !env '${ST_AUTH_VERSION_DOWNLOAD}'
#     user_domain_name: !env '${OS_USER_DOMAIN_NAME_DOWNLOAD}'

source:
  type: local
  kwargs:
    storage_path: /mnt/data/
target:
  type: swift
  kwargs:
    username: !env '${OS_USERNAME}'
    password: !env '${OS_PASSWORD}'
    tenant_name: !env '${OS_TENANT_NAME}'
    tenant_id: !env '${OS_TENANT_ID}'
    region_name: !env '${OS_REGION_NAME}'
    auth_version: !env '${ST_AUTH_VERSION}'
    auth_url: !env '${OS_AUTH_URL}'
    user_domain_name: !env '${OS_USER_DOMAIN_NAME}'
# target:
#   type: local
#   kwargs:
#     storage_path: /mnt/data/target

workdir: /mnt/data/workdir
keep_temp: true

# metadata file to look for in downloaded tar/zip file
metadata_glob: '*GSC*.xml'
glob_case: false

# extractors for Product type / level
type_extractor:
  xpath:
    - /gsc:report/gsc:opt_metadata/gml:using/eop:EarthObservationEquipment/eop:platform/eop:Platform/eop:shortName/text()
level_extractor:
  # xpath can also be a list of xpaths to be tried one after another
  xpath: substring-after(substring-after(/gsc:report/gsc:opt_metadata/gml:metaDataProperty/gsc:EarthObservationMetaData/eop:parentIdentifier/text(), '/'), '/')
preprocessing:
  defaults:
    move_files: true
    data_file_globs:
      - '*.tif'
    output:
      options:
        format: COG
        dstSRS: 'EPSG:4326'
        creationOptions:
          - BLOCKSIZE=512
          - COMPRESS=DEFLATE
          - NUM_THREADS=8
          - BIGTIFF=IF_SAFER
          - OVERVIEWS=AUTO
  types:
    AA01: #KS03 before
      nested: true
      data_file_globs:
        - '*.tif'
      additional_file_globs:
        - '*.rpc'
      georeference:
      stack_bands:
        # stack all bands for each scene in the product
        group_by: '.*/(.*)_P..tif'
        sort_by: '.*_P(R|G|B|N).tif'
        order:
          - R
          - G
          - B
          - N
    PH1B:
      nested: false
        