Changeset 900 for inundation


Ignore:
Timestamp:
Feb 16, 2005, 2:57:02 PM (20 years ago)
Author:
ole
Message:

Fiddle

Location:
inundation/ga/storm_surge/pyvolution
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • inundation/ga/storm_surge/pyvolution/data_manager.py

    r896 r900  
    10361036
    10371037    #Get NetCDF data
     1038    if verbose: print 'Reading files %s_*.nc' %basefilename
    10381039    file_h = NetCDFFile(basefilename + '_ha.nc', 'r') #Wave amplitude (cm)
    10391040    file_u = NetCDFFile(basefilename + '_ua.nc', 'r') #Velocity (x) (cm/s)
     
    10791080    longitudes = longitudes[lmin:lmax]
    10801081    times = times[jmin:jmax]
    1081    
     1082
     1083    if verbose: print 'cropping'
    10821084    amplitudes = file_h.variables['HA'][jmin:jmax, kmin:kmax, lmin:lmax]
    10831085    xspeed = file_u.variables['UA'][jmin:jmax, kmin:kmax, lmin:lmax]
  • inundation/ga/storm_surge/pyvolution/generic_boundary_conditions.py

    r862 r900  
    176176    """
    177177
    178 
    179     def __init__(self, filename, domain):
     178    def __init__(self, filename, domain, verbose = False):
    180179        import time
    181180        from Numeric import array, zeros, Float
     
    192191        #we don't know which ones at this stage since this object can be attached to
    193192        #any tagged boundary later on.
    194        
     193
     194        if verbose: print 'Find midpoint coordinates of entire boundary'
    195195        self.midpoint_coordinates = zeros( (len(domain.boundary), 2), Float)
    196196        boundary_keys = domain.boundary.keys()
     
    213213            self.boundary_indices[(vol_id, edge_id)] = i
    214214       
    215        
     215
     216        if verbose: print 'Initialise file_function'
    216217        self.F = file_function(filename, domain,
    217                                interpolation_points=self.midpoint_coordinates)
     218                               interpolation_points=self.midpoint_coordinates,
     219                               verbose = verbose)
    218220        self.domain = domain
    219221
  • inundation/ga/storm_surge/pyvolution/util.py

    r886 r900  
    8181   
    8282
    83 def file_function(filename, domain=None, quantities = None, interpolation_points = None):
     83def file_function(filename, domain=None, quantities = None, interpolation_points = None, verbose = False):
    8484    """If domain is specified, don't specify quantites as they are automatically derived
    8585    """
     
    105105    #FIXME: Maybe these can be merged later on
    106106    if line[:3] == 'CDF':
    107         return File_function_NetCDF(filename, domain, quantities, interpolation_points)
     107        return File_function_NetCDF(filename, domain, quantities, interpolation_points, verbose = verbose)
    108108    else:
    109109        return File_function_ASCII(filename, domain, quantities, interpolation_points)   
     
    133133    """
    134134   
    135     def  __init__(self, filename, domain=None, quantities=None, interpolation_points=None):
     135    def  __init__(self, filename, domain=None, quantities=None, interpolation_points=None, verbose = False):
    136136        """Initialise callable object from a file.
    137137
     
    142142        """
    143143
     144        #FIXME: Check that model origin is the same as file's origin
     145        #(both in UTM coordinates)
     146        #If not - modify those from file to match domain
     147       
    144148        import time, calendar
    145149        from config import time_format
     
    147151
    148152        #Open NetCDF file
     153        if verbose: print 'Reading', filename
    149154        fid = NetCDFFile(filename, 'r')
    150155
     
    192197
    193198        #Read all data in and produce values for desired data points at each timestep
    194         self.spatial_interpolation(interpolation_points)
     199        self.spatial_interpolation(interpolation_points, verbose = verbose)
    195200        fid.close()
    196201
    197     def spatial_interpolation(self, interpolation_points):
     202    def spatial_interpolation(self, interpolation_points, verbose = False):
    198203        """For each timestep in fid: read surface, interpolate to desired points
    199204        and store values for use when object is called.
     
    209214
    210215        #Get variables
     216        if verbose: print 'Get varibles'
    211217        x = fid.variables['x'][:]
    212218        y = fid.variables['y'][:]
     
    242248
    243249            #Build interpolator
     250            if verbose: print 'Build interpolation matrix'
    244251            x = reshape(x, (len(x),1))
    245252            y = reshape(y, (len(y),1))               
     
    250257                                     point_coordinates = P,
    251258                                     alpha = 0,
    252                                      verbose = False)
    253 
    254            
     259                                     verbose = verbose)
     260
     261
     262            if verbose: print 'Interpolate'
    255263            for i, t in enumerate(self.T):
    256264                #Interpolate quantities at this timestep
     265                print ' time step %d of %d' %(i, len(self.T))
    257266                for name in self.quantities:
    258267                    self.values[name][i, :] =\
Note: See TracChangeset for help on using the changeset viewer.