Skip to content

Commit 6070b98

Browse files
committed
feat: add docstrings for clarity in CLI and channel orientation functions
1 parent 54536f8 commit 6070b98

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

pydsm/cli.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ def compare_dss(
165165
def update_hydro_tidefile_with_inp(
166166
hydro_tidefile, input_file, tidefile_path, table_name
167167
):
168+
"""Patch an input table inside a Hydro HDF5 tidefile from a DSM2 .inp file."""
168169
from . import utils
169170

170171
utils.update_hydro_tidefile_with_inp(
@@ -193,6 +194,7 @@ def update_hydro_tidefile_with_inp(
193194
help="period type for the data",
194195
)
195196
def create_repeating(datafile, input_file, path, units, period_type="PER-AVER"):
197+
"""Create a repeating annual time series from a CSV template and write it to a DSS file."""
196198
# Load the input CSV file
197199
df_template_year = pd.read_csv(
198200
input_file, parse_dates=["datetime"], index_col="datetime"
@@ -218,6 +220,7 @@ def create_repeating(datafile, input_file, path, units, period_type="PER-AVER"):
218220
"--end-year", required=True, type=int, help="End year for the extended time series"
219221
)
220222
def extend_repeating(datafile, cpart, end_year):
223+
"""Extend an existing repeating time series in a DSS file forward to a given end year."""
221224
matches = dss.get_matching_ts(datafile, pathname=f"///{cpart}///")
222225
with dss.DSSFile(datafile, create_new=False) as dh:
223226
for df, u, t in matches:
@@ -236,6 +239,7 @@ def extend_repeating(datafile, cpart, end_year):
236239
@click.argument("dsm2_input_filename")
237240
@click.argument("file_field_string")
238241
def create_dsm2_input_for_cd(dss_filename, dsm2_input_filename, file_field_string):
242+
"""Generate a DSM2 .inp boundary-condition file for consumptive demand from a DSS file."""
239243
create_cd_inp.create_cd_inp(dss_filename, dsm2_input_filename, file_field_string)
240244

241245

@@ -249,13 +253,15 @@ def repeating():
249253
@click.argument("from_file", type=click.Path(exists=True))
250254
@click.argument("to_file", type=click.Path(exists=False))
251255
def copy_all_dss(from_file, to_file):
256+
"""Copy all pathnames from one DSS file to another."""
252257
dssutils.copy_all(from_file, to_file)
253258

254259

255260
@click.command()
256261
@click.argument("input_file", type=click.Path(exists=True))
257262
@click.argument("output_file", type=click.Path(exists=False), required=False)
258263
def pretty_print_input(input_file, output_file=None):
264+
"""Reformat (pretty-print) a DSM2 .inp echo file. Defaults to <basename>.pretty.inp."""
259265
from pydsm.input import read_input, pretty_print
260266

261267
tables = read_input(input_file)

pydsm/input/channel_orient.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ def find_segment_and_angle(line, distance, normalized=True):
5454
def generate_channel_orientation(
5555
channel_line_geojson_file, hydro_echo_file, channel_orient_file="channel_orient.inp"
5656
):
57+
"""Generate a channel orientation (angle) file from a GeoJSON channel geometry and a Hydro echo file."""
5758
from pydsm.analysis import dsm2study
5859

5960
hydro_tables = dsm2study.load_echo_file(hydro_echo_file)

0 commit comments

Comments
 (0)