def getGridPop(mesh, gTrajFileName, popFileName):
    GRIDNUMBER = (mesh.lonNum * mesh.latNum)
    Timestamps = getTimestamps(gTrajFileName)
    TIMENUMBER = len(Timestamps)
    TS = {}
    for i in range(TIMENUMBER):
        TS[Timestamps[i]] = i
    print('getGridPop Started : ', time.ctime())
    R = []
    for i in range(TIMENUMBER):
        R.append([])
        for j in range(GRIDNUMBER):
            R[i].append([])
    with open(popFileName, 'r') as rf:
        tansistReader = csv.reader(rf)
        for line in tansistReader:
            timestamp = TS[line[0]]
            grid = int(line[1])
            R[timestamp][grid] = int(line[2])
    R = np.array(R, dtype='int32')
    R = R.reshape(R.shape[0], int((R.shape[1] ** 0.5)), int((R.shape[1] ** 0.5)), 1)
    R = np.swapaxes(R, 2, 1)
    R = R[:, ::(- 1), :, :]
    return R
def getGridPop(mesh, gTrajFileName, popFileName):
    GRIDNUMBER = (mesh.lonNum * mesh.latNum)
    Timestamps = getTimestamps(gTrajFileName)
    TIMENUMBER = len(Timestamps)
    TS = {}
    for i in range(TIMENUMBER):
        TS[Timestamps[i]] = i
    print('getGridPop Started : ', time.ctime())
    R = []
    for i in range(TIMENUMBER):
        R.append([])
        for j in range(GRIDNUMBER):
            R[i].append([])
    with open(popFileName, 'r') as rf:
        tansistReader = csv.reader(rf)
        for line in tansistReader:
            timestamp = TS[line[0]]
            grid = int(line[1])
            R[timestamp][grid] = int(line[2])
    R = np.array(R, dtype='int32')
    R = R.reshape(R.shape[0], int((R.shape[1] ** 0.5)), int((R.shape[1] ** 0.5)), 1)
    R = np.swapaxes(R, 2, 1)
    R = R[:, ::(- 1), :, :]
    return R