{"id":16178279,"url":"https://github.com/gclunies/noaa_coops","last_synced_at":"2025-04-12T16:38:32.789Z","repository":{"id":34987599,"uuid":"179857193","full_name":"GClunies/noaa_coops","owner":"GClunies","description":"A Python wrapper for the NOAA CO-OPS Tides \u0026 Currents Data and Metadata APIs.","archived":false,"fork":false,"pushed_at":"2024-08-03T14:24:54.000Z","size":285,"stargazers_count":88,"open_issues_count":0,"forks_count":28,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-10T05:38:44.016Z","etag":null,"topics":["coops","currents","metocean","noaa","python","sensors-data","tides","water-level","weather-api"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/GClunies.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-04-06T16:19:40.000Z","updated_at":"2025-02-27T12:19:12.000Z","dependencies_parsed_at":"2024-11-06T00:33:52.619Z","dependency_job_id":"1d755399-458f-457c-99b9-6eb6db38d7b9","html_url":"https://github.com/GClunies/noaa_coops","commit_stats":{"total_commits":151,"total_committers":7,"mean_commits":"21.571428571428573","dds":"0.10596026490066224","last_synced_commit":"0972373cad4524dc8546a8810110a4c5b02278f0"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GClunies%2Fnoaa_coops","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GClunies%2Fnoaa_coops/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GClunies%2Fnoaa_coops/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GClunies%2Fnoaa_coops/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/GClunies","download_url":"https://codeload.github.com/GClunies/noaa_coops/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248351383,"owners_count":21089271,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["coops","currents","metocean","noaa","python","sensors-data","tides","water-level","weather-api"],"created_at":"2024-10-10T05:13:23.553Z","updated_at":"2025-04-12T16:38:32.761Z","avatar_url":"https://github.com/GClunies.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# noaa_coops\n\n[![PyPI](https://img.shields.io/pypi/v/noaa_coops.svg)](https://pypi.python.org/pypi/noaa-coops)\n[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/noaa_coops.svg)](https://pypi.python.org/pypi/noaa-coops)\n\nA Python wrapper for the NOAA CO-OPS Tides \u0026amp; Currents [Data](https://tidesandcurrents.noaa.gov/api/)\nand [Metadata](https://tidesandcurrents.noaa.gov/mdapi/latest/) APIs.\n\n## Installation\nThis package is distributed via [PyPi](https://pypi.org/project/noaa-coops/) and can be installed using , `pip`, `poetry`, etc.\n```bash\n# Install with pip\n❯ pip install noaa_coops\n\n# Install with poetry\n❯ poetry add noaa_coops\n```\n\n## Getting Started\n\n### Stations\nData is accessed via `Station` class objects. Each station is uniquely identified by an `id`. To initialize a `Station` object, run:\n\n```python\n\u003e\u003e\u003e from noaa_coops import Station\n\u003e\u003e\u003e seattle = Station(id=\"9447130\")  # Create Station object for Seattle (ID = 9447130)\n```\n\nStations and their IDs can be found using the Tides \u0026 Currents [mapping interface](https://tidesandcurrents.noaa.gov/). Alternatively, you can search for stations in a bounding box using the `get_stations_from_bbox` function, which will return a list of stations found in the box (if any).\n```python\n\u003e\u003e\u003e from pprint import pprint\n\u003e\u003e\u003e from noaa_coops import Station, get_stations_from_bbox\n\u003e\u003e\u003e stations = get_stations_from_bbox(lat_coords=[40.389, 40.9397], lon_coords=[-74.4751, -73.7432])\n\u003e\u003e\u003e pprint(stations)\n['8516945', '8518750', '8519483', '8531680']\n\u003e\u003e\u003e station_one = Station(id=\"8516945\")\n\u003e\u003e\u003e pprint(station_one.name)\n'Kings Point'\n```\n\n### Metadata\nStation metadata is stored in the `.metadata` attribute of a `Station` object. Additionally, the keys of the metadata attribute dictionary are also assigned as attributes of the station object itself.\n\n```python\n\u003e\u003e\u003e from pprint import pprint\n\u003e\u003e\u003e from noaa_coops import Station\n\u003e\u003e\u003e seattle = Station(id=\"9447130\")\n\u003e\u003e\u003e pprint(list(seattle.metadata.items())[:5])                   # Print first 3 items in metadata\n[('tidal', True), ('greatlakes', False), ('shefcode', 'EBSW1')]  # Metadata dictionary can be very long\n\u003e\u003e\u003e pprint(seattle.lat_lon['lat'])                               # Print latitude\n47.601944\n\u003e\u003e\u003e pprint(seattle.lat_lon['lon'])                               # Print longitude\n-122.339167\n```\n\n### Data Inventory\nA description of a Station's data products and available dates can be accessed via the `.data_inventory` attribute of a `Station` object.\n\n```python\n\u003e\u003e\u003e from noaa_coops import Station\n\u003e\u003e\u003e from pprint import pprint\n\u003e\u003e\u003e seattle = Station(id=\"9447130\")\n\u003e\u003e\u003e pprint(seattle.data_inventory)\n{'Air Temperature': {'end_date': '2019-01-02 18:36',\n                     'start_date': '1991-11-09 01:00'},\n 'Barometric Pressure': {'end_date': '2019-01-02 18:36',\n                         'start_date': '1991-11-09 00:00'},\n 'Preliminary 6-Minute Water Level': {'end_date': '2023-02-05 19:54',\n                                      'start_date': '2001-01-01 00:00'},\n 'Verified 6-Minute Water Level': {'end_date': '2022-12-31 23:54',\n                                   'start_date': '1995-06-01 00:00'},\n 'Verified High/Low Water Level': {'end_date': '2022-12-31 23:54',\n                                   'start_date': '1977-10-18 02:18'},\n 'Verified Hourly Height Water Level': {'end_date': '2022-12-31 23:00',\n                                        'start_date': '1899-01-01 00:00'},\n 'Verified Monthly Mean Water Level': {'end_date': '2022-12-31 23:54',\n                                       'start_date': '1898-12-01 00:00'},\n 'Water Temperature': {'end_date': '2019-01-02 18:36',\n                       'start_date': '1991-11-09 00:00'},\n 'Wind': {'end_date': '2019-01-02 18:36', 'start_date': '1991-11-09 00:00'}}\n```\n\n### Data Retrieval\nAvailable data products can be found in NOAA CO-OPS Data API docs.\n\nStation data can be fetched using the `.get_data` method on a `Station` object. Data is returned as a Pandas [DataFrame](https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.html) for ease of use and analysis. DataFrame columns are named according to the NOAA CO-OPS API [docs](https://api.tidesandcurrents.noaa.gov/api/prod/responseHelp.html), with the `t` column (timestamp) set as the DataFrame index.\n\nThe example below fetches water level data from the Seattle station (id=9447130) for a 1 month period. The corresponding [web output](https://tidesandcurrents.noaa.gov/waterlevels.html?id=9447130\u0026units=metric\u0026bdate=20150101\u0026edate=20150131\u0026timezone=GMT\u0026datum=MLLW) is shown below the code as a reference.\n\n```python\n\u003e\u003e\u003e from noaa_coops import Station\n\u003e\u003e\u003e seattle = Station(id=\"9447130\")\n\u003e\u003e\u003e df_water_levels = seattle.get_data(\n...     begin_date=\"20150101\",\n...     end_date=\"20150131\",\n...     product=\"water_level\",\n...     datum=\"MLLW\",\n...     units=\"metric\",\n...     time_zone=\"gmt\")\n\u003e\u003e\u003e df_water_levels.head()\n                         v      s        f  q\nt\n2015-01-01 00:00:00  1.799  0.023  0,0,0,0  v\n2015-01-01 00:06:00  1.718  0.018  0,0,0,0  v\n2015-01-01 00:12:00  1.639  0.013  0,0,0,0  v\n2015-01-01 00:18:00  1.557  0.012  0,0,0,0  v\n2015-01-01 00:24:00  1.473  0.014  0,0,0,0  v\n\n```\n\n![image](https://user-images.githubusercontent.com/28986302/233147224-765fbe05-372c-40f3-8bbe-4102536e7ff3.png)\n\n\n## Development\n\n### Requirements\nThis package and its dependencies are managed using [poetry](https://python-poetry.org/). To install the development environment for `noaa_coops`, first install poetry, then run (inside the repo):\n\n```bash\npoetry install\n```\n\n### TODO\nClick [here](https://github.com/GClunies/noaa_coops/issues) for a list of existing issues and to submit a new one.\n\n### Contribution\nContributions are welcome, feel free to submit a pull request.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgclunies%2Fnoaa_coops","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgclunies%2Fnoaa_coops","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgclunies%2Fnoaa_coops/lists"}