예제 #1
0
    def __init__(self,
                 startTime,
                 mObj,
                 axisHandle,
                 hemi='north',
                 maxVelScale=1000.,
                 plotCoords='mag'):

        import datetime
        from davitpy.pydarn.sdio import sdDataOpen
        import matplotlib.cm as cm
        import numpy
        import matplotlib

        # set up some initial paramteres
        self.radEarth = 6371.
        # This is used to change the length of the vector on the plot
        self.lenFactor = 500.
        self.radEarthMtrs = self.radEarth * 1000.
        self.maxVelPlot = maxVelScale
        self.axisHandle = axisHandle
        self.mObj = mObj

        # check if the mapObj is indicating the same hemisphere as data
        # requested
        if hemi == "north":
            assert(mObj.boundarylats[0] > 0.), \
                logging.error("Map object is using one hemisphere and data the"
                              " other")
        else:
            assert(mObj.boundarylats[0] < 0.), \
                logging.error("Map object is using one hemisphere and data the"
                              " other")

        # check if hemi and coords keywords are correct
        assert(hemi == "north" or hemi == "south"), \
            logging.error("hemi should either be 'north' or 'south'")
        assert(plotCoords == 'mag' or coords == 'mlt'), \
            logging.error("error, coords must be one of 'mag' or 'mlt'")

        self.hemi = hemi
        self.plotCoords = plotCoords

        # Read the corresponding data record from both map and grid files.
        # This is the way I'm setting stuff up to avoid confusion of reading
        # and plotting seperately.  Just give the date/hemi and the code reads
        # the corresponding rec
        endTime = startTime + datetime.timedelta(minutes=2)
        grdPtr = sdDataOpen(startTime, hemi, eTime=endTime, fileType='grdex')
        self.grdData = grdPtr.readRec()
        mapPtr = sdDataOpen(startTime, hemi, eTime=endTime, fileType='mapex')
        self.mapData = mapPtr.readRec()
예제 #2
0
    def __init__(self, startTime, mObj, axisHandle, hemi='north',
                 maxVelScale=1000., plotCoords='mag'):

        import datetime
        from davitpy.pydarn.sdio import sdDataOpen
        import matplotlib.cm as cm
        import numpy
        import matplotlib

        # set up some initial paramteres
        self.radEarth = 6371.
        # This is used to change the length of the vector on the plot
        self.lenFactor = 500.
        self.radEarthMtrs = self.radEarth * 1000.
        self.maxVelPlot = maxVelScale
        self.axisHandle = axisHandle
        self.mObj = mObj

        # check if the mapObj is indicating the same hemisphere as data
        # requested
        if hemi == "north":
            assert(mObj.boundarylats[0] > 0.), \
                logging.error("Map object is using one hemisphere and data the"
                              " other")
        else:
            assert(mObj.boundarylats[0] < 0.), \
                logging.error("Map object is using one hemisphere and data the"
                              " other")

        # check if hemi and coords keywords are correct
        assert(hemi == "north" or hemi == "south"), \
            logging.error("hemi should either be 'north' or 'south'")
        assert(plotCoords == 'mag' or coords == 'mlt'), \
            logging.error("error, coords must be one of 'mag' or 'mlt'")

        self.hemi = hemi
        self.plotCoords = plotCoords

        # Read the corresponding data record from both map and grid files.
        # This is the way I'm setting stuff up to avoid confusion of reading
        # and plotting seperately.  Just give the date/hemi and the code reads
        # the corresponding rec
        endTime = startTime + datetime.timedelta(minutes=2)
        grdPtr = sdDataOpen(startTime, hemi, eTime=endTime, fileType='grdex')
        self.grdData = grdPtr.readRec()
        mapPtr = sdDataOpen(startTime, hemi, eTime=endTime, fileType='mapex')
        self.mapData = mapPtr.readRec()
