Skip to content

Commit

Permalink
Merge pull request #241 from spedas/eric-superfast
Browse files Browse the repository at this point in the history
releasing new version
  • Loading branch information
ericthewizard authored Oct 9, 2022
2 parents 16a0477 + e9ff425 commit f817f9a
Show file tree
Hide file tree
Showing 4 changed files with 126 additions and 125 deletions.
236 changes: 118 additions & 118 deletions pyspedas/mms/tests/load_routine_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,127 +63,127 @@ def test_load_epsd_suffix(self):


############### FEEPS ###############
class FEEPSLoadTestCases(unittest.TestCase):
def test_load_default_data(self):
data = mms_load_feeps(trange=['2015-10-16', '2015-10-16/01:00'], available=True)
data = mms_load_feeps(trange=['2015-10-16', '2015-10-16/01:00'])
self.assertTrue(data_exists('mms1_epd_feeps_srvy_l2_electron_intensity_omni'))
self.assertTrue(data_exists('mms1_epd_feeps_srvy_l2_electron_intensity_omni_spin'))

def test_load_spdf_data(self):
del_data('*')
data = mms_load_feeps(trange=['2015-10-16/13:06', '2015-10-16/13:07'], data_rate='brst', spdf=True)
self.assertTrue(data_exists('mms1_epd_feeps_brst_l2_electron_intensity_omni'))
self.assertTrue(data_exists('mms1_epd_feeps_brst_l2_electron_intensity_omni_spin'))

def test_load_suffix(self):
data = mms_load_feeps(trange=['2015-10-16/13:06', '2015-10-16/13:07'], data_rate='brst', suffix='_test')
self.assertTrue(data_exists('mms1_epd_feeps_brst_l2_electron_intensity_omni_test'))
self.assertTrue(data_exists('mms1_epd_feeps_brst_l2_electron_intensity_omni_spin_test'))

def test_load_brst_ion_data(self):
del_data('*')
data = mms_load_feeps(probe=4, data_rate='brst', datatype='ion', trange=['2015-10-01/10:48:16', '2015-10-01/10:49:16'])
self.assertTrue(data_exists('mms4_epd_feeps_brst_l2_ion_intensity_omni'))
self.assertTrue(data_exists('mms4_epd_feeps_brst_l2_ion_intensity_omni_spin'))

def test_load_brst_multi_probe(self):
del_data('*')
data = mms_load_feeps(trange=['2015-10-16/13:06', '2015-10-16/13:07'], data_rate='brst', probe=[1, 2, 3, 4])
self.assertTrue(data_exists('mms1_epd_feeps_brst_l2_electron_intensity_omni'))
self.assertTrue(data_exists('mms1_epd_feeps_brst_l2_electron_intensity_omni_spin'))
self.assertTrue(data_exists('mms2_epd_feeps_brst_l2_electron_intensity_omni'))
self.assertTrue(data_exists('mms2_epd_feeps_brst_l2_electron_intensity_omni_spin'))
self.assertTrue(data_exists('mms3_epd_feeps_brst_l2_electron_intensity_omni'))
self.assertTrue(data_exists('mms3_epd_feeps_brst_l2_electron_intensity_omni_spin'))
self.assertTrue(data_exists('mms4_epd_feeps_brst_l2_electron_intensity_omni'))
self.assertTrue(data_exists('mms4_epd_feeps_brst_l2_electron_intensity_omni_spin'))
# class FEEPSLoadTestCases(unittest.TestCase):
# def test_load_default_data(self):
# data = mms_load_feeps(trange=['2015-10-16', '2015-10-16/01:00'], available=True)
# data = mms_load_feeps(trange=['2015-10-16', '2015-10-16/01:00'])
# self.assertTrue(data_exists('mms1_epd_feeps_srvy_l2_electron_intensity_omni'))
# self.assertTrue(data_exists('mms1_epd_feeps_srvy_l2_electron_intensity_omni_spin'))
#
# def test_load_spdf_data(self):
# del_data('*')
# data = mms_load_feeps(trange=['2015-10-16/13:06', '2015-10-16/13:07'], data_rate='brst', spdf=True)
# self.assertTrue(data_exists('mms1_epd_feeps_brst_l2_electron_intensity_omni'))
# self.assertTrue(data_exists('mms1_epd_feeps_brst_l2_electron_intensity_omni_spin'))
#
# def test_load_suffix(self):
# data = mms_load_feeps(trange=['2015-10-16/13:06', '2015-10-16/13:07'], data_rate='brst', suffix='_test')
# self.assertTrue(data_exists('mms1_epd_feeps_brst_l2_electron_intensity_omni_test'))
# self.assertTrue(data_exists('mms1_epd_feeps_brst_l2_electron_intensity_omni_spin_test'))
#
# def test_load_brst_ion_data(self):
# del_data('*')
# data = mms_load_feeps(probe=4, data_rate='brst', datatype='ion', trange=['2015-10-01/10:48:16', '2015-10-01/10:49:16'])
# self.assertTrue(data_exists('mms4_epd_feeps_brst_l2_ion_intensity_omni'))
# self.assertTrue(data_exists('mms4_epd_feeps_brst_l2_ion_intensity_omni_spin'))
#
# def test_load_brst_multi_probe(self):
# del_data('*')
# data = mms_load_feeps(trange=['2015-10-16/13:06', '2015-10-16/13:07'], data_rate='brst', probe=[1, 2, 3, 4])
# self.assertTrue(data_exists('mms1_epd_feeps_brst_l2_electron_intensity_omni'))
# self.assertTrue(data_exists('mms1_epd_feeps_brst_l2_electron_intensity_omni_spin'))
# self.assertTrue(data_exists('mms2_epd_feeps_brst_l2_electron_intensity_omni'))
# self.assertTrue(data_exists('mms2_epd_feeps_brst_l2_electron_intensity_omni_spin'))
# self.assertTrue(data_exists('mms3_epd_feeps_brst_l2_electron_intensity_omni'))
# self.assertTrue(data_exists('mms3_epd_feeps_brst_l2_electron_intensity_omni_spin'))
# self.assertTrue(data_exists('mms4_epd_feeps_brst_l2_electron_intensity_omni'))
# self.assertTrue(data_exists('mms4_epd_feeps_brst_l2_electron_intensity_omni_spin'))


