Skip to main content

Set of stuff for ingesting, discovery, editing and storing DG IMD files

Project description

IMDiddler

A tool for editing IMD files either from local or s3 Can be deployed/invoked as a lambda or command line. IMD file order is preserved. IMD edits can be in arbitrary order

Editing Specifier

The edit to the imd is specified by a json string which maps the key/value pairs and simply replaces an existing key/value pair in the IMD file with the key/value pair in the json string. There's no limit on how long you make the edit specifiers you can edit one or all the items in an IMD with a single specifier. It is a simple overlaying operation. The one special consideration is for the 'BEGIN_GROUP/END_GROUP' pair, discussed below. One can specify any of the types in the IMD. The following edits are for each of the individual types #####String

'{"version": "\\"28.4\\";"}'

#####Integer

'{"numRows": 6932;"}'

#####Date

'{"generationTime": 2017-08-01T03:39:53.000000Z;"}'

You get the idea...

####Groups IMDs contain a BEGIN_GROUP= and END_GROUP= for bands, images and products. The naming scheme is the disambiguator. You can edit the contents of a group by specifying the name of the group within the IMD as a key and then a sub-dictionary of key/value pairs to be applied within the group. The following edits the "IMAGE_1" group in the IMD, replacing the satellite name.

'"IMAGE_1": {"satId": "\\"WV09\\";"}}'

Invocation

The code can be invoked either via the command line or as a lambda.

Command line

python imd_handler.py <input file/s3 object> <edit[s]>

The input file is a file URI, self explanatory (any valid path, read/write access required)

file:///Volumes/GKW/Sibinacocha2017/1cc99383-29fd-470a-a3ac-22431193b65a/103001006A803400/056848496010_01/056848496010_01_P001_MUL/17MAY12150511-M1BS-056848496010_01_P001.IMD

The s3 Object is an S3 URI specifying the bucket and path for the name ie:

s3://727281582563-deliveries/production/I00000070198_01/I00000070198_01_P001_MUL/18APR05102137-M1BS_R1C1-I00000070198_01_P001.IMD

As a lambda

It's deployed as IMDiddler. The event dictionary/payload should look like:

{
    "file_uri":  "<input file/s3 object>"
    "edit" : 
    {
        "<edit tag>" : "<edit value>"
    }
}

#####Lambda Example payload

{
    "file_uri" :  "s3://727281582563-deliveries/production/I00000070198_01/I00000070198_01_P001_MUL/18APR05102137-M1BS_R1C1-I00000070198_01_P001.IMD"
    "edit" : 
    {
        "version": "\"28.4\";",
        "IMAGE_1": {"satId": "\"WV09;\""}
    }
}

#####Nota Bene: IMD Files contain quoted strings which means that the edits performed must also contain the quotes. This means that the JSON quote escapement mechanism must be used for string types. Other types (float, int, date) do not need this.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

imd_handler-0.0.422.tar.gz (4.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

imd_handler-0.0.422-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

File details

Details for the file imd_handler-0.0.422.tar.gz.

File metadata

  • Download URL: imd_handler-0.0.422.tar.gz
  • Upload date:
  • Size: 4.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.14.2 setuptools/40.3.0 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.6.1

File hashes

Hashes for imd_handler-0.0.422.tar.gz
Algorithm Hash digest
SHA256 1ecd85013af065b6cb6b63ad70bf561eb1853a06f6a8ea2929bd2e33a7f3a9fc
MD5 4f0793d7d2060513afa95b6ff3b14e9b
BLAKE2b-256 ad0b438a6fe9eb0eb1bf7c00452664f83946071f0a31046525c49fec381fca9b

See more details on using hashes here.

File details

Details for the file imd_handler-0.0.422-py3-none-any.whl.

File metadata

  • Download URL: imd_handler-0.0.422-py3-none-any.whl
  • Upload date:
  • Size: 5.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.14.2 setuptools/40.3.0 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.6.1

File hashes

Hashes for imd_handler-0.0.422-py3-none-any.whl
Algorithm Hash digest
SHA256 a7f18072d262133ee5998f332e014463a26a7c5a6490896176f098a72ce5513d
MD5 f8f608047d08ba6cb3298f7954194168
BLAKE2b-256 ebe8e2a1ab49273087bb43e5ce3826d7fd34f6aea7808654c7ce6ac1ccda591e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page