{ "info": { "author": "Jwely", "author_email": "jeff.ely.08@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3 :: Only", "Topic :: Software Development" ], "description": "[![PyPI version](https://badge.fury.io/py/cdo-api-py.svg)](https://badge.fury.io/py/cdo-api-py)\n\n# cdo-api-py\nPython interface to cdo api, which is described in full detail [here](https://www.ncdc.noaa.gov/cdo-web/webservices/v2#gettingStarted)\nBuilt to allow quick and easy query for weather data to pandas dataframe objects.\n\n## Installation\n\n```\npip install cdo-api-py\n```\nor for python3\n```\npip3 install cdo-api-py\n```\n\n## Example Use\n\nTo start, you'll need a token, which you can request [here](https://www.ncdc.noaa.gov/cdo-web/token).\n\nImport a few libraries and instantiate a client. default_units and default_limit are optional keyword arguments.\n```python\nfrom cdo_api_py import Client\nimport pandas as pd\nfrom datetime import datetime\nfrom pprint import pprint\ntoken = \"my_token_here\" # be sure not to share your token publicly\nmy_client = Client(token, default_units='metric', default_limit=1000)\n```\n\nOnce a client has been initialized, we can define a few variables to outline what we really want.\nSince this repo is just a python client to interface with the CDO api, the user has the option\nto use keyword arguments that are passed directly to the API and aren't detailed here, so you\nmay need to browse the options available for the dataset of choice.\n\nThe example we will use is the very common GHCN-Daily (ghcnd) weather set. We have found\nthe north, south, east, and west lat/lon coordinates that describe the bounding box of the\ngeneral Washington DC area. Next we define the dates we're interested in (optional) and\nthe dataset id. As an added step, we really want specific values from the dataset so lets\nsave those in a list as well as datatypeid (optional).\n\n```python\nextent = {\n \"north\": 39.14,\n \"south\": 38.68,\n \"east\": -76.65,\n \"west\": -77.35,\n}\n\nstartdate = datetime(2016, 12, 1)\nenddate = datetime(2016, 12, 31)\n\ndatasetid='GHCND'\ndatatypeid=['TMIN', 'TMAX', 'PRCP']\n```\n\nNow we pass all these into a single function call to our client `my_client` to find stations of interest.\nWe can use `return_dataframe=True` to automatically assemble the information into a dataframe.\n```python\nstations = my_client.find_stations(\n datasetid=datasetid,\n extent=extent,\n startdate=startdate,\n enddate=enddate,\n datatypeid=datatypeid,\n return_dataframe=True)\npprint(stations)\n```\n\nNow that we have a list of stations that have data useful to us, we can iterate through\nthe list of stations and pass the stationid argument to a `get_data_by_station` method.\n```python\nfor rowid, station in stations.iterrows(): # remember this is a pandas dataframe!\n station_data = my_client.get_data_by_station(\n datasetid=datasetid,\n stationid=station['id'],\n startdate=startdate,\n enddate=enddate,\n return_dataframe=True,\n include_station_meta=True # flatten station metadata with ghcnd readings\n )\n pprint(station_data)\n```\n\nWe can modify this slightly to concatenate all the small dataframes into one big dataframe\nand save it as a CSV.\n```python\nbig_df = pd.DataFrame()\nfor rowid, station in stations.iterrows(): # remember this is a pandas dataframe!\n station_data = my_client.get_data_by_station(\n datasetid=datasetid,\n stationid=station['id'],\n startdate=startdate,\n enddate=enddate,\n return_dataframe=True,\n include_station_meta=True # flatten station metadata with ghcnd readings\n )\n pprint(station_data)\n big_df = pd.concat([big_df, station_data])\n\nprint(big_df)\nbig_df = big_df.sort_values(by='date').reset_index()\nbig_df.to_csv('dc_ghcnd_example_output.csv')\n```\n\nsee all the example code here: [DC weather data example](docs/example/dc_weather_data.py)\n\nIt may take a bit of manual searching to familiarize yourself with the NOAA CDO offerings, but\nonce you figure out the arguments you'd like to use, this client should make it quite easy\nto automate weather data retrievals. There are many requirements and limits as to the nature of\nrequests that the server will allow, and this client will automatically determine if a request\nmust be split up into multiple smaller pieces and create them, send them, and piece the\nresults back together into a single coherent response without any additional effort.\n\n***\n\nYou can explore the endpoints available, either at the CDO documentation site or quickly with\n```python\npprint(my_client.list_endpoints())\n\n# returned at time of writing\n{'data': 'A datum is an observed value along with any ancillary attributes at '\n 'a specific place and time.',\n 'datacategories': 'A data category is a general type of data used to group '\n 'similar data types.',\n 'datasets': 'A dataset is the primary grouping for data at NCDC',\n 'datatypes': 'A data type is a specific type of data that is often unique to '\n 'a dataset.',\n 'locationcategories': 'A location category is a grouping of similar '\n 'locations.',\n 'locations': 'A location is a geopolitical entity.',\n 'stations': 'A station is a any weather observing platform where data is '\n 'recorded.'}\n```\n\nAt the time of writing, there are about 11 available datasets, they are `['GHCND', 'GSOM', 'GSOY', 'NEXRAD2', 'NEXRAD3', 'NORMAL_ANN', 'NORMAL_DLY', 'NORMAL_HLY', 'NORMAL_MLY', 'PRECIP_15', 'PRECIP_HLY']`. View the full details with:\n```python\npprint(my_client.list_datasets())\n```\n\nThere are more than 1000 datatypes, but you can see them all with\n```python\npprint(my_client.list_datatypes())\n```\n\n\n## TODO:\n* Another example or two for non GHCND\n* Build a gh-pages branch with sphinx\n\n\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/Jwely/cdo-api-py", "keywords": "weather data,noaa,ncdc,climate data online,cdo", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "cdo-api-py", "package_url": "https://pypi.org/project/cdo-api-py/", "platform": "", "project_url": "https://pypi.org/project/cdo-api-py/", "project_urls": { "Homepage": "https://github.com/Jwely/cdo-api-py" }, "release_url": "https://pypi.org/project/cdo-api-py/1.0.0.dev13/", "requires_dist": [ "requests", "pandas" ], "requires_python": "", "summary": "Python interface to the climate data online api", "version": "1.0.0.dev13" }, "last_serial": 4985062, "releases": { "1.0.0.dev10": [ { "comment_text": "", "digests": { "md5": "c777aadd11dc14d9b1b4b4750176cdc2", "sha256": "6dd078d13104a5c401600c8d731ce70e2ecd98dd2e0578965a5e7849b996bbbb" }, "downloads": -1, "filename": "cdo_api_py-1.0.0.dev10-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "c777aadd11dc14d9b1b4b4750176cdc2", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 9293, "upload_time": "2017-02-16T20:01:07", "url": "https://files.pythonhosted.org/packages/7e/81/04b456f73ba8cb6e22ba5f5b0ace4c533c3ab51c50cc43df82a8a830664f/cdo_api_py-1.0.0.dev10-py2.py3-none-any.whl" } ], "1.0.0.dev11": [ { "comment_text": "", "digests": { "md5": "3e39a249d7b3a03e0780a3262095b0ea", "sha256": "7cc61a8a432ec865f19d4a44de55098827721e243937c3f58fc9a310ec889bbf" }, "downloads": -1, "filename": "cdo_api_py-1.0.0.dev11-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "3e39a249d7b3a03e0780a3262095b0ea", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 9326, "upload_time": "2017-02-22T18:47:12", "url": "https://files.pythonhosted.org/packages/26/f4/c3495601f62850ee63c4320e65d3ec89e06fa9dff372bea6e8e612d6cc75/cdo_api_py-1.0.0.dev11-py2.py3-none-any.whl" } ], "1.0.0.dev12": [ { "comment_text": "", "digests": { "md5": "041bc96a8329557640c9a4c53e45a935", "sha256": "7b89a3eb267413ee1b224f85f0aa8b14a20971f7b4514ce8771b06320c929f10" }, "downloads": -1, "filename": "cdo_api_py-1.0.0.dev12-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "041bc96a8329557640c9a4c53e45a935", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 12747, "upload_time": "2017-04-24T20:10:36", "url": "https://files.pythonhosted.org/packages/0f/1a/69529ca359a7ec2393d00b9e399e3f37533f2821f5cdfff9119399692aee/cdo_api_py-1.0.0.dev12-py2.py3-none-any.whl" } ], "1.0.0.dev13": [ { "comment_text": "", "digests": { "md5": "1b9d10ed567857ca37cbfdffd83126c2", "sha256": "966127706aa61759019bb370c66a952d0eba981ab022f156a034de672b642222" }, "downloads": -1, "filename": "cdo_api_py-1.0.0.dev13-py3-none-any.whl", "has_sig": false, "md5_digest": "1b9d10ed567857ca37cbfdffd83126c2", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 13499, "upload_time": "2019-03-25T23:12:29", "url": "https://files.pythonhosted.org/packages/ca/fc/0a86d9e9068216d971fa351cbd5396ff71bc9d763ba662233ad29119211d/cdo_api_py-1.0.0.dev13-py3-none-any.whl" } ], "1.0.0.dev5": [ { "comment_text": "", "digests": { "md5": "c850a57b77dd716e34a33fe0d9194f09", "sha256": "c33911dd3782ed191383ba9c35825537ca2f3e74d8c0242d632ee2f7206471c5" }, "downloads": -1, "filename": "cdo_api_py-1.0.0.dev5-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "c850a57b77dd716e34a33fe0d9194f09", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 9488, "upload_time": "2017-01-12T19:13:34", "url": "https://files.pythonhosted.org/packages/ca/32/1e980e4690d0994dc618a62dec313860577b96fce4c88d77d2afd3a78dbd/cdo_api_py-1.0.0.dev5-py2.py3-none-any.whl" } ], "1.0.0.dev6": [ { "comment_text": "", "digests": { "md5": "b98fb1b10c585a2030db56162d3582dd", "sha256": "54904cae60fabb6e957b61f5f8f1b43aed73e0fe7c34c530d9c338b91d9e907a" }, "downloads": -1, "filename": "cdo_api_py-1.0.0.dev6-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "b98fb1b10c585a2030db56162d3582dd", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 11197, "upload_time": "2017-01-12T23:47:00", "url": "https://files.pythonhosted.org/packages/20/8a/5000906208061287e7cf7cd632c0df5dbeb365e2b5d17633a239c37e21f1/cdo_api_py-1.0.0.dev6-py2.py3-none-any.whl" } ], "1.0.0.dev7": [ { "comment_text": "", "digests": { "md5": "3c70421c41b11c1c76eb3c9673f6c832", "sha256": "1c07434458d5586897fe74801cfec15d31ee8e3bda52ebf9eecfa00954bf896e" }, "downloads": -1, "filename": "cdo_api_py-1.0.0.dev7-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "3c70421c41b11c1c76eb3c9673f6c832", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 9176, "upload_time": "2017-01-12T23:55:15", "url": "https://files.pythonhosted.org/packages/84/cf/c15f5d2751bb91cf3b2c2a4b9aee228205adb8776728192de15227beb2ec/cdo_api_py-1.0.0.dev7-py2.py3-none-any.whl" } ], "1.0.0.dev8": [ { "comment_text": "", "digests": { "md5": "9d8331caec597450072dde98e019a759", "sha256": "674589ee74bca32fa01ed063e6531c55987ae449e9ac6994ff3b43f933c70a92" }, "downloads": -1, "filename": "cdo_api_py-1.0.0.dev8-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "9d8331caec597450072dde98e019a759", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 9167, "upload_time": "2017-01-18T16:05:59", "url": "https://files.pythonhosted.org/packages/35/bf/6f572346c736d38f6dc89885d055047babea398fc0aeafa36e6bc098e363/cdo_api_py-1.0.0.dev8-py2.py3-none-any.whl" } ], "1.0.0.dev9": [ { "comment_text": "", "digests": { "md5": "16a6fdce5c304a534673ce880d73b7d8", "sha256": "62173caa1fd95e21f425c60259b336e7362adb0291a7d22c0be5a3a12a77c330" }, "downloads": -1, "filename": "cdo_api_py-1.0.0.dev9-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "16a6fdce5c304a534673ce880d73b7d8", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 9287, "upload_time": "2017-02-16T19:58:15", "url": "https://files.pythonhosted.org/packages/ab/10/56928a5cf18b0d03174c4a0c752abec0e51da4b9e5c09f9b8f9282c2911c/cdo_api_py-1.0.0.dev9-py2.py3-none-any.whl" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "1b9d10ed567857ca37cbfdffd83126c2", "sha256": "966127706aa61759019bb370c66a952d0eba981ab022f156a034de672b642222" }, "downloads": -1, "filename": "cdo_api_py-1.0.0.dev13-py3-none-any.whl", "has_sig": false, "md5_digest": "1b9d10ed567857ca37cbfdffd83126c2", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 13499, "upload_time": "2019-03-25T23:12:29", "url": "https://files.pythonhosted.org/packages/ca/fc/0a86d9e9068216d971fa351cbd5396ff71bc9d763ba662233ad29119211d/cdo_api_py-1.0.0.dev13-py3-none-any.whl" } ] }