/[escript]/trunk/downunder/py_src/datasources.py
ViewVC logotype

Diff of /trunk/downunder/py_src/datasources.py

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

revision 4005 by caltinay, Fri Sep 28 06:09:03 2012 UTC revision 4007 by caltinay, Tue Oct 2 02:12:01 2012 UTC
# Line 13  Line 13 
13  #  #
14  ##############################################################################  ##############################################################################
15    
16    """Data readers/providers for inversions"""
17    
18  __copyright__="""Copyright (c) 2003-2012 by University of Queensland  __copyright__="""Copyright (c) 2003-2012 by University of Queensland
19  http://www.uq.edu.au  http://www.uq.edu.au
20  Primary Business: Queensland, Australia"""  Primary Business: Queensland, Australia"""
# Line 24  __all__ = ['DataSource','UBCDataSource', Line 26  __all__ = ['DataSource','UBCDataSource',
26    
27  import logging  import logging
28  import numpy as np  import numpy as np
 from esys.escript import *  
29  from esys.escript.linearPDEs import LinearSinglePDE  from esys.escript.linearPDEs import LinearSinglePDE
30    from esys.escript.util import *
31  import esys.escript.unitsSI as U  import esys.escript.unitsSI as U
32  from esys.ripley import Brick, Rectangle, ripleycpp  from esys.ripley import Brick, Rectangle, ripleycpp
33    
# Line 39  def LatLonToUTM(lon, lat, wkt_string=Non Line 41  def LatLonToUTM(lon, lat, wkt_string=Non
41      """      """
42      Converts one or more longitude,latitude pairs to the corresponding x,y      Converts one or more longitude,latitude pairs to the corresponding x,y
43      coordinates in the Universal Transverse Mercator projection.      coordinates in the Universal Transverse Mercator projection.
44      If `wkt_string` is not given or invalid or the ``gdal`` module is not  
45      available to convert the string, then the input values are assumed to be      :note: If the ``pyproj`` module is not installed a warning if printed and
46      given in the Clarke 1866 projection.             the input values are scaled by a constant and returned.
47        :note: If `wkt_string` is not given or invalid or the ``gdal`` module is
48               not available to convert the string, then the input values are
49               assumed to be given in the Clarke 1866 projection.
50      """      """
51    
52      # not really optimal: if pyproj is not installed we return the input      # not really optimal: if pyproj is not installed we return the input
# Line 256  class DataSource(object): Line 261  class DataSource(object):
261    
262          return arrays          return arrays
263    
264      def _createDomain(self, padding_l, padding_h):      def _createDomain(self, padding_x, padding_y):
265          """          """
266          Creates and returns an escript domain that spans the entire area of          Creates and returns an escript domain that spans the entire area of
267          available data plus a buffer zone. This method is called only once          available data plus a buffer zone. This method is called only once
# Line 284  class DataSource(object): Line 289  class DataSource(object):
289          l = [NE[i]*self._spacing[i] for i in xrange(len(NE))]          l = [NE[i]*self._spacing[i] for i in xrange(len(NE))]
290    
291          # now add padding to the values          # now add padding to the values
292          NE_new, l_new, origin_new = self._addPadding(padding_l, padding_h, \          NE_new, l_new, origin_new = self._addPadding(padding_x, padding_y, \
293                  NE, l, origin)                  NE, l, origin)
294    
295          # number of padding elements per side          # number of padding elements per side
# Line 772  class SyntheticDataSource(DataSource): Line 777  class SyntheticDataSource(DataSource):
777          self.l=l          self.l=l
778          self.h=h          self.h=h
779    
780      def _createDomain(self, padding_l, padding_h):      def _createDomain(self, padding_x, padding_y):
781          NE_H=self.NE          NE_H=self.NE
782          NE_L=int((self.l/self.h)*NE_H+0.5)          NE_L=int((self.l/self.h)*NE_H+0.5)
783          l=[self.l]*(self.DIM-1)+[self.h]          l=[self.l]*(self.DIM-1)+[self.h]
784          NE=[NE_L]*(self.DIM-1)+[NE_H]          NE=[NE_L]*(self.DIM-1)+[NE_H]
785          origin=[0.]*self.DIM          origin=[0.]*self.DIM
786          NE_new, l_new, origin_new = self._addPadding(padding_l, padding_h, \          NE_new, l_new, origin_new = self._addPadding(padding_x, padding_y, \
787                  NE, l, origin)                  NE, l, origin)
788    
789          self.NE=NE_new          self.NE=NE_new

Legend:
Removed from v.4005  
changed lines
  Added in v.4007

  ViewVC Help
Powered by ViewVC 1.1.26