コード例 #1
0
ファイル: test_stats.py プロジェクト: HyeonJeongKim/tcrm
    def test_GetCellNum(self):
        """Testing getCellNum"""
        #valid values
        knownValues = ((173, -39, 174), (173, -30, 152), (133, -30, 144), (70, 0, 0), (173.5, -0.5, 20))
        for lon, lat, cell in knownValues:
            result = statutils.getCellNum(lon, lat, self.gridLimit, self.gridSpace)
            self.assertEqual(cell, result)

        #outside of limits
        invalidLatLongs = ((60, -20), (190, -20), (90, -50), (90, 20), (180, 0), (70, -40))
        for lon, lat in invalidLatLongs:
            self.assertRaises(ValueError, statutils.getCellNum, lon, lat, self.gridLimit, self.gridSpace)
コード例 #2
0
ファイル: test_stats.py プロジェクト: tonyrafter/tcrm
    def test_GetCellNum(self):
        """Testing getCellNum"""
        #valid values
        knownValues = ((173, -39, 174), (173, -30, 152), (133, -30, 144),
                       (70, 0, 0), (173.5, -0.5, 20))
        for lon, lat, cell in knownValues:
            result = statutils.getCellNum(lon, lat, self.gridLimit,
                                          self.gridSpace)
            self.assertEqual(cell, result)

        #outside of limits
        invalidLatLongs = ((60, -20), (190, -20), (90, -50), (90, 20),
                           (180, 0), (70, -40))
        for lon, lat in invalidLatLongs:
            self.assertRaises(ValueError, statutils.getCellNum, lon, lat,
                              self.gridLimit, self.gridSpace)
コード例 #3
0
ファイル: plotCell.py プロジェクト: jmettes/tcrm
    if not os.path.exists(configFile):
        error_msg = "Configuration file '" + configFile +"' not found"
        raise IOError, error_msg

    #dataPath = config.cnfGetIniValue(configFile,'Input','Path', os.getcwd())
    dataPath = '/home/carthur/atcram/data/output/australia/run1'

    lon_lat = os.path.join(dataPath, 'all_lon_lat')
    bearing = os.path.join(dataPath, 'all_bearing')
    speed = os.path.join(dataPath, 'all_speed')
    pressure = os.path.join(dataPath, 'all_pressure')
    bearing_rate = os.path.join(dataPath, 'bearing_rate')
    speed_rate = os.path.join(dataPath, 'speed_rate')
    pressure_rate = os.path.join(dataPath, 'pressure_rate')

    #gridSpace = eval(config.cnfGetIniValue(configFile, 'Parameters', 'gridSpace')
    #gridLimit = eval(config.cnfGetIniValue(configFile, 'Parameters', 'gridLimit')
    gridLimit = {'xMin':90, 'xMax':180, 'yMin':-40, 'yMax':0}
    gridSpace = {'x':5, 'y':5}

    cellNum = stats.getCellNum(115., -15., gridLimit, gridSpace)

    p = PlotCell(lon_lat, bearing, speed, pressure, bearing_rate, speed_rate,
                 pressure_rate, cellNum, gridLimit, gridSpace)
    p.plotBearing()
    p.plotSpeed()
    p.plotSpeedRate()
    p.plotPressure()
    p.plotPressureRate()
    pylab.show()
コード例 #4
0
    if not os.path.exists(configFile):
        error_msg = "Configuration file '" + configFile +"' not found"
        raise IOError, error_msg

    #dataPath = config.cnfGetIniValue(configFile,'Input','Path', os.getcwd())
    dataPath = '/home/carthur/atcram/data/output/australia/run1'

    lon_lat = os.path.join(dataPath, 'all_lon_lat')
    bearing = os.path.join(dataPath, 'all_bearing')
    speed = os.path.join(dataPath, 'all_speed')
    pressure = os.path.join(dataPath, 'all_pressure')
    bearing_rate = os.path.join(dataPath, 'bearing_rate')
    speed_rate = os.path.join(dataPath, 'speed_rate')
    pressure_rate = os.path.join(dataPath, 'pressure_rate')

    #gridSpace = eval(config.cnfGetIniValue(configFile, 'Parameters', 'gridSpace')
    #gridLimit = eval(config.cnfGetIniValue(configFile, 'Parameters', 'gridLimit')
    gridLimit = {'xMin':90, 'xMax':180, 'yMin':-40, 'yMax':0}
    gridSpace = {'x':5, 'y':5}

    cellNum = stats.getCellNum(115., -15., gridLimit, gridSpace)

    p = PlotCell(lon_lat, bearing, speed, pressure, bearing_rate, speed_rate,
                 pressure_rate, cellNum, gridLimit, gridSpace)
    p.plotBearing()
    p.plotSpeed()
    p.plotSpeedRate()
    p.plotPressure()
    p.plotPressureRate()
    pylab.show()