27
27
URL = 'https://re.jrc.ec.europa.eu/api/'
28
28
29
29
# Dictionary mapping PVGIS names to pvlib names
30
- VARIABLE_MAP = {
30
+ PVGIS_VARIABLE_MAP = {
31
31
'G(h)' : 'ghi' ,
32
32
'Gb(n)' : 'dni' ,
33
33
'Gd(h)' : 'dhi' ,
@@ -113,11 +113,10 @@ def get_pvgis_hourly(latitude, longitude, start=None, end=None,
113
113
documentation [2]_ for more info.
114
114
url: str, default: :const:`pvlib.iotools.pvgis.URL`
115
115
Base url of PVGIS API. ``seriescalc`` is appended to get hourly data
116
- endpoint. Note, a specific PVGIS version can be specified, e.g.,
117
- https://re.jrc.ec.europa.eu/api/v5_2/
116
+ endpoint.
118
117
map_variables: bool, default: True
119
118
When true, renames columns of the Dataframe to pvlib variable names
120
- where applicable. See variable :const:`VARIABLE_MAP` .
119
+ where applicable. See variable PVGIS_VARIABLE_MAP .
121
120
timeout: int, default: 30
122
121
Time in seconds to wait for server response before timeout
123
122
@@ -140,10 +139,10 @@ def get_pvgis_hourly(latitude, longitude, start=None, end=None,
140
139
Hint
141
140
----
142
141
PVGIS provides access to a number of different solar radiation datasets,
143
- including satellite-based (SARAH, SARAH2 , and NSRDB PSM3) and re-analysis
144
- products (ERA5). Each data source has a different geographical coverage and
145
- time stamp convention, e.g., SARAH and SARAH2 provide instantaneous values,
146
- whereas values from ERA5 are averages for the hour.
142
+ including satellite-based (SARAH, CMSAF , and NSRDB PSM3) and re-analysis
143
+ products (ERA5 and COSMO ). Each data source has a different geographical
144
+ coverage and time stamp convention, e.g., SARAH and CMSAF provide
145
+ instantaneous values, whereas values from ERA5 are averages for the hour.
147
146
148
147
Notes
149
148
-----
@@ -174,12 +173,6 @@ def get_pvgis_hourly(latitude, longitude, start=None, end=None,
174
173
--------
175
174
pvlib.iotools.read_pvgis_hourly, pvlib.iotools.get_pvgis_tmy
176
175
177
- Examples
178
- --------
179
- >>> # Retrieve two years of irradiance data from PVGIS:
180
- >>> data, meta, inputs = pvlib.iotools.get_pvgis_hourly( # doctest: +SKIP
181
- >>> latitude=45, longitude=8, start=2015, end=2016) # doctest: +SKIP
182
-
183
176
References
184
177
----------
185
178
.. [1] `PVGIS <https://ec.europa.eu/jrc/en/pvgis>`_
@@ -236,7 +229,7 @@ def _parse_pvgis_hourly_json(src, map_variables):
236
229
data = data .drop ('time' , axis = 1 )
237
230
data = data .astype (dtype = {'Int' : 'int' }) # The 'Int' column to be integer
238
231
if map_variables :
239
- data = data .rename (columns = VARIABLE_MAP )
232
+ data = data .rename (columns = PVGIS_VARIABLE_MAP )
240
233
return data , inputs , metadata
241
234
242
235
@@ -278,7 +271,7 @@ def _parse_pvgis_hourly_csv(src, map_variables):
278
271
data .index = pd .to_datetime (data ['time' ], format = '%Y%m%d:%H%M' , utc = True )
279
272
data = data .drop ('time' , axis = 1 )
280
273
if map_variables :
281
- data = data .rename (columns = VARIABLE_MAP )
274
+ data = data .rename (columns = PVGIS_VARIABLE_MAP )
282
275
# All columns should have the dtype=float, except 'Int' which should be
283
276
# integer. It is necessary to convert to float, before converting to int
284
277
data = data .astype (float ).astype (dtype = {'Int' : 'int' })
@@ -305,7 +298,7 @@ def read_pvgis_hourly(filename, pvgis_format=None, map_variables=True):
305
298
``pvgis_format`` is required and must be in ``['csv', 'json']``.
306
299
map_variables: bool, default True
307
300
When true, renames columns of the DataFrame to pvlib variable names
308
- where applicable. See variable :const:`VARIABLE_MAP` .
301
+ where applicable. See variable PVGIS_VARIABLE_MAP .
309
302
310
303
Returns
311
304
-------
@@ -377,9 +370,8 @@ def get_pvgis_tmy(latitude, longitude, outputformat='json', usehorizon=True,
377
370
userhorizon = None , startyear = None , endyear = None , url = URL ,
378
371
map_variables = None , timeout = 30 ):
379
372
"""
380
- Get TMY data from PVGIS.
381
-
382
- For more information see the PVGIS [1]_ TMY tool documentation [2]_.
373
+ Get TMY data from PVGIS. For more information see the PVGIS [1]_ TMY tool
374
+ documentation [2]_.
383
375
384
376
Parameters
385
377
----------
@@ -405,7 +397,7 @@ def get_pvgis_tmy(latitude, longitude, outputformat='json', usehorizon=True,
405
397
base url of PVGIS API, append ``tmy`` to get TMY endpoint
406
398
map_variables: bool
407
399
When true, renames columns of the Dataframe to pvlib variable names
408
- where applicable. See variable const:`VARIABLE_MAP` .
400
+ where applicable. See variable PVGIS_VARIABLE_MAP .
409
401
timeout : int, default 30
410
402
time in seconds to wait for server response before timeout
411
403
@@ -437,12 +429,13 @@ def get_pvgis_tmy(latitude, longitude, outputformat='json', usehorizon=True,
437
429
the error message in the response will be raised as an exception,
438
430
otherwise raise whatever ``HTTP/1.1`` error occurred
439
431
440
- See Also
432
+ See also
441
433
--------
442
434
read_pvgis_tmy
443
435
444
436
References
445
437
----------
438
+
446
439
.. [1] `PVGIS <https://ec.europa.eu/jrc/en/pvgis>`_
447
440
.. [2] `PVGIS TMY tool <https://ec.europa.eu/jrc/en/PVGIS/tools/tmy>`_
448
441
.. [3] `PVGIS horizon profile tool
@@ -500,7 +493,7 @@ def get_pvgis_tmy(latitude, longitude, outputformat='json', usehorizon=True,
500
493
)
501
494
map_variables = False
502
495
if map_variables :
503
- data = data .rename (columns = VARIABLE_MAP )
496
+ data = data .rename (columns = PVGIS_VARIABLE_MAP )
504
497
505
498
return data , months_selected , inputs , meta
506
499
@@ -574,7 +567,7 @@ def read_pvgis_tmy(filename, pvgis_format=None, map_variables=None):
574
567
be in ``['csv', 'epw', 'json', 'basic']``.
575
568
map_variables: bool
576
569
When true, renames columns of the Dataframe to pvlib variable names
577
- where applicable. See variable :const:`VARIABLE_MAP` .
570
+ where applicable. See variable PVGIS_VARIABLE_MAP .
578
571
579
572
580
573
Returns
@@ -597,7 +590,7 @@ def read_pvgis_tmy(filename, pvgis_format=None, map_variables=None):
597
590
TypeError
598
591
if ``pvgis_format`` is ``None`` and ``filename`` is a buffer
599
592
600
- See Also
593
+ See also
601
594
--------
602
595
get_pvgis_tmy
603
596
"""
@@ -663,7 +656,7 @@ def read_pvgis_tmy(filename, pvgis_format=None, map_variables=None):
663
656
)
664
657
map_variables = False
665
658
if map_variables :
666
- data = data .rename (columns = VARIABLE_MAP )
659
+ data = data .rename (columns = PVGIS_VARIABLE_MAP )
667
660
668
661
return data , months_selected , inputs , meta
669
662
@@ -695,11 +688,13 @@ def get_pvgis_horizon(latitude, longitude, proxies=None, url=URL):
695
688
# the horizon data is given in a different format then the others
696
689
# numpy has an easier time decoding it
697
690
array = np .genfromtxt (io .StringIO (string ),
698
- skip_header = 4 , skip_footer = 7 )
691
+ skip_header = 4 , skip_footer = 7 )
699
692
df = pd .DataFrame (array )
700
-
693
+
701
694
# Set the column names
702
695
df .columns = ['horizon_azimuth' , 'horizon_angles' ,
703
- 'azimuth_sun_winter_solstice' , 'elevation_sun_winter_solstice' ,
704
- 'azimuth_sun_summer_solstice' , 'elevation_sun_summer_solstice' ]
696
+ 'azimuth_sun_winter_solstice' ,
697
+ 'elevation_sun_winter_solstice' ,
698
+ 'azimuth_sun_summer_solstice' ,
699
+ 'elevation_sun_summer_solstice' ]
705
700
return df
0 commit comments