pvlib 0.11.0__py3-none-any.whl → 0.11.1__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 (51) hide show
  1. pvlib/atmosphere.py +157 -1
  2. pvlib/bifacial/__init__.py +4 -4
  3. pvlib/bifacial/loss_models.py +163 -0
  4. pvlib/clearsky.py +18 -29
  5. pvlib/data/pvgis_tmy_meta.json +32 -93
  6. pvlib/data/pvgis_tmy_test.dat +8761 -8761
  7. pvlib/data/tmy_45.000_8.000_2005_2020.csv +8789 -0
  8. pvlib/data/tmy_45.000_8.000_2005_2020.epw +8768 -0
  9. pvlib/data/tmy_45.000_8.000_2005_2020.json +1 -0
  10. pvlib/data/tmy_45.000_8.000_2005_2020.txt +8761 -0
  11. pvlib/data/tmy_45.000_8.000_userhorizon.json +1 -1
  12. pvlib/data/variables_style_rules.csv +2 -1
  13. pvlib/iotools/pvgis.py +39 -3
  14. pvlib/irradiance.py +141 -120
  15. pvlib/location.py +5 -5
  16. pvlib/modelchain.py +1 -1
  17. pvlib/pvsystem.py +2 -2
  18. pvlib/shading.py +8 -8
  19. pvlib/singlediode.py +1 -1
  20. pvlib/solarposition.py +55 -50
  21. pvlib/spa.py +24 -22
  22. pvlib/spectrum/__init__.py +9 -4
  23. pvlib/spectrum/irradiance.py +272 -0
  24. pvlib/spectrum/mismatch.py +118 -508
  25. pvlib/spectrum/response.py +280 -0
  26. pvlib/spectrum/spectrl2.py +16 -16
  27. pvlib/tests/bifacial/test_losses_models.py +54 -0
  28. pvlib/tests/iotools/test_pvgis.py +57 -11
  29. pvlib/tests/spectrum/__init__.py +0 -0
  30. pvlib/tests/spectrum/conftest.py +40 -0
  31. pvlib/tests/spectrum/test_irradiance.py +138 -0
  32. pvlib/tests/{test_spectrum.py → spectrum/test_mismatch.py} +32 -306
  33. pvlib/tests/spectrum/test_response.py +124 -0
  34. pvlib/tests/spectrum/test_spectrl2.py +72 -0
  35. pvlib/tests/test_atmosphere.py +71 -0
  36. pvlib/tests/test_clearsky.py +37 -25
  37. pvlib/tests/test_irradiance.py +6 -6
  38. pvlib/tests/test_solarposition.py +84 -36
  39. pvlib/tests/test_spa.py +1 -1
  40. pvlib/tools.py +26 -2
  41. pvlib/tracking.py +53 -47
  42. {pvlib-0.11.0.dist-info → pvlib-0.11.1.dist-info}/METADATA +31 -29
  43. {pvlib-0.11.0.dist-info → pvlib-0.11.1.dist-info}/RECORD +47 -38
  44. {pvlib-0.11.0.dist-info → pvlib-0.11.1.dist-info}/WHEEL +1 -1
  45. pvlib/data/tmy_45.000_8.000_2005_2016.csv +0 -8789
  46. pvlib/data/tmy_45.000_8.000_2005_2016.epw +0 -8768
  47. pvlib/data/tmy_45.000_8.000_2005_2016.json +0 -1
  48. pvlib/data/tmy_45.000_8.000_2005_2016.txt +0 -8761
  49. {pvlib-0.11.0.dist-info → pvlib-0.11.1.dist-info}/AUTHORS.md +0 -0
  50. {pvlib-0.11.0.dist-info → pvlib-0.11.1.dist-info}/LICENSE +0 -0
  51. {pvlib-0.11.0.dist-info → pvlib-0.11.1.dist-info}/top_level.txt +0 -0
@@ -10,6 +10,7 @@ bhi;beam/direct horizontal irradiance
10
10
  ghi;global horizontal irradiance
11
11
  ghi_extra;horizontal irradiance at top of atmosphere (extraterrestrial)
12
12
  gri;ground-reflected irradiance
13
+ ape;average photon energy
13
14
  aoi;angle of incidence between :math:`90\deg` and :math:`90\deg`
