def _create_site_list(self):
        """ creats a list of sites for a given self.rad for the period between
        self.stm and self.etm """

        import sqlite3

        # create a sqlite3 db connection to the radar.sqlite3
        conn = sqlite3.connect(database="../data/sqlite3/radars.sqlite",
                               detect_types=sqlite3.PARSE_DECLTYPES)
        cur = conn.cursor()

        # select all the datetime values (tval) later than stm
        command = "SELECT tval FROM hdw WHERE id=? "
        command = '{:s}and tval>=? ORDER BY tval ASC'.format(command)
        cur.execute(command, (self.rad_id, self.stm))
        tvals_stm = cur.fetchall()
        tvals_stm = [x[0] for x in tvals_stm]

        # select all the datetime values (tval) later than etm
        command = "SELECT tval FROM hdw WHERE id=? "
        command = '{:s}and tval>=? ORDER BY tval ASC'.format(command)
        cur.execute(command, (self.rad_id, self.etm))
        tval_etm = cur.fetchone()[0]
        indx_etm = tvals_stm.index(tval_etm)

        # select the tvals of interest
        tvals = tvals_stm[:indx_etm + 1]

        site_list = []
        for tval in tvals:
            site_list.append(site(code=self.rad, dt=tval))
        return site_list
예제 #2
0
    return gsSlantRange


if __name__ == "__main__":
    from davitpy.pydarn.radar import radStruct
    from datetime import datetime
    print("NOTE: Not working - need to remove dependence on davitpy")
    print("Testing radFov")
    print("Expected and result samples are from the fov's")
    print("fov.latCenter[0][0:4] and fov.lonCenter[0][0:4]")
    print("(in that order) on a 32-bit machine")
    print()
    time = datetime(2012, 1, 1, 0, 2)
    print("Create a site object for Saskatoon, 2012-01-01 00:02 UT.")
    site_sas = radStruct.site(code="sas", dt=time)
    print()
    print(
        "Create a fov object using that site, coords are geo, model Chisham.")
    fov1 = fov(site=site_sas, model="C")
    #    print "Expected: [ 53.20468706  53.7250585   54.18927222  54.63064699]"
    #    print "Result:   " + str(fov1.latCenter[0][0:4])
    #    print "Expected: [-106.87506589 -106.80488558 -106.77349475 "
    #    print "-106.75811049]"
    #    print "Result:   " + str(fov1.lonCenter[0][0:4])
    #    print "coords of result are " + fov1.coords
    print("Now create a fov object with mag coords.")
    fov2 = fov(site=site_sas, coords="mag", date_time=time)
    print("Expected: [ 61.55506679  62.08849503  62.55831358  63.00180636]")
    print("Result:   " + str(fov2.latCenter[0][0:4]))
    print("Expected: [-43.22579758 -43.25962883 -43.33474048 -43.42848079]")
예제 #3
0
    return gsSlantRange

if __name__ == "__main__":
    from davitpy.pydarn.radar import radStruct
    from datetime import datetime

    print
    print "Testing radFov"
    print "Expected and result samples are from the fov's"
    print "fov.latCenter[0][0:4] and fov.lonCenter[0][0:4]"
    print "(in that order) on a 32-bit machine"
    print
    time = datetime(2012, 1, 1, 0, 2)
    print "Create a site object for Saskatoon, 2012-01-01 00:02 UT."
    site_sas = radStruct.site(code="sas", dt=time)
    print
    print "Create a fov object using that site, coords are geo, model Chisham."
    fov1 = fov(site=site_sas, model="C")
#    print "Expected: [ 53.20468706  53.7250585   54.18927222  54.63064699]"
#    print "Result:   " + str(fov1.latCenter[0][0:4])
#    print "Expected: [-106.87506589 -106.80488558 -106.77349475 "
#    print "-106.75811049]"
#    print "Result:   " + str(fov1.lonCenter[0][0:4])
#    print "coords of result are " + fov1.coords
    print
    print "Now create a fov object with mag coords."
    fov2 = fov(site=site_sas, coords="mag", date_time=time)
    print "Expected: [ 61.55506679  62.08849503  62.55831358  63.00180636]"
    print "Result:   " + str(fov2.latCenter[0][0:4])
    print "Expected: [-43.22579758 -43.25962883 -43.33474048 -43.42848079]"