Exemplo n.º 1
0
  def test_filename(self):
    """
    Test filename().
    """
    valueGmv = "hi.txt"
    valuePset = "hi2.txt"

    io = MeshIOLagrit()
    io.filenameGmv(valueGmv)
    io.filenamePset(valuePset)
    self.assertEqual(valueGmv, io.filenameGmv())
    self.assertEqual(valuePset, io.filenamePset())
    return
Exemplo n.º 2
0
  def test_readwrite(self):
    """
    Test read().
    """
    filenameGmvIn = "data/cube2_ascii.gmv"
    filenamePsetIn = "data/cube2_ascii.pset"
    filenameOut = "data/cube2_test.txt"
    filenameE = "data/cube2.txt"

    from spatialdata.geocoords.CSCart import CSCart
    cs = CSCart()
    cs._configure()

    # For now, we only test reading the file. We would like to write
    # the file and compare against the original.
    io = MeshIOLagrit()
    io.inventory.filenameGmv = filenameGmvIn
    io.inventory.filenamePset = filenamePsetIn
    io._configure()

    from spatialdata.units.Nondimensional import Nondimensional
    normalizer = Nondimensional()

    mesh = io.read(debug=False, interpolate=True)

    testhandler = MeshIOAscii()
    testhandler.filename(filenameOut)
    testhandler.coordsys = cs
    testhandler.write(mesh)

    fileE = open(filenameE, "r")
    linesE = fileE.readlines()
    fileE.close()
    fileT = open(filenameOut, "r")
    linesT = fileT.readlines()
    fileT.close()

    self.assertEqual(len(linesE), len(linesT))
    for (lineE, lineT) in zip(linesE, linesT):
      self.assertEqual(lineE, lineT)
    return
Exemplo n.º 3
0
  def test_readwrite(self):
    """
    Test read().
    """
    filenameGmvIn = "data/cube2_ascii.gmv"
    filenamePsetIn = "data/cube2_ascii.pset"
    filenameOut = "data/cube2_test.txt"
    filenameE = "data/cube2.txt"

    from spatialdata.geocoords.CSCart import CSCart
    cs = CSCart()
    cs._configure()

    # For now, we only test reading the file. We would like to write
    # the file and compare against the original.
    io = MeshIOLagrit()
    io.inventory.filenameGmv = filenameGmvIn
    io.inventory.filenamePset = filenamePsetIn
    io._configure()

    from spatialdata.units.Nondimensional import Nondimensional
    normalizer = Nondimensional()

    mesh = io.read(debug=False, interpolate=True)

    testhandler = MeshIOAscii()
    testhandler.filename(filenameOut)
    testhandler.coordsys = cs
    testhandler.write(mesh)

    fileE = open(filenameE, "r")
    linesE = fileE.readlines()
    fileE.close()
    fileT = open(filenameOut, "r")
    linesT = fileT.readlines()
    fileT.close()

    self.assertEqual(len(linesE), len(linesT))
    for (lineE, lineT) in zip(linesE, linesT):
      self.assertEqual(lineE, lineT)
    return
Exemplo n.º 4
0
  def test_filename(self):
    """
    Test filename().
    """
    valueGmv = "hi.txt"
    valuePset = "hi2.txt"

    io = MeshIOLagrit()
    io.filenameGmv(valueGmv)
    io.filenamePset(valuePset)
    self.assertEqual(valueGmv, io.filenameGmv())
    self.assertEqual(valuePset, io.filenamePset())
    return
Exemplo n.º 5
0
 def test_constructor(self):
   """
   Test constructor.
   """
   io = MeshIOLagrit()
   return