示例#1
0
 def test_RamSat_orbit_formatter(self):
     '''Test label variables are as expected'''
     data = ram.RamSat(self.testfile)
     tst_time = matplotlib.dates.date2num(dt.datetime(2012, 10, 29, 0, 2))
     fmtstr = data._orbit_formatter(tst_time, None)
     expected = '00:02 UT\n04:35 MLT\n-13.4$^{\circ}$ MLat\nR=5.05 $R_{E}$'
     self.assertEqual(expected, fmtstr)
示例#2
0
 def test_RamSat_contents_time(self):
     '''Test that start time attribute and Time variable are as expected'''
     data = ram.RamSat(self.testfile)
     self.assertEqual(data.starttime, dt.datetime(2012, 10, 29))
     tst = [
         dt.datetime(2012, 10, 29) + dt.timedelta(seconds=sc)
         for sc in [60, 120, 180]
     ]
     numpy.testing.assert_array_equal(data['Time'], tst)
示例#3
0
 def test_RamSat_omni_pabin(self):
     '''Check that internal PA bin calc is consistent'''
     data = ram.RamSat(self.testfile)
     data.create_omniflux(check=False)
     omni1 = np.asarray(data['omniHe'].copy())
     origwid = np.asarray(data['pa_width'].copy())
     del data['pa_width']
     data.create_omniflux(check=False)
     omni2 = np.asarray(data['omniHe'])
     # test that calculated omni is close -- bin widths are
     # not fully recoverable from grid, so this is approximate
     numpy.testing.assert_allclose(omni1, omni2, rtol=1e-1)
     # and test that "pa_width" is consistent with simulation
     # (again, calculation from pa_grid isn't fully recovering
     # actual widths - so test is approximate)
     newwid = np.asarray(data['pa_width'])
     numpy.testing.assert_array_almost_equal(origwid, newwid, decimal=2)
示例#4
0
 def test_RamSat_omnicalc_regress(self):
     '''Regression test for omni flux calculation'''
     data = ram.RamSat(self.testfile)
     #remove any precalculated omniflux
     rmkeys = [key for key in data if key.lower().startswith('omni')]
     for rmk in rmkeys:
         del data[rmk]
     regrH = np.array([
         0.0000000e+00, 1.4857327e+07, 1.4904620e+07, 1.4523555e+07,
         1.3417377e+07, 1.1787100e+07, 9.8903560e+06, 8.0948140e+06,
         6.6876425e+06, 5.7112065e+06, 5.0520345e+06, 4.5785050e+06,
         4.2270450e+06, 3.9780850e+06, 3.8351362e+06, 3.7873392e+06,
         3.9363230e+06, 4.0524422e+06, 2.9526408e+06, 9.0399219e+05,
         5.2025672e+05, 2.4965306e+05, 9.1892180e+04, 3.0133383e+04,
         1.6105718e+04, 1.4831358e+04, 1.7809768e+04, 2.2456926e+04,
         2.5075262e+04, 2.3687787e+04, 1.8142951e+04, 1.0017233e+04,
         3.8184448e+03, 1.1123656e+03, 2.2883945e+02
     ],
                      dtype=np.float32)
     data.create_omniflux(check=False)
     testarr = np.array(data['omniH'][0].data)
     numpy.testing.assert_array_almost_equal(regrH, testarr)
示例#5
0
 def test_RamSat_preserveFlux(self):
     '''Ensure that original flux is unchanged on calculating omni-flux'''
     data = ram.RamSat(self.testfile)
     flux_h = data['FluxH+'].copy()
     data.create_omniflux()
     numpy.testing.assert_array_equal(flux_h, data['FluxH+'])
示例#6
0
 def test_RamSat_contents_dims(self):
     '''Test for expected shape of loaded data array'''
     data = ram.RamSat(self.testfile)
     numpy.testing.assert_array_equal(data['FluxH+'].shape, [3, 72, 35])
示例#7
0
 def test_RamSat_contents_time(self):
     '''Test that start time attribute and Time variable are as expected'''
     data = ram.RamSat(self.testfile)
     self.assertEqual(data.starttime, dt.datetime(2012, 10, 29))
     numpy.testing.assert_array_equal(data['Time'], [60., 120., 180.])
示例#8
0
 def test_RamSat_load(self):
     '''Test that RAM satellite netCDF will load'''
     data = ram.RamSat(self.testfile)