Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add map_variables parameter to read_tmy3 function #1623

Merged
merged 50 commits into from
May 24, 2023
Merged
Changes from 6 commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
0e60277
Added map_variables param in read_tmy3 func
Dec 21, 2022
a8977fa
solved failing tests
Dec 21, 2022
054dd35
solved failing tests
Dec 22, 2022
3c7f7f6
solving stickerly test fail
Dec 22, 2022
dc6399d
solving stickerly test fail
Dec 23, 2022
773b94e
solving stickerly test fail
Dec 23, 2022
df97faf
added variable_map
Jan 21, 2023
2eee8ce
resolving formatting issues
Jan 21, 2023
7a86c55
Update pvlib/iotools/tmy.py
ooprathamm Jan 22, 2023
7013739
Update pvlib/iotools/tmy.py
ooprathamm Jan 22, 2023
16b3986
Update pvlib/iotools/tmy.py
ooprathamm Jan 22, 2023
5210407
Update pvlib/iotools/tmy.py
ooprathamm Jan 22, 2023
68b54fe
Added tests to map_variables and check depreciation warning
Jan 22, 2023
2ccae9e
resolving formatting issues
Jan 22, 2023
1ee7ff0
resolving formatting issues
Jan 22, 2023
98e53b3
Adding more test cases
Jan 24, 2023
8e5c4d7
Merge branch 'pvlib:main' into main
ooprathamm Jan 24, 2023
96a30a6
updated VARIABLE_MAP
Jan 26, 2023
9a69f12
updates DOIs in tmy.py
Jan 26, 2023
850a798
Merge branch 'pvlib:main' into main
ooprathamm Feb 2, 2023
1e86046
Final changes as requested
Feb 2, 2023
0244732
Fix stickler
AdamRJensen Feb 2, 2023
bccaf02
Update variables_style_rules.csv
AdamRJensen Feb 2, 2023
c4e4417
Add missing map_variables=False
AdamRJensen Feb 2, 2023
b91408a
Add whatsnew deprecation entry
AdamRJensen Feb 2, 2023
94383e9
Apply suggestions from code review
AdamRJensen Feb 7, 2023
2d02f4d
Merge branch 'main' into main
AdamRJensen Feb 7, 2023
c6ebd9e
Add separate if statement for warning
AdamRJensen Feb 7, 2023
616cc76
removed wrong whatsnew entry
Feb 9, 2023
cd9cc86
Update pvlib/tests/iotools/test_tmy.py
ooprathamm Feb 12, 2023
da591f5
Update warning messages according to table
AdamRJensen May 17, 2023
13b8782
Merge remote-tracking branch 'upstream/main' into pr/1623
AdamRJensen May 17, 2023
8f9c788
Update whatsnew
AdamRJensen May 17, 2023
5661f71
Set recolumn=None
AdamRJensen May 17, 2023
a3e2016
Update tests
AdamRJensen May 17, 2023
d0d1644
Update pvlib/iotools/tmy.py
AdamRJensen May 22, 2023
b080c76
Update pvlib/iotools/tmy.py
AdamRJensen May 22, 2023
da131ad
Update docs/sphinx/source/whatsnew/v0.9.6.rst
AdamRJensen May 22, 2023
828b994
Implement updated error message logic from kansersolar
AdamRJensen May 22, 2023
737f5d6
Merge branch 'main' of https://github.com/ooprathamm/pvlib-python int…
AdamRJensen May 22, 2023
1f31390
Clean up deprecation warnings
AdamRJensen May 22, 2023
b720399
Merge branch 'main' into main
AdamRJensen May 22, 2023
98e7891
Fix clearsky.rst
AdamRJensen May 22, 2023
d0c5309
Merge branch 'main' of https://github.com/ooprathamm/pvlib-python int…
AdamRJensen May 22, 2023
24e90d7
Update aod variable mapping
AdamRJensen May 22, 2023
b4bf004
Fix stickler
AdamRJensen May 23, 2023
143f9ac
Update tmy3 variables names in field,description table
AdamRJensen May 23, 2023
5d2ef3a
Update table
AdamRJensen May 24, 2023
fe2f343
More table stuff
AdamRJensen May 24, 2023
35d2d54
Table stuff galore
AdamRJensen May 24, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions pvlib/iotools/tmy.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
import datetime
import re
import pandas as pd
import warnings


def read_tmy3(filename, coerce_year=None, recolumn=True):
def read_tmy3(filename, coerce_year=None, map_variables=None, recolumn=True):
"""Read a TMY3 file into a pandas dataframe.

Note that values contained in the metadata dictionary are unchanged
Expand All @@ -24,6 +25,10 @@ def read_tmy3(filename, coerce_year=None, recolumn=True):
If supplied, the year of the index will be set to `coerce_year`, except
for the last index value which will be set to the *next* year so that
the index increases monotonically.
map_variables : bool, default None
If ``True``, apply standard names to TMY3 columns. Typically this
results in stripping the units from the column name and issues
deprecationWarning for recolumn
recolumn : bool, default True
If ``True``, apply standard names to TMY3 columns. Typically this
results in stripping the units from the column name.
Expand Down Expand Up @@ -199,8 +204,15 @@ def read_tmy3(filename, coerce_year=None, recolumn=True):
# unit must be in (D,h,m,s,ms,us,ns), but pandas>=0.24 allows unit='hour'
data.index = data_ymd + pd.to_timedelta(shifted_hour, unit='h')

if recolumn:
if map_variables:
data = _recolumn(data) # rename to standard column names
elif recolumn:
if not map_variables: # silence warning if map_variables is false
data = _recolumn(data)
elif map_variables is None:
data = _recolumn(data)
warnings.warn("recolumn parameter will be retired starting version 0.9.5,"
"please use map_variables parameter instead.",DeprecationWarning)

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

Expand Down