25 lines
846 B
Python
25 lines
846 B
Python
|
"""
|
||
|
CliWeatherParameters class to extract weather parameters from a defined region in .dat format
|
||
|
SPDX - License - Identifier: LGPL - 3.0 - or -later
|
||
|
Copyright © 2020 Project Author Pilar Monsalvete pilar_monsalvete@yahoo.es
|
||
|
"""
|
||
|
|
||
|
import pandas as pd
|
||
|
|
||
|
|
||
|
class DatWeatherParameters:
|
||
|
"""
|
||
|
DatWeatherParameters class
|
||
|
"""
|
||
|
def __init__(self, full_path_weather):
|
||
|
self._full_path_weather = full_path_weather
|
||
|
self._weather_values = None
|
||
|
|
||
|
def weather_values(self):
|
||
|
if self._full_path_weather is not None:
|
||
|
# TODO: catch error if file does not exist
|
||
|
if self._weather_values is None:
|
||
|
self._weather_values = pd.read_csv(self._full_path_weather, sep='\s+', header=None,
|
||
|
names=['hour', 'global_horiz', 'temperature', 'diffuse', 'beam', 'empty'])
|
||
|
return self._weather_values
|