Utilities for working with RAMS atmospheric model output
Project description
xarrams
Python utilities for working with RAMS (Regional Atmospheric Modeling System) output using xarray.
Features
- File I/O — Read RAMS HDF5 output files into xarray Datasets with automatic dimension naming, coordinate assignment from header files, and optional pint unit attachment.
- Thermodynamic calculations — Derive temperature, pressure, humidity, buoyancy, and hydrometeor fields from raw RAMS output using MetPy.
- Idealized soundings — Generate Weisman & Klemp (1984) soundings with veering or unidirectional shear, and plot SkewT diagrams.
- Simulation execution — Generate RAMSIN configuration files from templates and launch serial or MPI-parallel RAMS runs.
- Source building — Build RAMS executables from Jinja2-templated Fortran source trees.
- Dask integration — Parallel reading and intermediate result caching for large datasets.
Installation
pip install xarrams
With optional extras:
pip install xarrams[dask] # dask + h5netcdf for parallel reading
pip install xarrams[build] # jinja2 for templated source building
pip install xarrams[dev] # development tools (pytest, ruff, mypy, etc.)
Quick start
Reading RAMS output
import xarrams
# Read one or more RAMS output files
ds = xarrams.read_rams_output(
["a-A-2020-01-01-120000-g1.h5", "a-A-2020-01-01-121500-g1.h5"],
parallel=True,
)
Computing derived variables
# Add thermodynamic variables (T, P, RH, buoyancy, etc.)
ds = xarrams.calculate_thermodynamic_variables(ds)
Generating an idealized sounding
import numpy as np
z_levels = xarrams.get_z_levels(deltaz=100, dzrat=1.1, dzmax=1000, nnzp=50)
sounding = xarrams.wk84_sounding(
U_s=30,
q_v0=14,
shear_layer_depth=6000,
veering=True,
z_levels=z_levels,
)
Running RAMS simulations
xarrams.run_rams(
parameter_sets_dict={"control": {"TIMMAX": "3600."}},
run_dir="./runs",
rams_executable_path="/path/to/rams",
ramsin_template_path="./RAMSIN.template",
)
Package structure
| Module | Description |
|---|---|
xarrams.constants |
RAMS constants, variable metadata, unit registry |
xarrams.io |
HDF5 file reading, filename parsing, dimension handling |
xarrams.calculations |
Thermodynamic and derived variable computations |
xarrams.soundings |
Sounding generation, SkewT plotting, RAMSIN formatting |
xarrams.execution |
RAMSIN generation and simulation launching |
xarrams.utils |
Grid generation, time utilities, log parsing |
xarrams.build |
Jinja2-templated RAMS source building |
xarrams.dask |
Dask diagnostics and intermediate caching |
xarrams.schedulers |
SLURM submission script generation |
Development
# Install with pixi (recommended)
pixi run -e dev install
pixi run -e dev test
# Or with pip
pip install -e ".[dev]"
pytest
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
xarrams-1.0.0.tar.gz
(36.5 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
xarrams-1.0.0-py3-none-any.whl
(35.1 kB
view details)
File details
Details for the file xarrams-1.0.0.tar.gz.
File metadata
- Download URL: xarrams-1.0.0.tar.gz
- Upload date:
- Size: 36.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.20
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2e67a12dca28ef03a5be36bed2e4462648dca1e13a03d9ca0c9d85407ae362b2
|
|
| MD5 |
419638423ae2172e06f3708d9be4bdf9
|
|
| BLAKE2b-256 |
ddcb12ce78993dd15a25e0b208ce90b3105c345ad0a63c13470a26d190de1011
|
File details
Details for the file xarrams-1.0.0-py3-none-any.whl.
File metadata
- Download URL: xarrams-1.0.0-py3-none-any.whl
- Upload date:
- Size: 35.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.20
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
06211b6abc6bd0ba482bacdcf2687872175a4800b6b53033cdf6c530b41fbf92
|
|
| MD5 |
d743457be907cd316794e86c5ffbd372
|
|
| BLAKE2b-256 |
96da930185bf8ab11967bfcf1aa5ca1f51d0a1a50471957b88e7daca7518de89
|