Skip to main content

Corps water management systems (CWMS) REST API for Data Retrieval of USACE water data

Project description

CWMSpy

CWMS REST API for Data Retrieval

Requirements.

Python 3.9+

Installation & Usage

pip install

pip install cwms-python

Then import the package:

import cwms

Getting Started

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
#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}

TimeSeries Profile API Compatibility Warning

Currently, the TimeSeries Profile API may not be fully supported until a new version of cwms-data-access is released with the updated endpoint implementation.

Contributing

Please view the contribution documentation here: [CONTRIBUTING.md]

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cwms_python-1.0.0.tar.gz (40.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cwms_python-1.0.0-py3-none-any.whl (64.7 kB view details)

Uploaded Python 3

File details

Details for the file cwms_python-1.0.0.tar.gz.

File metadata

  • Download URL: cwms_python-1.0.0.tar.gz
  • Upload date:
  • Size: 40.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for cwms_python-1.0.0.tar.gz
Algorithm Hash digest
SHA256 03a92ddf6e4558463d628eadaf2d2ca3a99f65e2ea1a68e76067a8bf1bd16f1b
MD5 b81d9269270b8ad2b5cae585044f79f5
BLAKE2b-256 9eb5eac152153836f1c1db58e07df542714657b71a42bf890505bad25a989aa5

See more details on using hashes here.

Provenance

The following attestation bundles were made for cwms_python-1.0.0.tar.gz:

Publisher: pypi-deploy.yml on HydrologicEngineeringCenter/cwms-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file cwms_python-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: cwms_python-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 64.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for cwms_python-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c552505f00d57760b806f521a1cb5ec435e3a2ee0ee84b5a083d3e5fdfcd4b8c
MD5 ccfb2439a86f13dd087a0f053dcfa0eb
BLAKE2b-256 60d7d1bc6f3e3259b0f730d0aba17c2ca0809b231ec6e5d431e55cedeb191eee

See more details on using hashes here.

Provenance

The following attestation bundles were made for cwms_python-1.0.0-py3-none-any.whl:

Publisher: pypi-deploy.yml on HydrologicEngineeringCenter/cwms-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page