/[escript]/trunk/downunder/test/python/run_domainbuilder.py
ViewVC logotype

Diff of /trunk/downunder/test/python/run_domainbuilder.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 4432 by caltinay, Tue Feb 19 01:16:29 2013 UTC revision 4433 by gross, Fri May 31 12:09:58 2013 UTC
# Line 28  import unittest Line 28  import unittest
28  from esys.escript import inf,sup,saveDataCSV,getMPISizeWorld  from esys.escript import inf,sup,saveDataCSV,getMPISizeWorld
29  from esys.downunder.datasources import *  from esys.downunder.datasources import *
30  from esys.downunder.domainbuilder import DomainBuilder  from esys.downunder.domainbuilder import DomainBuilder
31    from esys.downunder import WGS84ReferenceSystem
32    
33    
34  # this is mainly to avoid warning messages  # this is mainly to avoid warning messages
35  logging.basicConfig(format='%(name)s: %(message)s', level=logging.INFO)  logging.basicConfig(format='%(name)s: %(message)s', level=logging.INFO)
# Line 66  class TestDomainBuilderWithNetCdf(unitte Line 68  class TestDomainBuilderWithNetCdf(unitte
68          source1b = NetCdfData(DataSource.GRAVITY, NC_DATA1, scale_factor=2.)          source1b = NetCdfData(DataSource.GRAVITY, NC_DATA1, scale_factor=2.)
69          self.assertRaises(Exception, db.addSource, source1b)          self.assertRaises(Exception, db.addSource, source1b)
70    
71        def test_cartesian_domain(self):
72            db=DomainBuilder()
73            source1a = NetCdfData(DataSource.GRAVITY, NC_DATA1, scale_factor=1.)
74            db.addSource(source1a)
75            db.setVerticalExtents(depth=20000., air_layer=30000., num_cells=10)
76            dom=db.getDomain()
77    
78        def test_geodetic_domain(self):
79            COORDINATES=WGS84ReferenceSystem()
80            db=DomainBuilder(reference_system=COORDINATES)
81            source1a = NetCdfData(DataSource.GRAVITY, NC_DATA1, scale_factor=1., reference_system=COORDINATES)
82            db.addSource(source1a)
83            db.setVerticalExtents(depth=20000., air_layer=30000., num_cells=10)
84            dom=db.getDomain()
85            x=dom.getX()
86            self.assertAlmostEqual(inf(x[0]), 120.2, delta=0.001, msg="phi range wrong")
87            self.assertAlmostEqual(sup(x[0]), 120.3, delta=0.001, msg="phi range wrong")
88            self.assertAlmostEqual(inf(x[1]), -29.2 , delta=0.0001, msg="lambda range wrong")
89            self.assertAlmostEqual(sup(x[1]), -29.13333333333333, delta=0.0001, msg="lambda range wrong")
90            self.assertAlmostEqual(inf(x[2]), -20., msg="h range wrong")
91            self.assertAlmostEqual(sup(x[2]), 30., msg="h range wrong")
92            
93    
94  if __name__ == "__main__":  if __name__ == "__main__":
95      suite = unittest.TestSuite()      suite = unittest.TestSuite()
96      if 'NetCdfData' in dir():      if 'NetCdfData' in dir():

Legend:
Removed from v.4432  
changed lines
  Added in v.4433

  ViewVC Help
Powered by ViewVC 1.1.26