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
- Sampling of daily, hourly, and snow course data
- Searching for stations from a datasource within a shapefile
python >= 3.7
python3 -m pip install metloom
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 .
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
readthedocs coming soon
https://metloom.readthedocs.io.
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)
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
from metloom.variables import CdecStationVariables
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)
This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.