Changeset 900 for inundation
- Timestamp:
- Feb 16, 2005, 2:57:02 PM (20 years ago)
- Location:
- inundation/ga/storm_surge/pyvolution
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
inundation/ga/storm_surge/pyvolution/data_manager.py
r896 r900 1036 1036 1037 1037 #Get NetCDF data 1038 if verbose: print 'Reading files %s_*.nc' %basefilename 1038 1039 file_h = NetCDFFile(basefilename + '_ha.nc', 'r') #Wave amplitude (cm) 1039 1040 file_u = NetCDFFile(basefilename + '_ua.nc', 'r') #Velocity (x) (cm/s) … … 1079 1080 longitudes = longitudes[lmin:lmax] 1080 1081 times = times[jmin:jmax] 1081 1082 1083 if verbose: print 'cropping' 1082 1084 amplitudes = file_h.variables['HA'][jmin:jmax, kmin:kmax, lmin:lmax] 1083 1085 xspeed = file_u.variables['UA'][jmin:jmax, kmin:kmax, lmin:lmax] -
inundation/ga/storm_surge/pyvolution/generic_boundary_conditions.py
r862 r900 176 176 """ 177 177 178 179 def __init__(self, filename, domain): 178 def __init__(self, filename, domain, verbose = False): 180 179 import time 181 180 from Numeric import array, zeros, Float … … 192 191 #we don't know which ones at this stage since this object can be attached to 193 192 #any tagged boundary later on. 194 193 194 if verbose: print 'Find midpoint coordinates of entire boundary' 195 195 self.midpoint_coordinates = zeros( (len(domain.boundary), 2), Float) 196 196 boundary_keys = domain.boundary.keys() … … 213 213 self.boundary_indices[(vol_id, edge_id)] = i 214 214 215 215 216 if verbose: print 'Initialise file_function' 216 217 self.F = file_function(filename, domain, 217 interpolation_points=self.midpoint_coordinates) 218 interpolation_points=self.midpoint_coordinates, 219 verbose = verbose) 218 220 self.domain = domain 219 221 -
inundation/ga/storm_surge/pyvolution/util.py
r886 r900 81 81 82 82 83 def file_function(filename, domain=None, quantities = None, interpolation_points = None ):83 def file_function(filename, domain=None, quantities = None, interpolation_points = None, verbose = False): 84 84 """If domain is specified, don't specify quantites as they are automatically derived 85 85 """ … … 105 105 #FIXME: Maybe these can be merged later on 106 106 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) 108 108 else: 109 109 return File_function_ASCII(filename, domain, quantities, interpolation_points) … … 133 133 """ 134 134 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): 136 136 """Initialise callable object from a file. 137 137 … … 142 142 """ 143 143 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 144 148 import time, calendar 145 149 from config import time_format … … 147 151 148 152 #Open NetCDF file 153 if verbose: print 'Reading', filename 149 154 fid = NetCDFFile(filename, 'r') 150 155 … … 192 197 193 198 #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) 195 200 fid.close() 196 201 197 def spatial_interpolation(self, interpolation_points ):202 def spatial_interpolation(self, interpolation_points, verbose = False): 198 203 """For each timestep in fid: read surface, interpolate to desired points 199 204 and store values for use when object is called. … … 209 214 210 215 #Get variables 216 if verbose: print 'Get varibles' 211 217 x = fid.variables['x'][:] 212 218 y = fid.variables['y'][:] … … 242 248 243 249 #Build interpolator 250 if verbose: print 'Build interpolation matrix' 244 251 x = reshape(x, (len(x),1)) 245 252 y = reshape(y, (len(y),1)) … … 250 257 point_coordinates = P, 251 258 alpha = 0, 252 verbose = False) 253 254 259 verbose = verbose) 260 261 262 if verbose: print 'Interpolate' 255 263 for i, t in enumerate(self.T): 256 264 #Interpolate quantities at this timestep 265 print ' time step %d of %d' %(i, len(self.T)) 257 266 for name in self.quantities: 258 267 self.values[name][i, :] =\
Note: See TracChangeset
for help on using the changeset viewer.