pvlib 0.10.4__py3-none-any.whl → 0.11.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. pvlib/__init__.py +1 -0
  2. pvlib/albedo.py +168 -0
  3. pvlib/bifacial/utils.py +2 -1
  4. pvlib/data/ASTMG173.csv +2004 -0
  5. pvlib/iam.py +28 -28
  6. pvlib/iotools/__init__.py +0 -1
  7. pvlib/iotools/midc.py +15 -10
  8. pvlib/iotools/psm3.py +10 -25
  9. pvlib/iotools/srml.py +1 -61
  10. pvlib/iotools/surfrad.py +1 -1
  11. pvlib/irradiance.py +133 -95
  12. pvlib/location.py +16 -6
  13. pvlib/modelchain.py +2 -165
  14. pvlib/pvarray.py +7 -5
  15. pvlib/pvsystem.py +75 -106
  16. pvlib/scaling.py +4 -2
  17. pvlib/shading.py +350 -0
  18. pvlib/singlediode.py +37 -9
  19. pvlib/snow.py +3 -1
  20. pvlib/spectrum/__init__.py +5 -0
  21. pvlib/spectrum/mismatch.py +573 -43
  22. pvlib/spectrum/spectrl2.py +8 -8
  23. pvlib/tests/bifacial/test_utils.py +6 -5
  24. pvlib/tests/iotools/test_psm3.py +0 -18
  25. pvlib/tests/iotools/test_srml.py +1 -43
  26. pvlib/tests/test_albedo.py +84 -0
  27. pvlib/tests/test_inverter.py +2 -2
  28. pvlib/tests/test_irradiance.py +35 -2
  29. pvlib/tests/test_location.py +26 -18
  30. pvlib/tests/test_modelchain.py +0 -57
  31. pvlib/tests/test_pvsystem.py +73 -128
  32. pvlib/tests/test_shading.py +167 -1
  33. pvlib/tests/test_singlediode.py +68 -29
  34. pvlib/tests/test_spectrum.py +283 -22
  35. pvlib/tests/test_temperature.py +7 -7
  36. pvlib/tests/test_tools.py +24 -0
  37. pvlib/tests/test_transformer.py +60 -0
  38. pvlib/tools.py +27 -0
  39. pvlib/transformer.py +117 -0
  40. pvlib/version.py +1 -5
  41. {pvlib-0.10.4.dist-info → pvlib-0.11.0.dist-info}/METADATA +3 -4
  42. {pvlib-0.10.4.dist-info → pvlib-0.11.0.dist-info}/RECORD +46 -42
  43. {pvlib-0.10.4.dist-info → pvlib-0.11.0.dist-info}/WHEEL +1 -1
  44. pvlib/data/astm_g173_am15g.csv +0 -2003
  45. {pvlib-0.10.4.dist-info → pvlib-0.11.0.dist-info}/AUTHORS.md +0 -0
  46. {pvlib-0.10.4.dist-info → pvlib-0.11.0.dist-info}/LICENSE +0 -0
  47. {pvlib-0.10.4.dist-info → pvlib-0.11.0.dist-info}/top_level.txt +0 -0
pvlib/iam.py CHANGED
@@ -592,10 +592,10 @@ def marion_diffuse(model, surface_tilt, **kwargs):
592
592
  iam : dict
593
593
  IAM values for each type of diffuse irradiance:
594
594
 
595
- * 'sky': radiation from the sky dome (zenith <= 90)
596
- * 'horizon': radiation from the region of the sky near the horizon
597
- (89.5 <= zenith <= 90)
598
- * 'ground': radiation reflected from the ground (zenith >= 90)
595
+ * 'sky': radiation from the sky dome (zenith <= 90)
596
+ * 'horizon': radiation from the region of the sky near the horizon
597
+ (89.5 <= zenith <= 90)
598
+ * 'ground': radiation reflected from the ground (zenith >= 90)
599
599
 
600
600
  See [1]_ for a detailed description of each class.
601
601
 
@@ -667,10 +667,10 @@ def marion_integrate(function, surface_tilt, region, num=None):
667
667
  region : {'sky', 'horizon', 'ground'}
668
668
  The region to integrate over. Must be one of:
669
669
 