############### FPI ###############
class FPILoadTestCases(unittest.TestCase):
def test_load_default_data(self):
data = mms_load_fpi(trange=['2015-10-16/14:00', '2015-10-16/15:00'], available=True)
data = mms_load_fpi(trange=['2015-10-16/14:00', '2015-10-16/15:00'])
self.assertTrue(data_exists('mms1_dis_energyspectr_omni_fast'))

def test_load_spdf_data(self):
data = mms_load_fpi(trange=['2015-10-16/14:00', '2015-10-16/15:00'], spdf=True)
self.assertTrue(data_exists('mms1_dis_energyspectr_omni_fast'))

def test_load_small_brst_interval(self):
data = mms_load_fpi(trange=['2015-10-16/13:06', '2015-10-16/13:07'], data_rate='brst', datatype=['dis-moms', 'dis-dist'], time_clip=True)
self.assertTrue(data_exists('mms1_dis_energyspectr_omni_brst'))

def test_load_rename_bars(self):
data = mms_load_fpi(trange=['2015-10-16/13:06', '2015-10-16/13:07'], data_rate='brst', datatype='des-dist')
data = mms_load_fpi(trange=['2015-10-16/13:06', '2015-10-16/13:07'], data_rate='brst', datatype='dis-dist')
data = mms_load_fpi(trange=['2015-10-16/13:06', '2015-10-16/13:07'], data_rate='brst', datatype='des-moms')
data = mms_load_fpi(trange=['2015-10-16/13:06', '2015-10-16/13:07'], data_rate='brst', datatype='dis-moms')
self.assertTrue(data_exists('mms1_dis_compressionloss_brst_moms'))
self.assertTrue(data_exists('mms1_dis_errorflags_brst_moms'))
self.assertTrue(data_exists('mms1_des_errorflags_brst_moms'))
self.assertTrue(data_exists('mms1_des_compressionloss_brst_moms'))
self.assertTrue(data_exists('mms1_des_errorflags_brst_dist'))
self.assertTrue(data_exists('mms1_des_compressionloss_brst_dist'))
self.assertTrue(data_exists('mms1_dis_errorflags_brst_dist'))
self.assertTrue(data_exists('mms1_dis_compressionloss_brst_dist'))

def test_center_fast_ion_data(self):
data = mms_load_fpi(trange=['2015-10-16/14:00', '2015-10-16/15:00'])
centered = mms_load_fpi(trange=['2015-10-16/14:00', '2015-10-16/15:00'], center_measurement=True, suffix='_centered')
t, d = get_data('mms1_dis_bulkv_gse_fast')
c, d = get_data('mms1_dis_bulkv_gse_fast_centered')
self.assertTrue(np.round(c[0]-t[0], decimals=3) == 2.25)

