Skip to main content

Read and write ARL meteorological files.

Project description

arl-met

Tests Documentation Code Quality codecov PyPI version Python Version License: MIT Ruff Pyright

Read, write, subset, and sample NOAA ARL meteorological files.

arl-met provides a Python-first interface to the ARL packed meteorology format used by HYSPLIT and related workflows. It supports:

  • low-level record-preserving reads and writes through File, RecordSet, and DataRecord
  • xarray Dataset reads and common-case writes through open_dataset() and write_dataset()
  • crop-before-unpack subset extraction with extract_subset()
  • NOAA source fetching helpers for common ARL archives
  • vertical helper functions such as pressure(), z_agl(), and z_msl()

Alpha status

This is an alpha release. The core read/write/subset APIs are usable, but the package is still tightening its high-level contracts and release surface.

Current strengths:

  • low-level ARL fidelity, including preservation of trailing DIF* records
  • xarray-native analysis workflow for common ARL files
  • direct subset extraction and point sampling
  • tested support for Python 3.10 through 3.12

Current limitations:

  • write_dataset() is intentionally conservative and targets the flat common-case Dataset contract
  • complex multi-record DIFF chains are not tested
  • WRF vertical flag 5 is not implemented

Installation

Install the core package:

pip install arlmet

Install the optional source-fetching dependencies:

pip install "arlmet[sources]"

For development:

git clone https://github.com/jmineau/arl-met.git
cd arl-met
uv sync --dev

Quick examples

Open an ARL file as a Dataset:

import arlmet

ds = arlmet.open_dataset("met.arl")
print(ds)

Modify a Dataset and write it back:

import arlmet

ds = arlmet.open_dataset("met.arl")
ds["TEMP"] = ds["TEMP"] - 273.15
ds["WWND"].attrs["diff"] = "DIFW"
arlmet.write_dataset(ds, "edited.arl")

Extract a subset without unpacking the full file first:

import arlmet

arlmet.extract_subset(
    "met.arl",
    "subset.arl",
    bbox=(-114.0, 39.0, -110.0, 42.0),
    levels=[0, 1, 2],
)

Use the low-level writer for irregular layouts:

import numpy as np
import pandas as pd
import arlmet

grid = arlmet.Grid(
    projection=arlmet.Projection(
        pole_lat=90.0,
        pole_lon=0.0,
        tangent_lat=1.0,
        tangent_lon=1.0,
        grid_size=0.0,
        orientation=0.0,
        cone_angle=0.0,
        sync_x=1.0,
        sync_y=1.0,
        sync_lat=-10.0,
        sync_lon=20.0,
    ),
    nx=20,
    ny=20,
)
vertical_axis = arlmet.VerticalAxis(flag=2, levels=[0.0, 1000.0])
time = pd.Timestamp("2024-07-18 00:00")

prss = np.ones((grid.ny, grid.nx), dtype=np.float32)
wwnd = np.ones((grid.ny, grid.nx), dtype=np.float32)

with arlmet.File("custom.arl", mode="w", source="TEST", grid=grid, vertical_axis=vertical_axis) as arl:
    rs = arl.create_recordset(time, forecast=0)
    rs.create_datarecord("PRSS", level=0, forecast=0, data=prss)
    rs.create_datarecord("WWND", level=1, forecast=0, data=wwnd, diff="DIFW")

Resources

Documentation is available at https://jmineau.github.io/arl-met/

Useful ARL/HYSPLIT references:

Related project:

  • ARLreader, which focuses on GDAS1 files, while arl-met targets a broader ARL/xarray workflow.

Release notes

See CHANGELOG.md for release history.

Contributing

Contributions are welcome. See CONTRIBUTING.md for development setup and contribution guidelines.

License

This project is licensed under the MIT License. See LICENSE.

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

arlmet-0.1.0a1.tar.gz (84.2 kB view details)

Uploaded Source

Built Distribution

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

arlmet-0.1.0a1-py3-none-any.whl (64.8 kB view details)

Uploaded Python 3

File details

Details for the file arlmet-0.1.0a1.tar.gz.

File metadata

  • Download URL: arlmet-0.1.0a1.tar.gz
  • Upload date:
  • Size: 84.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for arlmet-0.1.0a1.tar.gz
Algorithm Hash digest
SHA256 1fe19aef5a598c2fc375bbee0db26c5846f5a935f78586cd9b277580e4f79807
MD5 ce8939f61b931ed33427f619a8cbca68
BLAKE2b-256 06eb92c8d17d37d394159d1e731df4335e6df753062cf20623f070374c725072

See more details on using hashes here.

Provenance

The following attestation bundles were made for arlmet-0.1.0a1.tar.gz:

Publisher: publish.yml on jmineau/arl-met

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

File details

Details for the file arlmet-0.1.0a1-py3-none-any.whl.

File metadata

  • Download URL: arlmet-0.1.0a1-py3-none-any.whl
  • Upload date:
  • Size: 64.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for arlmet-0.1.0a1-py3-none-any.whl
Algorithm Hash digest
SHA256 d8c32c02d96a8f7da10e22caeee36b07968c1b1ce4d54a144fd2ca417cd2acaa
MD5 3577362335ff19bcfde33f847cb0049d
BLAKE2b-256 f0a8de8aa106f6e582929e6c3d23c917799b92ee77a819ae6fc6efa15ed8308c

See more details on using hashes here.

Provenance

The following attestation bundles were made for arlmet-0.1.0a1-py3-none-any.whl:

Publisher: publish.yml on jmineau/arl-met

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