stactools-met-office-deterministic

0.4.2 · active · verified Mon Apr 13

stactools-met-office-deterministic is a Python package designed for generating SpatioTemporal Asset Catalog (STAC) metadata specifically for data originating from the Met Office Deterministic Numerical Weather Prediction model. It is part of the broader stactools ecosystem, which provides utilities for working with STAC. The current version is 0.4.2, and it typically sees rapid releases within the stactools-packages organization.

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to use `stactools-met-office-deterministic` to create a STAC Item from a Met Office Deterministic Numerical Weather Prediction model data file. It assumes the existence of a `stac.create_item` function, which is a common pattern across `stactools` dataset packages. Users should replace `/path/to/your/met_office_deterministic_data.nc` with the actual path to their NetCDF data file.

import pystac
from stactools.met_office_deterministic import stac

# Placeholder for your Met Office Deterministic NWP data file path
# Replace with an actual path to a NetCDF file from the Met Office UKV 2km deterministic forecast.
input_data_path = "/path/to/your/met_office_deterministic_data.nc"

# Assuming a 'create_item' function exists to generate a STAC Item from a data file
# The exact parameters may vary; this is a common pattern in stactools packages.
try:
    item = stac.create_item(input_data_path)
    print(f"Successfully created STAC Item: {item.id}")
    print(f"Item datetime: {item.datetime}")
    # Optionally, save the item to a file
    # item.save_object(dest_href='/tmp/met_office_item.json')
except AttributeError:
    print("Error: 'stac.create_item' or similar function not found or failed. "
          "Please refer to the actual library source or a more detailed example if available.")
except FileNotFoundError:
    print(f"Error: Input data file not found at {input_data_path}. Please provide a valid path.")
except Exception as e:
    print(f"An unexpected error occurred: {e}")

view raw JSON →