Changeset 6086
- Timestamp:
- Dec 19, 2008, 10:38:08 AM (15 years ago)
- Location:
- anuga_core/source/anuga
- Files:
-
- 18 edited
Legend:
- Unmodified
- Added
- Removed
-
anuga_core/source/anuga/abstract_2d_finite_volumes/test_util.py
r6072 r6086 1834 1834 if __name__ == "__main__": 1835 1835 suite = unittest.makeSuite(Test_Util,'test') 1836 # suite = unittest.makeSuite(Test_Util,'test_ remove_lone_verts')1836 # suite = unittest.makeSuite(Test_Util,'test_sww2csv_gauges') 1837 1837 # runner = unittest.TextTestRunner(verbosity=2) 1838 1838 runner = unittest.TextTestRunner(verbosity=1) -
anuga_core/source/anuga/abstract_2d_finite_volumes/util.py
r6072 r6086 25 25 from anuga.utilities.system_tools import get_revision_number 26 26 from anuga.utilities.system_tools import store_version_info 27 28 from anuga.config import netcdf_mode_r, netcdf_mode_w, netcdf_mode_a 27 29 28 30 … … 272 274 if verbose: print 'Reading', filename 273 275 274 fid = NetCDFFile(filename, 'r')276 fid = NetCDFFile(filename, netcdf_mode_r) 275 277 276 278 if type(quantity_names) == types.StringType: -
anuga_core/source/anuga/config.py
r5961 r6086 2 2 """ 3 3 4 # --------------------4 ################################################################################ 5 5 # Numerical constants 6 #-------------------- 7 epsilon = 1.0e-12 # Smallest number - used for safe division 8 max_float = 1.0e36 # Largest number - used to initialise (max, min) ranges 9 default_smoothing_parameter = 0.001 # Default alpha for penalised 10 # least squares fitting 11 12 single_precision = 1.0e-6 # Smallest single precision number 6 ################################################################################ 7 8 epsilon = 1.0e-12 # Smallest number - used for safe division 9 max_float = 1.0e36 # Largest number - used to initialise 10 # (max, min) ranges 11 default_smoothing_parameter = 0.001 # Default alpha for penalised 12 # least squares fitting 13 single_precision = 1.0e-6 # Smallest single precision number 13 14 velocity_protection = 1.0e-6 14 15 15 # -------------------------------------------16 # Standard filenames, directories and system 17 # parameters used by ANUGA18 #------------------------------------------- 16 ################################################################################ 17 # Standard filenames, directories and system parameters used by ANUGA 18 ################################################################################ 19 19 20 pmesh_filename = '.\\pmesh' 20 21 version_filename = 'stored_version_info.py' … … 28 29 major_revision = '1.0beta' 29 30 30 31 #------------------- 31 ################################################################################ 32 32 # Physical constants 33 #------------------- 33 ################################################################################ 34 34 35 manning = 0.03 # Manning's friction coefficient 35 36 #g = 9.80665 # Gravity - FIXME reinstate this and fix unit tests. … … 38 39 #The 'official' average is 9.80665 39 40 40 eta_w = 3.0e-3 #Wind stress coefficient 41 rho_a = 1.2e-3 #Atmospheric density 42 rho_w = 1023 #Fluid density [kg/m^3] (rho_w = 1023 for salt water) 43 44 45 #----------------------------------------------------- 41 eta_w = 3.0e-3 # Wind stress coefficient 42 rho_a = 1.2e-3 # Atmospheric density 43 rho_w = 1023 # Fluid density [kg/m^3] (rho_w = 1023 for salt water) 44 45 ################################################################################ 46 46 # Limiters - used with linear reconstruction of vertex 47 47 # values from centroid values 48 # -----------------------------------------------------48 ################################################################################ 49 49 50 50 # Betas [0;1] control the allowed steepness of gradient for second order … … 63 63 beta_vh_dry = 0.2 64 64 65 66 65 # Alpha_balance controls how limiters are balanced between deep and shallow. 67 # A large value will favour the deep water limiters, allowing the a closer hug to the coastline. 68 # This will minimise 'creep' but at the same time cause smaller time steps 66 # A large value will favour the deep water limiters, allowing the a closer hug 67 # to the coastline. This will minimise 'creep' but at the same time cause 68 # smaller time steps 69 69 # Range: 70 71 70 alpha_balance = 2.0 72 71 … … 85 84 # This option is good with tight_slope_limiters, especially for large domains. 86 85 use_centroid_velocities = True 87 88 86 89 87 # FIXME (Ole) Maybe get rid of order altogether and use beta_w … … 91 89 default_order = 1 92 90 93 94 #------------- 91 ################################################################################ 95 92 # Timestepping 96 # -------------93 ################################################################################ 97 94 98 95 CFL = 1.0 # CFL condition assigned to domain.CFL - controls timestep size 99 96 100 97 # Choose type of timestepping, 98 #timestepping_method = 'rk2' # 2nd Order TVD scheme 101 99 timestepping_method = 'euler' # 1st order euler 102 #timestepping_method = 'rk2' # 2nd Order TVD scheme103 100 104 101 # rk2 is a little more stable than euler, so rk2 timestepping … … 109 106 beta_rk2 = 1.6 110 107 111 112 113 108 # Option to search for signatures where isolated triangles are 114 109 # responsible for a small global timestep. … … 116 111 # overall computation. 117 112 # This facility is experimental. 118 119 113 # protect_against_isolated_degenerate_timesteps = False 120 114 protect_against_isolated_degenerate_timesteps = False 121 115 122 123 116 min_timestep = 1.0e-6 # Minimal timestep accepted in ANUGA 124 117 max_timestep = 1.0e+3 125 max_smallsteps = 50 # Max number of degenerate steps allowed b4 trying first order 126 127 #Perhaps minimal timestep could be based on the geometry as follows: 128 #Define maximal possible speed in open water v_max, e.g. 500m/s (soundspeed?) 129 #Then work out minimal internal distance in mesh r_min and set 130 #min_timestep = r_min/v_max 131 # 132 #Max speeds are calculated in the flux function as 133 # 134 #lambda = v +/- sqrt(gh) 118 max_smallsteps = 50 # Max number of degenerate steps allowed b4 119 # trying first order 120 121 # Perhaps minimal timestep could be based on the geometry as follows: 122 # Define maximal possible speed in open water v_max, e.g. 500m/s (soundspeed?) 123 # Then work out minimal internal distance in mesh r_min and set 124 # min_timestep = r_min/v_max 125 # 126 # Max speeds are calculated in the flux function as 127 # 128 # lambda = v +/- sqrt(gh) 135 129 # 136 130 # so with 500 m/s, h ~ 500^2/g = 2500 m well out of the domain of the 137 131 # shallow water wave equation 138 132 # 139 #The actual soundspeed can be as high as 1530m/s 140 #(see http://staff.washington.edu/aganse/public.projects/clustering/clustering.html), 141 #but that would only happen with h>225000m in this equation. Why ? 142 #The maximal speed we specify is really related to the max speed 143 #of surface pertubation 144 # 145 #v_max = 100 #For use in domain_ext.c 146 #sound_speed = 500 147 148 149 #--------------------------------------------------- 133 # The actual soundspeed can be as high as 1530m/s 134 # (see http://staff.washington.edu/aganse/public.projects/clustering/clustering.html), 135 # but that would only happen with h>225000m in this equation. Why ? 136 # The maximal speed we specify is really related to the max speed 137 # of surface pertubation 138 # 139 # v_max = 100 #For use in domain_ext.c 140 # sound_speed = 500 141 142 ################################################################################ 150 143 # Ranges specific to the shallow water wave equation 151 # These control maximal and minimal values of 152 # quantities 153 #--------------------------------------------------- 144 # These control maximal and minimal values of quantities 145 ################################################################################ 154 146 155 147 # Water depth below which it is considered to be 0 in the model … … 163 155 maximum_allowed_speed = 0.0 # Maximal particle speed of water 164 156 #maximum_allowed_speed = 1.0 # Maximal particle speed of water 165 # Too large (100) creates 'flopping' water166 # Too small (0) creates 'creep'157 # Too large (100) creates 'flopping' water 158 # Too small (0) creates 'creep' 167 159 168 160 maximum_froude_number = 100.0 # To be used in limiters. 169 161 170 171 #------------------------------------------------------------ 162 ################################################################################ 172 163 # Performance parameters used to invoke various optimisations 173 # ------------------------------------------------------------164 ################################################################################ 174 165 175 166 use_extensions = True # Use C-extensions 176 use_psyco = True # Use psyco optimisations167 use_psyco = True # Use psyco optimisations 177 168 178 169 optimise_dry_cells = True # Exclude dry and still cells from flux computation 179 170 optimised_gradient_limiter = True # Use hardwired gradient limiter 180 use_edge_limiter = False # The edge limiter is better, but most runs have been using vertex limiting. Validations passed with this one True 9th May 2008, but many unit tests need backward compatibility flag set FIXME(Ole). 171 use_edge_limiter = False # The edge limiter is better, but most runs have been 172 # using vertex limiting. Validations passed with this 173 # one True 9th May 2008, but many unit tests need 174 # backward compatibility flag set FIXME(Ole). 181 175 182 176 points_file_block_line_size = 500 # Number of lines read in from a points file 183 177 # when blocking 184 178 185 186 187 188 189 190 179 ################################################################################ 180 # Dynamically-defined constants. 181 ################################################################################ 182 183 # Determine if we can read/write large NetCDF files 184 185 netcdf_mode_w = 'w' 186 netcdf_mode_a = 'a' 187 netcdf_mode_r = 'r' 188 189 try: 190 import tempfile 191 from Scientific.IO.NetCDF import NetCDFFile 192 193 fname = tempfile.mktemp() 194 fid = NetCDFFile(fname, netcdf_mode_w) 195 fid.close() 196 netcdf_mode_w = 'wl' 197 # log('Using NetCDF large file mode') 198 except IOError: 199 pass 200 -
anuga_core/source/anuga/coordinate_transforms/test_geo_reference.py
r4663 r6086 8 8 from geo_reference import * 9 9 from Numeric import allclose,array 10 from anuga.config import netcdf_mode_r, netcdf_mode_w, netcdf_mode_a 10 11 11 12 … … 32 33 file_name = tempfile.mktemp(".geo_referenceTest") 33 34 34 out_file = NetCDFFile(file_name, 'w')35 out_file = NetCDFFile(file_name, netcdf_mode_w) 35 36 g.write_NetCDF(out_file) 36 37 out_file.close() 37 38 38 in_file = NetCDFFile(file_name, 'r')39 in_file = NetCDFFile(file_name, netcdf_mode_r) 39 40 new_g = Geo_reference(NetCDFObject=in_file) 40 41 in_file.close() … … 49 50 file_name = tempfile.mktemp(".geo_referenceTest") 50 51 51 outfile = NetCDFFile(file_name, 'w')52 outfile = NetCDFFile(file_name, netcdf_mode_w) 52 53 outfile.xllcorner = g.get_xllcorner() 53 54 outfile.yllcorner = g.get_yllcorner() … … 55 56 outfile.close() 56 57 57 in_file = NetCDFFile(file_name, 'r')58 in_file = NetCDFFile(file_name, netcdf_mode_r) 58 59 new_g = Geo_reference(NetCDFObject=in_file) 59 60 in_file.close() -
anuga_core/source/anuga/fit_interpolate/interpolate.py
r6073 r6086 40 40 from anuga.fit_interpolate.general_fit_interpolate import FitInterpolate 41 41 from anuga.abstract_2d_finite_volumes.util import file_function 42 from anuga.config import netcdf_mode_r, netcdf_mode_w, netcdf_mode_a 42 43 43 44 # Interpolation specific exceptions … … 1311 1312 stdout = sys.stdout 1312 1313 sys.stdout = fd 1313 fid = NetCDFFile(file_name, 'r')1314 fid = NetCDFFile(file_name, netcdf_mode_r) 1314 1315 sys.stdout = stdout 1315 1316 fd.close() -
anuga_core/source/anuga/geospatial_data/geospatial_data.py
r6081 r6086 21 21 from anuga.utilities.anuga_exceptions import ANUGAError 22 22 from anuga.config import points_file_block_line_size as MAX_READ_LINES 23 23 from anuga.config import netcdf_mode_r, netcdf_mode_w, netcdf_mode_a 24 24 25 25 DEFAULT_ATTRIBUTE = 'elevation' … … 793 793 794 794 # Throws prints to screen if file not present 795 self.fid = NetCDFFile(self.file_name, 'r')795 self.fid = NetCDFFile(self.file_name, netcdf_mode_r) 796 796 797 797 (self.blocking_georef, … … 1002 1002 1003 1003 # Throws prints to screen if file not present 1004 fid = NetCDFFile(file_name, 'r')1004 fid = NetCDFFile(file_name, netcdf_mode_r) 1005 1005 1006 1006 pointlist = array(fid.variables['points']) … … 1253 1253 1254 1254 # NetCDF file definition 1255 outfile = NetCDFFile(file_name, 'w')1255 outfile = NetCDFFile(file_name, netcdf_mode_w) 1256 1256 1257 1257 # Create new file -
anuga_core/source/anuga/geospatial_data/test_geospatial_data.py
r5730 r6086 14 14 from anuga.utilities.anuga_exceptions import ANUGAError 15 15 from anuga.utilities.system_tools import get_host_name 16 from anuga.config import netcdf_mode_r, netcdf_mode_w, netcdf_mode_a 16 17 17 18 class Test_Geospatial_data(unittest.TestCase): … … 1131 1132 fileName = tempfile.mktemp(".pts") 1132 1133 # NetCDF file definition 1133 outfile = NetCDFFile(fileName, 'w')1134 outfile = NetCDFFile(fileName, netcdf_mode_w) 1134 1135 1135 1136 # dimension definitions … … 1288 1289 FN = 'test_points.pts' 1289 1290 # NetCDF file definition 1290 outfile = NetCDFFile(FN, 'w')1291 outfile = NetCDFFile(FN, netcdf_mode_w) 1291 1292 1292 1293 # dimension definitions … … 1329 1330 FN = 'test_points.pts' 1330 1331 # NetCDF file definition 1331 outfile = NetCDFFile(FN, 'w')1332 outfile = NetCDFFile(FN, netcdf_mode_w) 1332 1333 1333 1334 # Make up an arbitrary georef -
anuga_core/source/anuga/load_mesh/loadASCII.py
r6074 r6086 66 66 67 67 from Scientific.IO.NetCDF import NetCDFFile 68 from anuga.config import netcdf_mode_r, netcdf_mode_w, netcdf_mode_a 69 68 70 69 71 import exceptions … … 682 684 # NetCDF file definition 683 685 try: 684 outfile = NetCDFFile(file_name, 'w')686 outfile = NetCDFFile(file_name, netcdf_mode_w) 685 687 except IOError: 686 688 msg = 'File %s could not be created' % file_name … … 844 846 845 847 #throws prints to screen if file not present 846 fid = NetCDFFile(file_name, 'r')848 fid = NetCDFFile(file_name, netcdf_mode_r) 847 849 mesh = {} 848 850 -
anuga_core/source/anuga/shallow_water/benchmark_sww2dem.py
r4894 r6086 34 34 from anuga.fit_interpolate.interpolate import benchmark_interpolate 35 35 from anuga.shallow_water.data_manager import Write_sww, export_grid 36 from anuga.config import netcdf_mode_r, netcdf_mode_w, netcdf_mode_a 37 36 38 37 39 def mem_usage(): … … 105 107 106 108 # NetCDF file definition 107 fid = NetCDFFile(sww_fileName, 'w')109 fid = NetCDFFile(sww_fileName, netcdf_mode_w) 108 110 sww = Write_sww() 109 111 sww.store_header(fid, 0, -
anuga_core/source/anuga/shallow_water/data_manager.py
r6080 r6086 78 78 from anuga.config import minimum_storable_height as \ 79 79 default_minimum_storable_height 80 from anuga.config import netcdf_mode_r, netcdf_mode_w, netcdf_mode_a 80 81 from anuga.config import max_float 81 82 from anuga.utilities.numerical_tools import ensure_numeric, mean … … 300 301 # @param extension 301 302 # @param mode The mode of the underlying file. 302 def __init__(self, domain, extension, mode= 'w'):303 assert mode in ['r', 'w', 'a'], \303 def __init__(self, domain, extension, mode=netcdf_mode_w): 304 assert mode[0] in ['r', 'w', 'a'], \ 304 305 "Mode %s must be either:\n" % mode + \ 305 306 " 'w' (write)\n" + \ … … 341 342 # @param max_size ?? 342 343 # @param recursion ?? 343 # @note Prepare the unde lying data file if mode is'w'.344 def __init__(self, domain, mode= 'w', max_size=2000000000, recursion=False):344 # @note Prepare the underlying data file if mode starts with 'w'. 345 def __init__(self, domain, mode=netcdf_mode_w, max_size=2000000000, recursion=False): 345 346 from Scientific.IO.NetCDF import NetCDFFile 346 347 from Numeric import Int, Float, Float32 … … 363 364 # NetCDF file definition 364 365 fid = NetCDFFile(self.filename, mode) 365 if mode == 'w':366 if mode[0] == 'w': 366 367 description = 'Output from anuga.abstract_2d_finite_volumes ' \ 367 368 'suitable for plotting' … … 429 430 430 431 # append to the NetCDF file 431 fid = NetCDFFile(self.filename, 'a')432 433 # Get the variables434 x = fid.variables['x']435 y = fid.variables['y']436 z = fid.variables['elevation']437 volumes = fid.variables['volumes']432 fid = NetCDFFile(self.filename, netcdf_mode_a) 433 434 # # Get the variables 435 # x = fid.variables['x'] 436 # y = fid.variables['y'] 437 # z = fid.variables['elevation'] 438 # volumes = fid.variables['volumes'] 438 439 439 440 # Get X, Y and bed elevation Z … … 445 446 self.writer.store_triangulation(fid, 446 447 points, 447 V.astype(volumes.typecode()), 448 # V.astype(volumes.typecode()), 449 V.astype(Float32), 448 450 Z, 449 451 points_georeference=\ … … 475 477 while not file_open and retries < 10: 476 478 try: 477 fid = NetCDFFile(self.filename, 'a') # Open existing file479 fid = NetCDFFile(self.filename, netcdf_mode_a) # Open existing file 478 480 except IOError: 479 481 # This could happen if someone was reading the file. … … 623 625 # @param domain ?? 624 626 # @param mode Mode of underlying data file (default WRITE). 625 def __init__(self, domain, mode= 'w'):627 def __init__(self, domain, mode=netcdf_mode_w): 626 628 from Scientific.IO.NetCDF import NetCDFFile 627 629 from Numeric import Int, Float, Float … … 633 635 # NetCDF file definition 634 636 fid = NetCDFFile(self.filename, mode) 635 if mode == 'w':637 if mode[0] == 'w': 636 638 #Create new file 637 639 fid.institution = 'Geoscience Australia' … … 683 685 684 686 #Get NetCDF 685 fid = NetCDFFile(self.filename, 'a')687 fid = NetCDFFile(self.filename, netcdf_mode_a) 686 688 687 689 # Get the variables … … 718 720 while not file_open and retries < 10: 719 721 try: 720 fid = NetCDFFile(self.filename, 'a')722 fid = NetCDFFile(self.filename, netcdf_mode_a) 721 723 except IOError: 722 724 #This could happen if someone was reading the file. … … 1134 1136 FN = create_filename('.', basefilename, 'sww', size) 1135 1137 print 'Reading from ', FN 1136 fid = NetCDFFile(FN, 'r') #Open existing file for read1138 fid = NetCDFFile(FN, netcdf_mode_r) #Open existing file for read 1137 1139 1138 1140 # Get the variables … … 1257 1259 1258 1260 # Get NetCDF 1259 infile = NetCDFFile(filename1, 'r') #Open existing file for read1260 outfile = NetCDFFile(filename2, 'w') #Open new file1261 infile = NetCDFFile(filename1, netcdf_mode_r) #Open existing file for read 1262 outfile = NetCDFFile(filename2, netcdf_mode_w) #Open new file 1261 1263 1262 1264 # Copy dimensions … … 1303 1305 # @return A class instance of required domain and mode. 1304 1306 #Get data objects 1305 def get_dataobject(domain, mode= 'w'):1307 def get_dataobject(domain, mode=netcdf_mode_w): 1306 1308 """Return instance of class of given format using filename 1307 1309 """ … … 1389 1391 1390 1392 # Get NetCDF 1391 infile = NetCDFFile(root + '.dem', 'r')1393 infile = NetCDFFile(root + '.dem', netcdf_mode_r) 1392 1394 1393 1395 if verbose: print 'Reading DEM from %s' %(root + '.dem') … … 1419 1421 1420 1422 # NetCDF file definition 1421 outfile = NetCDFFile(ptsname, 'w')1423 outfile = NetCDFFile(ptsname, netcdf_mode_w) 1422 1424 1423 1425 # Create new file … … 2700 2702 2701 2703 # NetCDF file definition 2702 fid = NetCDFFile(netcdfname, 'w')2704 fid = NetCDFFile(netcdfname, netcdf_mode_w) 2703 2705 2704 2706 #Create new file … … 2829 2831 if verbose: print 'Reading files %s_*.nc' % basename_in 2830 2832 2831 file_h = NetCDFFile(basename_in + '_ha.nc', 'r') # Wave amplitude (cm)2832 file_u = NetCDFFile(basename_in + '_ua.nc', 'r') # Velocity (x) (cm/s)2833 file_v = NetCDFFile(basename_in + '_va.nc', 'r') # Velocity (y) (cm/s)2834 file_e = NetCDFFile(basename_in + '_e.nc', 'r') # Elevation (z) (m)2833 file_h = NetCDFFile(basename_in + '_ha.nc', netcdf_mode_r) # Wave amplitude (cm) 2834 file_u = NetCDFFile(basename_in + '_ua.nc', netcdf_mode_r) # Velocity (x) (cm/s) 2835 file_v = NetCDFFile(basename_in + '_va.nc', netcdf_mode_r) # Velocity (y) (cm/s) 2836 file_e = NetCDFFile(basename_in + '_e.nc', netcdf_mode_r) # Elevation (z) (m) 2835 2837 2836 2838 if basename_out is None: … … 3033 3035 3034 3036 # NetCDF file definition 3035 outfile = NetCDFFile(swwname, 'w')3037 outfile = NetCDFFile(swwname, netcdf_mode_w) 3036 3038 3037 3039 description = 'Converted from Ferret files: %s, %s, %s, %s' \ … … 3263 3265 from Scientific.IO.NetCDF import NetCDFFile 3264 3266 3265 fid = NetCDFFile(filename + '.tms', 'w')3267 fid = NetCDFFile(filename + '.tms', netcdf_mode_w) 3266 3268 3267 3269 fid.institution = 'Geoscience Australia' … … 3312 3314 3313 3315 #Get NetCDF 3314 fid = NetCDFFile(file_name, 'r')3316 fid = NetCDFFile(file_name, netcdf_mode_r) 3315 3317 3316 3318 # Get the variables … … 3355 3357 if verbose: print 'Reading from ', filename 3356 3358 3357 fid = NetCDFFile(filename, 'r') # Open existing file for read3359 fid = NetCDFFile(filename, netcdf_mode_r) # Open existing file for read 3358 3360 time = fid.variables['time'] # Timesteps 3359 3361 if t is None: … … 3647 3649 3648 3650 #Open existing netcdf file to read 3649 infile = NetCDFFile(inname, 'r')3651 infile = NetCDFFile(inname, netcdf_mode_r) 3650 3652 3651 3653 if verbose: print 'Reading DEM from %s' % inname … … 3684 3686 3685 3687 #Open netcdf file for output 3686 outfile = NetCDFFile(outname, 'w')3688 outfile = NetCDFFile(outname, netcdf_mode_w) 3687 3689 3688 3690 #Create new file … … 3925 3927 3926 3928 # NetCDF file definition 3927 outfile = NetCDFFile(sww_file, 'w')3929 outfile = NetCDFFile(sww_file, netcdf_mode_w) 3928 3930 3929 3931 #Create new file … … 4276 4278 4277 4279 # NetCDF file definition 4278 self.outfile = NetCDFFile(file_name, 'w')4280 self.outfile = NetCDFFile(file_name, netcdf_mode_w) 4279 4281 outfile = self.outfile 4280 4282 … … 4557 4559 4558 4560 # NetCDF file definition 4559 outfile = NetCDFFile(file_out, 'w')4561 outfile = NetCDFFile(file_out, netcdf_mode_w) 4560 4562 4561 4563 #Create new file … … 5136 5138 if verbose: print 'Output to ', swwname 5137 5139 5138 outfile = NetCDFFile(swwname, 'w')5140 outfile = NetCDFFile(swwname, netcdf_mode_w) 5139 5141 5140 5142 # For a different way of doing this, check out tsh2sww … … 5528 5530 5529 5531 # NetCDF file definition 5530 outfile = NetCDFFile(stsname, 'w')5532 outfile = NetCDFFile(stsname, netcdf_mode_w) 5531 5533 5532 5534 description = 'Converted from URS mux2 files: %s' % basename_in … … 5628 5630 5629 5631 try: 5630 fid = NetCDFFile(stsname + '.sts', 'r')5632 fid = NetCDFFile(stsname + '.sts', netcdf_mode_r) 5631 5633 except: 5632 5634 msg = 'Cannot open %s' % stsname + '.sts' … … 6718 6720 if verbose: print 'Reading from ', filename 6719 6721 6720 fid = NetCDFFile(filename, 'r') # Open existing file for read6722 fid = NetCDFFile(filename, netcdf_mode_r) # Open existing file for read 6721 6723 time = fid.variables['time'][:] # Time vector 6722 6724 time += fid.starttime[0] -
anuga_core/source/anuga/shallow_water/most2nc.py
r6058 r6086 9 9 import sys 10 10 from Scientific.IO.NetCDF import NetCDFFile 11 from anuga.config import netcdf_mode_r, netcdf_mode_w, netcdf_mode_a 11 12 12 13 … … 75 76 if verbose: print 'writing results' 76 77 77 out_file = NetCDFFile(output_file, 'w')78 out_file = NetCDFFile(output_file, netcdf_mode_w) 78 79 79 80 out_file.createDimension(long_name,nx) -
anuga_core/source/anuga/shallow_water/shallow_water_domain.py
r6055 r6086 108 108 from anuga.config import use_edge_limiter 109 109 from anuga.config import use_centroid_velocities 110 from anuga.config import netcdf_mode_r, netcdf_mode_w, netcdf_mode_a 110 111 111 112 from anuga.fit_interpolate.interpolate import Modeltime_too_late, Modeltime_too_early … … 625 626 626 627 # Initialise writer 627 self.writer = get_dataobject(self, mode = 'w')628 self.writer = get_dataobject(self, mode=netcdf_mode_w) 628 629 629 630 # Store vertices and connectivity -
anuga_core/source/anuga/shallow_water/test_data_manager.py
r6010 r6086 22 22 from anuga.coordinate_transforms.redfearn import degminsec2decimal_degrees 23 23 from anuga.abstract_2d_finite_volumes.util import file_function 24 25 24 from anuga.utilities.system_tools import get_pathname_from_package 25 from anuga.config import netcdf_mode_r, netcdf_mode_w, netcdf_mode_a 26 26 27 27 # This is needed to run the tests of local functions … … 32 32 from anuga.geospatial_data.geospatial_data import Geospatial_data 33 33 34 34 35 class Test_Data_Manager(unittest.TestCase): 35 36 # Class variable … … 42 43 import time 43 44 from mesh_factory import rectangular 44 45 45 46 46 self.verbose = Test_Data_Manager.verbose … … 105 105 106 106 for ext in ['_ha.nc', '_ua.nc', '_va.nc', '_e.nc']: 107 fid = NetCDFFile(self.test_MOST_file + ext, 'w')107 fid = NetCDFFile(self.test_MOST_file + ext, netcdf_mode_w) 108 108 109 109 fid.createDimension(long_name,nx) … … 180 180 sww.store_connectivity() 181 181 182 fid = NetCDFFile(sww.filename, 'r') #Open existing file for append182 fid = NetCDFFile(sww.filename, netcdf_mode_r) #Open existing file for append 183 183 184 184 # Get the variables … … 214 214 #Check contents 215 215 #Get NetCDF 216 fid = NetCDFFile(sww.filename, 'r') #Open existing file for append216 fid = NetCDFFile(sww.filename, netcdf_mode_r) #Open existing file for append 217 217 218 218 # Get the variables … … 247 247 248 248 # Get NetCDF 249 fid = NetCDFFile(sww.filename, 'r') # Open existing file for append249 fid = NetCDFFile(sww.filename, netcdf_mode_r) # Open existing file for append 250 250 251 251 # Get the variables … … 326 326 327 327 # Get NetCDF 328 fid = NetCDFFile(sww.filename, 'r') # Open existing file for append328 fid = NetCDFFile(sww.filename, netcdf_mode_r) # Open existing file for append 329 329 330 330 # Get the variables … … 372 372 #Check contents 373 373 #Get NetCDF 374 fid = NetCDFFile(sww.filename, 'r') #Open existing file for append374 fid = NetCDFFile(sww.filename, netcdf_mode_r) #Open existing file for append 375 375 376 376 # Get the variables … … 413 413 #Check contents 414 414 #Get NetCDF 415 fid = NetCDFFile(sww.filename, 'r') #Open existing file for append415 fid = NetCDFFile(sww.filename, netcdf_mode_r) #Open existing file for append 416 416 417 417 … … 465 465 #Check contents 466 466 #Get NetCDF 467 fid = NetCDFFile(sww.filename, 'r') #Open existing file for append467 fid = NetCDFFile(sww.filename, netcdf_mode_r) #Open existing file for append 468 468 469 469 # Get the variables … … 522 522 #Check contents 523 523 #Get NetCDF 524 fid = NetCDFFile(sww.filename, 'r')524 fid = NetCDFFile(sww.filename, inetcdf_mode_r) 525 525 526 526 # Get the variables … … 586 586 587 587 #Get NetCDF 588 fid = NetCDFFile(self.domain.writer.filename, 'r')588 fid = NetCDFFile(self.domain.writer.filename, netcdf_mode_r) 589 589 stage_file = fid.variables['stage'] 590 590 … … 627 627 #Check contents 628 628 #Get NetCDF 629 fid = NetCDFFile(sww.filename, 'r')629 fid = NetCDFFile(sww.filename, netcdf_mode_r) 630 630 631 631 … … 677 677 #Check contents 678 678 #Get NetCDF 679 fid = NetCDFFile(sww.filename, 'r')679 fid = NetCDFFile(sww.filename, netcdf_mode_r) 680 680 681 681 # Get the variables … … 787 787 #Check contents 788 788 #Get NetCDF 789 fid = NetCDFFile(root+'.pts', 'r')789 fid = NetCDFFile(root+'.pts', netcdf_mode_r) 790 790 791 791 # Get the variables … … 908 908 #Check contents 909 909 #Get NetCDF 910 fid = NetCDFFile(root+'.pts', 'r')910 fid = NetCDFFile(root+'.pts', netcdf_mode_r) 911 911 912 912 # Get the variables … … 1039 1039 #Check contents 1040 1040 #Get NetCDF 1041 fid = NetCDFFile(root+'.pts', 'r')1041 fid = NetCDFFile(root+'.pts', netcdf_mode_r) 1042 1042 1043 1043 # Get the variables … … 1180 1180 #Check contents 1181 1181 #Get NetCDF 1182 fid = NetCDFFile(root+'.pts', 'r')1182 fid = NetCDFFile(root+'.pts', netcdf_mode_r) 1183 1183 1184 1184 # Get the variables … … 1266 1266 #Get NetCDF 1267 1267 1268 fid = NetCDFFile(sww.filename, 'r')1268 fid = NetCDFFile(sww.filename, netcdf_mode_r) 1269 1269 1270 1270 # Get the variables … … 1460 1460 #Get NetCDF 1461 1461 1462 fid = NetCDFFile(sww.filename, 'r')1462 fid = NetCDFFile(sww.filename, netcdf_mode_r) 1463 1463 1464 1464 # Get the variables … … 1542 1542 #Get NetCDF 1543 1543 1544 fid = NetCDFFile(sww.filename, 'r')1544 fid = NetCDFFile(sww.filename, netcdf_mode_r) 1545 1545 1546 1546 # Get the variables … … 1681 1681 #Get NetCDF 1682 1682 1683 fid = NetCDFFile(sww.filename, 'r')1683 fid = NetCDFFile(sww.filename, netcdf_mode_r) 1684 1684 1685 1685 # Get the variables … … 1828 1828 #Get NetCDF 1829 1829 1830 fid = NetCDFFile(sww.filename, 'r')1830 fid = NetCDFFile(sww.filename, netcdf_mode_r) 1831 1831 1832 1832 # Get the variables … … 1991 1991 #Get NetCDF 1992 1992 1993 fid = NetCDFFile(sww.filename, 'r')1993 fid = NetCDFFile(sww.filename, netcdf_mode_r) 1994 1994 1995 1995 # Get the variables … … 2182 2182 #Get NetCDF 2183 2183 2184 fid = NetCDFFile(sww.filename, 'r')2184 fid = NetCDFFile(sww.filename, netcdf_mode_r) 2185 2185 2186 2186 # Get the variables … … 2330 2330 #Get NetCDF 2331 2331 2332 fid = NetCDFFile(sww.filename, 'r')2332 fid = NetCDFFile(sww.filename, netcdf_mode_r) 2333 2333 2334 2334 # Get the variables … … 2443 2443 #Get NetCDF 2444 2444 2445 fid = NetCDFFile(sww.filename, 'r')2445 fid = NetCDFFile(sww.filename, netcdf_mode_r) 2446 2446 2447 2447 # Get the variables … … 2593 2593 #Get NetCDF 2594 2594 2595 fid = NetCDFFile(swwfile, 'r')2595 fid = NetCDFFile(swwfile, netcdf_mode_r) 2596 2596 2597 2597 # Get the variables … … 2704 2704 #Get NetCDF 2705 2705 2706 fid = NetCDFFile(sww.filename, 'r')2706 fid = NetCDFFile(sww.filename, netcdf_mode_r) 2707 2707 2708 2708 # Get the variables … … 2800 2800 2801 2801 # Check contents in NetCDF 2802 fid = NetCDFFile(sww.filename, 'r')2802 fid = NetCDFFile(sww.filename, netcdf_mode_r) 2803 2803 2804 2804 # Get the variables … … 3174 3174 from anuga.coordinate_transforms.redfearn import redfearn 3175 3175 import os 3176 fid1 = NetCDFFile('test_ha.nc', 'w')3177 fid2 = NetCDFFile('test_ua.nc', 'w')3178 fid3 = NetCDFFile('test_va.nc', 'w')3179 fid4 = NetCDFFile('test_e.nc', 'w')3176 fid1 = NetCDFFile('test_ha.nc',netcdf_mode_w) 3177 fid2 = NetCDFFile('test_ua.nc',netcdf_mode_w) 3178 fid3 = NetCDFFile('test_va.nc',netcdf_mode_w) 3179 fid4 = NetCDFFile('test_e.nc',netcdf_mode_w) 3180 3180 3181 3181 h1_list = [150.66667,150.83334,151.] … … 3262 3262 fid4.sync(); fid4.close() 3263 3263 3264 fid1 = NetCDFFile('test_ha.nc', 'r')3265 fid2 = NetCDFFile('test_e.nc', 'r')3266 fid3 = NetCDFFile('test_va.nc', 'r')3264 fid1 = NetCDFFile('test_ha.nc',netcdf_mode_r) 3265 fid2 = NetCDFFile('test_e.nc',netcdf_mode_r) 3266 fid3 = NetCDFFile('test_va.nc',netcdf_mode_r) 3267 3267 3268 3268 … … 3334 3334 from anuga.coordinate_transforms.redfearn import redfearn 3335 3335 import os 3336 fid1 = NetCDFFile('test_ha.nc', 'w')3337 fid2 = NetCDFFile('test_ua.nc', 'w')3338 fid3 = NetCDFFile('test_va.nc', 'w')3339 fid4 = NetCDFFile('test_e.nc', 'w')3336 fid1 = NetCDFFile('test_ha.nc',netcdf_mode_w) 3337 fid2 = NetCDFFile('test_ua.nc',netcdf_mode_w) 3338 fid3 = NetCDFFile('test_va.nc',netcdf_mode_w) 3339 fid4 = NetCDFFile('test_e.nc',netcdf_mode_w) 3340 3340 3341 3341 h1_list = [150.66667,150.83334,151.] … … 3426 3426 fid4.sync(); fid4.close() 3427 3427 3428 fid1 = NetCDFFile('test_ha.nc', 'r')3429 fid2 = NetCDFFile('test_e.nc', 'r')3430 fid3 = NetCDFFile('test_va.nc', 'r')3428 fid1 = NetCDFFile('test_ha.nc',netcdf_mode_r) 3429 fid2 = NetCDFFile('test_e.nc',netcdf_mode_r) 3430 fid3 = NetCDFFile('test_va.nc',netcdf_mode_r) 3431 3431 3432 3432 … … 3491 3491 3492 3492 #Read output file 'small.sww' 3493 #fid = NetCDFFile('small.sww', 'r')3493 #fid = NetCDFFile('small.sww', netcdf_mode_r) 3494 3494 fid = NetCDFFile(self.test_MOST_file + '.sww') 3495 3495 … … 3969 3969 3970 3970 filename = root + '.dem' 3971 fid = NetCDFFile(filename, 'w')3971 fid = NetCDFFile(filename, netcdf_mode_w) 3972 3972 3973 3973 fid.institution = 'Geoscience Australia' … … 4026 4026 4027 4027 #Open decimated NetCDF file 4028 fid = NetCDFFile(root + '_100.dem', 'r')4028 fid = NetCDFFile(root + '_100.dem', netcdf_mode_r) 4029 4029 4030 4030 # Get decimated elevation … … 4052 4052 4053 4053 filename = root + '.dem' 4054 fid = NetCDFFile(filename, 'w')4054 fid = NetCDFFile(filename, netcdf_mode_w) 4055 4055 4056 4056 fid.institution = 'Geoscience Australia' … … 4121 4121 4122 4122 #Open decimated NetCDF file 4123 fid = NetCDFFile(root + '_100.dem', 'r')4123 fid = NetCDFFile(root + '_100.dem', netcdf_mode_r) 4124 4124 4125 4125 # Get decimated elevation … … 4304 4304 # check the sww file 4305 4305 4306 fid = NetCDFFile(sww_file, 'r') #Open existing file for read4306 fid = NetCDFFile(sww_file, netcdf_mode_r) #Open existing file for read 4307 4307 x = fid.variables['x'][:] 4308 4308 y = fid.variables['y'][:] … … 4614 4614 # check the sww file 4615 4615 4616 fid = NetCDFFile(sww_file, 'r') #Open existing file for read4616 fid = NetCDFFile(sww_file, netcdf_mode_r) #Open existing file for read 4617 4617 x = fid.variables['x'][:] 4618 4618 y = fid.variables['y'][:] … … 4808 4808 # check the sww file 4809 4809 4810 fid = NetCDFFile(sww_file, 'r') #Open existing file for read4810 fid = NetCDFFile(sww_file, netcdf_mode_r) #Open existing file for read 4811 4811 x = fid.variables['x'][:] 4812 4812 y = fid.variables['y'][:] … … 7118 7118 7119 7119 # Read in sts file for this source file 7120 fid = NetCDFFile(sts_name_out+'.sts', 'r') # Open existing file for read7120 fid = NetCDFFile(sts_name_out+'.sts', netcdf_mode_r) # Open existing file for read 7121 7121 x = fid.variables['x'][:]+fid.xllcorner # x-coordinates of vertices 7122 7122 y = fid.variables['y'][:]+fid.yllcorner # y-coordinates of vertices … … 7274 7274 7275 7275 # read in sts file for combined source 7276 fid = NetCDFFile(sts_name_out+'.sts', 'r') #Open existing file for read7276 fid = NetCDFFile(sts_name_out+'.sts', netcdf_mode_r) #Open existing file for read 7277 7277 x = fid.variables['x'][:]+fid.xllcorner #x-coordinates of vertices 7278 7278 y = fid.variables['y'][:]+fid.yllcorner #y-coordinates of vertices … … 10007 10007 10008 10008 filename = tempfile.mktemp("_data_manager.sww") 10009 outfile = NetCDFFile(filename, "w")10009 outfile = NetCDFFile(filename, netcdf_mode_w) 10010 10010 points_utm = array([[0.,0.],[1.,1.], [0.,1.]]) 10011 10011 volumes = (0,1,2) … … 10039 10039 10040 10040 filename = tempfile.mktemp("_data_manager.sww") 10041 outfile = NetCDFFile(filename, "w")10041 outfile = NetCDFFile(filename, netcdf_mode_w) 10042 10042 points_utm = array([[0.,0.],[1.,1.], [0.,1.]]) 10043 10043 volumes = (0,1,2) … … 10074 10074 10075 10075 filename = tempfile.mktemp("_data_manager.sww") 10076 outfile = NetCDFFile(filename, "w")10076 outfile = NetCDFFile(filename, netcdf_mode_w) 10077 10077 points_utm = array([[0.,0.],[1.,1.], [0.,1.]]) 10078 10078 volumes = (0,1,2) … … 10113 10113 10114 10114 filename = tempfile.mktemp("_data_manager.sww") 10115 outfile = NetCDFFile(filename, "w")10115 outfile = NetCDFFile(filename, netcdf_mode_w) 10116 10116 points_utm = array([[0.,0.],[1.,1.], [0.,1.]]) 10117 10117 volumes = (0,1,2) … … 10149 10149 10150 10150 filename = tempfile.mktemp("_data_manager.sww") 10151 outfile = NetCDFFile(filename, "w")10151 outfile = NetCDFFile(filename, netcdf_mode_w) 10152 10152 points_utm = array([[0.,0.],[1.,1.], [0.,1.]]) 10153 10153 volumes = (0,1,2) … … 10472 10472 10473 10473 # Check that mimimum_storable_height works 10474 fid = NetCDFFile(swwfile, 'r') # Open existing file10474 fid = NetCDFFile(swwfile, netcdf_mode_r) # Open existing file 10475 10475 10476 10476 stage = fid.variables['stage'][:] … … 11049 11049 11050 11050 suite = unittest.makeSuite(Test_Data_Manager,'test') 11051 #suite = unittest.makeSuite(Test_Data_Manager,'test_file_boundary_stsI_beyond_model_time')11051 # suite = unittest.makeSuite(Test_Data_Manager,'test_export_gridIII') 11052 11052 #suite = unittest.makeSuite(Test_Data_Manager,'test_file_boundary_stsIV_sinewave_ordering') 11053 11053 #suite = unittest.makeSuite(Test_Data_Manager,'test_get_flow_through_cross_section_with_geo') -
anuga_core/source/anuga/shallow_water/test_most2nc.py
r3567 r6086 1 1 import unittest 2 2 from Numeric import allclose, asarray 3 from Scientific.IO.NetCDF import NetCDFFile 3 4 import most2nc 4 from Scientific.IO.NetCDF import NetCDFFile5 5 import os 6 6 -
anuga_core/source/anuga/shallow_water/test_shallow_water_domain.py
r6051 r6086 6 6 7 7 from anuga.config import g, epsilon 8 from anuga.config import netcdf_mode_r, netcdf_mode_w, netcdf_mode_a 8 9 from Numeric import allclose, alltrue, array, zeros, ones, Float, take 9 10 from anuga.utilities.numerical_tools import mean … … 6188 6189 6189 6190 #Get NetCDF 6190 fid = NetCDFFile(domain.writer.filename, 'r')6191 fid = NetCDFFile(domain.writer.filename, netcdf_mode_r) 6191 6192 stage_file = fid.variables['stage'] 6192 6193 -
anuga_core/source/anuga/shallow_water/test_system.py
r5878 r6086 16 16 from anuga.pmesh.mesh import Mesh 17 17 from anuga.abstract_2d_finite_volumes.pmesh2domain import pmesh_instance_to_domain_instance 18 18 from anuga.config import netcdf_mode_r, netcdf_mode_w, netcdf_mode_a 19 19 20 20 … … 114 114 115 115 # do an assertion on the time of the produced sww file 116 fid = NetCDFFile(filename, 'r') #Open existing file for read116 fid = NetCDFFile(filename, netcdf_mode_r) #Open existing file for read 117 117 times = fid.variables['time'][:] 118 118 #print "times", times … … 165 165 166 166 # do an assertion on the time of the produced sww file 167 fid = NetCDFFile(filename, 'r') #Open existing file for read167 fid = NetCDFFile(filename, netcdf_mode_r) #Open existing file for read 168 168 times = fid.variables['time'][:] 169 169 stage = fid.variables['stage'][:] -
anuga_core/source/anuga/test_all.py
r4978 r6086 20 20 exclude_files = [] 21 21 22 #if sys.platform != 'win32': 22 #if sys.platform != 'win32': 23 23 # exclude_files.append('test_advection.py') #Weave doesn't work on Linux 24 25 24 # Exclude test_advection on all platforms for the time being. See ticket:205 26 25 #exclude_files.append('test_advection.py') #Weave doesn't work on Linux 27 26 27 # Directories that should not be searched for test files. 28 28 29 # Directories that should not be searched for test files. 30 exclude_dirs = ['pypar_dist', #Special requirements 29 exclude_dirs = ['pypar_dist', #Special requirements 31 30 'props', 'wcprops', 'prop-base', 'text-base', '.svn', #Svn 32 31 'tmp'] 33 34 32 35 33 print "The following directories will be skipped over;" … … 38 36 print "" 39 37 38 40 39 def get_test_files(path): 41 42 43 40 try: 44 41 files = os.listdir(path) … … 53 50 path_files = [] 54 51 for file in files: 55 56 52 absolute_filename = path + os.sep + file 57 53 58 54 #sys.path.append('pmesh') 59 55 if os.path.isdir(absolute_filename): 60 sys.path.append(file) #FIXME: May cause name conflicts between pyvolution\mesh.py and pmesh\mesh.py on some systems 56 # FIXME: May cause name conflicts between pyvolution\mesh.py and 57 # pmesh\mesh.py on some systems 58 sys.path.append(file) 61 59 path_files.append(file) 62 print file + ',', 63 more_test_files, more_path_files =\ 64 get_test_files(absolute_filename) 65 60 print file + ',', 61 more_test_files, more_path_files = \ 62 get_test_files(absolute_filename) 66 63 test_files += more_test_files 67 64 path_files += more_path_files … … 70 67 else: 71 68 pass 72 69 73 70 return test_files, path_files 74 75 71 76 72 … … 83 79 84 80 files.sort() # Ensure same order on all platforms 85 81 86 82 print 87 83 print … … 89 85 print 90 86 print 'Files tested;' 91 #print_files = []92 87 for file in files: 93 #print_files += file + ' '94 88 print file + ',', 95 89 print … … 98 92 for file in exclude_files: 99 93 print 'WARNING: File '+ file + ' to be excluded from testing' 100 try: 94 try: 101 95 files.remove(file) 102 96 except ValueError, e: 103 msg = 'File "%s" was not found in test suite.\n' % file104 msg += 'Original error is "%s"\n' % e105 msg += 'Perhaps it should be removed from exclude list?' 97 msg = 'File "%s" was not found in test suite.\n' % file 98 msg += 'Original error is "%s"\n' % e 99 msg += 'Perhaps it should be removed from exclude list?' 106 100 raise Exception, msg 107 101 … … 109 103 moduleNames = map(filenameToModuleName, files) 110 104 modules = map(__import__, moduleNames) 111 105 112 106 # Fix up the system path 113 107 for file in path_files: 114 108 sys.path.remove(file) 115 109 116 110 load = unittest.defaultTestLoader.loadTestsFromModule 117 111 testCaseClasses = map(load, modules) 118 112 119 120 113 if test_verbose is True: 121 114 # Test the code by setting verbose to True. … … 128 121 # these are the test functions 129 122 try: 130 # Calls class method set_verbose in the test case classes 131 # print 'Tests', tests._tests[0] 132 # print 'Type', type(tests._tests[0]) 123 # Calls class method set_verbose in test case classes 133 124 tests._tests[0].set_verbose() 134 125 except: 135 pass # No all classes have set_verbose126 pass # No all classes have set_verbose 136 127 return unittest.TestSuite(testCaseClasses) 128 137 129 138 130 def check_anuga_import(): … … 143 135 print "Python cannot import ANUGA module." 144 136 print "Check you have followed all steps of its installation." 145 import sys; sys.exit() 137 import sys 138 sys.exit() 146 139 147 140 148 141 if __name__ == '__main__': 149 142 check_anuga_import() 143 150 144 if len(sys.argv) > 1 and sys.argv[1][0].upper() == 'V': 151 145 test_verbose = True 152 saveout = sys.stdout 146 saveout = sys.stdout 153 147 filename = ".temp" 154 148 fid = open(filename, 'w') 155 149 sys.stdout = fid 156 150 else: 157 test_verbose = False 151 test_verbose = False 158 152 suite = regressionTest(test_verbose) 159 153 runner = unittest.TextTestRunner() #verbosity=2 160 154 runner.run(suite) 161 155 162 156 # Cleaning up 163 157 if len(sys.argv) > 1 and sys.argv[1][0].upper() == 'V': 164 sys.stdout = saveout 158 sys.stdout = saveout 165 159 #fid.close() # This was causing an error in windows 166 160 #os.remove(filename) -
anuga_core/source/anuga/utilities/test_system_tools.py
r5897 r6086 6 6 import zlib 7 7 from os.path import join, split, sep 8 from anuga.config import netcdf_mode_r, netcdf_mode_w, netcdf_mode_a 8 9 9 10 … … 85 86 # First file 86 87 filename1 = mktemp(suffix='.nc', dir='.') 87 fid = NetCDFFile(filename1, 'w')88 fid = NetCDFFile(filename1, netcdf_mode_w) 88 89 fid.createDimension('two', 2) 89 90 fid.createVariable('test_array', Float, … … 94 95 # Second file 95 96 filename2 = mktemp(suffix='.nc', dir='.') 96 fid = NetCDFFile(filename2, 'w')97 fid = NetCDFFile(filename2, netcdf_mode_w) 97 98 fid.createDimension('two', 2) 98 99 fid.createVariable('test_array', Float,
Note: See TracChangeset
for help on using the changeset viewer.