Skip to content

Commit f6443fc

Browse files
committed
Merge branch 'era5' of https://github.com/AdamRJensen/pvlib-python into era5
2 parents 5db2fef + 6cd44b1 commit f6443fc

30 files changed

+368
-197
lines changed

README.md

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -111,11 +111,24 @@ Please see the [Contributing page](http://pvlib-python.readthedocs.io/en/stable/
111111
The long-term success of pvlib-python requires substantial community support.
112112

113113

114-
License
115-
=======
114+
Citing
115+
======
116+
117+
If you use pvlib-python in a published work, please cite:
118+
119+
William F. Holmgren, Clifford W. Hansen, and Mark A. Mikofski.
120+
"pvlib python: a python package for modeling solar energy systems."
121+
Journal of Open Source Software, 3(29), 884, (2018).
122+
https://doi.org/10.21105/joss.00884
116123

117-
BSD 3-clause
124+
Please also cite the DOI corresponding to the specific version of
125+
pvlib-python that you used. pvlib-python DOIs are listed at
126+
[Zenodo.org](https://zenodo.org/search?page=1&size=20&q=conceptrecid:593284&all_versions&sort=-version)
118127

128+
If you use pvlib-python in a commercial or publicly-available application, please
129+
consider displaying one of the "powered by pvlib" logos:
130+
131+
<img src="docs/sphinx/source/_images/pvlib_powered_logo_vert.png" width="300"><img src="docs/sphinx/source/_images/pvlib_powered_logo_horiz.png" width="300">
119132

120133
Getting support
121134
===============
@@ -133,19 +146,12 @@ change something about pvlib, then please make an issue on our
133146
[GitHub issues page](https://github.com/pvlib/pvlib-python/issues).
134147

135148

136-
Citing
137-
======
138149

139-
If you use pvlib-python in a published work, please cite:
150+
License
151+
=======
140152

141-
William F. Holmgren, Clifford W. Hansen, and Mark A. Mikofski.
142-
"pvlib python: a python package for modeling solar energy systems."
143-
Journal of Open Source Software, 3(29), 884, (2018).
144-
https://doi.org/10.21105/joss.00884
153+
BSD 3-clause.
145154

146-
Please also cite the DOI corresponding to the specific version of
147-
pvlib-python that you used. pvlib-python DOIs are listed at
148-
[Zenodo.org](https://zenodo.org/search?page=1&size=20&q=conceptrecid:593284&all_versions&sort=-version)
149155

150156
NumFOCUS
151157
========

azure-pipelines.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
vmImage: ubuntu-16.04
1313

1414

15-
- template: ci/azure/posix.yml
15+
- template: ci/azure/posix_no_39.yml
1616
parameters:
1717
name: Test_bare_macOS
1818
vmImage: macOS-10.14

ci/azure/posix_no_39.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
parameters:
2+
name: ''
3+
vmImage: ''
4+
5+
jobs:
6+
- job: ${{ parameters.name }}
7+
pool:
8+
vmImage: ${{ parameters.vmImage }}
9+
strategy:
10+
matrix:
11+
Python36:
12+
python.version: '3.6'
13+
Python37:
14+
python.version: '3.7'
15+
Python38:
16+
python.version: '3.8'
17+
18+
steps:
19+
- task: UsePythonVersion@0
20+
inputs:
21+
versionSpec: '$(python.version)'
22+
23+
- script: |
24+
pip install pytest pytest-cov pytest-mock requests-mock pytest-timeout pytest-azurepipelines pytest-rerunfailures pytest-remotedata
25+
pip install -e .
26+
pytest pvlib --junitxml=junit/test-results.xml --cov=com --cov-report=xml --cov-report=html
27+
displayName: 'Test with pytest'
28+
29+
- task: PublishTestResults@2
30+
condition: succeededOrFailed()
31+
inputs:
32+
testResultsFiles: '**/test-*.xml'
33+
testRunTitle: 'Publish test results for Python $(python.version)'
34+
35+
- task: PublishCodeCoverageResults@1
36+
inputs:
37+
codeCoverageTool: Cobertura
38+
summaryFileLocation: '$(System.DefaultWorkingDirectory)/**/coverage.xml'
39+
reportDirectory: '$(System.DefaultWorkingDirectory)/**/htmlcov'

ci/requirements-py36-min.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ dependencies:
55
- coveralls
66
- nose
77
- pip
8+
- pytables # tables when using pip+PyPI
89
- pytest
910
- pytest-cov
1011
- pytest-mock
@@ -20,3 +21,4 @@ dependencies:
2021
- pytest-rerunfailures # conda version is >3.6
2122
- pytest-remotedata # conda package is 0.3.0, needs > 0.3.1
2223
- requests-mock
24+
- numexpr==2.6.2 # needed for tables, but newest version is not compatible with numpy 1.12

ci/requirements-py36.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ channels:
33
- defaults
44
- conda-forge
55
dependencies:
6+
- blosc=1.14.3 # newest version breaks tables (pytables) on windows
67
- cdsapi
78
- coveralls
89
- cython

ci/requirements-py37.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ channels:
33
- defaults
44
- conda-forge
55
dependencies:
6+
- blosc=1.14.3 # newest version breaks tables (pytables) on windows
67
- cdsapi
78
- coveralls
89
- cython
Loading
Loading

docs/sphinx/source/index.rst

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@ functions and classes for simulating the performance of photovoltaic
99
energy systems. pvlib python was originally ported from the PVLIB MATLAB
1010
toolbox developed at Sandia National Laboratories and it implements many
1111
of the models and methods developed at the Labs. More information on
12-
Sandia Labs PV performance modeling programs can be found at
13-
https://pvpmc.sandia.gov/. We collaborate with the PVLIB MATLAB project,
12+
Sandia Labs PV performance modeling programs can be found at the `PVPMC <https://pvpmc.sandia.gov/>`_. We collaborate with the PVLIB MATLAB project,
1413
but operate independently of it.
1514

1615
The source code for pvlib python is hosted on `github
@@ -50,6 +49,16 @@ Please also cite the DOI corresponding to the specific version of
5049
pvlib python that you used. pvlib python DOIs are listed at
5150
`Zenodo.org <https://zenodo.org/search?page=1&size=20&q=conceptrecid:593284&all_versions&sort=-version>`_
5251

52+
If you use pvlib-python in a commercial or publicly-available
53+
application, please consider displaying one of the "powered by pvlib"
54+
logos:
55+
56+
.. image:: _images/pvlib_powered_logo_horiz.png
57+
:width: 300
58+
59+
.. image:: _images/pvlib_powered_logo_vert.png
60+
:width: 300
61+
5362
Additional pvlib python publications include:
5463

5564
* J. S. Stein, “The photovoltaic performance modeling
@@ -73,6 +82,10 @@ Additional pvlib python publications include:
7382
"An Open Source Solar Power Forecasting Tool Using PVLIB-Python,"
7483
in 43rd Photovoltaic Specialists Conference, 2016.
7584

85+
License
86+
=======
87+
88+
`BSD 3-clause <https://github.com/pvlib/pvlib-python/LICENSE>`_.
7689

7790
NumFOCUS
7891
========
@@ -83,7 +96,6 @@ pvlib python is a `NumFOCUS Affiliated Project <https://numfocus.org/sponsored-p
8396
:target: https://numfocus.org/sponsored-projects/affiliated-projects
8497
:alt: NumFocus Affliated Projects
8598

86-
8799
Contents
88100
========
89101

docs/sphinx/source/introtutorial.rst

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -52,24 +52,13 @@ the :ref:`iotools` module. In this example we will be using PVGIS, one of the
5252
data sources available, to retrieve a Typical Meteorological Year (TMY) which
5353
includes irradiation, temperature and wind speed.
5454

55-
.. note:: PVGIS uses different naming conventions, so it is required to rename
56-
the weather data variables before using them. Data is already UTC-localized,
57-
so conversion to local timezone is optional.
58-
5955
.. ipython:: python
6056
61-
variables_translation = {
62-
"Gb(n)": "dni",
63-
"G(h)": "ghi",
64-
"Gd(h)": "dhi",
65-
"T2m": "temp_air",
66-
"WS10m": "wind_speed",
67-
}
6857
tmys = []
6958
for location in coordinates:
7059
latitude, longitude, name, altitude, timezone = location
71-
weather = pvlib.iotools.get_pvgis_tmy(latitude, longitude)[0]
72-
weather = weather.rename(columns=variables_translation)
60+
weather = pvlib.iotools.get_pvgis_tmy(latitude, longitude,
61+
map_variables=True)[0]
7362
weather.index.name = "utc_time"
7463
tmys.append(weather)
7564

docs/sphinx/source/timetimezones.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ Let's first examine how pvlib handles time when it imports a TMY3 file.
278278
279279
The metadata has a ``'TZ'`` key with a value of ``-9.0``. This is the
280280
UTC offset in hours in which the data has been recorded. The
281-
:py:func:`~pvlib.tmy.readtmy3` function read the data in the file,
281+
:py:func:`~pvlib.iotools.read_tmy3` function read the data in the file,
282282
created a :py:class:`~pandas.DataFrame` with that data, and then
283283
localized the DataFrame's index to have this fixed offset. Here, we
284284
print just a few of the rows and columns of the large dataframe.
@@ -289,7 +289,7 @@ print just a few of the rows and columns of the large dataframe.
289289
290290
tmy3_data.loc[tmy3_data.index[0:3], ['GHI', 'DNI', 'AOD']]
291291
292-
The :py:func:`~pvlib.tmy.readtmy2` function also returns a DataFrame
292+
The :py:func:`~pvlib.iotools.read_tmy2` function also returns a DataFrame
293293
with a localized DatetimeIndex.
294294

295295
Solar position

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

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,16 @@ Breaking changes
4949
:py:meth:`~pvlib.pvsystem.PVSystem.calcparams_desoto` and
5050
:py:meth:`~pvlib.pvsystem.PVSystem.calcparams_cec` (:issue:`1118`, :pull:`1222`)
5151

52+
* Switched the order of the outputs from the PSM3 iotools, notably
53+
:py:func:`~pvlib.iotools.get_psm3` and :py:func:`~pvlib.iotools.read_psm3`
54+
(:issue:`1245`, :pull:`1268`)
55+
56+
* Changed the naming of the inputs ``startdate``/``enddate`` to ``start``/``end`` in
57+
:py:func:`~pvlib.iotools.get_ecmwf_macc`
58+
(:issue:`1245`, :pull:`1268`)
59+
60+
* Change the naming of the inputs ``lat``/``lon`` to ``latitude``/``longitude`` in
61+
:py:func:`~pvlib.iotools.get_pvgis_tmy` (:issue:`1245`, :pull:`1268`)
5262

5363
Deprecations
5464
~~~~~~~~~~~~
@@ -115,11 +125,13 @@ Enhancements
115125
:func:`~pvlib.iotools.get_pvgis_hourly` for reading and retrieving hourly
116126
solar radiation data and PV power output from PVGIS. (:pull:`1186`,
117127
:issue:`849`)
128+
* Added ``map_variables`` option to :func:`~pvlib.iotools.get_pvgis_tmy` and
129+
:func:`~pvlib.iotools.read_pvgis_tmy` (:issue:`1250`, :pull:`1268`)
118130
* Add :func:`~pvlib.iotools.get_bsrn` and :func:`~pvlib.iotools.read_bsrn`
119131
for retrieving and reading BSRN solar radiation data files.
120132
(:pull:`1254`, :pull:`1145`, :issue:`1015`)
121133
* Add :func:`~pvlib.iotools.get_cams`,
122-
:func:`~pvlib.iotools.parse_cams`, and
134+
:func:`~pvlib.iotools.parse_cams`, and
123135
:func:`~pvlib.iotools.read_cams`
124136
for retrieving, parsing, and reading CAMS Radiation and McClear time-series
125137
files. (:pull:`1175`)
@@ -171,9 +183,9 @@ Enhancements
171183
Bug fixes
172184
~~~~~~~~~
173185
* Corrected an error in :py:func:`~pvlib.irradiance.perez` where the horizon
174-
irradiance component was prevented from taking negative values. Negative
175-
values are intentional according to the original publication. Changes in
176-
output are expected to be small and primarily occur at low irradiance
186+
irradiance component was prevented from taking negative values. Negative
187+
values are intentional according to the original publication. Changes in
188+
output are expected to be small and primarily occur at low irradiance
177189
conditions.
178190
(:issue:`1238`, :pull:`1239`)
179191
* Pass weather data to solar position calculations in
@@ -196,6 +208,12 @@ Bug fixes
196208
(:issue:`1257`, :pull:`1258`)
197209
* Changed deprecated use of ``.astype()`` to ``.view()`` in :py:mod:`~pvlib.solarposition`.
198210
(:pull:`1256`, :issue:`1261`, :pull:`1262`)
211+
* Fix :py:func:`~pvlib.tracking.singleaxis` AOI wrong when sun behind module.
212+
(:pull:`1273`, :issue:`1221`)
213+
* Fix :py:meth:`~pvlib.forecast.ForecastModel.get_data` failure to correct for
214+
non-UTC timezones. (:issue:`1237`, :pull:`1285`)
215+
* Fixed :py:class:`~pvlib.forecast.HRRR` by changing model name to reflect change on the server. (:issue:`1291`,
216+
:pull:`1292`)
199217

200218
Testing
201219
~~~~~~~
@@ -214,10 +232,12 @@ Documentation
214232
* Clarified how statistics are calculated for :py:func:`pvlib.clearsky.detect_clearsky`
215233
(:issue:`1070`, :pull:`1243`)
216234
* Add gallery examples using the new ``Mount`` classes (:pull:`1266`)
235+
* Add "powered by pvlib" logos (:pull:`1277`)
217236

218237
Requirements
219238
~~~~~~~~~~~~
220-
* ``dataclasses`` is required for python 3.6
239+
* ``dataclasses`` is required for python 3.6 (:pull:`1076`)
240+
* ``tables`` is now required instead of optional (:issue:`1286`, :pull:`1287`)
221241
* xarray, dask, and cdsapi are now optional requirements. (:pull:`1264`)
222242

223243
Contributors

pvlib/clearsky.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import pandas as pd
1212
from scipy.optimize import minimize_scalar
1313
from scipy.linalg import hankel
14+
import tables
1415

1516
from pvlib import atmosphere, tools
1617

@@ -186,13 +187,6 @@ def lookup_linke_turbidity(time, latitude, longitude, filepath=None,
186187
# 1st row: 89.9583 S, 2nd row: 89.875 S
187188
# 1st column: 179.9583 W, 2nd column: 179.875 W
188189

189-
try:
190-
import tables
191-
except ImportError:
192-
raise ImportError('The Linke turbidity lookup table requires tables. '
193-
'You can still use clearsky.ineichen if you '
194-
'supply your own turbidities.')
195-
196190
if filepath is None:
197191
pvlib_path = os.path.dirname(os.path.abspath(__file__))
198192
filepath = os.path.join(pvlib_path, 'data', 'LinkeTurbidities.h5')

pvlib/forecast.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,12 @@ def set_query_time_range(self, start, end):
183183
self.end = pd.Timestamp(end)
184184
if self.start.tz is None or self.end.tz is None:
185185
raise TypeError('start and end must be tz-localized')
186-
self.query.time_range(self.start, self.end)
186+
# don't assume that siphon or the server can handle anything other
187+
# than UTC
188+
self.query.time_range(
189+
self.start.tz_convert('UTC'),
190+
self.end.tz_convert('UTC')
191+
)
187192

188193
def set_query_latlon(self):
189194
'''
@@ -412,10 +417,14 @@ def set_time(self, time):
412417
-------
413418
pandas.DatetimeIndex
414419
'''
420+
# np.masked_array with elements like real_datetime(2021, 8, 17, 16, 0)
421+
# and dtype=object
415422
times = num2date(time[:].squeeze(), time.units,
416423
only_use_cftime_datetimes=False,
417424
only_use_python_datetimes=True)
418-
self.time = pd.DatetimeIndex(pd.Series(times), tz=self.location.tz)
425+
# convert to pandas, localize to UTC, convert to desired timezone
426+
self.time = pd.DatetimeIndex(
427+
times, tz='UTC').tz_convert(self.location.tz)
419428

420429
def cloud_cover_to_ghi_linear(self, cloud_cover, ghi_clear, offset=35,
421430
**kwargs):
@@ -977,7 +986,7 @@ class HRRR(ForecastModel):
977986

978987
def __init__(self, set_type='best'):
979988
model_type = 'Forecast Model Data'
980-
model = 'NCEP HRRR CONUS 2.5km'
989+
model = 'HRRR CONUS 2.5km Forecasts'
981990

982991
self.variables = {
983992
'temp_air': 'Temperature_height_above_ground',

pvlib/iotools/bsrn.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,11 @@ def _empty_dataframe_from_logical_records(logical_records):
5757
columns = []
5858
for lr in logical_records:
5959
columns += BSRN_COLUMNS[lr][2:]
60+
columns = [c for c in columns if c != 'empty']
6061
return pd.DataFrame(columns=columns)
6162

6263

63-
def get_bsrn(start, end, station, username, password,
64+
def get_bsrn(station, start, end, username, password,
6465
logical_records=('0100',), local_path=None):
6566
"""
6667
Retrieve ground measured irradiance data from the BSRN FTP server.
@@ -73,12 +74,12 @@ def get_bsrn(start, end, station, username, password,
7374
7475
Parameters
7576
----------
77+
station: str
78+
3-letter BSRN station abbreviation
7679
start: datetime-like
7780
First day of the requested period
7881
end: datetime-like
7982
Last day of the requested period
80-
station: str
81-
3-letter BSRN station abbreviation
8283
username: str
8384
username for accessing the BSRN FTP server
8485
password: str

0 commit comments

Comments
 (0)