Package: metloom
metloomLocation Oriented Observed Meteorologymetloom 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 byM3 Worksas 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 licenseFeaturesSampling of daily, hourly, and snow course dataSearching for stations from a datasource within a shapefileCurrent data sources:CDECSNOTELMESOWESTUSGSGEOSPHERE AUSTRIARequirementspython >= 3.7Installpython3-mpipinstallmetloomCommon install issues:Macbook M1 and M2 chips: some python packages run into issues with the new M chipserror : from lxml import etree in utils.py((mach-ofile, but is an incompatible architecture (have 'x86_64', need 'arm64)The solution is the followingpipuninstalllxmlpipinstall--no-binarylxmllxmlLocal install for devThe recommendation is to use virtualenv, but other local python
environment isolation tools will work (pipenv, conda)python3-mpipinstall--upgradepippython3-mpipinstall-rrequirements_devpython3-mpipinstall.TestingpytestIf 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=metloomDocumentationreadthedocs coming soonhttps://metloom.readthedocs.io.UsageSee usage documentationhttps://metloom.readthedocs.io/en/latest/usage.htmlNOTES:PointData methods that get point data return a GeoDataFrame indexed
onbothdatetime and station code. To reset the index simply rundf.reset_index(inplace=True)Simple usage examples are provided in this readme and in the docs. See
ourexamplesandtutorialfor code walkthroughs and more complicated use cases.Usage ExamplesUse metloom to find data for a stationfromdatetimeimportdatetimefrommetloom.pointdataimportSnotelPointDatasnotel_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 geometryfrommetloom.pointdataimportCDECPointDatafrommetloom.variablesimportCdecStationVariablesimportgeopandasasgpdfp=<pathtoshapefile>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)TutorialsIn theExamplesfolder, there are multiple Jupyter notbook based
tutorials. You can edit and run these notebooks by running Jupyter Lab
from the command linepipinstalljupyterlabjupyterlabThis will open a Jupyter Lab session in your default browser.CreditsThis package was created withCookiecutterand theaudreyr/cookiecutter-pypackageproject template.History0.1.0 (2021-10-05)This is the first release!Create the packageAdd CDEC functionalityAdd SNOTEL functionalityAdd CLI to find stations from shapefileWrite a custom Snotel client using zeep0.2.0 (2021-12-29)Added mesowest networkAdded in a token json arg to the get_*_data functionsPinned docutils for an update that happenedAdded in a resample_df function for the highway stations where the returned data is 5min for air temp.0.3.0 (2022-10-28)Added USGS network