#!/usr/bin/python3
# -*- coding: utf-8 -*-
########################################################################
#
# This file is part of python module <pySPC>.
# Copyright (C) 2013-2020 R. Marty
# (renaud.marty@developpement-durable.gouv.fr)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program (see COPYING.txt).
# If not, see <http://www.gnu.org/licenses/>.
#
########################################################################
"""
Définir la liste des stations à traiter à partir
d'un nom <station_name>
ou d'un fichier contenant une liste <stations_list_file>
"""
[docs]
def get_stations_list(station_name=None, stations_list_file=None):
"""
Définir la liste des stations à traiter à partir
d'un nom <station_name>
ou d'un fichier contenant une liste <stations_list_file>
"""
if station_name is not None:
return [station_name]
if stations_list_file is not None:
# with open(stations_list_file, 'r', encoding='iso-8859-1') as f:
with open(stations_list_file, 'r', encoding='utf-8') as f:
lines = f.readlines()
return [line.replace("\n", '').strip() for line in lines]
return []