Skip to content

Commit c83ecc7

Browse files
committed
Remove basic option from PVGIS_TMY
1 parent 0deb93f commit c83ecc7

1 file changed

Lines changed: 18 additions & 38 deletions

File tree

pvlib/iotools/pvgis.py

Lines changed: 18 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,7 @@ def get_pvgis_tmy(latitude, longitude, outputformat='json', usehorizon=True,
429429
longitude : float
430430
Longitude in degrees east
431431
outputformat : str, default 'json'
432-
Must be in ``['csv', 'basic', 'epw', 'json']``. See PVGIS TMY tool
432+
Must be in ``['csv', 'epw', 'json']``. See PVGIS TMY tool
433433
documentation [2]_ for more info.
434434
usehorizon : bool, default True
435435
include effects of horizon
@@ -461,11 +461,11 @@ def get_pvgis_tmy(latitude, longitude, outputformat='json', usehorizon=True,
461461
data : pandas.DataFrame
462462
the weather data
463463
months_selected : list
464-
TMY year for each month, ``None`` for basic and EPW
464+
TMY year for each month, ``None`` for EPW
465465
inputs : dict
466-
the inputs, ``None`` for basic and EPW
466+
the inputs, ``None`` for EPW
467467
metadata : list or dict
468-
file metadata, ``None`` for basic
468+
file metadata
469469
470470
Raises
471471
------
@@ -516,9 +516,6 @@ def get_pvgis_tmy(latitude, longitude, outputformat='json', usehorizon=True,
516516
elif outputformat == 'csv':
517517
with io.BytesIO(res.content) as src:
518518
data, months_selected, inputs, meta = _parse_pvgis_tmy_csv(src)
519-
elif outputformat == 'basic':
520-
with io.BytesIO(res.content) as src:
521-
data, months_selected, inputs, meta = _parse_pvgis_tmy_basic(src)
522519
elif outputformat == 'epw':
523520
with io.StringIO(res.content.decode('utf-8')) as src:
524521
data, meta = parse_epw(src)
@@ -590,13 +587,6 @@ def _parse_pvgis_tmy_csv(src):
590587
return data, months_selected, inputs, meta
591588

592589

593-
def _parse_pvgis_tmy_basic(src):
594-
data = pd.read_csv(src)
595-
data.index = pd.to_datetime(
596-
data['time(UTC)'], format='%Y%m%d:%H%M', utc=True)
597-
data = data.drop('time(UTC)', axis=1)
598-
return data, None, None, None
599-
600590

601591
def read_pvgis_tmy(filename, pvgis_format=None, map_variables=True):
602592
"""
@@ -610,11 +600,9 @@ def read_pvgis_tmy(filename, pvgis_format=None, map_variables=True):
610600
Format of PVGIS file or buffer. Equivalent to the ``outputformat``
611601
parameter in the PVGIS TMY API. If ``filename`` is a file and
612602
``pvgis_format`` is not specified then the file extension will be used
613-
to determine the PVGIS format to parse. For PVGIS files from the API
614-
with ``outputformat='basic'``, please set ``pvgis_format`` to
615-
``'basic'``.
603+
to determine the PVGIS format to parse.
616604
If ``filename`` is a buffer, then ``pvgis_format`` is required and must
617-
be in ``['csv', 'epw', 'json', 'basic']``.
605+
be in ``['csv', 'epw', 'json']``.
618606
map_variables: bool, default True
619607
When true, renames columns of the Dataframe to pvlib variable names
620608
where applicable. See variable :const:`VARIABLE_MAP`.
@@ -625,18 +613,18 @@ def read_pvgis_tmy(filename, pvgis_format=None, map_variables=True):
625613
data : pandas.DataFrame
626614
the weather data
627615
months_selected : list
628-
TMY year for each month, ``None`` for basic and EPW
616+
TMY year for each month, ``None`` for EPW
629617
inputs : dict
630-
the inputs, ``None`` for basic and EPW
618+
the inputs, ``None`` for EPW
631619
metadata : list or dict
632-
file metadata, ``None`` for basic
620+
file metadata
633621
634622
Raises
635623
------
636624
ValueError
637625
if ``pvgis_format`` is not specified and the file extension is neither
638626
``.csv``, ``.json``, nor ``.epw``, or if ``pvgis_format`` is provided
639-
as input but isn't in ``['csv', 'epw', 'json', 'basic']``
627+
as input but isn't in ``['csv', 'epw', 'json']``
640628
TypeError
641629
if ``pvgis_format`` is not specified and ``filename`` is a buffer
642630
@@ -652,8 +640,7 @@ def read_pvgis_tmy(filename, pvgis_format=None, map_variables=True):
652640
outputformat = Path(filename).suffix[1:].lower()
653641
else:
654642
outputformat = pvgis_format
655-
# parse the pvgis file based on the output format, either 'epw', 'json',
656-
# 'csv', or 'basic'
643+
# parse the pvgis file based on the output format, either 'epw', 'json', or 'csv'
657644

658645
# EPW: use the EPW parser from the pvlib.iotools epw.py module
659646
if outputformat == 'epw':
@@ -663,8 +650,7 @@ def read_pvgis_tmy(filename, pvgis_format=None, map_variables=True):
663650
data, meta = read_epw(filename)
664651
months_selected, inputs = None, None
665652

666-
# NOTE: json, csv, and basic output formats have parsers defined as private
667-
# functions in this module
653+
# NOTE: json and csv output formats have parsers defined as private functions in this module
668654

669655
# JSON: use Python built-in json module to convert file contents to a
670656
# Python dictionary, and pass the dictionary to the _parse_pvgis_tmy_json()
@@ -677,24 +663,18 @@ def read_pvgis_tmy(filename, pvgis_format=None, map_variables=True):
677663
src = json.load(fbuf)
678664
data, months_selected, inputs, meta = _parse_pvgis_tmy_json(src)
679665

680-
# CSV or basic: use the correct parser from this module
681-
# eg: _parse_pvgis_tmy_csv() or _parse_pvgist_tmy_basic()
682-
elif outputformat in ['csv', 'basic']:
683-
# get the correct parser function for this output format from globals()
684-
pvgis_parser = globals()['_parse_pvgis_tmy_{:s}'.format(outputformat)]
685-
# NOTE: pvgis_parse() is a pvgis parser function from this module,
686-
# either _parse_pvgis_tmy_csv() or _parse_pvgist_tmy_basic()
666+
elif outputformat == 'csv':
687667
try:
688-
data, months_selected, inputs, meta = pvgis_parser(filename)
668+
data, months_selected, inputs, meta = _parse_pvgis_tmy_csv(filename)
689669
except AttributeError: # str/path has no .read() attribute
690670
with open(str(filename), 'rb') as fbuf:
691-
data, months_selected, inputs, meta = pvgis_parser(fbuf)
671+
data, months_selected, inputs, meta = _parse_pvgis_tmy_csv(fbuf)
692672

693673
else:
694-
# raise exception if pvgis format isn't in ['csv','basic','epw','json']
674+
# raise exception if pvgis format isn't in ['csv','epw','json']
695675
err_msg = (
696-
"pvgis format '{:s}' was unknown, must be either 'epw', 'json', "
697-
"'csv', or 'basic'").format(outputformat)
676+
"pvgis format '{:s}' was unknown, must be either 'epw', 'json', or 'csv'"
677+
).format(outputformat)
698678
raise ValueError(err_msg)
699679

700680
if map_variables:

0 commit comments

Comments
 (0)