Пример #1
0
        itop = pftools.computeTopSurfaceIndices(top)

        ## Compute the surface storage
        ps = pftools.dataPointExtent(input0) + (3, )
        xx = np.reshape(vton(output.GetPoints().GetData()), ps)
        sus = np.sum(pftools.computeSurfaceStorage(ext, itop, xx, pressure))
        arr = ntov(sus)
        arr.SetName('surface storage')
        arr.GetInformation().Set(e2r.GLOBAL_TEMPORAL_VARIABLE(), 1)
        output.GetFieldData().AddArray(arr)

        ## Compute the surface runoff
        slope = np.reshape(slope, top.shape + (2, ))
        mannings = np.reshape(mannings, top.shape)
        sro = np.sum(
            pftools.computeSurfaceRunoff(top, xx, pressure, slope, mannings))
        arr = ntov(sro)
        arr.SetName('surface runoff')
        arr.GetInformation().Set(e2r.GLOBAL_TEMPORAL_VARIABLE(), 1)
        output.GetFieldData().AddArray(arr)

        return 1


if __name__ == "__main__":
    from paraview.detail.pythonalgorithm import get_plugin_xmls
    from xml.dom.minidom import parseString
    for xml in get_plugin_xmls(globals()):
        dom = parseString(xml)
        print(dom.toprettyxml(" ", "\n"))
Пример #2
0
        print("Pretend work done!")
        return 1

def test_PythonSuperquadricSource():
    src = PythonSuperquadricSource()
    src.Update()

    npts = src.GetOutputDataObject(0).GetNumberOfPoints()
    assert npts > 0

    src.SetThetaResolution(50)
    src.SetPhiResolution(50)
    src.Update()
    assert src.GetOutputDataObject(0).GetNumberOfPoints() > npts

def test_PythonCSVReader(fname):
    reader = PythonCSVReader()
    reader.SetFileName(fname)
    reader.Update()
    assert reader.GetOutputDataObject(0).GetNumberOfRows() > 0

if __name__ == "__main__":
    #test_PythonSuperquadricSource()
    #test_PythonCSVReader("/tmp/data.csv")

    from paraview.detail.pythonalgorithm import get_plugin_xmls
    from xml.dom.minidom import parseString
    for xml in get_plugin_xmls(globals()):
        dom = parseString(xml)
        print(dom.toprettyxml(" ","\n"))