metloom
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.
https://github.com/m3works/metloom
Category: Atmosphere
Sub Category: Meteorological Observation and Forecast
Keywords from Contributors
optimize transforms archiving measur compose observation conversion water projection generic
Last synced: about 20 hours ago
JSON representation
Repository metadata
Location Oriented Observed Meteorology
- Host: GitHub
- URL: https://github.com/m3works/metloom
- Owner: M3Works
- License: other
- Created: 2021-09-17T17:26:55.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2025-10-20T19:22:47.000Z (2 months ago)
- Last Synced: 2025-11-21T07:03:03.619Z (about 1 month ago)
- Language: Python
- Size: 1.75 MB
- Stars: 17
- Watchers: 1
- Forks: 6
- Open Issues: 8
- Releases: 43
-
Metadata Files:
- Readme: README.rst
- Changelog: HISTORY.rst
- Contributing: CONTRIBUTING.rst
- License: LICENSE
- Authors: AUTHORS.rst
README.rst
========
metloom
========
.. image:: https://img.shields.io/pypi/v/metloom.svg
:target: https://pypi.python.org/pypi/metloom
.. image:: https://github.com/M3Works/metloom/actions/workflows/testing.yml/badge.svg
:target: https://github.com/M3Works/metloom/actions/workflows/testing.yml
:alt: Testing Status
.. image:: https://readthedocs.org/projects/metloom/badge/?version=latest
:target: https://metloom.readthedocs.io/en/latest/?version=latest
:alt: Documentation Status
.. image:: https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/micah-prime/04da387b53bdb4a3aa31253789550a9f/raw/metloom__heads_main.json
:target: https://github.com/M3Works/metloom
:alt: 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 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
.. code-block:: python
# Find your data with ease
# !pip install folium mapclassify matplotlib
from metloom.pointdata import SnotelPointData, CDECPointData, USGSPointData
import geopandas as gpd
import pandas as pd
# Shapefile for the US states
shp = gpd.read_file('https://eric.clst.org/assets/wiki/uploads/Stuff/gz_2010_us_040_00_500k.json').to_crs("EPSG:4326")
# Filter to states of interest
west_states = ["Washington", "Oregon", "California", "Idaho", "Nevada", "Utah", "Wyoming", "Montana", "Colorado" ] # , "Arizona", "New Mexico"]
shp = shp.loc[shp["NAME"].isin(west_states)].dissolve()
# Collect all points with SWE from CDEC and NRCS
dfs = []
for src in [CDECPointData, SnotelPointData]:
dfs.append(src.points_from_geometry(shp, [src.ALLOWED_VARIABLES.SWE]).to_dataframe())
# Combine dataframes
gdf = pd.concat(dfs)
# plot the shapefile
m = shp.explore(
tooltip=False, color="grey", highlight=False, style_kwds={"opacity": 0.2}, popup=["NAME"]
)
# plot the points on top of the shapefile
gdf.explore(m=m, tooltip=["name", "id", "datasource"], color="red", marker_kwds={"radius":4})
.. image:: docs/images/map_of_swe.png
:alt: Resulting plot of SWE trace at Banner summit
Features
--------
.. code-block:: python
# !pip install plotly
from metloom.pointdata import SnotelPointData
import plotly.express as px
import pandas as pd
# Initialize your point
pt = SnotelPointData("312:ID:SNTL", "Banner Summit")
swe_variable = pt.ALLOWED_VARIABLES.SWE
# Get the data
df = pt.get_daily_data(
pd.to_datetime("2024-10-01"), pd.to_datetime("2025-03-11"), [swe_variable]
).reset_index()
# Create a time series plot using Plotly Express
px.line(df, x="datetime", y=swe_variable.name, title=f"{pt.name} SWE")
.. image:: docs/images/banner_swe.png
:alt: Resulting plot of SWE trace at Banner summit
* Sampling of daily, hourly, and snow course data
* Searching for stations from a datasource within a shapefile
* Current data sources:
* `CDEC `_
* `SNOTEL `_
* `MESOWEST `_
* `USGS `_
* `NWS FORECAST `_
* `GEOSPHERE AUSTRIA `_
* `UCSB CUES `_
* `MET NORWAY `_
* `SNOWEX MET STATIONS `_
* `CENTER FOR SNOW AND AVALANCHE STUDIES (CSAS) `_
Requirements
------------
python >= 3.7
Install
-------
.. code-block:: bash
python3 -m pip install metloom
* Common install issues:
* Macbook M1 and M2 chips: some python packages run into issues with the new M chips
* ``error : from lxml import etree in utils.py ((mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64)``
The solution is the following
.. code-block:: bash
pip uninstall lxml
pip install --no-binary lxml lxml
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
-------
.. code-block:: bash
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.
.. code-block:: bash
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)``
Simple usage examples are provided in this readme and in the docs. See
our `examples `_
for code walkthroughs and more complicated use cases.
Usage Examples
==============
Use metloom to find data for a station
.. code-block:: python
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
.. code-block:: python
from metloom.pointdata import CDECPointData
from metloom.variables import CdecStationVariables
import geopandas as gpd
fp =
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)
Tutorials
---------
In the ``Examples`` folder, there are multiple Jupyter notbook based
tutorials. You can edit and run these notebooks by running Jupyter Lab
from the command line
.. code-block:: bash
pip install jupyterlab
jupyter lab
This will open a Jupyter Lab session in your default browser.
Credits
-------
This package was created with Cookiecutter_ and the `audreyr/cookiecutter-pypackage`_ project template.
.. _Cookiecutter: https://github.com/audreyr/cookiecutter
.. _`audreyr/cookiecutter-pypackage`: https://github.com/audreyr/cookiecutter-pypackage
Owner metadata
- Name: M3 Works
- Login: M3Works
- Email:
- Kind: organization
- Description: Snowpack Modeling & Geoscience Software Consulting
- Website: m3works.io
- Location: United States of America
- Twitter:
- Company:
- Icon url: https://avatars.githubusercontent.com/u/90869452?v=4
- Repositories: 1
- Last ynced at: 2023-03-06T12:58:40.902Z
- Profile URL: https://github.com/M3Works
GitHub Events
Total
- Create event: 17
- Release event: 4
- Issues event: 7
- Watch event: 2
- Delete event: 22
- Issue comment event: 11
- Push event: 82
- Pull request review comment event: 23
- Pull request review event: 28
- Pull request event: 22
- Fork event: 1
Last Year
- Create event: 17
- Release event: 4
- Issues event: 5
- Watch event: 2
- Delete event: 4
- Issue comment event: 9
- Push event: 82
- Pull request review comment event: 23
- Pull request review event: 28
- Pull request event: 22
- Fork event: 1
Committers metadata
Last synced: 3 days ago
Total Commits: 231
Total Committers: 9
Avg Commits per committer: 25.667
Development Distribution Score (DDS): 0.342
Commits in past year: 25
Committers in past year: 5
Avg Commits per committer in past year: 5.0
Development Distribution Score (DDS) in past year: 0.68
| Name | Commits | |
|---|---|---|
| Micah Sandusky | m****5@g****m | 152 |
| micah johnson | m****0@g****m | 28 |
| Mark Robertson | m****n@g****m | 28 |
| dependabot[bot] | 4****] | 8 |
| Andrew E Slaughter | s****8@g****m | 7 |
| leahgibson | l****n@r****u | 3 |
| Zachary Keskinen | 5****n | 3 |
| Hannah Besso | b****2@u****u | 1 |
| YangKehan | y****n@Y****l | 1 |
Committer domains:
- uw.edu: 1
- rams.colostate.edu: 1
Issue and Pull Request metadata
Last synced: 2 months ago
Total issues: 32
Total pull requests: 130
Average time to close issues: 4 months
Average time to close pull requests: 13 days
Total issue authors: 6
Total pull request authors: 8
Average comments per issue: 0.44
Average comments per pull request: 0.34
Merged pull request: 113
Bot issues: 0
Bot pull requests: 16
Past year issues: 6
Past year pull requests: 27
Past year average time to close issues: 9 days
Past year average time to close pull requests: 3 days
Past year issue authors: 3
Past year pull request authors: 5
Past year average comments per issue: 0.67
Past year average comments per pull request: 0.89
Past year merged pull request: 15
Past year bot issues: 0
Past year bot pull requests: 4
Top Issue Authors
- micah-prime (15)
- micahjohnson150 (12)
- jomey (2)
- rmower90 (1)
- noahcreany (1)
- leahgibson (1)
Top Pull Request Authors
- micah-prime (84)
- dependabot[bot] (16)
- micahjohnson150 (11)
- aeslaughter (10)
- robertson-mark (4)
- ZachKeskinen (2)
- leahgibson (2)
- bessoh2 (1)
Top Issue Labels
- enhancement (14)
- bug (8)
- documentation (1)
Top Pull Request Labels
- dependencies (16)
- python (4)
- bug (1)
- enhancement (1)
Package metadata
- Total packages: 1
-
Total downloads:
- pypi: 945 last-month
- Total dependent packages: 0
- Total dependent repositories: 1
- Total versions: 42
- Total maintainers: 1
pypi.org: metloom
Location Oriented Observed Meteorology (LOOM)
- Homepage: https://github.com/M3Works/metloom
- Documentation: https://metloom.readthedocs.io/
- Licenses: BSD license
- Latest release: 0.8.0 (published 7 months ago)
- Last Synced: 2025-11-25T09:04:52.282Z (about 1 month ago)
- Versions: 42
- Dependent Packages: 0
- Dependent Repositories: 1
- Downloads: 945 Last month
-
Rankings:
- Dependent packages count: 9.995%
- Downloads: 12.527%
- Average: 15.637%
- Forks count: 16.855%
- Stargazers count: 17.081%
- Dependent repos count: 21.728%
- Maintainers (1)
Dependencies
- docutils <0.18
- setuptools ==57.4.0
- sphinxcontrib-apidoc ==0.3.0
- Sphinx ==1.8.5 development
- black ==21.7b0 development
- bump2version ==0.5.11 development
- coverage ==5.5 development
- flake8 ==3.7.8 development
- pip ==21.2.4 development
- pytest ==6.2.4 development
- pytest-cov ==2.12.1 development
- tox ==3.14.0 development
- twine ==1.14.0 development
- watchdog ==0.9.0 development
- wheel ==0.33.6 development
- actions/checkout v2 composite
- actions/setup-python v2 composite
- pypa/gh-action-pypi-publish 27b31702a0e7fc50959f5ad993c78deac1bdfc29 composite
- actions/checkout v2 composite
- actions/setup-python v2 composite
- schneegans/dynamic-badges-action v1.0.0 composite
Score: 12.269399495390498