3
3
import datetime
4
4
import re
5
5
import pandas as pd
6
+ import warnings
6
7
7
8
8
- def read_tmy3 (filename , coerce_year = None , recolumn = True ):
9
+ def read_tmy3 (filename , coerce_year = None , map_variables = None , recolumn = True ):
9
10
"""Read a TMY3 file into a pandas dataframe.
10
11
11
12
Note that values contained in the metadata dictionary are unchanged
@@ -24,6 +25,10 @@ def read_tmy3(filename, coerce_year=None, recolumn=True):
24
25
If supplied, the year of the index will be set to `coerce_year`, except
25
26
for the last index value which will be set to the *next* year so that
26
27
the index increases monotonically.
28
+ map_variables : bool, default None
29
+ If ``True``, apply standard names to TMY3 columns. Typically this
30
+ results in stripping the units from the column name and issues deprecationWarning
31
+ for recolumn
27
32
recolumn : bool, default True
28
33
If ``True``, apply standard names to TMY3 columns. Typically this
29
34
results in stripping the units from the column name.
@@ -198,9 +203,17 @@ def read_tmy3(filename, coerce_year=None, recolumn=True):
198
203
# NOTE: as of pvlib-0.6.3, min req is pandas-0.18.1, so pd.to_timedelta
199
204
# unit must be in (D,h,m,s,ms,us,ns), but pandas>=0.24 allows unit='hour'
200
205
data .index = data_ymd + pd .to_timedelta (shifted_hour , unit = 'h' )
201
-
202
- if recolumn :
206
+
207
+ if map_variables :
203
208
data = _recolumn (data ) # rename to standard column names
209
+ elif recolumn :
210
+ if not map_variables : # silence warning if map_variables is false
211
+ data = _recolumn (data )
212
+ elif map_variables is None :
213
+ data = _recolumn (data )
214
+ warnings .warn ("recolumn parameter will be retired starting version 0.9.5, please"
215
+ "use map_variables parameter instead." ,DeprecationWarning )
216
+
204
217
205
218
data = data .tz_localize (int (meta ['TZ' ] * 3600 ))
206
219
0 commit comments