예제 #3
0
    def __init__(self,
                 start_time,
                 mobj=None,
                 ax=None,
                 end_time=None,
                 hemi='north',
                 maxVelScale=1000.0,
                 min_vel=0.0,
                 grid_type='grd',
                 map_type='map'):
        from davitpy.pydarn.sdio import sdDataOpen
        import matplotlib as mpl

        # set up some initial parameters
        self.radEarth = 6371.0
        # This is used to change the length of the vector on the plot
        self.lenFactor = 500.0
        self.radEarthMtrs = self.radEarth * 1000.0
        self.maxVelPlot = maxVelScale
        self.min_vel = min_vel
        self.axisHandle = ax
        self.mObj = mobj

        # check if hemi and coords keywords are correct
        assert(hemi == "north" or hemi == "south"), \
            logging.error("hemi should either be 'north' or 'south'")

        # check if the mapObj is indicating the same hemisphere as data
        # requested, if it was provided.
        if mobj is not None:
            if hemi == "north":
                assert(mobj.boundarylats[0] > 0.0), \
                    logging.error("Map and data objects must be from the same"
                                  " hemisphere")
            else:
                assert(mobj.boundarylats[0] <= 0.0), \
                    logging.error("Map and data objects must be from the same"
                                  " hemisphere")

        self.hemi = hemi

        # Read the corresponding data record from both map and grid files.
        # This is the way I'm setting stuff up to avoid confusion of reading
        # and plotting seperately.  Just give the date/hemi and the code reads
        # the corresponding rec
        if end_time is None:
            end_time = start_time + dt.timedelta(minutes=2)

        if grid_type is not None:
            grdPtr = sdDataOpen(start_time,
                                hemi,
                                eTime=end_time,
                                fileType=grid_type)
            try:
                self.grdData = grdPtr.readRec()
            except:
                self.grdData = None
        else:
            self.grdData = None

        if map_type is not None:
            mapPtr = sdDataOpen(start_time,
                                hemi,
                                eTime=end_time,
                                fileType=map_type)
            try:
                self.mapData = mapPtr.readRec()
            except:
                self.mapData = None
        else:
            self.mapData = None

        if self.grdData is None and self.mapData is None:
            estr = "unable to load data for grid type [{:s}] ".format(
                grid_type)
            estr = "{:s}and map type [{:s}] for ".format(estr, map_type)
            estr = "{:s}[{:} to {:}]".format(estr, start_time, end_time)
            logging.error(estr)
예제 #4
0
    def __init__(self, start_time, mobj=None, ax=None, end_time=None,
                 hemi='north', maxVelScale=1000.0, min_vel=0.0, grid_type='grd',
                 map_type='map'):
        from davitpy.pydarn.sdio import sdDataOpen
        import matplotlib as mpl

        # set up some initial parameters
        self.radEarth = 6371.0
        # This is used to change the length of the vector on the plot
        self.lenFactor = 500.0
        self.radEarthMtrs = self.radEarth * 1000.0
        self.maxVelPlot = maxVelScale
        self.min_vel = min_vel
        self.axisHandle = ax
        self.mObj = mobj

        # check if hemi and coords keywords are correct
        assert(hemi == "north" or hemi == "south"), \
            logging.error("hemi should either be 'north' or 'south'")

        # check if the mapObj is indicating the same hemisphere as data
        # requested, if it was provided.
        if mobj is not None:
            if hemi == "north":
                assert(mobj.boundarylats[0] > 0.0), \
                    logging.error("Map and data objects must be from the same"
                                  " hemisphere")
            else:
                assert(mobj.boundarylats[0] <= 0.0), \
                    logging.error("Map and data objects must be from the same"
                                  " hemisphere")

        self.hemi = hemi

        # Read the corresponding data record from both map and grid files.
        # This is the way I'm setting stuff up to avoid confusion of reading
        # and plotting seperately.  Just give the date/hemi and the code reads
        # the corresponding rec
        if end_time is None:
            end_time = start_time + dt.timedelta(minutes=2)

        if grid_type is not None:
            grdPtr = sdDataOpen(start_time, hemi, eTime=end_time,
                                fileType=grid_type)
            try:
                self.grdData = grdPtr.readRec()
            except:
                self.grdData = None
        else:
            self.grdData = None

        if map_type is not None:
            mapPtr = sdDataOpen(start_time, hemi, eTime=end_time,
                                fileType=map_type)
            try:
                self.mapData = mapPtr.readRec()
            except:
                self.mapData = None
        else:
            self.mapData = None

        if self.grdData is None and self.mapData is None:
            estr = "unable to load data for grid type [{:s}] ".format(grid_type)
            estr = "{:s}and map type [{:s}] for ".format(estr, map_type)
            estr = "{:s}[{:} to {:}]".format(estr, start_time, end_time)
            logging.error(estr)