Skip to content

feat: Add modern DSS transfer utilities - #242

Open
krowvin wants to merge 7 commits into
mainfrom
agent/modern-dss-transfer-utilities
Open

feat: Add modern DSS transfer utilities#242
krowvin wants to merge 7 commits into
mainfrom
agent/modern-dss-transfer-utilities

Conversation

@krowvin

@krowvin krowvin commented Jul 30, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • add cwms-cli dss import and cwms-cli dss export with legacy entry points
  • preserve legacy mappings and options while using CDA and shared authentication
  • add tests, documentation, and downloadable sample mapping files

Closes #94

Validation

  • poetry run pytest (261 passed)
  • poetry run sphinx-build -W -b html docs docs/_build/html

@krowvin krowvin changed the title Add modern DSS transfer utilities feat: Add modern DSS transfer utilities Jul 30, 2026

@krowvin krowvin left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Few thoughts for the reviewer

Comment thread cwmscli/dss/compat.py
Comment on lines +12 to +19
def dss2cwms_main() -> None:
_enable_terminal_colors()
import_cmd.main(args=_normalize_legacy_args(sys.argv[1:]), prog_name="dss2cwms")


def cwms2dss_main() -> None:
_enable_terminal_colors()
export_cmd.main(args=_normalize_legacy_args(sys.argv[1:]), prog_name="cwms2dss")

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Didn't want to sneak these in.

But this would create commands in the path for cwms2dss ...etc or dss2cwms ...etc in an attempt to make for backwards compatibility.

We don't do this for other commands and this could be starting something.

Should we just stick with cwms-cli dss import/export or is it OK to keep these two commands as well?

Comment thread cwmscli/dss/compat.py
def _normalize_legacy_args(args: list[str]) -> list[str]:
"""Translate legacy ``-option=value`` forms into Click-compatible tokens."""
normalized = []
prefixes = ("-dss", "-db", "-id", "-f2", "-tz", "-o", "-f", "-p", "-v", "-l")

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of translating old args should we instead throw an error and ask for the new args to be used?

Comment thread cwmscli/dss/naming.py
Comment on lines +9 to +16
_DSS_INTERVAL = {
"minute": "MIN",
"hour": "HOUR",
"day": "DAY",
"week": "WEEK",
"month": "MON",
"year": "YEAR",
}

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I couldn't find these exposed in hecdss, but would prefer to get it from there in case DECADE, etc was every added.

Comment thread cwmscli/dss/naming.py
for line_number, row in _rows(filename):
if len(row) != 4:
raise MappingError(
f"{filename}:{line_number}: expected pathname,tsid,CWMS_unit,factor"

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wondering if I should link to the docs here too

Comment thread cwmscli/dss/naming.py
pathname, tsid, cwms_unit, factor_text = row
normalized = normalize_pathname(pathname)
if len(tsid.split(".")) != 6:
raise MappingError(f"{filename}:{line_number}: invalid CWMS TSID: {tsid}")

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or really any mapping error link to the docs

Comment thread pyproject.toml
Comment on lines +81 to +82
dss2cwms = "cwmscli.dss.compat:dss2cwms_main"
cwms2dss = "cwmscli.dss.compat:cwms2dss_main"

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These get exposed along with the cwms-cli command, related to my comment above about how we don't expose commands like this for any other commands but perhaps this is a one-off because these commands existed as stand alones prior.

@krowvin
krowvin marked this pull request as ready for review July 30, 2026 21:32
@krowvin
krowvin requested a review from Enovotny as a code owner July 30, 2026 21:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add DSS2CWMS

1 participant