/[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 4132 by caltinay, Fri Jan 11 05:46:49 2013 UTC revision 4145 by caltinay, Fri Jan 18 00:51:49 2013 UTC
# Line 1  Line 1 
1    
2  ##############################################################################  ##############################################################################
3  #  #
4  # Copyright (c) 2003-2012 by University of Queensland  # Copyright (c) 2003-2013 by University of Queensland
5  # http://www.uq.edu.au  # http://www.uq.edu.au
6  #  #
7  # Primary Business: Queensland, Australia  # Primary Business: Queensland, Australia
# Line 15  Line 15 
15    
16  """Data readers/providers for inversions"""  """Data readers/providers for inversions"""
17    
18  __copyright__="""Copyright (c) 2003-2012 by University of Queensland  __copyright__="""Copyright (c) 2003-2013 by University of Queensland
19  http://www.uq.edu.au  http://www.uq.edu.au
20  Primary Business: Queensland, Australia"""  Primary Business: Queensland, Australia"""
21  __license__="""Licensed under the Open Software License version 3.0  __license__="""Licensed under the Open Software License version 3.0
22  http://www.opensource.org/licenses/osl-3.0.php"""  http://www.opensource.org/licenses/osl-3.0.php"""
23  __url__="https://launchpad.net/escript-finley"  __url__="https://launchpad.net/escript-finley"
24    
25  __all__ = ['simpleGeoMagneticFluxDensity', 'DataSource','ErMapperData', 'SyntheticDataBase' , 'SyntheticFeatureData', 'SyntheticData','SmoothAnomaly']  __all__ = ['simpleGeoMagneticFluxDensity', 'DataSource', 'ErMapperData', \
26            'SyntheticDataBase', 'SyntheticFeatureData', 'SyntheticData',
27            'SmoothAnomaly']
28    
29  import logging  import logging
30  import numpy as np  import numpy as np
31  from esys.escript import ReducedFunction  from esys.escript import ReducedFunction
32    from esys.escript import unitsSI as U
33  from esys.escript.linearPDEs import LinearSinglePDE  from esys.escript.linearPDEs import LinearSinglePDE
34  from esys.escript.util import *  from esys.escript.util import *
 import esys.escript.unitsSI as U  
35  from esys.ripley import Brick, Rectangle, ripleycpp  from esys.ripley import Brick, Rectangle, ripleycpp
36    
37  try:  try:
# Line 79  def LatLonToUTM(lon, lat, wkt_string=Non Line 81  def LatLonToUTM(lon, lat, wkt_string=Non
81      return x,y      return x,y
82    
83  def simpleGeoMagneticFluxDensity(latitude, longitude=0.):  def simpleGeoMagneticFluxDensity(latitude, longitude=0.):
84          theta = (90-latitude)/180.*np.pi      theta = (90-latitude)/180.*np.pi
85          B_0=U.Mu_0  * U.Magnetic_Dipole_Moment_Earth / (4 * np.pi *  U.R_Earth**3)      B_0=U.Mu_0  * U.Magnetic_Dipole_Moment_Earth / (4 * np.pi *  U.R_Earth**3)
86          B_theta= B_0 * sin(theta)      B_theta= B_0 * sin(theta)
87          B_r= 2 * B_0 * cos(theta)      B_r= 2 * B_0 * cos(theta)
88          return B_r, B_theta, 0.      return B_r, B_theta, 0.
89    
90  class DataSource(object):  class DataSource(object):
91      """      """
# Line 102  class DataSource(object): Line 104  class DataSource(object):
104          """          """
105          self.logger = logging.getLogger('inv.%s'%self.__class__.__name__)          self.logger = logging.getLogger('inv.%s'%self.__class__.__name__)
106          self.__subsampling_factor=1          self.__subsampling_factor=1
         self.__background_magnetic_field=None  
107    
108      def getDataExtents(self):      def getDataExtents(self):
109          """          """
# Line 127  class DataSource(object): Line 128  class DataSource(object):
128          """          """
129          This method is called by the `DomainBuilder` to retrieve the survey          This method is called by the `DomainBuilder` to retrieve the survey
130          data as `Data` objects on the given domain.          data as `Data` objects on the given domain.
131    
132          Subclasses should return one or more `Data` objects with survey data          Subclasses should return one or more `Data` objects with survey data
133          interpolated on the given ripley domain. The exact return type          interpolated on the given ripley domain. The exact return type
134          depends on the type of data.          depends on the type of data.
# Line 145  class DataSource(object): Line 147  class DataSource(object):
147      def setSubsamplingFactor(self, f):      def setSubsamplingFactor(self, f):
148          """          """
149          Sets the data subsampling factor (default=1).          Sets the data subsampling factor (default=1).
150    
151          The factor is applied in all dimensions. For example a 2D dataset          The factor is applied in all dimensions. For example a 2D dataset
152          with 300 x 150 data points will be reduced to 150 x 75 when a          with 300 x 150 data points will be reduced to 150 x 75 when a
153          subsampling factor of 2 is used.          subsampling factor of 2 is used.

Legend:
Removed from v.4132  
changed lines
  Added in v.4145

  ViewVC Help
Powered by ViewVC 1.1.26