Skip to content

Commit 067671c

Browse files
committed
fixed meta parser, renamed elevation to altitude removed capitals in latitude and longitude and return an integer TZ
1 parent 4e6b007 commit 067671c

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

pvlib/pvl_readtmy2.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ def pvl_readtmy2(FileName):
171171

172172
string='%2d%2d%2d%2d%4d%4d%4d%1s%1d%4d%1s%1d%4d%1s%1d%4d%1s%1d%4d%1s%1d%4d%1s%1d%4d%1s%1d%2d%1s%1d%2d%1s%1d%4d%1s%1d%4d%1s%1d%3d%1s%1d%4d%1s%1d%3d%1s%1d%3d%1s%1d%4d%1s%1d%5d%1s%1d%10d%3d%1s%1d%3d%1s%1d%3d%1s%1d%2d%1s%1d'
173173
columns='year,month,day,hour,ETR,ETRN,GHI,GHISource,GHIUncertainty,DNI,DNISource,DNIUncertainty,DHI,DHISource,DHIUncertainty,GHillum,GHillumSource,GHillumUncertainty,DNillum,DNillumSource,DNillumUncertainty,DHillum,DHillumSource,DHillumUncertainty,Zenithlum,ZenithlumSource,ZenithlumUncertainty,TotCld,TotCldSource,TotCldUnertainty,OpqCld,OpqCldSource,OpqCldUncertainty,DryBulb,DryBulbSource,DryBulbUncertainty,DewPoint,DewPointSource,DewPointUncertainty,RHum,RHumSource,RHumUncertainty,Pressure,PressureSource,PressureUncertainty,Wdir,WdirSource,WdirUncertainty,Wspd,WspdSource,WspdUncertainty,Hvis,HvisSource,HvisUncertainty,CeilHgt,CeilHgtSource,CeilHgtUncertainty,PresentWeather,Pwat,PwatSource,PwatUncertainty,AOD,AODSource,AODUncertainty,SnowDepth,SnowDepthSource,SnowDepthUncertainty,LastSnowfall,LastSnowfallSource,LastSnowfallUncertaint'
174-
hdr_columns='WBAN,City,State,TimeZone,Latitude,Longitude,Elevation'
174+
hdr_columns='WBAN,City,State,TZ,latitude,longitude,altitude'
175175

176176
TMY2,TMY2_meta=readTMY(string,columns,hdr_columns,var.FileName)
177177

@@ -196,7 +196,8 @@ def parsemeta(columns,line):
196196
197197
"""
198198
rawmeta=" ".join(line.split()).split(" ") #Remove sduplicated spaces, and read in each element
199-
meta=rawmeta[:4] #take the first string entries
199+
meta=rawmeta[:3] #take the first string entries
200+
meta.append(int(rawmeta[3]))
200201
longitude=(float(rawmeta[5])+float(rawmeta[6])/60)*(2*(rawmeta[4]=='N')-1)#Convert to decimal notation with S negative
201202
latitude=(float(rawmeta[8])+float(rawmeta[9])/60)*(2*(rawmeta[7]=='E')-1) #Convert to decimal notation with W negative
202203
meta.append(longitude)

0 commit comments

Comments
 (0)