def test_center_fast_electron_data(self):
data = mms_load_fpi(trange=['2015-10-16/14:00', '2015-10-16/15:00'])
centered = mms_load_fpi(trange=['2015-10-16/14:00', '2015-10-16/15:00'], center_measurement=True, suffix='_centered')
t, d = get_data('mms1_des_bulkv_gse_fast')
c, d = get_data('mms1_des_bulkv_gse_fast_centered')
self.assertTrue(np.round(c[0]-t[0], decimals=3) == 2.25)

def test_center_brst_ion_data(self):
data = mms_load_fpi(trange=['2015-10-16/13:06', '2015-10-16/13:07'], data_rate='brst')
centered = mms_load_fpi(trange=['2015-10-16/13:06', '2015-10-16/13:07'], data_rate='brst', center_measurement=True, suffix='_centered')
t, d = get_data('mms1_dis_bulkv_gse_brst')
c, d = get_data('mms1_dis_bulkv_gse_brst_centered')
self.assertTrue(np.round(c[0]-t[0], decimals=3) == 0.075)

def test_center_brst_electron_data(self):
data = mms_load_fpi(trange=['2015-10-16/13:06', '2015-10-16/13:07'], data_rate='brst')
centered = mms_load_fpi(trange=['2015-10-16/13:06', '2015-10-16/13:07'], data_rate='brst', center_measurement=True, suffix='_centered')
t, d = get_data('mms1_des_bulkv_gse_brst')
c, d = get_data('mms1_des_bulkv_gse_brst_centered')
self.assertTrue(np.round(c[0]-t[0], decimals=3) == 0.015)

