15
15
'100' : 'ghi' ,
16
16
'201' : 'dni' ,
17
17
'300' : 'dhi' ,
18
- '920' : 'wind_dir ' ,
18
+ '920' : 'wind_direction ' ,
19
19
'921' : 'wind_speed' ,
20
20
'930' : 'temp_air' ,
21
21
'931' : 'temp_dew' ,
24
24
}
25
25
26
26
27
- def read_srml (filename ):
27
+ def read_srml (filename , map_variables = True ):
28
28
"""
29
29
Read University of Oregon SRML 1min .tsv file into pandas dataframe. The
30
30
SRML is described in [1]_.
@@ -33,13 +33,14 @@ def read_srml(filename):
33
33
----------
34
34
filename: str
35
35
filepath or url to read for the tsv file.
36
+ map_variables: bool, default: True
37
+ When true, renames columns of the DataFrame to pvlib variable names
38
+ where applicable. See variable :const:`VARIABLE_MAP`.
36
39
37
40
Returns
38
41
-------
39
42
data: Dataframe
40
- A dataframe with datetime index and all of the variables listed
41
- in the `VARIABLE_MAP` dict inside of the map_columns function,
42
- along with their associated quality control flags.
43
+ A dataframe with datetime index
43
44
44
45
Notes
45
46
-----
@@ -64,7 +65,8 @@ def read_srml(filename):
64
65
# Drop day of year and time columns
65
66
data = data [data .columns [2 :]]
66
67
67
- data = data .rename (columns = map_columns )
68
+ if map_variables :
69
+ data = data .rename (columns = map_columns )
68
70
69
71
# Quality flag columns are all labeled 0 in the original data. They
70
72
# appear immediately after their associated variable and are suffixed
@@ -166,7 +168,8 @@ def format_index(df):
166
168
return df
167
169
168
170
169
- def read_srml_month_from_solardat (station , year , month , filetype = 'PO' ):
171
+ def read_srml_month_from_solardat (station , year , month , filetype = 'PO' ,
172
+ map_variables = True ):
170
173
"""Request a month of SRML data from solardat and read it into
171
174
a Dataframe. The SRML is described in [1]_.
172
175
@@ -180,6 +183,9 @@ def read_srml_month_from_solardat(station, year, month, filetype='PO'):
180
183
Month to request data for.
181
184
filetype: string
182
185
SRML file type to gather. See notes for explanation.
186
+ map_variables: bool, default: True
187
+ When true, renames columns of the DataFrame to pvlib variable names
188
+ where applicable. See variable :const:`VARIABLE_MAP`.
183
189
184
190
Returns
185
191
-------
@@ -214,5 +220,5 @@ def read_srml_month_from_solardat(station, year, month, filetype='PO'):
214
220
year = year % 100 ,
215
221
month = month )
216
222
url = "http://solardat.uoregon.edu/download/Archive/"
217
- data = read_srml (url + file_name )
223
+ data = read_srml (url + file_name , map_variables = map_variables )
218
224
return data
0 commit comments