cwms-python


Namecwms-python JSON
Version 0.3.0 PyPI version JSON
download
home_pageNone
SummaryCorps water managerment systems (CWMS) REST API for Data Retrieval of USACE water data
upload_time2024-04-25 15:42:05
maintainerNone
docs_urlNone
authorEric Novotny
requires_python<4.0,>=3.9
licenseLICENSE
keywords usace water data
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # CWMSpy

CWMS REST API for Data Retrieval

## Requirements.

Python 3.9+

## Installation & Usage

### pip install

```sh
pip install cwms-python
```

Then import the package:

```python
import cwms
```

## Getting Started

```python
import cwms
from datetime import datetime, timedelta

end = datetime.now()
begin = end - timedelta(days = 10)
data = cwms.get_timeseries(p_tsId='Some.Fully.Qualified.Ts.Id',begin = begin, end = end)

#a cwms data object will be provided this object containes both the JSON as well
#as the values converted into a dataframe

#display the dataframe

df = data.df
print(df)
```

```
     date-time 	value 	quality-code
0 	2024-04-23 08:15:00 	86.57 	3
1 	2024-04-23 08:30:00 	86.57 	3
2 	2024-04-23 08:45:00 	86.58 	3
3 	2024-04-23 09:00:00 	86.58 	3
4 	2024-04-23 09:15:00 	86.58 	3
5 	2024-04-23 09:30:00 	86.58 	3
6 	2024-04-23 09:45:00 	86.59 	3
7 	2024-04-23 10:00:00 	86.58 	3
```

```python
#display JSON
json = data.JSON
print(json)
```

```
{'name': 'Some.Fully.Qualified.Ts.Id',
 'office-id': 'MVP',
 'units': 'ft',
 'values': [['2024-04-23T08:15:00', 86.57, 3],
  ['2024-04-23T08:30:00', 86.57, 3],
  ['2024-04-23T08:45:00', 86.57999999999997, 3],
  ['2024-04-23T09:00:00', 86.57999999999997, 3],
  ['2024-04-23T09:15:00', 86.57999999999997, 3],
  ['2024-04-23T09:30:00', 86.57999999999997, 3],
  ['2024-04-23T09:45:00', 86.59, 3],
  ['2024-04-23T10:00:00', 86.57999999999997, 3]],
 'version-date': None}
```


            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "cwms-python",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.9",
    "maintainer_email": null,
    "keywords": "USACE, water data",
    "author": "Eric Novotny",
    "author_email": "eric.v.novotny@usace.army.mil",
    "download_url": "https://files.pythonhosted.org/packages/d1/fc/48f417548f449a36ae97222016b7b6c83ac34a3712af659ba8e6bfeff3f9/cwms_python-0.3.0.tar.gz",
    "platform": null,
    "description": "# CWMSpy\n\nCWMS REST API for Data Retrieval\n\n## Requirements.\n\nPython 3.9+\n\n## Installation & Usage\n\n### pip install\n\n```sh\npip install cwms-python\n```\n\nThen import the package:\n\n```python\nimport cwms\n```\n\n## Getting Started\n\n```python\nimport cwms\nfrom datetime import datetime, timedelta\n\nend = datetime.now()\nbegin = end - timedelta(days = 10)\ndata = cwms.get_timeseries(p_tsId='Some.Fully.Qualified.Ts.Id',begin = begin, end = end)\n\n#a cwms data object will be provided this object containes both the JSON as well\n#as the values converted into a dataframe\n\n#display the dataframe\n\ndf = data.df\nprint(df)\n```\n\n```\n     date-time \tvalue \tquality-code\n0 \t2024-04-23 08:15:00 \t86.57 \t3\n1 \t2024-04-23 08:30:00 \t86.57 \t3\n2 \t2024-04-23 08:45:00 \t86.58 \t3\n3 \t2024-04-23 09:00:00 \t86.58 \t3\n4 \t2024-04-23 09:15:00 \t86.58 \t3\n5 \t2024-04-23 09:30:00 \t86.58 \t3\n6 \t2024-04-23 09:45:00 \t86.59 \t3\n7 \t2024-04-23 10:00:00 \t86.58 \t3\n```\n\n```python\n#display JSON\njson = data.JSON\nprint(json)\n```\n\n```\n{'name': 'Some.Fully.Qualified.Ts.Id',\n 'office-id': 'MVP',\n 'units': 'ft',\n 'values': [['2024-04-23T08:15:00', 86.57, 3],\n  ['2024-04-23T08:30:00', 86.57, 3],\n  ['2024-04-23T08:45:00', 86.57999999999997, 3],\n  ['2024-04-23T09:00:00', 86.57999999999997, 3],\n  ['2024-04-23T09:15:00', 86.57999999999997, 3],\n  ['2024-04-23T09:30:00', 86.57999999999997, 3],\n  ['2024-04-23T09:45:00', 86.59, 3],\n  ['2024-04-23T10:00:00', 86.57999999999997, 3]],\n 'version-date': None}\n```\n\n",
    "bugtrack_url": null,
    "license": "LICENSE",
    "summary": "Corps water managerment systems (CWMS) REST API for Data Retrieval of USACE water data",
    "version": "0.3.0",
    "project_urls": null,
    "split_keywords": [
        "usace",
        " water data"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "37a2576a4bf076de150ae743e9905a1b02bd8d3b5c83a45c64a6205bdd768178",
                "md5": "ab72b73411051d348405174f9ee3a2c4",
                "sha256": "902b40807dec0017240cfb44923a8c5b297b54b249fe75b1b46211e683817ec0"
            },
            "downloads": -1,
            "filename": "cwms_python-0.3.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "ab72b73411051d348405174f9ee3a2c4",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.9",
            "size": 22985,
            "upload_time": "2024-04-25T15:42:03",
            "upload_time_iso_8601": "2024-04-25T15:42:03.406172Z",
            "url": "https://files.pythonhosted.org/packages/37/a2/576a4bf076de150ae743e9905a1b02bd8d3b5c83a45c64a6205bdd768178/cwms_python-0.3.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d1fc48f417548f449a36ae97222016b7b6c83ac34a3712af659ba8e6bfeff3f9",
                "md5": "a16b89458bd1dfe0b67c25eac6e127eb",
                "sha256": "d4b6a927bc4e6eebaed5077d9931bd44b7467c7f8d770c7b025dc62dc65a2d94"
            },
            "downloads": -1,
            "filename": "cwms_python-0.3.0.tar.gz",
            "has_sig": false,
            "md5_digest": "a16b89458bd1dfe0b67c25eac6e127eb",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.9",
            "size": 15298,
            "upload_time": "2024-04-25T15:42:05",
            "upload_time_iso_8601": "2024-04-25T15:42:05.063276Z",
            "url": "https://files.pythonhosted.org/packages/d1/fc/48f417548f449a36ae97222016b7b6c83ac34a3712af659ba8e6bfeff3f9/cwms_python-0.3.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-25 15:42:05",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "cwms-python"
}
        
Elapsed time: 0.21262s