Skip to main content

Tool to generate podaac forge and tig configurations

Project description

HitideConfigGenerator

Overview

HitideConfigGenerator is a Python class designed to generate configuration objects adhering to a specified JSON schema. It allows users to specify key parameters for HiTIDE processing and validates the generated configuration against a schema before saving it as a JSON file.

Features

  • Generate structured configuration objects for HiTIDE processing.
  • Supports optional parameters for customization.
  • Validates configuration against a predefined JSON schema.
  • Saves the configuration to a JSON file.

Installation

pip install podaac-forge-tig-config-generator

Usage

Creating a Configuration Generator Instance

from podaac.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 generated configuration includes:

  • Required Fields:
    • shortName (str): Dataset short name.
    • latVar (str): Latitude variable name.
    • lonVar (str): Longitude variable name.
    • is360 (bool): Whether longitude is in 0-360 format.
  • Optional Fields:
    • timeVar (str): Time variable name.
    • tiles (dict): Grid tiling configuration.
    • global_grid (bool): Indicates if global grid is used.
    • footprinter (str): Footprint generation method.
    • tolerance (float): Processing tolerance.
    • footprint (dict): Includes footprinting strategies (OpenCV, Alpha Shape, etc.).
    • imgVariables (list of dict): List of image-related variables.
    • image (dict): Image configuration, defaults to {"ppd": 4, "res": 8}.

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

podaac_forge_tig_config_generator-0.1.0.tar.gz (9.0 kB view details)

Uploaded Source

Built Distribution

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

File details

Details for the file podaac_forge_tig_config_generator-0.1.0.tar.gz.

File metadata

File hashes

Hashes for podaac_forge_tig_config_generator-0.1.0.tar.gz
Algorithm Hash digest
SHA256 48ca0f8ad75102b650a43502520345894b9a65cf8e038da928bf69a27847cc50
MD5 165f534c83ba969c211300af579a71e4
BLAKE2b-256 4884af995336e81a3e69fbffb9dd0f87f82f04cdc1ee1ccb9dc8b4026b2ca921

See more details on using hashes here.

File details

Details for the file podaac_forge_tig_config_generator-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for podaac_forge_tig_config_generator-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7d2ebb9cf794e01653cf857594369298da69bb268951bcf78ab87f51cca12df7
MD5 ebff12be0144db9c8d2589254347007f
BLAKE2b-256 20d343054092ed82013fe1d03b7a15677a8bad68db6eae8c4062e57d9e0325e4

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