예제 #1
0
        def test_cxform(self):
            d = datetime.datetime(year=2008,
                                  month=8,
                                  day=1,
                                  hour=0,
                                  minute=0,
                                  second=0)

            geopack.recalc(d.year,
                           d.timetuple().tm_yday, d.hour, d.minute, d.second)

            gse = (0.25, -2.63, -0.4)

            out = geopack.gsmgse(0., 0., 0., gse[0], gse[1], gse[2],
                                 self.iGSEtoGSM)
            out = geopack.smgsm(0., 0., 0., out[0], out[1], out[2],
                                self.iGSMtoSM)

            self.__assertPercentDiff(.2830, out[0])
            self.__assertPercentDiff(-2.6554, out[1])
            self.__assertPercentDiff(-0.087301346866137039, out[2])

            # Check the inverse:
            out = geopack.smgsm(out[0], out[1], out[2], 0., 0., 0.,
                                self.iSMtoGSM)
            out = geopack.gsmgse(out[3], out[4], out[5], 0., 0., 0.,
                                 self.iGSMtoGSE)

            self.__assertPercentDiff(gse[0], out[3])
            self.__assertPercentDiff(gse[1], out[4])
            self.__assertPercentDiff(gse[2], out[5])
예제 #2
0
        def test_1990s(self):
            # First day of NHL hockey season in '94-95. Stupid strike!
            d = datetime.datetime(year=1995,
                                  month=1,
                                  day=20,
                                  hour=19,
                                  minute=0,
                                  second=0)

            geopack.recalc(d.year,
                           d.timetuple().tm_yday, d.hour, d.minute, d.second)

            gse = (0.25, -2.63, -0.4)

            out = geopack.gsmgse(0., 0., 0., gse[0], gse[1], gse[2],
                                 self.iGSEtoGSM)
            out = geopack.smgsm(0., 0., 0., out[0], out[1], out[2],
                                self.iGSMtoSM)

            self.__assertPercentDiff(0.02189803712013394, out[0])
            self.__assertPercentDiff(-2.3804487166857329, out[1])
            self.__assertPercentDiff(-1.2134184699432964, out[2])

            # Check the inverse:
            out = geopack.smgsm(out[0], out[1], out[2], 0., 0., 0.,
                                self.iSMtoGSM)
            out = geopack.gsmgse(out[3], out[4], out[5], 0., 0., 0.,
                                 self.iGSMtoGSE)

            self.__assertPercentDiff(gse[0], out[3])
            self.__assertPercentDiff(gse[1], out[4])
            self.__assertPercentDiff(gse[2], out[5])
예제 #3
0
        def test_merkin(self):
            """
            Slava Merkin experienced strange behavior with cxform on
            certain inputs.  Compare those inputs here against GEOPACK.
            """
            d = datetime.datetime(year=2008,
                                  month=8,
                                  day=1,
                                  hour=0,
                                  minute=0,
                                  second=0)

            geopack.recalc(d.year,
                           d.timetuple().tm_yday, d.hour, d.minute, d.second)

            gse = (0.25, -2.63, -0.4)

            out = geopack.gsmgse(0., 0., 0., gse[0], gse[1], gse[2],
                                 self.iGSEtoGSM)
            self.__assertPercentDiff(0.25, out[0])
            self.__assertPercentDiff(-2.6556295971324912, out[1])
            self.__assertPercentDiff(-0.15662516666844989, out[2])

            out = geopack.gsmgse(out[0], out[1], out[2], 0., 0., 0.,
                                 self.iGSMtoGSE)
            self.__assertPercentDiff(gse[0], out[3])
            self.__assertPercentDiff(gse[1], out[4])
            self.__assertPercentDiff(gse[2], out[5])
예제 #4
0
     def test_GSMGSE(self):
         
         output = geopack.gsmgse(self.gsm[0], self.gsm[1], self.gsm[2], 0.,0.,0., self.iGSMtoGSE)
         self.__assertPercentDiff( self.gse[0], output[3] )
         self.__assertPercentDiff( self.gse[1], output[4] )
         self.__assertPercentDiff( self.gse[2], output[5] )
 
         output = geopack.gsmgse(0.,0.,0., output[3], output[4], output[5], self.iGSEtoGSM)
         self.__assertPercentDiff( self.gsm[0], output[0] )
         self.__assertPercentDiff( self.gsm[1], output[1] )
         self.__assertPercentDiff( self.gsm[2], output[2] )