Commit 347fc629 authored by Paulo Medeiros's avatar Paulo Medeiros
Browse files

csv2obsoul: Fix crash in --selected_stations opt

Caused by a reference to select_stations before the variable had been
defined.
parent 109c3755
......@@ -445,11 +445,13 @@ def csv2obsoul(args):
# Allow mkdir to raise eventual exceptions if cannot write to outdir
outdir.mkdir(parents=True)
# Allow picking only selected stations
selected_stations = None
if args.selected_stations is not None:
if str(args.selected_stations).endswith(".csv"):
if args.selected_stations.suffix == ".csv":
selected_stations = pd.read_csv(args.selected_stations)["id"]
logger.info(
"Read %s stations from file '%s'",
"Found %s selected stations in file '%s'.",
len(selected_stations),
args.selected_stations,
)
......@@ -458,7 +460,6 @@ def csv2obsoul(args):
"Only csv files supported. Skipping file '%s'",
args.selected_stations,
)
selected_stations = None
netatmoqc_input2output(
config.general.dtgs,
......
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