diff --git a/seppy/loader/wind.py b/seppy/loader/wind.py index 0cdfec6..de802ff 100644 --- a/seppy/loader/wind.py +++ b/seppy/loader/wind.py @@ -180,6 +180,9 @@ def wind3dp_download(dataset, startdate, enddate, path=None, **kwargs): if not os.path.exists(f): # downloaded_file = Fido.fetch(result[0][i], path=path, max_conn=max_conn) downloaded_file = wind3dp_single_download(files[i], path=path) + if downloaded_file == []: + print('Trying download from CDAWeb...') + downloaded_file = Fido.fetch(result[0][i], path=path) #, max_conn=max_conn) except (RuntimeError, IndexError): print(f'Unable to obtain "{dataset}" data for {startdate}-{enddate}!') @@ -279,22 +282,31 @@ def wind3dp_load(dataset, startdate, enddate, resample="1min", multi_index=True, metacdf = cdflib.CDF(path_to_metafile) e_mean = df.filter(like='ENERGY_').mean() - # ∼30% ΔE/E => ΔE = 0.3*E # from Table 3 of Wilson et al. 2021, https://doi.org/10.1029/2020RG000714 - delta_e = 0.3 * e_mean + # ∼30% ΔE/E => ΔE = 0.3*E + if dataset in ['WI_SFSP_3DP', 'WI_SFPD_3DP', 'WI_SOSP_3DP', 'WI_SOPD_3DP']: + delta_e = 0.3 * e_mean + # ∼20% ΔE/E => ΔE = 0.2*E + elif dataset in ['WI_ELSP_3DP', 'WI_ELPD_3DP', 'WI_EHSP_3DP', 'WI_EHPD_3DP']: + delta_e = 0.2 * e_mean e_low = e_mean - delta_e e_high = e_mean + delta_e energies = pd.concat([e_mean, delta_e, e_low, e_high], axis=1, keys=['mean_E', 'DE', 'lower_E', 'upper_E']) energies['Bins_Text']= np.around(e_low/1e3, 2).astype('string') +' - '+ np.around(e_high/1e3, 2).astype('string') + ' keV' meta = {'channels_dict_df': energies, - 'APPROX_ENERGY_LABELS': metacdf.varget('APPROX_ENERGY_LABELS'), 'ENERGY_UNITS': metacdf.varattsget('ENERGY')['UNITS'], 'FLUX_UNITS': metacdf.varattsget('FLUX')['UNITS'], 'FLUX_FILLVAL': metacdf.varattsget('FLUX')['FILLVAL'], - 'FLUX_LABELS': metacdf.varget('FLUX_ENERGY_LABL'), } + # for SFSP, SOSP, SFPD, SFSP: + try: + meta['APPROX_ENERGY_LABELS'] = metacdf.varget('APPROX_ENERGY_LABELS') + meta['FLUX_LABELS'] = metacdf.varget('FLUX_ENERGY_LABL') + except: + pass + # create multi-index data frame of flux if multi_index: if dataset == 'WI_SFPD_3DP' or dataset == 'WI_SOPD_3DP':