14
15
  aoi_projection;cos(aoi)
15
16
  airmass;airmass
@@ -49,7 +50,7 @@ transposition_factor; the gain ratio of the radiation on inclined plane to globa
49
50
  pdc0; nameplate DC rating
50
51
  pdc, dc; dc power
51
52
  gamma_pdc; module temperature coefficient. Typically in units of 1/C.
52
- pac, ac; ac powe.
53
+ pac, ac; ac power
53
54
  eta_inv; inverter efficiency
54
55
  eta_inv_ref; reference inverter efficiency
55
56
  eta_inv_nom; nominal inverter efficiency
pvlib/iotools/pvgis.py CHANGED
@@ -18,10 +18,10 @@ import io
18
18
  import json
19
19
  from pathlib import Path
20
20
  import requests
21
+ import numpy as np
21
22
  import pandas as pd
23
+ import pytz
22
24
  from pvlib.iotools import read_epw, parse_epw
23
- import warnings
24
- from pvlib._deprecation import pvlibDeprecationWarning
25
25
 
26
26
  URL = 'https://re.jrc.ec.europa.eu/api/'
27
27
 
@@ -390,9 +390,33 @@ def read_pvgis_hourly(filename, pvgis_format=None, map_variables=True):
390
390
  raise ValueError(err_msg)
391
391
 
392
392
 
393
+ def _coerce_and_roll_tmy(tmy_data, tz, year):
394
+ """
395
+ Assumes ``tmy_data`` input is UTC, converts from UTC to ``tz``, rolls
396
+ dataframe so timeseries starts at midnight, and forces all indices to
397
+ ``year``. Only works for integer ``tz``, but ``None`` and ``False`` are
398
+ re-interpreted as zero / UTC.
399
+ """
400
+ if tz:
401
+ tzname = pytz.timezone(f'Etc/GMT{-tz:+d}')
402
+ else:
403
+ tz = 0
404
+ tzname = pytz.timezone('UTC')
405
+ new_index = pd.DatetimeIndex([
406
+ timestamp.replace(year=year, tzinfo=tzname)
407
+ for timestamp in tmy_data.index],
408
+ name=f'time({tzname})')
409
+ new_tmy_data = pd.DataFrame(
410
+ np.roll(tmy_data, tz, axis=0),
411
+ columns=tmy_data.columns,
412
+ index=new_index)
413
+ return new_tmy_data
414
+
415
+
393
416
  def get_pvgis_tmy(latitude, longitude, outputformat='json', usehorizon=True,
394
417
  userhorizon=None, startyear=None, endyear=None,
395
- map_variables=True, url=URL, timeout=30):
418
+ map_variables=True, url=URL, timeout=30,
419
+ roll_utc_offset=None, coerce_year=None):
396
420
  """
397
421
  Get TMY data from PVGIS.
398
422
 
@@ -424,6 +448,13 @@ def get_pvgis_tmy(latitude, longitude, outputformat='json', usehorizon=True,
424
448
  base url of PVGIS API, append ``tmy`` to get TMY endpoint
425
449
  timeout : int, default 30
426
450
  time in seconds to wait for server response before timeout
451
+ roll_utc_offset: int, optional
452
+ Use to specify a time zone other than the default UTC zero and roll
453
+ dataframe by ``roll_utc_offset`` so it starts at midnight on January
454
+ 1st. Ignored if ``None``, otherwise will force year to ``coerce_year``.
455
+ coerce_year: int, optional
456
+ Use to force indices to desired year. Will default to 1990 if
457
+ ``coerce_year`` is not specified, but ``roll_utc_offset`` is specified.
427
458
 
428
459
  Returns
429
460
  -------
@@ -510,6 +541,11 @@ def get_pvgis_tmy(latitude, longitude, outputformat='json', usehorizon=True,
510
541
  if map_variables:
511
542
  data = data.rename(columns=VARIABLE_MAP)
512
543
 
544
+ if not (roll_utc_offset is None and coerce_year is None):
545
+ # roll_utc_offset is specified, but coerce_year isn't
546
+ coerce_year = coerce_year or 1990
547
+ data = _coerce_and_roll_tmy(data, roll_utc_offset, coerce_year)
548
+
513
549
  return data, months_selected, inputs, meta
514
550
 
515
551