Skip to content

Commit 460324f

Browse files
committed
feat: add support for downloading Cluster CODIF psd data
1 parent 22d9660 commit 460324f

2 files changed

Lines changed: 30 additions & 3 deletions

File tree

pyspedas/projects/cluster/cis.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
def cis(trange:List[str]=['2018-11-5', '2018-11-6'],
99
probe:Union[str,List[str]]='1',
10+
option:str='mom',
1011
datatype:str='pp',
1112
prefix:str='',
1213
suffix:str='',
@@ -33,6 +34,10 @@ def cis(trange:List[str]=['2018-11-5', '2018-11-6'],
3334
List of probes to load. Valid options: '1','2','3','4'
3435
Default: '1'
3536
37+
option: str
38+
The data option to load. Valid options: 'mom' (moments), 'psd_h1' (H+ PSD), 'psd_he1' (He+ PSD), 'psd_o1' (O+ PSD)
39+
Default: 'mom'
40+
3641
datatype: str
3742
Data type; Valid options:
3843
Default: 'pp'
@@ -94,6 +99,14 @@ def cis(trange:List[str]=['2018-11-5', '2018-11-6'],
9499
>>> tplot(['N_p__C1_PP_CIS','N_O1__C1_PP_CIS','N_He1__C1_PP_CIS','N_He2__C1_PP_CIS','N_HIA__C1_PP_CIS'])
95100
96101
"""
97-
return load(instrument='cis', trange=trange, probe=probe, datatype=datatype, prefix=prefix, suffix=suffix, get_support_data=get_support_data, varformat=varformat, varnames=varnames, downloadonly=downloadonly, notplot=notplot, no_update=no_update, time_clip=time_clip, force_download=force_download)
102+
103+
if option == 'mom':
104+
species = None
105+
elif option.startswith('psd'):
106+
species = option.split('_')[1]
107+
else:
108+
raise ValueError("Invalid option: " + option + ". Valid options are 'mom', 'psd_h1' 'psd_he1', 'psd_o1'.")
109+
110+
return load(instrument='cis', trange=trange, probe=probe, datatype=datatype, prefix=prefix, suffix=suffix, get_support_data=get_support_data, varformat=varformat, varnames=varnames, downloadonly=downloadonly, notplot=notplot, no_update=no_update, time_clip=time_clip, force_download=force_download, species=species)
98111

99112

pyspedas/projects/cluster/load.py

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ def load(trange:List[str]=['2018-11-5', '2018-11-6'],
1818
notplot:bool=False,
1919
no_update:bool=False,
2020
time_clip:bool=False,
21-
force_download=False) -> List[str]:
21+
force_download=False,
22+
species=None
23+
) -> List[str]:
2224
"""
2325
Load data from Cluster instruments
2426
@@ -85,6 +87,9 @@ def load(trange:List[str]=['2018-11-5', '2018-11-6'],
8587
Download file even if local version is more recent than server version
8688
Default: False
8789
90+
species: str
91+
Species to load psd data for. Valid options are: 'h1', 'he1', 'o1'.
92+
Default: None
8893
8994
Returns
9095
-------
@@ -137,7 +142,16 @@ def load(trange:List[str]=['2018-11-5', '2018-11-6'],
137142
elif instrument == 'aspoc':
138143
pathformat = 'c'+prb+'/'+datatype+'/asp/%Y/c'+prb+'_'+datatype+'_asp_%Y%m%d_v??.cdf'
139144
elif instrument == 'cis':
140-
pathformat = 'c'+prb+'/'+datatype+'/'+instrument+'/%Y/c'+prb+'_'+datatype+'_'+instrument+'_%Y%m%d_v??.cdf'
145+
if species == None:
146+
pathformat = 'c'+prb+'/'+datatype+'/'+instrument+'/%Y/c'+prb+'_'+datatype+'_'+instrument+'_%Y%m%d_v??.cdf'
147+
else:
148+
if species == 'h1':
149+
scd = 'proton' # second name for H+
150+
if species == 'he1':
151+
scd = 'heplus' # second name for He+
152+
if species == 'o1':
153+
scd = 'oplus' # second name for O+
154+
pathformat = 'c'+prb+'/'+instrument+'-codif/'+scd+'_3ddist_highsens_phasespacedens'+'/%Y/c'+prb+'_cp_'+instrument+'-codif_hs_'+species+'_psd'+'_%Y%m%d_v????????.cdf'
141155
elif instrument == 'dwp':
142156
pathformat = 'c'+prb+'/'+datatype+'/'+instrument+'/%Y/c'+prb+'_'+datatype+'_'+instrument+'_%Y%m%d_v??.cdf'
143157
elif instrument == 'edi':

0 commit comments

Comments
 (0)