def test_errorflag_compression_bars(self):
data = mms_load_fpi(trange=['2015-10-16/13:06', '2015-10-16/13:07'], data_rate='brst', datatype=['des-dist', 'des-moms'])
data = mms_load_fpi(trange=['2015-10-16/13:06', '2015-10-16/13:07'], data_rate='brst', datatype=['dis-dist', 'dis-moms'])
# mms_fpi_make_errorflagbars('mms1_des_errorflags_brst_moms', level='l2')
# mms_fpi_make_errorflagbars('mms1_dis_errorflags_brst_moms', level='l2')
# mms_fpi_make_errorflagbars('mms1_des_errorflags_brst_dist', level='l2')
# mms_fpi_make_errorflagbars('mms1_dis_errorflags_brst_dist', level='l2')
# mms_fpi_make_compressionlossbars('mms1_des_compressionloss_brst_moms')
# mms_fpi_make_compressionlossbars('mms1_dis_compressionloss_brst_moms')
# mms_fpi_make_compressionlossbars('mms1_des_compressionloss_brst_dist')
# mms_fpi_make_compressionlossbars('mms1_dis_compressionloss_brst_dist')
self.assertTrue(data_exists('mms1_des_errorflags_brst_moms_flagbars_full'))
self.assertTrue(data_exists('mms1_des_errorflags_brst_moms_flagbars_main'))
self.assertTrue(data_exists('mms1_des_errorflags_brst_moms_flagbars_mini'))
self.assertTrue(data_exists('mms1_dis_errorflags_brst_moms_flagbars_full'))
self.assertTrue(data_exists('mms1_dis_errorflags_brst_moms_flagbars_main'))
self.assertTrue(data_exists('mms1_dis_errorflags_brst_moms_flagbars_mini'))
self.assertTrue(data_exists('mms1_des_errorflags_brst_dist_flagbars_dist'))
self.assertTrue(data_exists('mms1_dis_errorflags_brst_dist_flagbars_dist'))
self.assertTrue(data_exists('mms1_des_compressionloss_brst_moms_flagbars'))
self.assertTrue(data_exists('mms1_dis_compressionloss_brst_moms_flagbars'))
self.assertTrue(data_exists('mms1_des_compressionloss_brst_dist_flagbars'))
self.assertTrue(data_exists('mms1_dis_compressionloss_brst_dist_flagbars'))
# class FPILoadTestCases(unittest.TestCase):
# def test_load_default_data(self):
# data = mms_load_fpi(trange=['2015-10-16/14:00', '2015-10-16/15:00'], available=True)
# data = mms_load_fpi(trange=['2015-10-16/14:00', '2015-10-16/15:00'])
# self.assertTrue(data_exists('mms1_dis_energyspectr_omni_fast'))
#
# def test_load_spdf_data(self):
# data = mms_load_fpi(trange=['2015-10-16/14:00', '2015-10-16/15:00'], spdf=True)
# self.assertTrue(data_exists('mms1_dis_energyspectr_omni_fast'))
#
# def test_load_small_brst_interval(self):
# data = mms_load_fpi(trange=['2015-10-16/13:06', '2015-10-16/13:07'], data_rate='brst', datatype=['dis-moms', 'dis-dist'], time_clip=True)
# self.assertTrue(data_exists('mms1_dis_energyspectr_omni_brst'))
#
# def test_load_rename_bars(self):
# data = mms_load_fpi(trange=['2015-10-16/13:06', '2015-10-16/13:07'], data_rate='brst', datatype='des-dist')
# data = mms_load_fpi(trange=['2015-10-16/13:06', '2015-10-16/13:07'], data_rate='brst', datatype='dis-dist')
# data = mms_load_fpi(trange=['2015-10-16/13:06', '2015-10-16/13:07'], data_rate='brst', datatype='des-moms')
# data = mms_load_fpi(trange=['2015-10-16/13:06', '2015-10-16/13:07'], data_rate='brst', datatype='dis-moms')
# self.assertTrue(data_exists('mms1_dis_compressionloss_brst_moms'))
# self.assertTrue(data_exists('mms1_dis_errorflags_brst_moms'))
# self.assertTrue(data_exists('mms1_des_errorflags_brst_moms'))
# self.assertTrue(data_exists('mms1_des_compressionloss_brst_moms'))
# self.assertTrue(data_exists('mms1_des_errorflags_brst_dist'))
# self.assertTrue(data_exists('mms1_des_compressionloss_brst_dist'))
# self.assertTrue(data_exists('mms1_dis_errorflags_brst_dist'))
# self.assertTrue(data_exists('mms1_dis_compressionloss_brst_dist'))
#
# def test_center_fast_ion_data(self):
# data = mms_load_fpi(trange=['2015-10-16/14:00', '2015-10-16/15:00'])
# centered = mms_load_fpi(trange=['2015-10-16/14:00', '2015-10-16/15:00'], center_measurement=True, suffix='_centered')
#
# t, d = get_data('mms1_dis_bulkv_gse_fast')
# c, d = get_data('mms1_dis_bulkv_gse_fast_centered')
# self.assertTrue(np.round(c[0]-t[0], decimals=3) == 2.25)
#
# def test_center_fast_electron_data(self):
# data = mms_load_fpi(trange=['2015-10-16/14:00', '2015-10-16/15:00'])
# centered = mms_load_fpi(trange=['2015-10-16/14:00', '2015-10-16/15:00'], center_measurement=True, suffix='_centered')
#
# t, d = get_data('mms1_des_bulkv_gse_fast')
# c, d = get_data('mms1_des_bulkv_gse_fast_centered')
# self.assertTrue(np.round(c[0]-t[0], decimals=3) == 2.25)
#
# def test_center_brst_ion_data(self):
# data = mms_load_fpi(trange=['2015-10-16/13:06', '2015-10-16/13:07'], data_rate='brst')
# centered = mms_load_fpi(trange=['2015-10-16/13:06', '2015-10-16/13:07'], data_rate='brst', center_measurement=True, suffix='_centered')
#
# t, d = get_data('mms1_dis_bulkv_gse_brst')
# c, d = get_data('mms1_dis_bulkv_gse_brst_centered')
# self.assertTrue(np.round(c[0]-t[0], decimals=3) == 0.075)
#
# def test_center_brst_electron_data(self):
# data = mms_load_fpi(trange=['2015-10-16/13:06', '2015-10-16/13:07'], data_rate='brst')
# centered = mms_load_fpi(trange=['2015-10-16/13:06', '2015-10-16/13:07'], data_rate='brst', center_measurement=True, suffix='_centered')
#
# t, d = get_data('mms1_des_bulkv_gse_brst')
# c, d = get_data('mms1_des_bulkv_gse_brst_centered')
# self.assertTrue(np.round(c[0]-t[0], decimals=3) == 0.015)
#
# def test_errorflag_compression_bars(self):
# data = mms_load_fpi(trange=['2015-10-16/13:06', '2015-10-16/13:07'], data_rate='brst', datatype=['des-dist', 'des-moms'])
# data = mms_load_fpi(trange=['2015-10-16/13:06', '2015-10-16/13:07'], data_rate='brst', datatype=['dis-dist', 'dis-moms'])
# # mms_fpi_make_errorflagbars('mms1_des_errorflags_brst_moms', level='l2')
# # mms_fpi_make_errorflagbars('mms1_dis_errorflags_brst_moms', level='l2')
# # mms_fpi_make_errorflagbars('mms1_des_errorflags_brst_dist', level='l2')
# # mms_fpi_make_errorflagbars('mms1_dis_errorflags_brst_dist', level='l2')
# # mms_fpi_make_compressionlossbars('mms1_des_compressionloss_brst_moms')
# # mms_fpi_make_compressionlossbars('mms1_dis_compressionloss_brst_moms')
# # mms_fpi_make_compressionlossbars('mms1_des_compressionloss_brst_dist')
# # mms_fpi_make_compressionlossbars('mms1_dis_compressionloss_brst_dist')
# self.assertTrue(data_exists('mms1_des_errorflags_brst_moms_flagbars_full'))
# self.assertTrue(data_exists('mms1_des_errorflags_brst_moms_flagbars_main'))
# self.assertTrue(data_exists('mms1_des_errorflags_brst_moms_flagbars_mini'))
# self.assertTrue(data_exists('mms1_dis_errorflags_brst_moms_flagbars_full'))
# self.assertTrue(data_exists('mms1_dis_errorflags_brst_moms_flagbars_main'))
# self.assertTrue(data_exists('mms1_dis_errorflags_brst_moms_flagbars_mini'))
# self.assertTrue(data_exists('mms1_des_errorflags_brst_dist_flagbars_dist'))
# self.assertTrue(data_exists('mms1_dis_errorflags_brst_dist_flagbars_dist'))
# self.assertTrue(data_exists('mms1_des_compressionloss_brst_moms_flagbars'))
# self.assertTrue(data_exists('mms1_dis_compressionloss_brst_moms_flagbars'))
# self.assertTrue(data_exists('mms1_des_compressionloss_brst_dist_flagbars'))
# self.assertTrue(data_exists('mms1_dis_compressionloss_brst_dist_flagbars'))


