Skip to main content

metloom

https://img.shields.io/pypi/v/metloom.svg Testing Status Documentation Status Code Coverage

Location Oriented Observed Meteorology

metloom is a python library created with the goal of consistent, simple sampling of meteorology and snow related point measurments from a variety of datasources across the Western US. metloom is developed by M3 Works as a tool for validating computational hydrology model results. Contributions welcome!

Warning - This software is provided as is (see the license), so use at your own risk. This is an opensource package with the goal of making data wrangling easier. We make no guarantees about the quality or accuracy of the data and any interpretation of the meaning of the data is up to you.

  • Free software: BSD license

Features

  • Sampling of daily, hourly, and snow course data

  • Searching for stations from a datasource within a shapefile

  • Current data sources:

Requirements

python >= 3.7

Install

python3 -m pip install metloom

Local install for dev

The recommendation is to use virtualenv, but other local python environment isolation tools will work (pipenv, conda) .. code-block:: bash

python3 -m pip install –upgrade pip python3 -m pip install -r requirements_dev python3 -m pip install .

Testing

pytest

If contributing to the codebase, code coverage should not decrease from the contributions. Make sure to check code coverage before opening a pull request.

pytest --cov=metloom

Documentation

readthedocs coming soon

https://metloom.readthedocs.io.

Usage

See usage documentation https://metloom.readthedocs.io/en/latest/usage.html

NOTES: PointData methods that get point data return a GeoDataFrame indexed on both datetime and station code. To reset the index simply run df.reset_index(inplace=True)

Usage Examples

Use metloom to find data for a station

from datetime import datetime
from metloom.pointdata import SnotelPointData

snotel_point = SnotelPointData("713:CO:SNTL", "MyStation")
df = snotel_point.get_daily_data(
    datetime(2020, 1, 2), datetime(2020, 1, 20),
    [snotel_point.ALLOWED_VARIABLES.SWE]
)
print(df)

Use metloom to find snow courses within a geometry

from metloom.pointdata import CDECPointData
import geopandas as gpd

fp = <path to shape file>
obj = gpd.read_file(fp)

vrs = [
    CdecStationVariables.SWE,
    CdecStationVariables.SNOWDEPTH
]
points = CDECPointData.points_from_geometry(obj, vrs, snow_courses=True)
df = points.to_dataframe()
print(df)

Credits

This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.

History

0.1.1 (2021-10-05)

  • This is the first release!

  • Create the package

  • Add CDEC functionality

  • Add SNOTEL functionality

  • Add CLI to find stations from shapefile

0.1.2 (2021-10-15)

  • Remove dependency on climata to fix suds-jurko issue when building with newest setuptools

  • Write a custom Snotel client using zeep

0.1.3 (2021-10-25)

  • Filter out _unused columns resulting from joining multiple sensor result dataframes in CDEC and SNOTEL point data

  • Change CDEC timezone to avoid impossible date logic when datetimes returned from the sensors don’t exist in US/Pacific timezone

  • Account for nodata returns when validating dataframes

  • Include datasource in dataframes

0.1.4 (2021-11-08)

  • Add more network options to Snotel API usage

  • Fix dataframe joining bug

0.1.5 (2021-12-23)

  • Adjust filtering to snow course logic in CDEC client to handle perviously unhandled scenario

  • Only include measurementDate column with snow courses

0.2.0 (2021-12-29)

  • Added mesowest

  • Added in a token json arg to the get_*_data functions

  • Pinned docutils for an update that happened

  • Added in a resample_df function for the highway stations where the returned data is 5min for air temp.

Metadata

Release files for metloom 0.2.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 metloom 0.2.0
File Size Uploaded Provenance Actions
metloom-0.2.0.tar.gz 37.4 kB Without provenance Details for metloom-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for metloom 0.2.0
File Interpreter ABI Platform Actions
metloom-0.2.0-py2.py3-none-any.whl Python 3, Python 2 none any Details for metloom-0.2.0-py2.py3-none-any.whl

Total release size: 62.9 kB

Release files / metloom-0.2.0.tar.gz

Download URL metloom-0.2.0.tar.gz
Size 37.4 kB
Tags Source
SHA-256 checksum
How to use checksums
806ab55f1a9136f0a014089fea165e87f953b33415457469b10e14de1ce38915
BLAKE2b-256 checksum
How to use checksums
6258d49b88e842cec9d8dfc4ec3d6e30d053cacf20fc6b8ef9e3c34756a5ca0f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9

Release files / metloom-0.2.0-py2.py3-none-any.whl

Download URL metloom-0.2.0-py2.py3-none-any.whl
Size 25.5 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
dcef1749952debfd020aed6e2855ba64e1bdc2c0d53205777afb24c95c40bf67
BLAKE2b-256 checksum
How to use checksums
a8feaa3416c4a2cc1e2ac80d04a5d99081d3b2bae3124bff8ca2c1c7197be3fb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9

Security for metloom 0.2.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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files No provenance

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