Skip to main content

Package SHEF Parser

A python based package to parse SHEF files and optionally load them into various data stores. It also provides functionality for generating SHEF text from various data stores.

Parsing and loading can be performed by using module in python or through command line. Generating SHEF text from a data store is currenly limited to using the module in python.

See User Guide at https://shef-processing.readthedocs.io/en/latest/

See API Documentation at https://hydrologicengineeringcenter.github.io/shef-parser/index.html

Install

pip install shef-parser

Loading via command line

#CWMS CDA loader will load for all offices
shefParser -i input_filename --loader cda[$API_ROOT][$API_KEY]
# optional office scoping for transform lookup
shefParser -i input_filename --loader cda[$API_ROOT][$API_KEY][MVP]
shefParser -i input_filename --loader cda[$API_ROOT][$API_KEY][MVP,LRL,SWG]
#HEC-DSS loader
shefParser -i input_filename --loader dss[<dss_file>][<sensors_file>][<parameters_file>]

Loading via module

#CWMS CDA loader
import os
from shef import shef_parser

cda_url: str = os.getenv("CDA_API_ROOT")
cda_api_key: str = os.getenv("CDA_API_KEY")

shef_parser.parse(
    input_name=input_filename,
    loader_spec=f"cda[{cda_url}][{cda_api_key}]",
)
#HEC-DSS loader
from shef import shef_parser

dss_filename: str = "/path/to/dss_file"
sensors_filename: str = "/path/to/sensors_file"
parameters_filename: str = "/path/to/parameters_file"

shef_parser.parse(
    input_name=input_filename,
    loader_spec=f"dss[{dss_filename}][{sensors_filename}][{parameters_filename}]",
)

Generating SHEF Text

Exporting via command line

#CWMS CDA loader
#et and st can be either ISO date formate 2026-02-01T11:00:00 or use HEC time T, T-1D, T-5Hr, 02Feb2026, ect...)
#either timeseries group ID can be used or the -tsids parameter with a list of timeseries ids ("tsid1,tsid2,...")
shefParser export -a api_root -o office -f filename.shef -st start_time -et end_time -tsg <Timesereis Group ID> 

shefParser export -a api_root -o MVP -f filename.shef -st T-2D -et T -tsg KEYS
#CWMS CDA loader
import os
from datetime import datetime, timedelta
from shef import shef_parser

cda_url: str = os.getenv("CDA_API_ROOT")
office_id: str = os.getenv("CDA_OFFICE_ID")
tsids: list[str] = [
    ...
]

export_file="/path/to/output_file"
shef_parser.export(
            api_root=cda_url,
            office=office_id,
            export_file=export_file,
            timeseries_ids=tsids,
            start_time=datetime.now(),
            end_time=datetime.now() - timedelta(days=1),
        )
#HEC-DSS loader
from datetime import datetime, timedelta
from shef.exporters import DssExporter

dss_filename: str = "/path_to_dss_file"
sensors_filename: str = "/path/to/sensors_file"
parameters_filename: str = "/path/to/parameters_file"
pathnames: list[str] = [
    ...
]

exporter = DssExporter(
    dss_filename,
    sensors_filename,
    parameters_filename
)
exporter.start_time = datetime.now() - timedelta(days=1)
exporter.end_time = datetime.now()
with open("/path/to/output_file", "w") as f:
    exporter.set_output(f)
    for (pathname in pathnames):
        exporter.export(pathname)

Metadata

Release files for shef-parser 1.11.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for shef-parser 1.11.0
File Size Uploaded Provenance
shef_parser-1.11.0.tar.gz 75.3 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for shef-parser 1.11.0
File Interpreter ABI Platform
shef_parser-1.11.0-py3-none-any.whl Python 3 none any Details

Total release size: 157.7 kB

Release files / shef_parser-1.11.0.tar.gz

Download URL shef_parser-1.11.0.tar.gz
Size 75.3 kB
Tags Source
SHA-256 checksum
How to use checksums
eef004e4850c13b87105a9010845f3b2de3017faba14a9b23afd0c30820d4604
BLAKE2b-256 checksum
How to use checksums
303be00ead5c9c4ef93903549029b3c2f0e7e2ba2269ffca1a0fce1ef6896da7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 4, 2026.

Transparency log

Release files / shef_parser-1.11.0-py3-none-any.whl

Download URL shef_parser-1.11.0-py3-none-any.whl
Size 82.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c3059ad6dd27a62fcaf328bfec35e5be4b637bdc60b4f525b5c5ec1887617564
BLAKE2b-256 checksum
How to use checksums
628b635f44e90c5e61aaa17ea8b9a5c13dcd584c74589c37bf18b1ff5c3cfc6e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 4, 2026.

Transparency log

Security for shef-parser 1.11.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for shef_parser-1.11.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 4, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page