========
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 <https://m3works.io>`_ 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:
* `CDEC <https://cdec.water.ca.gov/>`_
* `SNOTEL <https://www.nrcs.usda.gov/wps/portal/wcc/home/dataAccessHelp/webService/webServiceReference/>`_
* `MESOWEST <https://developers.synopticdata.com/mesonet/>`_
* `USGS <https://waterservices.usgs.gov/rest/>`_
* `NWS FORECAST <https://api.weather.gov>`_
* `GEOSPHERE AUSTRIA <https://data.hub.geosphere.at/dataset/>`_
* `UCSB CUES <https://snow.ucsb.edu/#>`_
* `MET NORWAY <https://frost.met.no/index.html>`_
* `SNOWEX MET STATIONS <https://nsidc.org/data/snex_met/versions/1>`_
* `CENTER FOR SNOW AND AVALANCHE STUDIES (CSAS) <https://snowstudies.org/csas-facilities/>`_
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 <https://github.com/M3Works/metloom/tree/main/docs/gallery>`_
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 = <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)
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
=======
History
=======
0.1.0 (2021-10-05)
------------------
* This is the first release!
* Create the package
* Add CDEC functionality
* Add SNOTEL functionality
* Add CLI to find stations from shapefile
* Write a custom Snotel client using zeep
0.2.0 (2021-12-29)
------------------
* Added mesowest network
* 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.
0.3.0 (2022-10-28)
------------------
* Added USGS network
Raw data
{
"_id": null,
"home_page": "https://github.com/M3Works/metloom",
"name": "metloom",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": null,
"keywords": "metloom",
"author": "M3Works",
"author_email": "m3worksllc@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/0c/d4/0e9002312a510fa7aa9ff1dc4edecb7855a1948142f48e8d5f063f542835/metloom-0.6.1.tar.gz",
"platform": null,
"description": "========\nmetloom\n========\n\n\n.. image:: https://img.shields.io/pypi/v/metloom.svg\n :target: https://pypi.python.org/pypi/metloom\n.. image:: https://github.com/M3Works/metloom/actions/workflows/testing.yml/badge.svg\n :target: https://github.com/M3Works/metloom/actions/workflows/testing.yml\n :alt: Testing Status\n.. image:: https://readthedocs.org/projects/metloom/badge/?version=latest\n :target: https://metloom.readthedocs.io/en/latest/?version=latest\n :alt: Documentation Status\n.. image:: https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/micah-prime/04da387b53bdb4a3aa31253789550a9f/raw/metloom__heads_main.json\n :target: https://github.com/M3Works/metloom\n :alt: Code Coverage\n\n\nLocation Oriented Observed Meteorology\n\nmetloom is a python library created with the goal of consistent, simple sampling of\nmeteorology and snow related point measurments from a variety of datasources is developed by `M3 Works <https://m3works.io>`_ as a tool for validating\ncomputational hydrology model results. Contributions welcome!\n\nWarning - This software is provided as is (see the license), so use at your own risk.\nThis is an opensource package with the goal of making data wrangling easier. We make\nno guarantees about the quality or accuracy of the data and any interpretation of the meaning\nof the data is up to you.\n\n\n* Free software: BSD license\n\n\nFeatures\n--------\n\n* Sampling of daily, hourly, and snow course data\n* Searching for stations from a datasource within a shapefile\n* Current data sources:\n * `CDEC <https://cdec.water.ca.gov/>`_\n * `SNOTEL <https://www.nrcs.usda.gov/wps/portal/wcc/home/dataAccessHelp/webService/webServiceReference/>`_\n * `MESOWEST <https://developers.synopticdata.com/mesonet/>`_\n * `USGS <https://waterservices.usgs.gov/rest/>`_\n * `NWS FORECAST <https://api.weather.gov>`_\n * `GEOSPHERE AUSTRIA <https://data.hub.geosphere.at/dataset/>`_\n * `UCSB CUES <https://snow.ucsb.edu/#>`_\n * `MET NORWAY <https://frost.met.no/index.html>`_\n * `SNOWEX MET STATIONS <https://nsidc.org/data/snex_met/versions/1>`_\n * `CENTER FOR SNOW AND AVALANCHE STUDIES (CSAS) <https://snowstudies.org/csas-facilities/>`_\n\nRequirements\n------------\npython >= 3.7\n\nInstall\n-------\n.. code-block:: bash\n\n python3 -m pip install metloom\n\n* Common install issues:\n * Macbook M1 and M2 chips: some python packages run into issues with the new M chips\n * ``error : from lxml import etree in utils.py ((mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64)``\n The solution is the following\n\n .. code-block:: bash\n\n pip uninstall lxml\n pip install --no-binary lxml lxml\n\n\n\nLocal install for dev\n---------------------\nThe recommendation is to use virtualenv, but other local python\nenvironment isolation tools will work (pipenv, conda)\n\n.. code-block:: bash\n\n python3 -m pip install --upgrade pip\n python3 -m pip install -r requirements_dev\n python3 -m pip install .\n\nTesting\n-------\n\n.. code-block:: bash\n\n pytest\n\nIf contributing to the codebase, code coverage should not decrease\nfrom the contributions. Make sure to check code coverage before\nopening a pull request.\n\n.. code-block:: bash\n\n pytest --cov=metloom\n\nDocumentation\n-------------\nreadthedocs coming soon\n\nhttps://metloom.readthedocs.io.\n\nUsage\n-----\nSee usage documentation https://metloom.readthedocs.io/en/latest/usage.html\n\n**NOTES:**\nPointData methods that get point data return a GeoDataFrame indexed\non *both* datetime and station code. To reset the index simply run\n``df.reset_index(inplace=True)``\n\nSimple usage examples are provided in this readme and in the docs. See\nour `examples <https://github.com/M3Works/metloom/tree/main/docs/gallery>`_\nfor code walkthroughs and more complicated use cases.\n\nUsage Examples\n==============\n\nUse metloom to find data for a station\n\n.. code-block:: python\n\n from datetime import datetime\n from metloom.pointdata import SnotelPointData\n\n snotel_point = SnotelPointData(\"713:CO:SNTL\", \"MyStation\")\n df = snotel_point.get_daily_data(\n datetime(2020, 1, 2), datetime(2020, 1, 20),\n [snotel_point.ALLOWED_VARIABLES.SWE]\n )\n print(df)\n\nUse metloom to find snow courses within a geometry\n\n.. code-block:: python\n\n from metloom.pointdata import CDECPointData\n from metloom.variables import CdecStationVariables\n\n import geopandas as gpd\n\n fp = <path to shape file>\n obj = gpd.read_file(fp)\n\n vrs = [\n CdecStationVariables.SWE,\n CdecStationVariables.SNOWDEPTH\n ]\n points = CDECPointData.points_from_geometry(obj, vrs, snow_courses=True)\n df = points.to_dataframe()\n print(df)\n\nTutorials\n---------\nIn the ``Examples`` folder, there are multiple Jupyter notbook based\ntutorials. You can edit and run these notebooks by running Jupyter Lab\nfrom the command line\n\n.. code-block:: bash\n\n pip install jupyterlab\n jupyter lab\n\nThis will open a Jupyter Lab session in your default browser.\n\n\nCredits\n-------\n\nThis package was created with Cookiecutter_ and the `audreyr/cookiecutter-pypackage`_ project template.\n\n.. _Cookiecutter: https://github.com/audreyr/cookiecutter\n.. _`audreyr/cookiecutter-pypackage`: https://github.com/audreyr/cookiecutter-pypackage\n\n\n=======\nHistory\n=======\n\n0.1.0 (2021-10-05)\n------------------\n\n* This is the first release!\n* Create the package\n* Add CDEC functionality\n* Add SNOTEL functionality\n* Add CLI to find stations from shapefile\n* Write a custom Snotel client using zeep\n\n0.2.0 (2021-12-29)\n------------------\n\n* Added mesowest network\n* Added in a token json arg to the get_*_data functions\n* Pinned docutils for an update that happened\n* Added in a resample_df function for the highway stations where the returned data is 5min for air temp.\n\n0.3.0 (2022-10-28)\n------------------\n\n* Added USGS network\n",
"bugtrack_url": null,
"license": "BSD license",
"summary": "Location Oriented Observed Meteorology (LOOM)",
"version": "0.6.1",
"project_urls": {
"Homepage": "https://github.com/M3Works/metloom"
},
"split_keywords": [
"metloom"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "89c75376fe0a0998c432474e3ce785d9d84ab4cec5dc86f32fe87928e4d50c62",
"md5": "8d47e223c4830190286f4c4a3cdb5c71",
"sha256": "6a14f61d23cb3c1f6f120bae6b79406c297ffd15f37ca8e6cbf9177d092d837f"
},
"downloads": -1,
"filename": "metloom-0.6.1-py2.py3-none-any.whl",
"has_sig": false,
"md5_digest": "8d47e223c4830190286f4c4a3cdb5c71",
"packagetype": "bdist_wheel",
"python_version": "py2.py3",
"requires_python": ">=3.7",
"size": 56725,
"upload_time": "2024-07-15T21:21:32",
"upload_time_iso_8601": "2024-07-15T21:21:32.684242Z",
"url": "https://files.pythonhosted.org/packages/89/c7/5376fe0a0998c432474e3ce785d9d84ab4cec5dc86f32fe87928e4d50c62/metloom-0.6.1-py2.py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "0cd40e9002312a510fa7aa9ff1dc4edecb7855a1948142f48e8d5f063f542835",
"md5": "f65f1e0b3afb72e26a21fe9a4c8d458b",
"sha256": "a3e846ff424aec86653b3d3bbdd6e9b99846558d13cc264f54720e8f4ea7a156"
},
"downloads": -1,
"filename": "metloom-0.6.1.tar.gz",
"has_sig": false,
"md5_digest": "f65f1e0b3afb72e26a21fe9a4c8d458b",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 454399,
"upload_time": "2024-07-15T21:21:34",
"upload_time_iso_8601": "2024-07-15T21:21:34.881081Z",
"url": "https://files.pythonhosted.org/packages/0c/d4/0e9002312a510fa7aa9ff1dc4edecb7855a1948142f48e8d5f063f542835/metloom-0.6.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-07-15 21:21:34",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "M3Works",
"github_project": "metloom",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"tox": true,
"lcname": "metloom"
}