cwms-python


Namecwms-python JSON
Version 0.5.0 PyPI version JSON
download
home_pageNone
SummaryCorps water managerment systems (CWMS) REST API for Data Retrieval of USACE water data
upload_time2024-10-11 17:57:28
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(ts_id='Some.Fully.Qualified.Ts.Id',office_id='OFFICE1' , 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/84/9a/0d048b8d1e0d2c7f048b50972474a39aa031e04c7a06cd0afccd7e51cf92/cwms_python-0.5.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(ts_id='Some.Fully.Qualified.Ts.Id',office_id='OFFICE1' , 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.5.0",
    "project_urls": null,
    "split_keywords": [
        "usace",
        " water data"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "3a9c63280efbfc894cf71975452b8120aab0ac993ff955bc81a9adf2ac7d12b6",
                "md5": "d03545a35f98043fbb3fb011eb9c1bd7",
                "sha256": "d0441789fbf2f262985c8f7069c90df761943b0b248be728158762def116e5ec"
            },
            "downloads": -1,
            "filename": "cwms_python-0.5.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "d03545a35f98043fbb3fb011eb9c1bd7",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.9",
            "size": 38706,
            "upload_time": "2024-10-11T17:57:27",
            "upload_time_iso_8601": "2024-10-11T17:57:27.213041Z",
            "url": "https://files.pythonhosted.org/packages/3a/9c/63280efbfc894cf71975452b8120aab0ac993ff955bc81a9adf2ac7d12b6/cwms_python-0.5.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "849a0d048b8d1e0d2c7f048b50972474a39aa031e04c7a06cd0afccd7e51cf92",
                "md5": "d95de21e27c1989439e212460768e487",
                "sha256": "848cc73bb39c26f5b37434937608dd30092d73b82d22f089910d9716cf01dbef"
            },
            "downloads": -1,
            "filename": "cwms_python-0.5.0.tar.gz",
            "has_sig": false,
            "md5_digest": "d95de21e27c1989439e212460768e487",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.9",
            "size": 22789,
            "upload_time": "2024-10-11T17:57:28",
            "upload_time_iso_8601": "2024-10-11T17:57:28.632105Z",
            "url": "https://files.pythonhosted.org/packages/84/9a/0d048b8d1e0d2c7f048b50972474a39aa031e04c7a06cd0afccd7e51cf92/cwms_python-0.5.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-10-11 17:57:28",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "cwms-python"
}
        
Elapsed time: 0.32897s