Skip to main content

Tool to generate podaac forge and tig configurations

Project description

HitideConfigGenerator

Overview

This package is used to create configuration JSON files which specify input parameters for the forge, forge-py and tig software - these software generate geographic coverage footprints and variable thumbnails for granules, which are utilized by user-facing services such as HiTIDE and Earthdata Search. The same config file is used as input to all 3 of these tools, with one file per collection. The config generator's intention is to simplify the process of making these config files, as well as validate the config file format against a predefined schema.

Features

  • Generate structured configuration objects for forge, forge-py, tig, and HiTIDE processing.
  • Supports optional parameters for customization.
  • Validates configuration against a predefined JSON schema.
  • Saves the configuration to a JSON file.

Installation

pip install forge-tig-config-generator

Usage

Creating a Configuration Generator Instance

from podaac.forge_tig_config_generator.generate_config import HitideConfigGenerator
import json

config_generator = HitideConfigGenerator(
    short_name="example_dataset",
    lat_var="latitude",
    lon_var="longitude",
    is360=False,
    time_var="time",
    footprinter="forge-py",
    strategy="open_cv",
    opencv_params={
       "pixel_height": 1000,
       "simplify":0.3,
       "min_area": 30,
       "fill_value": -99999.0,
       "fill_kernel": [30,30]
    },
    alpha_shape_params={
       "alpha":0.2,
       "thinning": {"method": "bin_avg", "value": [0.5, 0.5]},
       "cutoff_lat": 80,
       "smooth_poles": [78,80],
       "simplify" : 0.3,
       "min_area": 30,
       "fill_value": -99999.0
    },
    img_variables=[
        {
            "id": "sses_bias",
            "min": "-18.85",
            "max": "19.25",
            "palette": "paletteMedspirationIndexed"
        },
        {
            "id": "sses_standard_deviation",
            "min": "-18.85",
            "max": "19.25",
            "palette": "paletteMedspirationIndexed"
        }
    ],
    image={"ppd": 8, "res": 16}
)
config = config_generator.generate()
print(json.dumps(config, indent=4))

Generating and Saving the Configuration

config = config_generator.generate()
print(config)  # Outputs the generated configuration

This method:

  1. Generates a configuration dictionary.
  2. Validates the configuration against a predefined schema.
  3. Saves the configuration as a JSON file named <short_name>.cfg.

Methods

generate() -> dict

Generates a configuration object adhering to the specified schema.

  • Returns: dict - The generated configuration.
  • Raises: Exception if validation fails.

Configuration Schema

The arg names / values passed to HitideConfigGenerator become the keys / values in the dictionary and JSON. Because the main purpose of the JSON is to be used with forge-py and tig, the args relevant to each are split below. Detailed descriptions of these args are on the respective read-me pages (where the args are alternately referred to as "config parameters" or "fields"). Config files can be generated for use with either forge-py or tig separately, or both. It is only necessary to pass the args relevant to the software intended for use with the config file.

args relevant to forge-py footprinter

shortName (str, required), latVar (str, required), lonVar (str, required), is360 (bool, required), timeVar (str, optional), strategy (str, optional), open_cv (dict, optional), alpha_shape (dict, optional), shapely_linestring (dict, optional).

Detailed descriptions of the args can be found on the forge-py readme.

args relevant to tig image generation

shortName (str, required), latVar (str, required), lonVar (str, required), is360 (bool, required), imgVariables (list of dicts, required), image (dict, optional).

Detailed descriptions of the args can be found on the tig readme.

Example Output

{
    "shortName": "example_dataset",
    "latVar": "latitude",
    "lonVar": "longitude",
    "is360": false,
    "timeVar": "time",
    "footprinter": "forge-py",
    "footprint": {
        "strategy": "open_cv",
        "open_cv": {
            "pixel_height": 1000,
            "simplify": 0.3,
            "min_area": 30,
            "fill_value": -99999.0,
            "fill_kernel": [
                30,
                30
            ]
        },
        "alpha_shape": {
            "alpha": 0.2,
            "thinning": {
                "method": "bin_avg",
                "value": [
                    0.5,
                    0.5
                ]
            },
            "cutoff_lat": 80,
            "smooth_poles": [
                78,
                80
            ],
            "simplify": 0.3,
            "min_area": 30,
            "fill_value": -99999.0
        }
    },
    "imgVariables": [
        {
            "id": "sses_bias",
            "min": "-18.85",
            "max": "19.25",
            "palette": "paletteMedspirationIndexed"
        },
        {
            "id": "sses_standard_deviation",
            "min": "-18.85",
            "max": "19.25",
            "palette": "paletteMedspirationIndexed"
        }
    ],
    "image": {
        "ppd": 8,
        "res": 16
    }
}

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

forge_tig_config_generator-0.3.0.tar.gz (9.2 kB view details)

Uploaded Source

Built Distribution

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

forge_tig_config_generator-0.3.0-py3-none-any.whl (11.0 kB view details)

Uploaded Python 3

File details

Details for the file forge_tig_config_generator-0.3.0.tar.gz.

File metadata

File hashes

Hashes for forge_tig_config_generator-0.3.0.tar.gz
Algorithm Hash digest
SHA256 45968edfdebc4951e96e3f12c667f19f91bedcd39fe8a630ff907fbdd318f0c6
MD5 ab591eccd13b85fd901d00f97710e0f6
BLAKE2b-256 65b8da57ba2b61d9b4d39c8b9c49f7afaad418db3d72367b032ccc12d97bec06

See more details on using hashes here.

Provenance

The following attestation bundles were made for forge_tig_config_generator-0.3.0.tar.gz:

Publisher: build.yml on podaac/forge-tig-configuration

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file forge_tig_config_generator-0.3.0-py3-none-any.whl.

File metadata

File hashes

Hashes for forge_tig_config_generator-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fcb84df34ce7687b900e85b7531852c89624d03abda128ac87d9f88f7e3350c0
MD5 9928c7b5a96463a995ebe86f3f90effb
BLAKE2b-256 819f0f503f484a23c3f495a2e8f994e0d2e180888eb1abf02700dd01a36e1ab8

See more details on using hashes here.

Provenance

The following attestation bundles were made for forge_tig_config_generator-0.3.0-py3-none-any.whl:

Publisher: build.yml on podaac/forge-tig-configuration

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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