8000 TMY loading improvements by wholmgren · Pull Request #7 · pvlib/pvlib-python · GitHub
[go: up one dir, main page]

Skip to content

TMY loading improvements #7

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

Merged
merged 8 commits into from
Mar 11, 2015
Merged
Changes from 1 commit
Commits
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
Prev Previous commit
Next Next commit
add _ to helper function names
  • Loading branch information
wholmgren committed Feb 28, 2015
commit c5261f9b39bd331da730745b2324a9eedd2b7754
20 changes: 4 additions & 16 deletions pvlib/tmy.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ def readtmy3(filename=None, coerce_year=None, recolumn=True):

if filename is None:
try:
filename = interactive_load()
filename = _interactive_load()
except:
raise Exception('Interactive load failed. Tkinter not supported on this system. Try installing X-Quartz and reloading')

Expand All @@ -182,7 +182,7 @@ def readtmy3(filename=None, coerce_year=None, recolumn=True):

TMYData = pd.read_csv(filename, header=1,
parse_dates={'datetime':['Date (MM/DD/YYYY)','Time (HH:MM)']},
date_parser=parsedate, index_col='datetime')
date_parser=_parsedate, index_col='datetime')

if recolumn:
_recolumn(TMYData) #rename to standard column names
Expand All @@ -193,15 +193,15 @@ def readtmy3(filename=None, coerce_year=None, recolumn=True):



def interactive_load():
def _interactive_load():
import Tkinter
from tkFileDialog import askopenfilename
Tkinter.Tk().withdraw() #Start interactive file input
return askopenfilename()



def parsedate(ymd, hour):
def _parsedate(ymd, hour):
# stupidly complicated due to TMY3's usage of hour 24
# and dateutil's inability to handle that.
offset_hour = int(hour[:2]) - 1
Expand All @@ -212,18 +212,6 @@ def parsedate(ymd, hour):



def parsetz(UTC):
#currently not used, need to make these daylight savings unaware
TZinfo = {-5:'EST',
-6:'CST',
-7:'MST',
-8:'PST',
-9:'AKST',
-10:'HAST'}
return TZinfo[UTC]



def _recolumn(tmy3_dataframe, inplace=True):
"""
Rename the columns of the TMY3 DataFrame.
Expand Down
0