Skip to content

Commit 1869d87

Browse files
AdamRJensenAdamRJensen
and
AdamRJensen
authored
Add getter/parser for PVGIS hourly-radiation (#1186)
* Add pvgis.get_pvgis_hourly function * Update documentation * Add parser for pvgis_hourly csv and basic * Update variable map and documentation * Update whatsnew, api.rst, and __init__ * Add read_pvgis_hourly * Update input and output names Change lat/lon to latitude/longitude and changed startyear/endyear to start/end. Also, changed meta to metadata * Add cams.get_cams_radiation function * Revert "Add cams.get_cams_radiation function" This reverts commit d7deb80. * Add requests-mock to CI files * Revert "Add requests-mock to CI files" This reverts commit b416f62. * Add tests and test files * Fix stickler * Parametrize read_pvgis_hourly tests * Add test for metadata assertion * Add test documentation * Fixed minor documentation issues * Remove basic parser and add bad extension test * Add TypeError test and minor doc fixes * Fix stickler * Fix stickler again * Add tests for get_pvgis_hourly * Add tests for HTTPError message with json * Fix documentation issues * Update data columns data * Change asterisk to dagger symbol in data table * Update documentation * Rename poa_sky_diffuse and minor doc fixes * Update whatsnew description * Refactor test_read_pvgis_hourly Also add datetime like input for start and end * Coverage for userhorizon, usehorizon, & optimal_surface_tilt * Add inputs to params dict instead of if statements It is more robust to always pass in the input arguments instead of relying on the PVGIS defaults (these could change and then the pvlib documentation would be wrong). * Fix stickler * Doc. update & refactoring of start/end * Reorder inputs & capitalize input descriptions * Use .strip() instead of replace('\r\n','') Also remove instances of using inplace * Update pvgis.py * Raise ValueError for invalid outputformat * Coverage for bad outputformat * Minor doc fixes * Change 'not relevant' to 'ignored' * Have get function call read function, instead of individual parse functions * Raise ValueError if no data section is detected * Coverage for empty file passed to read_pvgis_hourly * Add info box concerning databases and timestamps * Update admonition * Change admonition style to 'attention' * Update admonition * Admonition update * Fix admonition * Refactor start input Co-authored-by: AdamRJensen <arajen@byg.dtu.dk>
1 parent 5a14156 commit 1869d87

File tree

7 files changed

+673
-1
lines changed

7 files changed

+673
-1
lines changed

docs/sphinx/source/api.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -486,6 +486,8 @@ of sources and file formats relevant to solar energy modeling.
486486
iotools.parse_psm3
487487
iotools.get_pvgis_tmy
488488
iotools.read_pvgis_tmy
489+
iotools.get_pvgis_hourly
490+
iotools.read_pvgis_hourly
489491
iotools.read_bsrn
490492
iotools.get_cams
491493
iotools.read_cams

docs/sphinx/source/whatsnew/v0.9.0.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,10 @@ Deprecations
103103

104104
Enhancements
105105
~~~~~~~~~~~~
106+
* Added :func:`~pvlib.iotools.read_pvgis_hourly` and
107+
:func:`~pvlib.iotools.get_pvgis_hourly` for reading and retrieving hourly
108+
solar radiation data and PV power output from PVGIS. (:pull:`1186`,
109+
:issue:`849`)
106110
* Add :func:`~pvlib.iotools.read_bsrn` for reading BSRN solar radiation data
107111
files. (:pull:`1145`, :issue:`1015`)
108112
* Add :func:`~pvlib.iotools.get_cams`,
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"inputs": {"location": {"latitude": 45.0, "longitude": 8.0, "elevation": 250.0}, "meteo_data": {"radiation_db": "PVGIS-CMSAF", "meteo_db": "ERA-Interim", "year_min": 2013, "year_max": 2014, "use_horizon": true, "horizon_db": null, "horizon_data": "DEM-calculated"}, "mounting_system": {"two_axis": {"slope": {"value": "-", "optimal": "-"}, "azimuth": {"value": "-", "optimal": "-"}}}, "pv_module": {"technology": "CIS", "peak_power": 10.0, "system_loss": 5.0}}, "outputs": {"hourly": [{"time": "20130101:0055", "P": 0.0, "Gb(i)": 0.0, "Gd(i)": 0.0, "Gr(i)": 0.0, "H_sun": 0.0, "T2m": 3.01, "WS10m": 1.23, "Int": 0.0}, {"time": "20130101:0155", "P": 0.0, "Gb(i)": 0.0, "Gd(i)": 0.0, "Gr(i)": 0.0, "H_sun": 0.0, "T2m": 2.22, "WS10m": 1.46, "Int": 0.0}, {"time": "20130101:0255", "P": 0.0, "Gb(i)": 0.0, "Gd(i)": 0.0, "Gr(i)": 0.0, "H_sun": 0.0, "T2m": 1.43, "WS10m": 1.7, "Int": 0.0}, {"time": "20130101:0355", "P": 0.0, "Gb(i)": 0.0, "Gd(i)": 0.0, "Gr(i)": 0.0, "H_sun": 0.0, "T2m": 0.64, "WS10m": 1.93, "Int": 0.0}, {"time": "20130101:0455", "P": 0.0, "Gb(i)": 0.0, "Gd(i)": 0.0, "Gr(i)": 0.0, "H_sun": 0.0, "T2m": 0.77, "WS10m": 1.8, "Int": 0.0}, {"time": "20130101:0555", "P": 0.0, "Gb(i)": 0.0, "Gd(i)": 0.0, "Gr(i)": 0.0, "H_sun": 0.0, "T2m": 0.91, "WS10m": 1.66, "Int": 0.0}, {"time": "20130101:0655", "P": 0.0, "Gb(i)": 0.0, "Gd(i)": 0.0, "Gr(i)": 0.0, "H_sun": 0.0, "T2m": 1.05, "WS10m": 1.53, "Int": 0.0}, {"time": "20130101:0755", "P": 3464.5, "Gb(i)": 270.35, "Gd(i)": 91.27, "Gr(i)": 6.09, "H_sun": 6.12, "T2m": 1.92, "WS10m": 1.44, "Int": 0.0}, {"time": "20130101:0855", "P": 1586.9, "Gb(i)": 80.76, "Gd(i)": 83.95, "Gr(i)": 9.04, "H_sun": 13.28, "T2m": 2.79, "WS10m": 1.36, "Int": 0.0}, {"time": "20130101:0955", "P": 713.3, "Gb(i)": 5.18, "Gd(i)": 70.57, "Gr(i)": 7.31, "H_sun": 18.56, "T2m": 3.66, "WS10m": 1.27, "Int": 0.0}]}, "meta": {"inputs": {"location": {"description": "Selected location", "variables": {"latitude": {"description": "Latitude", "units": "decimal degree"}, "longitude": {"description": "Longitude", "units": "decimal degree"}, "elevation": {"description": "Elevation", "units": "m"}}}, "meteo_data": {"description": "Sources of meteorological data", "variables": {"radiation_db": {"description": "Solar radiation database"}, "meteo_db": {"description": "Database used for meteorological variables other than solar radiation"}, "year_min": {"description": "First year of the calculations"}, "year_max": {"description": "Last year of the calculations"}, "use_horizon": {"description": "Include horizon shadows"}, "horizon_db": {"description": "Source of horizon data"}}}, "mounting_system": {"description": "Mounting system", "choices": "fixed, vertical_axis, inclined_axis, two_axis", "fields": {"slope": {"description": "Inclination angle from the horizontal plane", "units": "degree"}, "azimuth": {"description": "Orientation (azimuth) angle of the (fixed) PV system (0 = S, 90 = W, -90 = E)", "units": "degree"}}}, "pv_module": {"description": "PV module parameters", "variables": {"technology": {"description": "PV technology"}, "peak_power": {"description": "Nominal (peak) power of the PV module", "units": "kW"}, "system_loss": {"description": "Sum of system losses", "units": "%"}}}}, "outputs": {"hourly": {"type": "time series", "timestamp": "hourly averages", "variables": {"P": {"description": "PV system power", "units": "W"}, "Gb(i)": {"description": "Beam (direct) irradiance on the inclined plane (plane of the array)", "units": "W/m2"}, "Gd(i)": {"description": "Diffuse irradiance on the inclined plane (plane of the array)", "units": "W/m2"}, "Gr(i)": {"description": "Reflected irradiance on the inclined plane (plane of the array)", "units": "W/m2"}, "H_sun": {"description": "Sun height", "units": "degree"}, "T2m": {"description": "2-m air temperature", "units": "degree Celsius"}, "WS10m": {"description": "10-m total wind speed", "units": "m/s"}, "Int": {"description": "1 means solar radiation values are reconstructed"}}}}}}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
Latitude (decimal degrees): 45.000
2+
Longitude (decimal degrees): 8.000
3+
Elevation (m): 250
4+
Radiation database: PVGIS-SARAH
5+
6+
7+
Slope: 30 deg.
8+
Azimuth: 0 deg.
9+
time,Gb(i),Gd(i),Gr(i),H_sun,T2m,WS10m,Int
10+
20160101:0010,0.0,0.0,0.0,0.0,3.44,1.43,0.0
11+
20160101:0110,0.0,0.0,0.0,0.0,2.94,1.47,0.0
12+
20160101:0210,0.0,0.0,0.0,0.0,2.43,1.51,0.0
13+
20160101:0310,0.0,0.0,0.0,0.0,1.93,1.54,0.0
14+
20160101:0410,0.0,0.0,0.0,0.0,2.03,1.62,0.0
15+
20160101:0510,0.0,0.0,0.0,0.0,2.14,1.69,0.0
16+
20160101:0610,0.0,0.0,0.0,0.0,2.25,1.77,0.0
17+
20160101:0710,0.0,0.0,0.0,0.0,3.06,1.49,0.0
18+
20160101:0810,26.71,8.28,0.21,8.06,3.87,1.22,1.0
19+
20160101:0910,14.69,5.76,0.16,14.8,4.67,0.95,1.0
20+
20160101:1010,2.19,0.94,0.03,19.54,5.73,0.77,1.0
21+
20160101:1110,2.11,0.94,0.03,21.82,6.79,0.58,1.0
22+
20160101:1210,4.25,1.88,0.05,21.41,7.84,0.4,1.0
23+
20160101:1310,0.0,0.0,0.0,0.0,7.43,0.72,0.0
24+
25+
Gb(i): Beam (direct) irradiance on the inclined plane (plane of the array) (W/m2)
26+
Gd(i): Diffuse irradiance on the inclined plane (plane of the array) (W/m2)
27+
Gr(i): Reflected irradiance on the inclined plane (plane of the array) (W/m2)
28+
H_sun: Sun height (degree)
29+
T2m: 2-m air temperature (degree Celsius)
30+
WS10m: 10-m total wind speed (m/s)
31+
Int: 1 means solar radiation values are reconstructed
32+
33+
34+
35+
PVGIS (c) European Union, 2001-2021

pvlib/iotools/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
from pvlib.iotools.psm3 import read_psm3 # noqa: F401
1414
from pvlib.iotools.psm3 import parse_psm3 # noqa: F401
1515
from pvlib.iotools.pvgis import get_pvgis_tmy, read_pvgis_tmy # noqa: F401
16+
from pvlib.iotools.pvgis import read_pvgis_hourly # noqa: F401
17+
from pvlib.iotools.pvgis import get_pvgis_hourly # noqa: F401
1618
from pvlib.iotools.bsrn import read_bsrn # noqa: F401
1719
from pvlib.iotools.sodapro import get_cams # noqa: F401
1820
from pvlib.iotools.sodapro import read_cams # noqa: F401

0 commit comments

Comments
 (0)