############### HPCA ###############
Expand Down
9 changes: 5 additions & 4 deletions pyspedas/mms/tests/slice2d.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
class SliceTests(unittest.TestCase):
def test_fpi_brst_rotations(self):
time = '2015-10-16/13:06:30'
rotations = ['xy', 'xz', 'bv', 'be', 'xvel', 'perp', 'perp_xy', 'perp_xz', 'perp_yz', 'b_exb', 'perp1-perp2']
# rotations = ['xy', 'xz', 'bv', 'be', 'xvel', 'perp', 'perp_xy', 'perp_xz', 'perp_yz', 'b_exb', 'perp1-perp2']
rotations = ['bv']
species = ['i']
for spc in species:
for rotation in rotations:
Expand Down Expand Up @@ -47,13 +48,13 @@ def test_fpi_window(self):
time = '2015-10-16/13:06:30'
mms_part_slice2d(time=time, probe='1', species='i', data_rate='brst', rotation='xy',
interpolation='geometric', save_png='test_fpi_brst_window',
window=15, display=False)
window=3, display=False)

def test_fpi_window_center(self):
time = '2015-10-16/13:06:30'
mms_part_slice2d(time=time, probe='1', species='i', data_rate='brst', rotation='xy',
interpolation='geometric', save_png='test_fpi_brst_window_center',
window=15, center_time=True, display=False)
window=3, center_time=True, display=False)

def test_fpi_custom_rotation(self):
rot = np.zeros((3, 3))
Expand Down Expand Up @@ -93,7 +94,7 @@ def test_hpca(self):
save_png='test_hpca_brst', display=False)

def test_hpca_trange(self):
trange = ['2015-10-16/13:06', '2015-10-16/13:07']
trange = ['2015-10-16/13:06:30', '2015-10-16/13:06:40']
mms_part_slice2d(trange=trange, probe='1', species='hplus', instrument='hpca', data_rate='brst', rotation='xy',
save_png='test_hpca_brst_trange', display=False)

Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
numpy>=1.19.5
requests
cdflib>=0.4.3
pytplot-mpl-temp>=2.0.8
pytplot-mpl-temp>=2.1.0
cdasws>=1.7.24
netCDF4
pywavelets
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

setup(
name='pyspedas',
version='1.3.23',
version='1.3.24',
description='Python Space Physics Environment Data Analysis Software (pySPEDAS)',
long_description=open('README.md').read(),
long_description_content_type='text/markdown',
Expand All @@ -28,7 +28,7 @@
install_requires=['numpy>=1.19.5', 'requests', 'geopack>=1.0.9',
'cdflib>=0.4.3', 'cdasws>=1.7.24', 'netCDF4',
'pywavelets', 'astropy', 'hapiclient>=0.2.2',
'pytplot-mpl-temp>=2.0.8'],
'pytplot-mpl-temp>=2.1.0'],
python_requires='>=3.7',
include_package_data=True,
)

0 comments on commit f817f9a

Please sign in to comment.