@@ -205,6 +205,26 @@ def load(fnames, tag='', inst_id=''):
205205 meta .labels .fill_val : np .nan ,
206206 meta .labels .min_val : 0 ,
207207 meta .labels .max_val : 400 }
208+ elif tag == 'historic' :
209+
210+ # LASP updated file format in June, 2022. Minimize impact downstream by
211+ # continuing use of `f107` as primary data product.
212+ if 'f107_adjusted' in data .columns :
213+ data ['f107' ] = data ['f107_adjusted' ]
214+
215+ # Add metadata
216+ meta ['f107_observed' ] = meta ['f107' ]
217+ raw_str = 'Raw F10.7 cm radio flux in Solar Flux Units (SFU)'
218+ meta ['f107_observed' ] = {meta .labels .desc : raw_str }
219+
220+ meta ['f107_adjusted' ] = meta ['f107_observed' ]
221+ norm_str = '' .join (['F10.7 cm radio flux in Solar Flux Units (SFU)' ,
222+ ' normalized to 1-AU' ])
223+ meta ['f107_adjusted' ] = {meta .labels .desc : norm_str }
224+
225+ meta ['f107' ] = {
226+ meta .labels .desc : meta ['f107_adjusted' , meta .labels .desc ]}
227+
208228 elif tag == 'daily' or tag == 'prelim' :
209229 meta ['ssn' ] = {meta .labels .units : '' ,
210230 meta .labels .name : 'Sunspot Number' ,
@@ -473,8 +493,9 @@ def download(date_array, tag, inst_id, data_path, update_files=False):
473493 data .index = times
474494
475495 # Replace fill value with NaNs
476- idx , = np .where (data ['f107' ] == - 99999.0 )
477- data .iloc [idx , :] = np .nan
496+ for var in data .columns :
497+ idx , = np .where (data [var ] == - 99999.0 )
498+ data .iloc [idx , :] = np .nan
478499
479500 # Create a local CSV file
480501 data .to_csv (data_file , header = True )
0 commit comments