Skip to content

Commit 1a340e1

Browse files
authored
Merge branch 'main' into remove_sapm_spectral_loss
2 parents 6f103e0 + 9f5ac3f commit 1a340e1

File tree

14 files changed

+16
-183
lines changed

14 files changed

+16
-183
lines changed

docs/sphinx/source/reference/airmass_atmospheric.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ Airmass and atmospheric models
1414
atmosphere.tdew_from_rh
1515
atmosphere.rh_from_tdew
1616
atmosphere.gueymard94_pw
17-
atmosphere.first_solar_spectral_correction
1817
atmosphere.bird_hulstrom80_aod_bb
1918
atmosphere.kasten96_lt
2019
atmosphere.angstrom_aod_at_lambda

docs/sphinx/source/reference/effects_on_pv_system_output/spectrum.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ Spectrum
88

99
spectrum.spectrl2
1010
spectrum.get_example_spectral_response
11-
spectrum.get_am15g
1211
spectrum.get_reference_spectra
1312
spectrum.calc_spectral_mismatch_field
1413
spectrum.spectral_factor_caballero

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ Deprecations
5353
deprecated. Use :py:func:`pvlib.pvsystem.v_from_i` and
5454
:py:func:`pvlib.pvsystem.i_from_v` instead. (:issue:`1626`, :pull:`1743`)
5555
* Functions for calculating spectral modifiers have been moved to :py:mod:`pvlib.spectrum`:
56-
:py:func:`pvlib.atmosphere.first_solar_spectral_correction` is deprecated and
56+
:py:func:`!pvlib.atmosphere.first_solar_spectral_correction` is deprecated and
5757
replaced by :py:func:`~pvlib.spectrum.spectral_factor_firstsolar`, and
5858
:py:func:`!pvlib.pvsystem.sapm_spectral_loss` is deprecated and replaced by
5959
:py:func:`~pvlib.spectrum.spectral_factor_sapm`. (:pull:`1628`)

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Deprecations
2828
~~~~~~~~~~~~
2929
* The ``pvlib.irradiance.SURFACE_ALBEDOS`` dictionary has been moved to
3030
:py:const:`pvlib.albedo.SURFACE_ALBEDOS`. (:pull:`2095`)
31-
* Function :py:func:`pvlib.spectrum.get_am15g` has been deprecated in favor
31+
* Function :py:func:`!pvlib.spectrum.get_am15g` has been deprecated in favor
3232
of the new function :py:func:`pvlib.spectrum.get_reference_spectra`. Use
3333
``pvlib.spectrum.get_reference_spectra(standard="ASTM G173-03")["global"]``
3434
instead. (:pull:`2039`)

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@ Breaking Changes
1414
the spectral model from PVSystem attributes. (:issue:`2017`, :pull:`2253`)
1515
* Remove deprecated :py:func:`!pvlib.pvsystem.sapm_spectral_loss`.
1616
(:issue:`2243`, :pull:`2244`)
17+
* :py:func:`~pvlib.iotools.read_tmy3` now defaults to ``map_variables=True``.
18+
Additionally, the deprecated ``recolumn`` parameter is now removed. (:issue:`2324`, :pull:`2408`)
19+
* Remove :py:func:`!pvlib.atmosphere.first_solar_spectral_correction`, deprecated in v0.10.0.
20+
Use :py:func:`~pvlib.spectrum.spectral_factor_firstsolar` instead. (:issue:`2130`, :pull:`2131`)
21+
* Remove deprecated :py:func:`!pvlib.spectrum.get_am15g` function; use
22+
:py:func:`~pvlib.spectrum.get_reference_spectra` instead. (:pull:`2409`)
1723

1824
Bug fixes
1925
~~~~~~~~~

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ API Changes with Deprecations
104104
* Changes related to spectral modifier (:issue:`782`):
105105
* Changes to functions
106106
- Added the argument `pw_min` and `pw_max`, default values 0.1 and 8 resp.,
107-
to `atmosphere.first_solar_spectral_correction`. This function now returns NaN
107+
to :py:func:`!pvlib.atmosphere.first_solar_spectral_correction`. This function now returns NaN
108108
if pw value higher than `pw_max`.
109109
* The `times` keyword argument has been deprecated in the
110110
:py:meth:`pvlib.modelchain.ModelChain.run_model`,

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Enhancements
1414
(:issue:`1516`, :pull:`1518`)
1515
* New module to calculate spectral mismatch from field spectral measurements
1616
:py:func:`~pvlib.spectrum.get_example_spectral_response`
17-
:py:func:`~pvlib.spectrum.get_am15g`
17+
:py:func:`!pvlib.spectrum.get_am15g`
1818
:py:func:`~pvlib.spectrum.calc_spectral_mismatch_field`
1919
(:issue:`1523`, :pull:`1524`)
2020
* Added Townsend-Powers monthly snow loss model:

