Skip to main content

Decode and map UM STASH metadata

Project description

Welcome to stashmap

Package Latest PyPI Version Supported Python Versions
Coverage Codecov test coverage

The stashmap package provides functions to read and modify the stash and associated variables for the UM model. It main focus is to convert the relevant sections in the UM namelist (usually in rose-app.conf) into a .csv file for easy manipulation and then convert it back to the namelist format.

It also includes helpers to get variable names from stash codes and to get the human version for the time and domain profiles.

Get started

For now, you can install this package into your preferred Python environment using:

$ pip install git+https://github.com/21centuryweather/stashmap.git

Example

import stashmap

Read from namelist:

sections = stashmap.read_namelist("examples/rose-app.conf", print_summary=True)
Parsed 215 sections — DomainProfile: 8/26, OutputStream: 7/12, TimeProfile: 10/26, UseProfile: 8/14, Variable: 133/137

Add human-readable variable names:

stashmap.describe_variable(sections)

variables = [s for s in sections if isinstance(s, stashmap.Variable)]

for v in variables[0:15]:
    print("isec=", v.record.get('isec'), "item=", v.record.get('item'), "->", v.record.get('description'))
isec= 0 item= 2 -> U COMPNT OF WIND AFTER TIMESTEP
isec= 0 item= 2 -> U COMPNT OF WIND AFTER TIMESTEP
isec= 0 item= 3 -> V COMPNT OF WIND AFTER TIMESTEP
isec= 0 item= 3 -> V COMPNT OF WIND AFTER TIMESTEP
isec= 0 item= 4 -> THETA AFTER TIMESTEP
isec= 0 item= 4 -> THETA AFTER TIMESTEP
isec= 0 item= 10 -> SPECIFIC HUMIDITY AFTER TIMESTEP
isec= 0 item= 10 -> SPECIFIC HUMIDITY AFTER TIMESTEP
isec= 0 item= 12 -> QCF AFTER TIMESTEP
isec= 0 item= 12 -> QCF AFTER TIMESTEP
isec= 0 item= 24 -> SURFACE TEMPERATURE AFTER TIMESTEP
isec= 0 item= 24 -> SURFACE TEMPERATURE AFTER TIMESTEP
isec= 0 item= 25 -> BOUNDARY LAYER DEPTH AFTER TIMESTEP
isec= 0 item= 150 -> W COMPNT OF WIND AFTER TIMESTEP
isec= 0 item= 150 -> W COMPNT OF WIND AFTER TIMESTEP

And write to csv:

stashmap.export_sections_to_csv(sections, "examples/stash", section_type="variables")

Copyright

  • Copyright © 2025 Pao Corrales.
  • Free software distributed under the MIT 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

stashmap-0.1.0.tar.gz (14.9 kB view details)

Uploaded Source

Built Distribution

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

stashmap-0.1.0-py3-none-any.whl (13.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: stashmap-0.1.0.tar.gz
  • Upload date:
  • Size: 14.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: Hatch/1.16.2 cpython/3.12.3 HTTPX/0.28.1

File hashes

Hashes for stashmap-0.1.0.tar.gz
Algorithm Hash digest
SHA256 d27f03192452b5fa2dfbbcc69a841b02a02cc79ee3e6da8d2cc669f4fb056558
MD5 88024610ddc0f74f33e73bf1bb78baf2
BLAKE2b-256 0d71916ffe79b7710075edf554dd474210ffe01948b098cc79a0226816770135

See more details on using hashes here.

File details

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

File metadata

  • Download URL: stashmap-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 13.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: Hatch/1.16.2 cpython/3.12.3 HTTPX/0.28.1

File hashes

Hashes for stashmap-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0eb93d99f048643b4fc321a03c932f30f921e93a1c227d60c9cc7e50f8f2a2b3
MD5 dff1a486a8b6834732ec003682846abe
BLAKE2b-256 8c20b613c46af76873f3d81d074d6ac4c04edfe21d31b93648cb921705aa3b30

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