From 0a960425bea282674bb0ccee2fcc6791a4dd4c13 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 3 Mar 2026 05:10:06 +0000 Subject: [PATCH 1/3] Initial plan From c967282c7642f588e58d0e1975008759d893c7a7 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 3 Mar 2026 05:14:46 +0000 Subject: [PATCH 2/3] Address PR review comments: fix imports, types, help text, and version requirements Co-authored-by: krowvin <23619282+krowvin@users.noreply.github.com> --- cwmscli/load/timeseries/timeseries.py | 2 +- cwmscli/load/timeseries/timeseries_data.py | 27 +++++++++++----------- cwmscli/requirements.py | 2 +- pyproject.toml | 2 +- 4 files changed, 16 insertions(+), 17 deletions(-) diff --git a/cwmscli/load/timeseries/timeseries.py b/cwmscli/load/timeseries/timeseries.py index e6f78cf..a7ee440 100644 --- a/cwmscli/load/timeseries/timeseries.py +++ b/cwmscli/load/timeseries/timeseries.py @@ -58,7 +58,7 @@ def load_timeseries_ids_all( @timeseries.command( "data", - help="Copy timeseries data for a single location in a target CDA from a source CDA.", + help="Copy timeseries data (by timeseries ID or timeseries group) into a target CDA from a source CDA.", ) @shared_source_target_options @click.option( diff --git a/cwmscli/load/timeseries/timeseries_data.py b/cwmscli/load/timeseries/timeseries_data.py index 4febb89..9e9fd9b 100644 --- a/cwmscli/load/timeseries/timeseries_data.py +++ b/cwmscli/load/timeseries/timeseries_data.py @@ -1,12 +1,10 @@ -# cwmscli/load/timeseries_ids.py -import json +# cwmscli/load/timeseries/timeseries_data.py import logging from datetime import datetime from typing import Optional import click import pandas as pd -from cwms import JSON def _load_timeseries_data( @@ -16,10 +14,10 @@ def _load_timeseries_data( target_api_key: Optional[str], verbose: int, dry_run: bool, - ts_id: str, - ts_group: str, - ts_group_category_id: str, - ts_group_category_office_id: str, + ts_id: Optional[str] = None, + ts_group: Optional[str] = None, + ts_group_category_id: Optional[str] = None, + ts_group_category_office_id: Optional[str] = None, begin: Optional[datetime] = None, end: Optional[datetime] = None, ): @@ -33,12 +31,13 @@ def _load_timeseries_data( cwms.init_session(api_root=source_cda, api_key=None) # User has a ts_id if ts_id and not ts_group: - ts_data = [ - cwms.get_timeseries( - ts_id=ts_id, office_id=source_office, begin=begin, end=end - ) - ] - # only grab time_ids for locations that are in the target database + ts_data = cwms.get_timeseries( + ts_id=ts_id, + office_id=source_office, + begin=begin, + end=end, + ) + # store the retrieved timeseries data into the target database try: if dry_run: click.echo("Dry run enabled. No changes will be made.") @@ -106,4 +105,4 @@ def _load_timeseries_data( ) if verbose: - click.echo("Timeseries ID copy operation completed.") + click.echo("Timeseries data copy operation completed.") diff --git a/cwmscli/requirements.py b/cwmscli/requirements.py index a20674c..fb5524f 100644 --- a/cwmscli/requirements.py +++ b/cwmscli/requirements.py @@ -5,7 +5,7 @@ cwms = { "module": "cwms", "package": "cwms-python", - "version": "0.8.0", + "version": "1.0.1", "desc": "CWMS REST API Python client", "link": "https://github.com/HydrologicEngineeringCenter/cwms-python", } diff --git a/pyproject.toml b/pyproject.toml index c4cee9c..60d6a7e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -18,7 +18,7 @@ authors = ["Eric Novotny ", "Charles Graham Date: Tue, 3 Mar 2026 05:51:07 +0000 Subject: [PATCH 3/3] Update poetry.lock to reflect cwms-python>=1.0.1 requirement Co-authored-by: krowvin <23619282+krowvin@users.noreply.github.com> --- poetry.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/poetry.lock b/poetry.lock index 1b33e5c..bc7c821 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1,4 +1,4 @@ -# This file is automatically @generated by Poetry 2.2.1 and should not be changed by hand. +# This file is automatically @generated by Poetry 2.3.2 and should not be changed by hand. [[package]] name = "annotated-types" @@ -268,14 +268,14 @@ markers = {main = "platform_system == \"Windows\"", dev = "sys_platform == \"win [[package]] name = "cwms-python" -version = "1.0.0" +version = "1.0.1" description = "Corps water management systems (CWMS) REST API for Data Retrieval of USACE water data" optional = true python-versions = "<4.0,>=3.9" groups = ["main"] files = [ - {file = "cwms_python-1.0.0-py3-none-any.whl", hash = "sha256:c552505f00d57760b806f521a1cb5ec435e3a2ee0ee84b5a083d3e5fdfcd4b8c"}, - {file = "cwms_python-1.0.0.tar.gz", hash = "sha256:03a92ddf6e4558463d628eadaf2d2ca3a99f65e2ea1a68e76067a8bf1bd16f1b"}, + {file = "cwms_python-1.0.1-py3-none-any.whl", hash = "sha256:c0cac8e8b4607d94b8930b3c43373bfae8f9038c001948dad6dbf27c0b040934"}, + {file = "cwms_python-1.0.1.tar.gz", hash = "sha256:260b19f0b0385dd72f1cb4ba48b789b2e764e84c1a0afd59decefc991ca03203"}, ] [package.dependencies] @@ -530,7 +530,7 @@ colorama = {version = ">=0.3.4", markers = "sys_platform == \"win32\""} win32-setctime = {version = ">=1.0.0", markers = "sys_platform == \"win32\""} [package.extras] -dev = ["Sphinx (==8.1.3) ; python_version >= \"3.11\"", "build (==1.2.2) ; python_version >= \"3.11\"", "colorama (==0.4.5) ; python_version < \"3.8\"", "colorama (==0.4.6) ; python_version >= \"3.8\"", "exceptiongroup (==1.1.3) ; python_version >= \"3.7\" and python_version < \"3.11\"", "freezegun (==1.1.0) ; python_version < \"3.8\"", "freezegun (==1.5.0) ; python_version >= \"3.8\"", "mypy (==v0.910) ; python_version < \"3.6\"", "mypy (==v0.971) ; python_version == \"3.6\"", "mypy (==v1.13.0) ; python_version >= \"3.8\"", "mypy (==v1.4.1) ; python_version == \"3.7\"", "myst-parser (==4.0.0) ; python_version >= \"3.11\"", "pre-commit (==4.0.1) ; python_version >= \"3.9\"", "pytest (==6.1.2) ; python_version < \"3.8\"", "pytest (==8.3.2) ; python_version >= \"3.8\"", "pytest-cov (==2.12.1) ; python_version < \"3.8\"", "pytest-cov (==5.0.0) ; python_version == \"3.8\"", "pytest-cov (==6.0.0) ; python_version >= \"3.9\"", "pytest-mypy-plugins (==1.9.3) ; python_version >= \"3.6\" and python_version < \"3.8\"", "pytest-mypy-plugins (==3.1.0) ; python_version >= \"3.8\"", "sphinx-rtd-theme (==3.0.2) ; python_version >= \"3.11\"", "tox (==3.27.1) ; python_version < \"3.8\"", "tox (==4.23.2) ; python_version >= \"3.8\"", "twine (==6.0.1) ; python_version >= \"3.11\""] +dev = ["Sphinx (==8.1.3) ; python_version >= \"3.11\"", "build (==1.2.2) ; python_version >= \"3.11\"", "colorama (==0.4.5) ; python_version < \"3.8\"", "colorama (==0.4.6) ; python_version >= \"3.8\"", "exceptiongroup (==1.1.3) ; python_version >= \"3.7\" and python_version < \"3.11\"", "freezegun (==1.1.0) ; python_version < \"3.8\"", "freezegun (==1.5.0) ; python_version >= \"3.8\"", "mypy (==0.910) ; python_version < \"3.6\"", "mypy (==0.971) ; python_version == \"3.6\"", "mypy (==1.13.0) ; python_version >= \"3.8\"", "mypy (==1.4.1) ; python_version == \"3.7\"", "myst-parser (==4.0.0) ; python_version >= \"3.11\"", "pre-commit (==4.0.1) ; python_version >= \"3.9\"", "pytest (==6.1.2) ; python_version < \"3.8\"", "pytest (==8.3.2) ; python_version >= \"3.8\"", "pytest-cov (==2.12.1) ; python_version < \"3.8\"", "pytest-cov (==5.0.0) ; python_version == \"3.8\"", "pytest-cov (==6.0.0) ; python_version >= \"3.9\"", "pytest-mypy-plugins (==1.9.3) ; python_version >= \"3.6\" and python_version < \"3.8\"", "pytest-mypy-plugins (==3.1.0) ; python_version >= \"3.8\"", "sphinx-rtd-theme (==3.0.2) ; python_version >= \"3.11\"", "tox (==3.27.1) ; python_version < \"3.8\"", "tox (==4.23.2) ; python_version >= \"3.8\"", "twine (==6.0.1) ; python_version >= \"3.11\""] [[package]] name = "maison" @@ -1750,4 +1750,4 @@ ruyaml = ">=0.91.0" [metadata] lock-version = "2.1" python-versions = "^3.9" -content-hash = "c723b5ad9dbb174e0ebd77e88fb0db45719cd4708f7015b222b7ec36d13947f5" +content-hash = "1e229934c01aab19131bcba2b226992a4daa47ae8740622422c57d18c913e322"