From 5afc666309155ac4d1abc2740b19b6c206a9f4a3 Mon Sep 17 00:00:00 2001 From: jameswilburlewis Date: Wed, 31 Jan 2024 16:13:27 -0800 Subject: [PATCH 1/2] Docstring updates for ERGSC ground data load routines --- pyspedas/erg/ground/camera/camera_omti_asi.py | 65 +++++ .../erg/ground/geomag/gmag_isee_fluxgate.py | 63 +++++ .../erg/ground/geomag/gmag_isee_induction.py | 217 ++++++++++++---- .../erg/ground/geomag/gmag_magdas_1sec.py | 241 +++++++++++++----- pyspedas/erg/ground/geomag/gmag_mm210.py | 70 +++++ .../erg/ground/geomag/gmag_stel_fluxgate.py | 107 ++++++-- .../erg/ground/geomag/gmag_stel_induction.py | 104 ++++++-- 7 files changed, 716 insertions(+), 151 deletions(-) diff --git a/pyspedas/erg/ground/camera/camera_omti_asi.py b/pyspedas/erg/ground/camera/camera_omti_asi.py index f6c94a89..17fdce78 100644 --- a/pyspedas/erg/ground/camera/camera_omti_asi.py +++ b/pyspedas/erg/ground/camera/camera_omti_asi.py @@ -22,7 +22,72 @@ def camera_omti_asi( time_clip=False, ror=True ): + """ + Load data from OMTI all sky imagers + Parameters + ---------- + trange: list of str + time range of interest [starttime, endtime] with the format + 'YYYY-MM-DD','YYYY-MM-DD'] or to specify more or less than a day + ['YYYY-MM-DD/hh:mm:ss','YYYY-MM-DD/hh:mm:ss'] + Default: ['2020-08-01', '2020-08-02'] + + suffix: str + The tplot variable names will be given this suffix. Default: '' + + site: str or list of str + The site or list of sites to load. + Valid values: 'abu', 'ath', 'drw', 'eur', 'gak', 'hlk', 'hus', 'isg', + 'ist', 'ith', 'kap', 'ktb','mgd', 'nai', 'nyr', 'ptk', 'rik', 'rsb', + 'sgk', 'sta', 'syo', 'trs', 'yng', 'all' + Default: ['all'] + + wavelength: str, int, list of str, or list of int + Valid values: [5577, 5725, 6300, 7200, 7774] + Default: 5577 + + get_support_data: bool + If true, data with an attribute "VAR_TYPE" with a value of "support_data" + or 'data' will be loaded into tplot. Default: False + + varformat: str + The CDF file variable formats to load into tplot. Wildcard character + "*" is accepted. Default: None (all variables will be loaded). + + varnames: list of str + List of variable names to load. Default: [] (all variables will be loadee) + + downloadonly: bool + Set this flag to download the CDF files, but not load them into + tplot variables. Default: False + + notplot: bool + Return the data in hash tables instead of creating tplot variables. Default: False + + no_update: bool + If set, only load data from your local cache. Default: False + + uname: str + User name. Default: None + + passwd: str + Password. Default: None + + time_clip: bool + Time clip the variables to exactly the range specified in the trange keyword. Default: False + + ror: bool + If set, print PI info and rules of the road. Default: True + + Returns + ------- + + Examples + ________ + + + """ site_code_all = ['abu', 'ath', 'drw', 'eur', 'gak', 'hlk', 'hus', 'isg', 'ist', 'ith', 'kap', 'ktb', 'mgd', 'nai', 'nyr', 'ptk', 'rik', 'rsb', diff --git a/pyspedas/erg/ground/geomag/gmag_isee_fluxgate.py b/pyspedas/erg/ground/geomag/gmag_isee_fluxgate.py index 12b195b0..581d829b 100644 --- a/pyspedas/erg/ground/geomag/gmag_isee_fluxgate.py +++ b/pyspedas/erg/ground/geomag/gmag_isee_fluxgate.py @@ -22,7 +22,70 @@ def gmag_isee_fluxgate( time_clip=False, ror=True ): + """ + Load data from ISEE Fluxgate Magnetometers + Parameters + ---------- + trange: list of str + time range of interest [starttime, endtime] with the format + 'YYYY-MM-DD','YYYY-MM-DD'] or to specify more or less than a day + ['YYYY-MM-DD/hh:mm:ss','YYYY-MM-DD/hh:mm:ss'] + Default: ['2020-08-01', '2020-08-02'] + + suffix: str + The tplot variable names will be given this suffix. Default: '' + + site: str or list of str + The site or list of sites to load. + Valid values: 'msr', 'rik', 'kag', 'ktb', 'lcl', 'mdm', 'tew', 'all' + Default: ['all'] + + datatype: str or list of str + The data types to load. Valid values: '64hz', '1sec', '1min', '1h', 'all' + Default: 'all' + + get_support_data: bool + If true, data with an attribute "VAR_TYPE" with a value of "support_data" + or 'data' will be loaded into tplot. Default: False + + varformat: str + The CDF file variable formats to load into tplot. Wildcard character + "*" is accepted. Default: None (all variables will be loaded). + + varnames: list of str + List of variable names to load. Default: [] (all variables will be loadee) + + downloadonly: bool + Set this flag to download the CDF files, but not load them into + tplot variables. Default: False + + notplot: bool + Return the data in hash tables instead of creating tplot variables. Default: False + + no_update: bool + If set, only load data from your local cache. Default: False + + uname: str + User name. Default: None + + passwd: str + Password. Default: None + + time_clip: bool + Time clip the variables to exactly the range specified in the trange keyword. Default: False + + ror: bool + If set, print PI info and rules of the road. Default: True + + Returns + ------- + + Examples + ________ + + + """ site_code_all = ['msr', 'rik', 'kag', 'ktb', 'lcl', 'mdm', 'tew'] tres_all=['64hz', '1sec', '1min', '1h'] if isinstance(datatype, str): diff --git a/pyspedas/erg/ground/geomag/gmag_isee_induction.py b/pyspedas/erg/ground/geomag/gmag_isee_induction.py index c42394f8..aa0235f9 100644 --- a/pyspedas/erg/ground/geomag/gmag_isee_induction.py +++ b/pyspedas/erg/ground/geomag/gmag_isee_induction.py @@ -8,9 +8,9 @@ def gmag_isee_induction( - trange=['2018-10-18/00:00:00','2018-10-18/02:00:00'], - suffix='', - site='all', + trange=["2018-10-18/00:00:00", "2018-10-18/02:00:00"], + suffix="", + site="all", get_support_data=False, varformat=None, varnames=[], @@ -21,21 +21,96 @@ def gmag_isee_induction( passwd=None, time_clip=False, ror=True, - frequency_dependent=False + frequency_dependent=False, ): + """ + Load data from ISEE Induction Magnetometers - site_code_all = ['ath', 'gak', 'hus', 'kap', 'lcl', 'mgd', 'msr', 'nai', 'ptk', 'rik', 'sta', 'zgn'] + Parameters + ---------- + trange: list of str + time range of interest [starttime, endtime] with the format + 'YYYY-MM-DD','YYYY-MM-DD'] or to specify more or less than a day + ['YYYY-MM-DD/hh:mm:ss','YYYY-MM-DD/hh:mm:ss'] + Default: ['2018-10-18/00:00:00', '2018-10-18/02:00:00'] + suffix: str + The tplot variable names will be given this suffix. Default: '' + site: str or list of str + The site or list of sites to load. Valid values: "ath", "gak", "hus", "kap", "lcl", "mgd", "msr", + "nai", "ptk", "rik", "sta", "zgn", "all" + Default: ['all'] + + get_support_data: bool + If true, data with an attribute "VAR_TYPE" with a value of "support_data" + or 'data' will be loaded into tplot. Default: False + + varformat: str + The CDF file variable formats to load into tplot. Wildcard character + "*" is accepted. Default: None (all variables will be loaded). + + varnames: list of str + List of variable names to load. Default: [] (all variables will be loadee) + + downloadonly: bool + Set this flag to download the CDF files, but not load them into + tplot variables. Default: False + + notplot: bool + Return the data in hash tables instead of creating tplot variables. Default: False + + no_update: bool + If set, only load data from your local cache. Default: False + + uname: str + User name. Default: None + + passwd: str + Password. Default: None + + time_clip: bool + Time clip the variables to exactly the range specified in the trange keyword. Default: False + + ror: bool + If set, print PI info and rules of the road. Default: True + + frequency_dependent: bool + If set, load frequency dependent data. + Default: False + + Returns + ------- + + Examples + ________ + + + """ + + site_code_all = [ + "ath", + "gak", + "hus", + "kap", + "lcl", + "mgd", + "msr", + "nai", + "ptk", + "rik", + "sta", + "zgn", + ] if isinstance(site, str): site_code = site.lower() - site_code = site_code.split(' ') + site_code = site_code.split(" ") elif isinstance(site, list): site_code = [] for i in range(len(site)): site_code.append(site[i].lower()) - if 'all' in site_code: + if "all" in site_code: site_code = site_code_all site_code = list(set(site_code).intersection(site_code_all)) @@ -44,28 +119,45 @@ def gmag_isee_induction( frequency_dependent_structure = {} for site_input in site_code: frequency_dependent_structure[site_input] = { - 'site_code':'', - 'nfreq':0, - 'frequency':np.zeros(shape=(64)), - 'sensitivity':np.zeros(shape=(64,3)), - 'phase_difference':np.zeros(shape=(64,3)) + "site_code": "", + "nfreq": 0, + "frequency": np.zeros(shape=(64)), + "sensitivity": np.zeros(shape=(64, 3)), + "phase_difference": np.zeros(shape=(64, 3)), } - prefix = 'isee_induction_' + prefix = "isee_induction_" if notplot: loaded_data = {} else: loaded_data = [] - - for site_input in site_code: - file_res = 3600. - pathformat = 'ground/geomag/isee/induction/'+site_input\ - +'/%Y/%m/isee_induction_'+site_input+'_%Y%m%d%H_v??.cdf' + for site_input in site_code: + file_res = 3600.0 + pathformat = ( + "ground/geomag/isee/induction/" + + site_input + + "/%Y/%m/isee_induction_" + + site_input + + "_%Y%m%d%H_v??.cdf" + ) + + loaded_data_temp = load( + pathformat=pathformat, + file_res=file_res, + trange=trange, + prefix=prefix, + suffix="_" + site_input + suffix, + get_support_data=get_support_data, + varformat=varformat, + downloadonly=downloadonly, + notplot=notplot, + time_clip=time_clip, + no_update=no_update, + uname=uname, + passwd=passwd, + ) - loaded_data_temp = load(pathformat=pathformat, file_res=file_res, trange=trange, prefix=prefix, suffix='_'+site_input+suffix, get_support_data=get_support_data, - varformat=varformat, downloadonly=downloadonly, notplot=notplot, time_clip=time_clip, no_update=no_update, uname=uname, passwd=passwd) - if notplot: loaded_data.update(loaded_data_temp) else: @@ -77,54 +169,71 @@ def gmag_isee_induction( cdf_file = cdflib.CDF(loaded_data_temp[-1]) gatt = cdf_file.globalattsget() else: - gatt = get_data(loaded_data_temp[-1], metadata=True)['CDF']['GATT'] + gatt = get_data(loaded_data_temp[-1], metadata=True)["CDF"][ + "GATT" + ] elif isinstance(loaded_data_temp, dict): - gatt = loaded_data_temp[list(loaded_data_temp.keys())[-1]]['CDF']['GATT'] - print('**************************************************************************') + gatt = loaded_data_temp[list(loaded_data_temp.keys())[-1]]["CDF"][ + "GATT" + ] + print( + "**************************************************************************" + ) print(gatt["Logical_source_description"]) - print('') + print("") print(f'Information about {gatt["Station_code"]}') - print('PI and Host PI(s):') + print("PI and Host PI(s):") print(gatt["PI_name"]) - print('') - print('Affiliation: ') + print("") + print("Affiliation: ") print(gatt["PI_affiliation"]) - print('') - print('Rules of the Road for ISEE Induction Magnetometer Data Use:') + print("") + print("Rules of the Road for ISEE Induction Magnetometer Data Use:") for gatt_text in gatt["TEXT"]: print(gatt_text) print(gatt["LINK_TEXT"]) - print('**************************************************************************') + print( + "**************************************************************************" + ) except: - print('printing PI info and rules of the road was failed') - - - if (not downloadonly) and (not notplot): + print("printing PI info and rules of the road was failed") - tplot_name = prefix+'db_dt_' + site_input+suffix + if (not downloadonly) and (not notplot): + tplot_name = prefix + "db_dt_" + site_input + suffix if tplot_name in loaded_data: - clip(tplot_name, -1e+4, 1e+4) + clip(tplot_name, -1e4, 1e4) get_data_vars = get_data(tplot_name) - ylim(tplot_name, np.nanmin(get_data_vars[1]), np.nanmax(get_data_vars[1])) - options(tplot_name, 'legend_names', ['dH/dt','dD/dt','dZ/dt']) - options(tplot_name, 'Color', ['b', 'g', 'r']) - options(tplot_name, 'ytitle', '\n'.join(tplot_name.split('_'))) - + ylim( + tplot_name, np.nanmin(get_data_vars[1]), np.nanmax(get_data_vars[1]) + ) + options(tplot_name, "legend_names", ["dH/dt", "dD/dt", "dZ/dt"]) + options(tplot_name, "Color", ["b", "g", "r"]) + options(tplot_name, "ytitle", "\n".join(tplot_name.split("_"))) + if frequency_dependent: - - meta_data_var = get_data(tplot_name,metadata=True) + meta_data_var = get_data(tplot_name, metadata=True) if meta_data_var is not None: - cdf_file = cdflib.CDF(meta_data_var['CDF']['FILENAME']) - cdfcont = cdf_file.varget('frequency', inq=True) - ffreq = cdf_file.varget('frequency') - ssensi=cdf_file.varget('sensitivity') - pphase=cdf_file.varget('phase_difference') - frequency_dependent_structure[site_input]['site_code'] = site_input - frequency_dependent_structure[site_input]['nfreq'] = cdfcont['max_records'] + 1 - frequency_dependent_structure[site_input]['frequency'][0:ffreq.shape[0]] = deepcopy(ffreq) - frequency_dependent_structure[site_input]['sensitivity'][0:ssensi.shape[0]] = deepcopy(ssensi) - frequency_dependent_structure[site_input]['phase_difference'][0:pphase.shape[0]] = deepcopy(pphase) + cdf_file = cdflib.CDF(meta_data_var["CDF"]["FILENAME"]) + cdfcont = cdf_file.varget("frequency", inq=True) + ffreq = cdf_file.varget("frequency") + ssensi = cdf_file.varget("sensitivity") + pphase = cdf_file.varget("phase_difference") + frequency_dependent_structure[site_input][ + "site_code" + ] = site_input + frequency_dependent_structure[site_input]["nfreq"] = ( + cdfcont["max_records"] + 1 + ) + frequency_dependent_structure[site_input]["frequency"][ + 0 : ffreq.shape[0] + ] = deepcopy(ffreq) + frequency_dependent_structure[site_input]["sensitivity"][ + 0 : ssensi.shape[0] + ] = deepcopy(ssensi) + frequency_dependent_structure[site_input]["phase_difference"][ + 0 : pphase.shape[0] + ] = deepcopy(pphase) if frequency_dependent: return frequency_dependent_structure diff --git a/pyspedas/erg/ground/geomag/gmag_magdas_1sec.py b/pyspedas/erg/ground/geomag/gmag_magdas_1sec.py index 0a9fff78..8a1bf0b8 100644 --- a/pyspedas/erg/ground/geomag/gmag_magdas_1sec.py +++ b/pyspedas/erg/ground/geomag/gmag_magdas_1sec.py @@ -7,10 +7,10 @@ def gmag_magdas_1sec( - trange=['2010-11-20/00:00:00','2010-11-21/00:00:00'], - suffix='', - site='all', - datatype='1sec', + trange=["2010-11-20/00:00:00", "2010-11-21/00:00:00"], + suffix="", + site="all", + datatype="1sec", get_support_data=False, varformat=None, varnames=[], @@ -20,42 +20,122 @@ def gmag_magdas_1sec( uname=None, passwd=None, time_clip=False, - ror=True + ror=True, ): + """ + Load MAGDAS 1sec data from ERG Science Center - site_code_all = ['ama', 'asb', 'daw', 'her', 'hln', 'hob', - 'kuj', 'laq', 'mcq', 'mgd', 'mlb', 'mut', - 'onw', 'ptk', 'wad', 'yap'] - tres_all=['1sec'] + Parameters + ---------- + trange: list of str + time range of interest [starttime, endtime] with the format + 'YYYY-MM-DD','YYYY-MM-DD'] or to specify more or less than a day + ['YYYY-MM-DD/hh:mm:ss','YYYY-MM-DD/hh:mm:ss'] + Default: ['2010-11-20/00:00:00', '2010-11-21/00:00:00'] + + suffix: str + The tplot variable names will be given this suffix. Default: '' + + site: str or list of str + The site or list of sites to load. + Valid values: "ama", "asb", "daw", "her", "hln", "hob", "kuj", "laq", "mcq", "mgd", + "mlb", "mut", "onw", "ptk", "wad", "yap", "all" + Default: ['all'] + + datatype: str or list of str + The data types to load. Valid values: '1s', '1sec', 'all' + Default: '1sec' + + get_support_data: bool + If true, data with an attribute "VAR_TYPE" with a value of "support_data" + or 'data' will be loaded into tplot. Default: False + + varformat: str + The CDF file variable formats to load into tplot. Wildcard character + "*" is accepted. Default: None (all variables will be loaded). + + varnames: list of str + List of variable names to load. Default: [] (all variables will be loadee) + + downloadonly: bool + Set this flag to download the CDF files, but not load them into + tplot variables. Default: False + + notplot: bool + Return the data in hash tables instead of creating tplot variables. Default: False + + no_update: bool + If set, only load data from your local cache. Default: False + + uname: str + User name. Default: None + + passwd: str + Password. Default: None + + time_clip: bool + Time clip the variables to exactly the range specified in the trange keyword. Default: False + + ror: bool + If set, print PI info and rules of the road. Default: True + + Returns + ------- + + Examples + ________ + + + """ + + site_code_all = [ + "ama", + "asb", + "daw", + "her", + "hln", + "hob", + "kuj", + "laq", + "mcq", + "mgd", + "mlb", + "mut", + "onw", + "ptk", + "wad", + "yap", + ] + tres_all = ["1sec"] if isinstance(datatype, str): datatype = datatype.lower() - datatype = datatype.split(' ') + datatype = datatype.split(" ") elif isinstance(datatype, list): for i in range(len(datatype)): datatype[i] = datatype[i].lower() - if 'all' in datatype: - datatype=tres_all + if "all" in datatype: + datatype = tres_all datatype = list(set(datatype).intersection(tres_all)) if len(datatype) < 1: return - if '1s' in datatype: - index = np.where(np.array(datatype) == '1s')[0][0] - datatype[index] = '1sec' - + if "1s" in datatype: + index = np.where(np.array(datatype) == "1s")[0][0] + datatype[index] = "1sec" + if isinstance(site, str): site_code = site.lower() - site_code = site_code.split(' ') + site_code = site_code.split(" ") elif isinstance(site, list): site_code = [] for i in range(len(site)): site_code.append(site[i].lower()) - if 'all' in site_code: + if "all" in site_code: site_code = site_code_all site_code = list(set(site_code).intersection(site_code_all)) - prefix = 'magdas_' + prefix = "magdas_" if notplot: loaded_data = {} else: @@ -64,13 +144,36 @@ def gmag_magdas_1sec( for data_type_in in datatype: fres = data_type_in - file_res = 3600. * 24 - pathformat = 'ground/geomag/magdas/'+fres+'/'+site_input\ - +'/%Y/magdas_'+fres+'_'+site_input+'_%Y%m%d_v??.cdf' - - loaded_data_temp = load(pathformat=pathformat, file_res=file_res, trange=trange, datatype=datatype, prefix=prefix, suffix='_'+site_input+suffix, get_support_data=get_support_data, - varformat=varformat, downloadonly=downloadonly, notplot=notplot, time_clip=time_clip, no_update=no_update, uname=uname, passwd=passwd) - + file_res = 3600.0 * 24 + pathformat = ( + "ground/geomag/magdas/" + + fres + + "/" + + site_input + + "/%Y/magdas_" + + fres + + "_" + + site_input + + "_%Y%m%d_v??.cdf" + ) + + loaded_data_temp = load( + pathformat=pathformat, + file_res=file_res, + trange=trange, + datatype=datatype, + prefix=prefix, + suffix="_" + site_input + suffix, + get_support_data=get_support_data, + varformat=varformat, + downloadonly=downloadonly, + notplot=notplot, + time_clip=time_clip, + no_update=no_update, + uname=uname, + passwd=passwd, + ) + if notplot: loaded_data.update(loaded_data_temp) else: @@ -82,56 +185,80 @@ def gmag_magdas_1sec( cdf_file = cdflib.CDF(loaded_data_temp[-1]) gatt = cdf_file.globalattsget() else: - gatt = get_data(loaded_data_temp[-1], metadata=True)['CDF']['GATT'] + gatt = get_data(loaded_data_temp[-1], metadata=True)["CDF"][ + "GATT" + ] elif isinstance(loaded_data_temp, dict): - gatt = loaded_data_temp[list(loaded_data_temp.keys())[-1]]['CDF']['GATT'] - print('**************************************************************************') + gatt = loaded_data_temp[list(loaded_data_temp.keys())[-1]][ + "CDF" + ]["GATT"] + print( + "**************************************************************************" + ) print(gatt["Logical_source_description"]) - print('') + print("") print(f'Information about {gatt["Station_code"]}') print(f'PI and Host PI(s): {gatt["PI_name"]}') - print('') - print('Affiliations: ') + print("") + print("Affiliations: ") print(gatt["PI_affiliation"]) - print('') - print('Rules of the Road for MAGDAS Data Use:') + print("") + print("Rules of the Road for MAGDAS Data Use:") for gatt_text in gatt["TEXT"]: print(gatt_text) print(f'{gatt["LINK_TEXT"]} {gatt["HTTP_LINK"]}') - print('**************************************************************************') + print( + "**************************************************************************" + ) except: - print('printing PI info and rules of the road was failed') - + print("printing PI info and rules of the road was failed") + if (not downloadonly) and (not notplot): - current_tplot_name = prefix+'hdz_'+fres+'_' + site_input+suffix + current_tplot_name = prefix + "hdz_" + fres + "_" + site_input + suffix if current_tplot_name in loaded_data: - #;--- Rename *** HDZ - new_tplot_name = prefix+'mag_'+site_input+'_'+fres+'_hdz'+suffix + # ;--- Rename *** HDZ + new_tplot_name = ( + prefix + "mag_" + site_input + "_" + fres + "_hdz" + suffix + ) store_data(current_tplot_name, newname=new_tplot_name) loaded_data.remove(current_tplot_name) loaded_data.append(new_tplot_name) - #;--- Missing data -1.e+31 --> NaN - clip(new_tplot_name, -7e+4, 7e+4) + # ;--- Missing data -1.e+31 --> NaN + clip(new_tplot_name, -7e4, 7e4) get_data_vars = get_data(new_tplot_name) - ylim(new_tplot_name, -np.nanmax(abs(get_data_vars[1])) * 1.1, np.nanmax(abs(get_data_vars[1])) * 1.1) - #;--- Labels - options(new_tplot_name, 'legend_names', ['H','D','Z']) - options(new_tplot_name, 'Color', ['b', 'g', 'r']) - options(new_tplot_name, 'ytitle', '\n'.join(new_tplot_name.split('_'))) - - current_tplot_name = prefix+'f_'+fres+'_' + site_input+suffix + ylim( + new_tplot_name, + -np.nanmax(abs(get_data_vars[1])) * 1.1, + np.nanmax(abs(get_data_vars[1])) * 1.1, + ) + # ;--- Labels + options(new_tplot_name, "legend_names", ["H", "D", "Z"]) + options(new_tplot_name, "Color", ["b", "g", "r"]) + options( + new_tplot_name, "ytitle", "\n".join(new_tplot_name.split("_")) + ) + + current_tplot_name = prefix + "f_" + fres + "_" + site_input + suffix if current_tplot_name in loaded_data: - #; --- Rename *** F - new_tplot_name = prefix+'mag_'+site_input+'_'+fres+'_f'+suffix + # ; --- Rename *** F + new_tplot_name = ( + prefix + "mag_" + site_input + "_" + fres + "_f" + suffix + ) store_data(current_tplot_name, newname=new_tplot_name) loaded_data.remove(current_tplot_name) loaded_data.append(new_tplot_name) - #;--- Missing data -1.e+31 --> NaN - clip(new_tplot_name, -7e+4, 7e+4) + # ;--- Missing data -1.e+31 --> NaN + clip(new_tplot_name, -7e4, 7e4) get_data_vars = get_data(new_tplot_name) - ylim(new_tplot_name, -np.nanmax(abs(get_data_vars[1])) * 1.1, np.nanmax(abs(get_data_vars[1])) * 1.1) - #;--- Labels - options(new_tplot_name, 'legend_names', ['F']) - options(new_tplot_name, 'ytitle', '\n'.join(new_tplot_name.split('_'))) + ylim( + new_tplot_name, + -np.nanmax(abs(get_data_vars[1])) * 1.1, + np.nanmax(abs(get_data_vars[1])) * 1.1, + ) + # ;--- Labels + options(new_tplot_name, "legend_names", ["F"]) + options( + new_tplot_name, "ytitle", "\n".join(new_tplot_name.split("_")) + ) return loaded_data diff --git a/pyspedas/erg/ground/geomag/gmag_mm210.py b/pyspedas/erg/ground/geomag/gmag_mm210.py index fd67cd00..5075557c 100644 --- a/pyspedas/erg/ground/geomag/gmag_mm210.py +++ b/pyspedas/erg/ground/geomag/gmag_mm210.py @@ -22,6 +22,76 @@ def gmag_mm210( time_clip=False, ror=True ): + """ + Load mm210 data from ERG Science Center + + Parameters + ---------- + trange: list of str + time range of interest [starttime, endtime] with the format + 'YYYY-MM-DD','YYYY-MM-DD'] or to specify more or less than a day + ['YYYY-MM-DD/hh:mm:ss','YYYY-MM-DD/hh:mm:ss'] + Default: ['2020-08-01', '2020-08-02'] + + suffix: str + The tplot variable names will be given this suffix. Default: '' + + site: str or list of str + The site or list of sites to load. + Valid values: 'tik', 'zgn', 'yak', 'irt', 'ppi', 'bji', + 'lnp', 'mut', 'ptn', 'wtk', 'lmt', 'kat', + 'ktn', 'chd', 'zyk', 'mgd', 'ptk', 'msr', + 'rik', 'onw', 'kag', 'ymk', 'cbi', 'gua', + 'yap', 'kor', 'ktb', 'bik', 'wew', 'daw', + 'wep', 'bsv', 'dal', 'can', 'adl', 'kot', + 'cst', 'ewa', 'asa', 'mcq', 'all' + Default: ['all'] + + datatype: str or list of str + The data types to load. Valid values: '1s', '1sec', '1m', '1min', '1h', '1hr', 'all' + Default: 'all' + + get_support_data: bool + If true, data with an attribute "VAR_TYPE" with a value of "support_data" + or 'data' will be loaded into tplot. Default: False + + varformat: str + The CDF file variable formats to load into tplot. Wildcard character + "*" is accepted. Default: None (all variables will be loaded). + + varnames: list of str + List of variable names to load. Default: [] (all variables will be loadee) + + downloadonly: bool + Set this flag to download the CDF files, but not load them into + tplot variables. Default: False + + notplot: bool + Return the data in hash tables instead of creating tplot variables. Default: False + + no_update: bool + If set, only load data from your local cache. Default: False + + uname: str + User name. Default: None + + passwd: str + Password. Default: None + + time_clip: bool + Time clip the variables to exactly the range specified in the trange keyword. Default: False + + ror: bool + If set, print PI info and rules of the road. Default: True + + Returns + ------- + + Examples + ________ + + + """ site_code_all = ['tik', 'zgn', 'yak', 'irt', 'ppi', 'bji', 'lnp', 'mut', 'ptn', 'wtk', 'lmt', 'kat', diff --git a/pyspedas/erg/ground/geomag/gmag_stel_fluxgate.py b/pyspedas/erg/ground/geomag/gmag_stel_fluxgate.py index 9020e6fc..fb18f7fd 100644 --- a/pyspedas/erg/ground/geomag/gmag_stel_fluxgate.py +++ b/pyspedas/erg/ground/geomag/gmag_stel_fluxgate.py @@ -1,10 +1,11 @@ from .gmag_isee_fluxgate import gmag_isee_fluxgate + def gmag_stel_fluxgate( - trange=['2020-08-01', '2020-08-02'], - suffix='', - site='all', - datatype='all', + trange=["2020-08-01", "2020-08-02"], + suffix="", + site="all", + datatype="all", get_support_data=False, varformat=None, varnames=[], @@ -14,20 +15,86 @@ def gmag_stel_fluxgate( uname=None, passwd=None, time_clip=False, - ror=True + ror=True, ): - - return gmag_isee_fluxgate(trange=trange, - suffix=suffix, - site=site, - datatype=datatype, - get_support_data=get_support_data, - varformat=varformat, - varnames=varnames, - downloadonly=downloadonly, - notplot=notplot, - no_update=no_update, - uname=uname, - passwd=passwd, - time_clip=time_clip, - ror=ror) \ No newline at end of file + """ + Load data from STEL Fluxgate Magnetometers (wrapper for gmag_isee_fluxgate) + + Parameters + ---------- + trange: list of str + time range of interest [starttime, endtime] with the format + 'YYYY-MM-DD','YYYY-MM-DD'] or to specify more or less than a day + ['YYYY-MM-DD/hh:mm:ss','YYYY-MM-DD/hh:mm:ss'] + Default: ['2020-08-01', '2020-08-02'] + + suffix: str + The tplot variable names will be given this suffix. Default: '' + + site: str or list of str + The site or list of sites to load. + Valid values: 'msr', 'rik', 'kag', 'ktb', 'lcl', 'mdm', 'tew', 'all' + Default: ['all'] + + datatype: str or list of str + The data types to load. Valid values: '64hz', '1sec', '1min', '1h', 'all' + Default: 'all' + + get_support_data: bool + If true, data with an attribute "VAR_TYPE" with a value of "support_data" + or 'data' will be loaded into tplot. Default: False + + varformat: str + The CDF file variable formats to load into tplot. Wildcard character + "*" is accepted. Default: None (all variables will be loaded). + + varnames: list of str + List of variable names to load. Default: [] (all variables will be loadee) + + downloadonly: bool + Set this flag to download the CDF files, but not load them into + tplot variables. Default: False + + notplot: bool + Return the data in hash tables instead of creating tplot variables. Default: False + + no_update: bool + If set, only load data from your local cache. Default: False + + uname: str + User name. Default: None + + passwd: str + Password. Default: None + + time_clip: bool + Time clip the variables to exactly the range specified in the trange keyword. Default: False + + ror: bool + If set, print PI info and rules of the road. Default: True + + Returns + ------- + + Examples + ________ + + + """ + + return gmag_isee_fluxgate( + trange=trange, + suffix=suffix, + site=site, + datatype=datatype, + get_support_data=get_support_data, + varformat=varformat, + varnames=varnames, + downloadonly=downloadonly, + notplot=notplot, + no_update=no_update, + uname=uname, + passwd=passwd, + time_clip=time_clip, + ror=ror, + ) diff --git a/pyspedas/erg/ground/geomag/gmag_stel_induction.py b/pyspedas/erg/ground/geomag/gmag_stel_induction.py index adb50f62..2f38852a 100644 --- a/pyspedas/erg/ground/geomag/gmag_stel_induction.py +++ b/pyspedas/erg/ground/geomag/gmag_stel_induction.py @@ -1,10 +1,10 @@ - from .gmag_isee_induction import gmag_isee_induction + def gmag_stel_induction( - trange=['2018-10-18/00:00:00','2018-10-18/02:00:00'], - suffix='', - site='all', + trange=["2018-10-18/00:00:00", "2018-10-18/02:00:00"], + suffix="", + site="all", get_support_data=False, varformat=None, varnames=[], @@ -15,22 +15,86 @@ def gmag_stel_induction( passwd=None, time_clip=False, ror=True, - frequency_dependent=False + frequency_dependent=False, ): + """ + Load data from STEL Induction Magnetometers (wrapper for gmag_isee_induction) + + Parameters + ---------- + trange: list of str + time range of interest [starttime, endtime] with the format + 'YYYY-MM-DD','YYYY-MM-DD'] or to specify more or less than a day + ['YYYY-MM-DD/hh:mm:ss','YYYY-MM-DD/hh:mm:ss'] + Default: ['2018-10-18/00:00:00', '2018-10-18/02:00:00'] + + suffix: str + The tplot variable names will be given this suffix. Default: '' + + site: str or list of str + The site or list of sites to load. Valid values: "ath", "gak", "hus", "kap", "lcl", "mgd", "msr", + "nai", "ptk", "rik", "sta", "zgn", "all" + Default: ['all'] + + get_support_data: bool + If true, data with an attribute "VAR_TYPE" with a value of "support_data" + or 'data' will be loaded into tplot. Default: False + + varformat: str + The CDF file variable formats to load into tplot. Wildcard character + "*" is accepted. Default: None (all variables will be loaded). + + varnames: list of str + List of variable names to load. Default: [] (all variables will be loadee) + + downloadonly: bool + Set this flag to download the CDF files, but not load them into + tplot variables. Default: False + + notplot: bool + Return the data in hash tables instead of creating tplot variables. Default: False + + no_update: bool + If set, only load data from your local cache. Default: False + + uname: str + User name. Default: None + + passwd: str + Password. Default: None + + time_clip: bool + Time clip the variables to exactly the range specified in the trange keyword. Default: False + + ror: bool + If set, print PI info and rules of the road. Default: True + + frequency_dependent: bool + If set, load frequency dependent data. + Default: False + + Returns + ------- + + Examples + ________ + + + """ return gmag_isee_induction( - trange=trange, - suffix=suffix, - site=site, - get_support_data=get_support_data, - varformat=varformat, - varnames=varnames, - downloadonly=downloadonly, - notplot=notplot, - no_update=no_update, - uname=uname, - passwd=passwd, - time_clip=time_clip, - ror=ror, - frequency_dependent=frequency_dependent - ) + trange=trange, + suffix=suffix, + site=site, + get_support_data=get_support_data, + varformat=varformat, + varnames=varnames, + downloadonly=downloadonly, + notplot=notplot, + no_update=no_update, + uname=uname, + passwd=passwd, + time_clip=time_clip, + ror=ror, + frequency_dependent=frequency_dependent, + ) From 33f7e4b174c73a9c44190a71b06f0ba9da7ca123 Mon Sep 17 00:00:00 2001 From: jameswilburlewis Date: Wed, 31 Jan 2024 16:13:39 -0800 Subject: [PATCH 2/2] Typo fix --- pyspedas/erg/satellite/erg/hep/hep.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyspedas/erg/satellite/erg/hep/hep.py b/pyspedas/erg/satellite/erg/hep/hep.py index 5528b98c..906e3b81 100644 --- a/pyspedas/erg/satellite/erg/hep/hep.py +++ b/pyspedas/erg/satellite/erg/hep/hep.py @@ -46,7 +46,7 @@ def hep(trange=['2017-03-27', '2017-03-28'], varformat: str The CDF file variable formats to load into tplot. Wildcard character - "*" is accepted. Derault: None (all variables will be loaded). + "*" is accepted. Default: None (all variables will be loaded). varnames: list of str List of variable names to load. Default: [] (all variables will be loadee)