def genMeshDynamic(mesh, fileName, meshFileName):
    MD = {}
    with open(fileName, 'r') as rf:
        reader = csv.reader(rf)
        for line in reader:
            tid = line[0]
            timestamp = line[1]
            meshid = line[2]
            key = (timestamp, meshid)
            if (key in MD):
                MD[key].add(tid)
            else:
                MD[key] = set(tid)
    wf = open(meshFileName, 'w')
    Timestamps = getTimestamps(fileName)
    for ts in Timestamps:
        for meshid in range((mesh.lonNum * mesh.latNum)):
            key = (ts, str(meshid))
            if (key in MD):
                value = len(MD[key])
            else:
                value = 0
            wf.write((','.join([key[0], key[1], str(value)]) + '\n'))
    wf.close()
def genMeshDynamic(mesh, fileName, meshFileName):
    MD = {}
    with open(fileName, 'r') as rf:
        reader = csv.reader(rf)
        for line in reader:
            tid = line[0]
            timestamp = line[1]
            meshid = line[2]
            key = (timestamp, meshid)
            if (key in MD):
                MD[key].add(tid)
            else:
                MD[key] = set(tid)
    wf = open(meshFileName, 'w')
    Timestamps = getTimestamps(fileName)
    for ts in Timestamps:
        for meshid in range((mesh.lonNum * mesh.latNum)):
            key = (ts, str(meshid))
            if (key in MD):
                value = len(MD[key])
            else:
                value = 0
            wf.write((','.join([key[0], key[1], str(value)]) + '\n'))
    wf.close()