pvlib/atmosphere.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@
66

77
import numpy as np
88
import pandas as pd
9-
import pvlib
10-
11-
from pvlib._deprecation import deprecated
129

1310
APPARENT_ZENITH_MODELS = ('simple', 'kasten1966', 'kastenyoung1989',
1411
'gueymard1993', 'pickering2002')
@@ -416,12 +413,6 @@ def tdew_from_rh(temp_air, relative_humidity, coeff=(6.112, 17.62, 243.12)):
416413
return dewpoint
417414

418415

419-
first_solar_spectral_correction = deprecated(
420-
since='0.10.0',
421-
alternative='pvlib.spectrum.spectral_factor_firstsolar'
422-
)(pvlib.spectrum.spectral_factor_firstsolar)
423-
424-
425416
def bird_hulstrom80_aod_bb(aod380, aod500):
426417
"""
427418
Approximate broadband aerosol optical depth.

pvlib/iotools/tmy.py

Lines changed: 3 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
import datetime
44
import re
55
import pandas as pd
6-
import warnings
7-
from pvlib._deprecation import pvlibDeprecationWarning
86

97
# Dictionary mapping TMY3 names to pvlib names
108
VARIABLE_MAP = {
@@ -24,8 +22,7 @@
2422
}
2523

2624

27-
def read_tmy3(filename, coerce_year=None, map_variables=None, recolumn=None,
28-
encoding=None):
25+
def read_tmy3(filename, coerce_year=None, map_variables=True, encoding=None):
2926
"""Read a TMY3 file into a pandas dataframe.
3027
3128
Note that values contained in the metadata dictionary are unchanged
@@ -44,13 +41,9 @@ def read_tmy3(filename, coerce_year=None, map_variables=None, recolumn=None,
4441
If supplied, the year of the index will be set to ``coerce_year``, except
4542
for the last index value which will be set to the *next* year so that
4643
the index increases monotonically.
47-
map_variables : bool, optional
44+
map_variables : bool, default True
4845
When True, renames columns of the DataFrame to pvlib variable names
4946
where applicable. See variable :const:`VARIABLE_MAP`.
50-
recolumn : bool (deprecated, use map_variables instead)
51-
If ``True``, apply standard names to TMY3 columns. Typically this
52-
results in stripping the units from the column name.
53-
Cannot be used in combination with ``map_variables``.
5447
encoding : str, optional
5548
Encoding of the file. For files that contain non-UTF8 characters it may
5649
be necessary to specify an alternative encoding, e.g., for
@@ -233,74 +226,15 @@ def read_tmy3(filename, coerce_year=None, map_variables=None, recolumn=None,
233226
# unit must be in (D,h,m,s,ms,us,ns), but pandas>=0.24 allows unit='hour'
234227
data.index = data_ymd + pd.to_timedelta(shifted_hour, unit='h') \
235228
+ pd.to_timedelta(minutes, unit='min')
236-
# shouldnt' specify both recolumn and map_variables
237-
if recolumn is not None and map_variables is not None:
238-
msg = "`map_variables` and `recolumn` cannot both be specified"
239-
raise ValueError(msg)
240-
elif map_variables is None and recolumn is not None:
241-
warnings.warn(
242-
'The recolumn parameter is deprecated and will be removed in '
243-
'pvlib 0.11.0. Use `map_variables` instead, although note that '
244-
'its behavior is different from `recolumn`.',
245-
pvlibDeprecationWarning)
246-
elif map_variables is None and recolumn is None:
247-
warnings.warn(
248-
'TMY3 variable names will be renamed to pvlib conventions by '
249-
'default starting in pvlib 0.11.0. Specify map_variables=True '
250-
'to enable that behavior now, or specify map_variables=False '
251-
'to hide this warning.', pvlibDeprecationWarning)
229+
252230
if map_variables:
253231
data = data.rename(columns=VARIABLE_MAP)
254-
elif recolumn or (recolumn is None and map_variables is None):
255-
data = _recolumn(data)
256232

257233
data = data.tz_localize(int(meta['TZ'] * 3600))
258234

259235
return data, meta
260236

261237

262-
def _recolumn(tmy3_dataframe):
263-
"""
264-
Rename the columns of the TMY3 DataFrame.
265-
266-
Parameters
267-
----------
268-
tmy3_dataframe : DataFrame
269-
inplace : bool
270-
passed to DataFrame.rename()
271-
272-
Returns
273-
-------
274-
Recolumned DataFrame.
275-
"""
276-
# paste in the header as one long line
277-
raw_columns = 'ETR (W/m^2),ETRN (W/m^2),GHI (W/m^2),GHI source,GHI uncert (%),DNI (W/m^2),DNI source,DNI uncert (%),DHI (W/m^2),DHI source,DHI uncert (%),GH illum (lx),GH illum source,Global illum uncert (%),DN illum (lx),DN illum source,DN illum uncert (%),DH illum (lx),DH illum source,DH illum uncert (%),Zenith lum (cd/m^2),Zenith lum source,Zenith lum uncert (%),TotCld (tenths),TotCld source,TotCld uncert (code),OpqCld (tenths),OpqCld source,OpqCld uncert (code),Dry-bulb (C),Dry-bulb source,Dry-bulb uncert (code),Dew-point (C),Dew-point source,Dew-point uncert (code),RHum (%),RHum source,RHum uncert (code),Pressure (mbar),Pressure source,Pressure uncert (code),Wdir (degrees),Wdir source,Wdir uncert (code),Wspd (m/s),Wspd source,Wspd uncert (code),Hvis (m),Hvis source,Hvis uncert (code),CeilHgt (m),CeilHgt source,CeilHgt uncert (code),Pwat (cm),Pwat source,Pwat uncert (code),AOD (unitless),AOD source,AOD uncert (code),Alb (unitless),Alb source,Alb uncert (code),Lprecip depth (mm),Lprecip quantity (hr),Lprecip source,Lprecip uncert (code),PresWth (METAR code),PresWth source,PresWth uncert (code)' # noqa: E501
278-
279-
new_columns = [
280-
'ETR', 'ETRN', 'GHI', 'GHISource', 'GHIUncertainty',
281-
'DNI', 'DNISource', 'DNIUncertainty', 'DHI', 'DHISource',
282-
'DHIUncertainty', 'GHillum', 'GHillumSource', 'GHillumUncertainty',
283-
'DNillum', 'DNillumSource', 'DNillumUncertainty', 'DHillum',
284-
'DHillumSource', 'DHillumUncertainty', 'Zenithlum',
285-
'ZenithlumSource', 'ZenithlumUncertainty', 'TotCld', 'TotCldSource',
286-
'TotCldUncertainty', 'OpqCld', 'OpqCldSource', 'OpqCldUncertainty',
287-
'DryBulb', 'DryBulbSource', 'DryBulbUncertainty', 'DewPoint',
288-
'DewPointSource', 'DewPointUncertainty', 'RHum', 'RHumSource',
289-
'RHumUncertainty', 'Pressure', 'PressureSource',
290-
'PressureUncertainty', 'Wdir', 'WdirSource', 'WdirUncertainty',
291-
'Wspd', 'WspdSource', 'WspdUncertainty', 'Hvis', 'HvisSource',
292-
'HvisUncertainty', 'CeilHgt', 'CeilHgtSource', 'CeilHgtUncertainty',
293-
'Pwat', 'PwatSource', 'PwatUncertainty', 'AOD', 'AODSource',
294-
'AODUncertainty', 'Alb', 'AlbSource', 'AlbUncertainty',
295-
'Lprecipdepth', 'Lprecipquantity', 'LprecipSource',
296-
'LprecipUncertainty', 'PresWth', 'PresWthSource',
297-
'PresWthUncertainty']
298-
299-
mapping = dict(zip(raw_columns.split(','), new_columns))
300-
301-
return tmy3_dataframe.rename(columns=mapping)
302-
303-
304238
def read_tmy2(filename):
305239
"""
306240
Read a TMY2 file into a DataFrame.

pvlib/spectrum/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
spectral_factor_jrc,
99
)
1010
from pvlib.spectrum.irradiance import ( # noqa: F401
11-
get_am15g,
1211
get_reference_spectra,
1312
average_photon_energy,
1413
)

0 commit comments

Comments
 (0)