示例#1
0
 def testGIRO(self):
     # Setup the configuration for the DataController
     dataControllerConfig = ConfigValues.DataControllerConfig()
     # Use only giro
     dataControllerConfig.sources = ['giro']
     # Need to stand this up, usually the Manager has it
     pharlapHandle = Pharlap()
     irtamHandle = IrtamPyIface()
     # Create an instance of DataController and let it go
     dataController = DataController(dataControllerConfig,
                                     irtamHandle=irtamHandle,
                                     pharlapHandle=pharlapHandle)
     listOfOutputFiles = dataController.process(datetime(2015, 10, 20))
     self.assertEqual(len(listOfOutputFiles['giro']), 4)
示例#2
0
    def __init__(self, config, saoReaderHandle=None, irtamHandle=None, pharlapHandle=None):

        self.config = config

        # Comms channels
        self.heartbeatChannel = None
        self.ionoChannel      = None

        # Create handle to SAO reader 
        if saoReaderHandle:
            self.saoReaderHandle = saoReaderHandle
        else:
            self.saoReaderHandle = SaoPyIface()

        # Create handle to IRTAM Processor
        if irtamHandle:
            self.irtamHandle = irtamHandle
        else:
            self.irtamHandle = IrtamPyIface()

        # Create handle to Pharlap
        if pharlapHandle:
            self.pharlapHandle = pharlapHandle
        else:
            self.pharlapHandle = Pharlap()

        # Standup the data controler which does the downloading and massaging of external data        
        self.dataController = DataController(self.config.dataControllerConfig,
                                             self.saoReaderHandle, 
                                             self.irtamHandle,
                                             self.pharlapHandle)

        self.roam = ROAM(self.config.roamConfig,
                         self.irtamHandle, 
                         self.pharlapHandle)

        # Set this method up to run
        self.running = True
示例#3
0
文件: Niue.py 项目: floquet/trabajo
 def setUp(self):
     ionoPyToCHandle = Pharlap()
     irtamPyToCHandle = IrtamPyIface()
     self.irtam = IRTAM(irtamPyToCHandle, ionoPyToCHandle)
示例#4
0
def PharlapRayProcessorConfig(pharlap=None):

    pharlapRayProcessorConfig = ConfigDef.PharlapRayProcessorConfig()

    # The footprints of the voxel grids are squares with an incribed circle with this radius. (Meter)
    pharlapRayProcessorConfig.grids.radiusMeter = 900e3

    # The electron density grid's increment in latitude (degrees)
    pharlapRayProcessorConfig.grids.latInc = numpy.deg2rad(0.10048)
    # The electron density grid's increment in longitude (degrees)
    pharlapRayProcessorConfig.grids.lonInc = numpy.deg2rad(0.10048)
    # The electron density grid's lowest height (km)
    pharlapRayProcessorConfig.grids.htStart = 60e3
    # The electron density grid's increment in height (km)
    pharlapRayProcessorConfig.grids.htInc = 2e3
    # The electron density grid's number of voxels in height
    pharlapRayProcessorConfig.grids.numHt = 201

    # The geomagnetic field grid's increment in latitude (degrees)
    pharlapRayProcessorConfig.grids.bLatInc = numpy.deg2rad(0.2)
    # The geomagnetic field grid's increment in longitude (degrees)
    pharlapRayProcessorConfig.grids.bLonInc = numpy.deg2rad(0.2)
    # The geomagnetic field grid's lowest height (km)
    pharlapRayProcessorConfig.grids.bHtStart = 60e3
    # The geomagnetic field grid's increment in height (km)
    pharlapRayProcessorConfig.grids.bHtInc = 10e3
    # The geomagnetic field grid's number of voxels in height
    pharlapRayProcessorConfig.grids.bNumHt = 41

    # Parameters of PHaRLAP
    pharlapRayProcessorConfig.pharlap.tolPharlapMin = numpy.array(
        [1e-7, 0.01, 1])
    # Root solver for ray homing

    elLimits = numpy.array([0, 90.0])
    elSpan = 180.0
    azSpan = 30.0

    # 1D Ray Shooting
    options1d = {"fatol": 1e-2, "maxNumIter": 10, "nfev": 50}
    elLimits = pharlapRayProcessorConfig.elLimits
    pharlapRayProcessorConfig.elMaxSolver = RayData.genRootSolver(
        "rayShooting1d", option=options1d, elLimits=elLimits)
    #pharlapRayProcessorConfig.solver = RayData.genRootSolver("minimize")
    #pharlapRayProcessorConfig.solver = RayData.genRootSolver("krylov", options={"fatol": 1.0e-3})

    # 2D Bisectioning
    #solverOptions = {"fatol": 20, "maxNumIter": 100, "func1d": pharlapRayProcessorConfig.elMaxSolver}
    # pharlapRayProcessorConfig.solver = RayData.genRootSolver("bisect2d", options=solverOptions,
    #             elLimits=elLimits, elSpan=elSpan, azSpan=azSpan)

    # 2D Ray Shooting
    solverOptions = {
        "fatol": 10000,
        "maxNumIter": 50,
        "nfev": 100,
        "nInit": 200
    }
    pharlapRayProcessorConfig.solver = RayData.genRootSolver(
        "rayShooting2d",
        options=solverOptions,
        elLimits=elLimits,
        elSpan=elSpan,
        azSpan=azSpan)

    # If no Pharlap object is provided, construct a new one.
    if not isinstance(pharlap, Pharlap):
        pharlap = Pharlap()

    # Construct a ROAM object
    roamConfig = IonoConfig.ROAMConfig()
    roam = ROAM(roamConfig, pharlapHandle=pharlap)
    # Set the model to IRI
    roam.background_model = 0

    pharlapRayProcessorConfig.raytrace_3d = pharlap.raytrace_3d
    pharlapRayProcessorConfig.genGeoMagGrid = GeoMagGrid.genGridIGRF12
    pharlapRayProcessorConfig.genElectronDensityGridROAM = roam.genElectronDensityGridROAM

    # Number of days as the threshold to trigger the regeneration of geomagnetic fields.
    pharlapRayProcessorConfig.deltaDaysRegenGeomagGrid = datetime.timedelta(
        90
    )  # Regenerate the geomagnetic fields if it is outdated by more than 90 days.

    return pharlapRayProcessorConfig