670
- * 'sky': radiation from the sky dome (zenith <= 90)
671
- * 'horizon': radiation from the region of the sky near the horizon
672
- (89.5 <= zenith <= 90)
673
- * 'ground': radiation reflected from the ground (zenith >= 90)
670
+ * 'sky': radiation from the sky dome (zenith <= 90)
671
+ * 'horizon': radiation from the region of the sky near the horizon
672
+ (89.5 <= zenith <= 90)
673
+ * 'ground': radiation reflected from the ground (zenith >= 90)
674
674
 
675
675
  See [1]_ for a detailed description of each class.
676
676
 
@@ -678,8 +678,8 @@ def marion_integrate(function, surface_tilt, region, num=None):
678
678
  The number of increments in the zenith integration.
679
679
  If not specified, N will follow the values used in [1]_:
680
680
 
681
- * 'sky' or 'ground': num = 180
682
- * 'horizon': num = 1800
681
+ * 'sky' or 'ground': num = 180
682
+ * 'horizon': num = 1800
683
683
 
684
684
  Returns
685
685
  -------
@@ -1107,14 +1107,14 @@ def convert(source_name, source_params, target_name, weight=_sin_weight,
1107
1107
  source_params : dict
1108
1108
  A dictionary of parameters for the source model.
1109
1109
 
1110
- If source model is ``'ashrae'``, the dictionary must contain
1111
- the key ``'b'``.
1110
+ If source model is ``'ashrae'``, the dictionary must contain
1111
+ the key ``'b'``.
1112
1112
 
1113
- If source model is ``'martin_ruiz'``, the dictionary must
1114
- contain the key ``'a_r'``.
1113
+ If source model is ``'martin_ruiz'``, the dictionary must
1114
+ contain the key ``'a_r'``.
1115
1115
 
1116
- If source model is ``'physical'``, the dictionary must
1117
- contain the keys ``'n'``, ``'K'``, and ``'L'``.
1116
+ If source model is ``'physical'``, the dictionary must
1117
+ contain the keys ``'n'``, ``'K'``, and ``'L'``.
1118
1118
 
1119
1119
  target_name : str
1120
1120
  Name of the target model. Must be ``'ashrae'``, ``'martin_ruiz'``, or
@@ -1146,14 +1146,14 @@ def convert(source_name, source_params, target_name, weight=_sin_weight,
1146
1146
  dict
1147
1147
  Parameters for the target model.
1148
1148
 
1149
- If target model is ``'ashrae'``, the dictionary will contain
1150
- the key ``'b'``.
1149
+ If target model is ``'ashrae'``, the dictionary will contain
1150
+ the key ``'b'``.
1151
1151
 
1152
- If target model is ``'martin_ruiz'``, the dictionary will
1153
- contain the key ``'a_r'``.
1152
+ If target model is ``'martin_ruiz'``, the dictionary will
1153
+ contain the key ``'a_r'``.
1154
1154
 
1155
- If target model is ``'physical'``, the dictionary will
1156
- contain the keys ``'n'``, ``'K'``, and ``'L'``.
1155
+ If target model is ``'physical'``, the dictionary will
1156
+ contain the keys ``'n'``, ``'K'``, and ``'L'``.
1157
1157
 
1158
1158
  Note
1159
1159
  ----
@@ -1243,14 +1243,14 @@ def fit(measured_aoi, measured_iam, model_name, weight=_sin_weight, xtol=None):
1243
1243
  dict
1244
1244
  Parameters for target model.
1245
1245
 
1246
- If target model is ``'ashrae'``, the dictionary will contain
1247
- the key ``'b'``.
1246
+ If target model is ``'ashrae'``, the dictionary will contain
1247
+ the key ``'b'``.
1248
1248
 
1249
- If target model is ``'martin_ruiz'``, the dictionary will
1250
- contain the key ``'a_r'``.
1249
+ If target model is ``'martin_ruiz'``, the dictionary will
1250
+ contain the key ``'a_r'``.
1251
1251
 
1252
- If target model is ``'physical'``, the dictionary will
1253
- contain the keys ``'n'``, ``'K'``, and ``'L'``.
1252
+ If target model is ``'physical'``, the dictionary will
1253
+ contain the keys ``'n'``, ``'K'``, and ``'L'``.
1254
1254
 
1255
1255
  References
1256
1256
  ----------
pvlib/iotools/__init__.py CHANGED
@@ -1,7 +1,6 @@
1
1
  from pvlib.iotools.tmy import read_tmy2, read_tmy3 # noqa: F401
2
2
  from pvlib.iotools.epw import read_epw, parse_epw # noqa: F401
3
3
  from pvlib.iotools.srml import read_srml # noqa: F401
4
- from pvlib.iotools.srml import read_srml_month_from_solardat # noqa: F401
5
4
  from pvlib.iotools.srml import get_srml # noqa: F401
6
5
  from pvlib.iotools.surfrad import read_surfrad # noqa: F401
7
6
  from pvlib.iotools.midc import read_midc # noqa: F401
pvlib/iotools/midc.py CHANGED
@@ -20,15 +20,21 @@ import pandas as pd
20
20
  MIDC_VARIABLE_MAP = {
21
21
  'BMS': {
22
22
  'Global CMP22 (vent/cor) [W/m^2]': 'ghi',
23
- 'Direct NIP [W/m^2]': 'dni',
23
+ 'Direct CHP1-1 [W/m^2]': 'dni_chp1',
24
+ # NIP was mapped to dni for pvlib<=0.10.5
25
+ 'Direct NIP [W/m^2]': 'dni_nip',
24
26
  'Diffuse CM22-1 (vent/cor) [W/m^2]': 'dhi',
25
27
  'Avg Wind Speed @ 6ft [m/s]': 'wind_speed',
26
28
  'Tower Dry Bulb Temp [deg C]': 'temp_air',
27
29
  'Tower RH [%]': 'relative_humidity'},
28
30
  'UOSMRL': {
29
31
  'Global CMP22 [W/m^2]': 'ghi',
30
- 'Direct NIP [W/m^2]': 'dni',
31
- 'Diffuse Schenk [W/m^2]': 'dhi',
32
+ 'Direct CHP1 [W/m^2]': 'dni_chp1',
33
+ 'Diffuse [W/m^2]': 'dhi',
34
+ # NIP was mapped to dni for pvlib<=0.10.5
35
+ 'Direct NIP [W/m^2]': 'dni_nip',
36
+ # Schenk was mapped to dhi for pvlib<=0.10.5
37
+ # 'Diffuse Schenk [W/m^2]': 'dhi',
32
38
  'Air Temperature [deg C]': 'temp_air',
33
39
  'Relative Humidity [%]': 'relative_humidity',
34
40
  'Avg Wind Speed @ 10m [m/s]': 'wind_speed'},
@@ -80,18 +86,17 @@ MIDC_VARIABLE_MAP = {
80
86
  'Air Temperature [deg C]': 'temp_air',
81
87
  'Rel Humidity [%]': 'relative_humidity',
82
88
  'Avg Wind Speed @ 3m [m/s]': 'wind_speed'},
83
- 'VTIF': {
89
+ 'NWTC': {
84
90
  'Global Horizontal [W/m^2]': 'ghi',
85
91
  'Direct Normal [W/m^2]': 'dni',
86
92
  'Diffuse Horizontal [W/m^2]': 'dhi',
87
- 'Air Temperature [deg C]': 'temp_air',
88
- 'Avg Wind Speed @ 3m [m/s]': 'wind_speed',
89
- 'Rel Humidity [%]': 'relative_humidity'},
90
- 'NWTC': {
91
- 'Global PSP [W/m^2]': 'ghi',
93
+ # PSP instrument was removed Feb. 2021
94
+ # PSP was mapped to ghi for pvlib<=0.10.5
95
+ # 'Global PSP [W/m^2]': 'ghi',
92
96
  'Temperature @ 2m [deg C]': 'temp_air',
93
97
  'Avg Wind Speed @ 2m [m/s]': 'wind_speed',
94
- 'Relative Humidity [%]': 'relative_humidity'}}
98
+ 'Relative Humidity [%]': 'relative_humidity'},
99
+ }
95
100
 
96
101
 
97
102
  # Maps problematic timezones to 'Etc/GMT' for parsing.
pvlib/iotools/psm3.py CHANGED
@@ -62,8 +62,8 @@ REQUEST_VARIABLE_MAP = {
62
62
 
63
63
 
64
64
  def get_psm3(latitude, longitude, api_key, email, names='tmy', interval=60,
65
- attributes=ATTRIBUTES, leap_day=None, full_name=PVLIB_PYTHON,
66
- affiliation=PVLIB_PYTHON, map_variables=None, url=None,
65
+ attributes=ATTRIBUTES, leap_day=True, full_name=PVLIB_PYTHON,
66
+ affiliation=PVLIB_PYTHON, map_variables=True, url=None,
67
67
  timeout=30):
68
68
  """
69
69
  Retrieve NSRDB PSM3 timeseries weather data from the PSM3 API. The NSRDB
@@ -105,14 +105,14 @@ def get_psm3(latitude, longitude, api_key, email, names='tmy', interval=60,
105
105
  for lists of available fields. Alternatively, pvlib names may also be
106
106
  used (e.g. 'ghi' rather than 'GHI'); see :const:`REQUEST_VARIABLE_MAP`.
107
107
  To retrieve all available fields, set ``attributes=[]``.
108
- leap_day : boolean, default False
108
+ leap_day : bool, default : True
109
109
  include leap day in the results. Only used for single-year requests
110
110
  (i.e., it is ignored for tmy/tgy/tdy requests).
111
111
  full_name : str, default 'pvlib python'
112
112
  optional
113
113
  affiliation : str, default 'pvlib python'
114
114
  optional
115
- map_variables : boolean, optional
115
+ map_variables : bool, default True
116
116
  When true, renames columns of the Dataframe to pvlib variable names
117
117
  where applicable. See variable :const:`VARIABLE_MAP`.
118
118
  url : str, optional
@@ -179,14 +179,6 @@ def get_psm3(latitude, longitude, api_key, email, names='tmy', interval=60,
179
179
  # convert pvlib names in attributes to psm3 convention
180
180
  attributes = [REQUEST_VARIABLE_MAP.get(a, a) for a in attributes]
181
181
 
182
- if (leap_day is None) and (not names.startswith('t')):
183
- warnings.warn(
184
- 'The ``get_psm3`` function will default to leap_day=True '
185
- 'starting in pvlib 0.11.0. Specify leap_day=True '
186
- 'to enable this behavior now, or specify leap_day=False '
187
- 'to hide this warning.', pvlibDeprecationWarning)
188
- leap_day = False
189
-
190
182
  # required query-string parameters for request to PSM3 API
191
183
  params = {
192
184
  'api_key': api_key,
@@ -227,7 +219,7 @@ def get_psm3(latitude, longitude, api_key, email, names='tmy', interval=60,
227
219
  return parse_psm3(fbuf, map_variables)
228
220
 
229
221
 
230
- def parse_psm3(fbuf, map_variables=None):
222
+ def parse_psm3(fbuf, map_variables=True):
231
223
  """
232
224
  Parse an NSRDB PSM3 weather file (formatted as SAM CSV). The NSRDB
233
225
  is described in [1]_ and the SAM CSV format is described in [2]_.
@@ -241,9 +233,9 @@ def parse_psm3(fbuf, map_variables=None):
241
233
  ----------
242
234
  fbuf: file-like object
243
235
  File-like object containing data to read.
244
- map_variables: bool
236
+ map_variables: bool, default True
245
237
  When true, renames columns of the Dataframe to pvlib variable names
246
- where applicable. See variable VARIABLE_MAP.
238
+ where applicable. See variable :const:`VARIABLE_MAP`.
247
239
 
248
240
  Returns
249
241
  -------
@@ -356,13 +348,6 @@ def parse_psm3(fbuf, map_variables=None):
356
348
  tz = 'Etc/GMT%+d' % -metadata['Time Zone']
357
349
  data.index = pd.DatetimeIndex(dtidx).tz_localize(tz)
358
350
 
359
- if map_variables is None:
360
- warnings.warn(
361
- 'PSM3 variable names will be renamed to pvlib conventions by '
362
- 'default starting in pvlib 0.11.0. Specify map_variables=True '
363
- 'to enable that behavior now, or specify map_variables=False '
364
- 'to hide this warning.', pvlibDeprecationWarning)
365
- map_variables = False
366
351
  if map_variables:
367
352
  data = data.rename(columns=VARIABLE_MAP)
368
353
  metadata['latitude'] = metadata.pop('Latitude')
@@ -372,7 +357,7 @@ def parse_psm3(fbuf, map_variables=None):
372
357
  return data, metadata
373
358
 
374
359
 
375
- def read_psm3(filename, map_variables=None):
360
+ def read_psm3(filename, map_variables=True):
376
361
  """
377
362
  Read an NSRDB PSM3 weather file (formatted as SAM CSV). The NSRDB
378
363
  is described in [1]_ and the SAM CSV format is described in [2]_.
@@ -386,9 +371,9 @@ def read_psm3(filename, map_variables=None):
386
371
  ----------
387
372
  filename: str
388
373
  Filename of a file containing data to read.
389
- map_variables: bool
374
+ map_variables: bool, default True
390
375
  When true, renames columns of the Dataframe to pvlib variable names
391
- where applicable. See variable VARIABLE_MAP.
376
+ where applicable. See variable :const:`VARIABLE_MAP`.
392
377
 
393
378
  Returns
394
379
  -------
pvlib/iotools/srml.py CHANGED
@@ -6,8 +6,6 @@ import pandas as pd
6
6
  import urllib
7
7
  import warnings
8
8
 
9
- from pvlib._deprecation import deprecated
10
-
11
9
  # VARIABLE_MAP is a dictionary mapping SRML data element numbers to their
12
10
  # pvlib names. For most variables, only the first three digits are used,
13
11
  # the fourth indicating the instrument. Spectral data (7xxx) uses all
@@ -92,7 +90,7 @@ def read_srml(filename, map_variables=True):
92
90
  # Mask data marked with quality flag 99 (bad or missing data)
93
91
  for col in columns[::2]:
94
92
  missing = data[col + '_flag'] == 99
95
- data[col] = data[col].where(~(missing), np.NaN)
93
+ data[col] = data[col].where(~(missing), np.nan)
96
94
  return data
97
95
 
98
96
 
@@ -172,64 +170,6 @@ def _format_index(df):
172
170
  return df
173
171
 
174
172
 
175
- @deprecated('0.10.0', alternative='pvlib.iotools.get_srml', removal='0.11.0')
176
- def read_srml_month_from_solardat(station, year, month, filetype='PO',
177
- map_variables=True):
178
- """Request a month of SRML data and read it into a Dataframe.
179
-
180
- The SRML is described in [1]_.
181
-
182
- Parameters
183
- ----------
184
- station: str
185
- The name of the SRML station to request.
186
- year: int
187
- Year to request data for
188
- month: int
189
- Month to request data for.
190
- filetype: string
191
- SRML file type to gather. See notes for explanation.
192
- map_variables: bool, default: True
193
- When true, renames columns of the DataFrame to pvlib variable names
194
- where applicable. See variable :const:`VARIABLE_MAP`.
195
-
196
- Returns
197
- -------
198
- data: pd.DataFrame
199
- One month of data from SRML.
200
-
201
- Notes
202
- -----
203
- File types designate the time interval of a file and if it contains
204
- raw or processed data. For instance, `RO` designates raw, one minute
205
- data and `PO` designates processed one minute data. The availability
206
- of file types varies between sites. Below is a table of file types
207
- and their time intervals. See [1] for site information.
208
-
209
- ============= ============ ==================
210
- time interval raw filetype processed filetype
211
- ============= ============ ==================
212
- 1 minute RO PO
213
- 5 minute RF PF
214
- 15 minute RQ PQ
215
- hourly RH PH
216
- ============= ============ ==================
217
-
218
- References
219
- ----------
220
- .. [1] University of Oregon Solar Radiation Measurement Laboratory
221
- http://solardata.uoregon.edu/
222
- """
223
- file_name = "{station}{filetype}{year:02d}{month:02d}.txt".format(
224
- station=station,
225
- filetype=filetype,
226
- year=year % 100,
227
- month=month)
228
- url = "http://solardata.uoregon.edu/download/Archive/"
229
- data = read_srml(url + file_name, map_variables=map_variables)
230
- return data
231
-
232
-
233
173
  def get_srml(station, start, end, filetype='PO', map_variables=True,
234
174
  url="http://solardata.uoregon.edu/download/Archive/"):
235
175
  """Request data from UoO SRML and read it into a Dataframe.
pvlib/iotools/surfrad.py CHANGED
@@ -152,7 +152,7 @@ def read_surfrad(filename, map_variables=True):
152
152
 
153
153
  data = _format_index(data)
154
154
  missing = data == -9999.9
155
- data = data.where(~missing, np.NaN)
155
+ data = data.where(~missing, np.nan)
156
156
 
157
157
  if map_variables:
158
158
  data.rename(columns=VARIABLE_MAP, inplace=True)