Commit 7a65347f authored by Paulo Medeiros's avatar Paulo Medeiros
Browse files

"selected-stations" -> "--selected-stations-fpath"

Change the "--selected-stations" option in the csv2obsoul command to
"--selected-stations-fpath". This is to make it more obvious that this
refers to a file path.

The old syntax using "--selected-stations" should still work though, as
argparse tries to match the options from passed abbreviations.
parent 347fc629
......@@ -184,7 +184,7 @@ def get_parsed_args(program_name):
metavar="data_column=fillna_value_for_col",
)
parser_csv2obsoul.add_argument(
"--selected_stations",
"--selected-stations-fpath",
metavar="STATIONS_FILE_PATH",
default=None,
type=Path,
......
......@@ -447,18 +447,18 @@ def csv2obsoul(args):
# Allow picking only selected stations
selected_stations = None
if args.selected_stations is not None:
if args.selected_stations.suffix == ".csv":
selected_stations = pd.read_csv(args.selected_stations)["id"]
if args.selected_stations_fpath is not None:
if args.selected_stations_fpath.suffix == ".csv":
selected_stations = pd.read_csv(args.selected_stations_fpath)["id"]
logger.info(
"Found %s selected stations in file '%s'.",
len(selected_stations),
args.selected_stations,
args.selected_stations_fpath,
)
else:
logger.warning(
"Only csv files supported. Skipping file '%s'",
args.selected_stations,
'Only csv files supported in "--selected-stations-fpath". '
"Received '%s'." % (args.selected_stations_fpath),
)
netatmoqc_input2output(
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment