Changeset 8780
- Timestamp:
- Mar 27, 2013, 8:04:00 PM (12 years ago)
- Location:
- trunk/anuga_core/source
- Files:
-
- 55 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/anuga_core/source/anuga/abstract_2d_finite_volumes/file_function.py
r8718 r8780 16 16 17 17 from anuga.geospatial_data.geospatial_data import ensure_absolute 18 from Scientific.IO.NetCDFimport NetCDFFile18 from anuga.file.netcdf import NetCDFFile 19 19 from anuga.config import netcdf_mode_r, netcdf_mode_w, netcdf_mode_a 20 20 from anuga.utilities.numerical_tools import ensure_numeric … … 297 297 # Get first timestep 298 298 try: 299 starttime = f id.starttime299 starttime = float(fid.starttime) 300 300 except ValueError: 301 301 msg = 'Could not read starttime from file %s' % filename 302 302 raise Exception(msg) 303 303 304 304 305 # Get variables -
trunk/anuga_core/source/anuga/abstract_2d_finite_volumes/gauge.py
r8718 r8780 163 163 if value.strip()=='elevation':elevation=j 164 164 else: 165 #points.append([float(row[easting]),float(row[northing])]) 165 166 points.append([float(row[easting]),float(row[northing])]) 166 167 point_name.append(row[name]) … … 170 171 171 172 points_array = ensure_absolute(points_array) 173 174 #print 'points_array', points_array 172 175 173 176 dir_name, base = os.path.split(sww_file) … … 223 226 224 227 if quake_offset_time is None: 225 quake_offset_time = callable_sww.starttime [0]228 quake_offset_time = callable_sww.starttime 226 229 227 230 for point_i, point in enumerate(points_array): … … 241 244 points_writer = writer(file(dir_name + sep + gauge_file 242 245 + point_name[point_i] + '.csv', "ab")) 246 243 247 244 248 points_list = [quake_time, quake_time/3600.] + _quantities2csv(quantities, point_quantities, callable_sww.centroids, point_i) -
trunk/anuga_core/source/anuga/abstract_2d_finite_volumes/test_gauge.py
r8718 r8780 9 9 import anuga 10 10 #from anuga.abstract_2d_finite_volumes.util import * 11 from anuga.abstract_2d_finite_volumes.gauge import *11 from anuga.abstract_2d_finite_volumes.gauge import sww2csv_gauges 12 12 from anuga.config import epsilon 13 13 … … 94 94 95 95 96 def test_sww2csv (self):96 def test_sww2csv_0(self): 97 97 98 98 """Most of this test was copied from test_interpolate … … 109 109 points = [[5.0,1.],[0.5,2.]] 110 110 111 points_file = tempfile.mktemp(".csv") 111 points_file = tempfile.mktemp(".csv") 112 112 # points_file = 'test_point.csv' 113 113 file_id = open(points_file,"w") … … 155 155 point1_handle.close() 156 156 point2_handle.close() 157 os.remove(points_file)158 os.remove(point1_filename)159 os.remove(point2_filename)157 #os.remove(points_file) 158 #os.remove(point1_filename) 159 #os.remove(point2_filename) 160 160 161 161 … … 544 544 545 545 if __name__ == "__main__": 546 suite = unittest.makeSuite(Test_Gauge, 'test ')546 suite = unittest.makeSuite(Test_Gauge, 'test_') 547 547 # runner = unittest.TextTestRunner(verbosity=2) 548 548 runner = unittest.TextTestRunner(verbosity=1) -
trunk/anuga_core/source/anuga/abstract_2d_finite_volumes/test_util.py
r8599 r8780 173 173 174 174 #Now read data from sww and check 175 from Scientific.IO.NetCDFimport NetCDFFile175 from anuga.file.netcdf import NetCDFFile 176 176 filename = domain1.get_name() + '.sww' 177 177 fid = NetCDFFile(filename) … … 375 375 376 376 #Now read data from sww and check 377 from Scientific.IO.NetCDFimport NetCDFFile377 from anuga.file.netcdf import NetCDFFile 378 378 filename = domain1.get_name() + '.sww' 379 379 fid = NetCDFFile(filename) -
trunk/anuga_core/source/anuga/config.py
r8745 r8780 228 228 s = """ 229 229 import os, tempfile 230 from Scientific.IO.NetCDFimport NetCDFFile230 from anuga.file.netcdf import NetCDFFile 231 231 232 232 filename = tempfile.mktemp('.nc') … … 237 237 """ 238 238 239 """ 239 240 # Need to run in a separate process due an 240 241 # error with older versions of Scientific.IO … … 265 266 #netcdf_mode_w = 'w' # Old style NetCDF used by OSG viewer 266 267 267 268 """ -
trunk/anuga_core/source/anuga/coordinate_transforms/test_geo_reference.py
r8125 r8780 30 30 31 31 def test_read_write_NetCDF(self): 32 from Scientific.IO.NetCDFimport NetCDFFile32 from anuga.file.netcdf import NetCDFFile 33 33 g = Geo_reference(56,1.9,1.9) 34 34 file_name = tempfile.mktemp(".geo_referenceTest") … … 47 47 def test_read_NetCDFI(self): 48 48 # test if read_NetCDF 49 from Scientific.IO.NetCDFimport NetCDFFile49 from anuga.file.netcdf import NetCDFFile 50 50 g = Geo_reference(56,1.9,1.9) 51 51 file_name = tempfile.mktemp(".geo_referenceTest") … … 65 65 66 66 def test_read_write_ASCII(self): 67 from Scientific.IO.NetCDFimport NetCDFFile67 from anuga.file.netcdf import NetCDFFile 68 68 g = Geo_reference(56,1.9,1.9) 69 69 file_name = tempfile.mktemp(".geo_referenceTest") … … 80 80 81 81 def test_read_write_ASCII2(self): 82 from Scientific.IO.NetCDFimport NetCDFFile82 from anuga.file.netcdf import NetCDFFile 83 83 g = Geo_reference(56,1.9,1.9) 84 84 file_name = tempfile.mktemp(".geo_referenceTest") … … 95 95 96 96 def test_read_write_ASCII3(self): 97 from Scientific.IO.NetCDFimport NetCDFFile97 from anuga.file.netcdf import NetCDFFile 98 98 g = Geo_reference(56,1.9,1.9) 99 99 file_name = tempfile.mktemp(".geo_referenceTest") … … 498 498 499 499 def test_read_write_ASCII_test_and_fail(self): 500 from Scientific.IO.NetCDFimport NetCDFFile500 from anuga.file.netcdf import NetCDFFile 501 501 502 502 # This is to test a fail … … 631 631 ''' 632 632 633 from Scientific.IO.NetCDFimport NetCDFFile633 from anuga.file.netcdf import NetCDFFile 634 634 635 635 # ensure that basic instance attributes are correct -
trunk/anuga_core/source/anuga/file/netcdf.py
r8145 r8780 3 3 4 4 import numpy as num 5 6 from Scientific.IO.NetCDF import NetCDFFile7 5 8 6 from anuga.coordinate_transforms.redfearn import \ … … 22 20 time_name = 'TIME' 23 21 precision = netcdf_float # So if we want to change the precision its done here 22 23 24 25 def NetCDFFile(file_name, netcdf_mode=netcdf_mode_r): 26 """Wrapper to isolate changes of the netcdf libray. 27 28 In theory we should be able to change over to NetCDF4 via this 29 wrapper, by ensuring the interface to the NetCDF library isthe same as the 30 the old Scientific.IO.NetCDF library. 31 32 There is a difference between extracting dimensions. We have used the following 33 to cover netcdf4 and scientific python 34 35 try: # works with netcdf4 36 number_of_timesteps = len(fid.dimensions['number_of_timesteps']) 37 number_of_points = len(fid.dimensions['number_of_points']) 38 except: # works with scientific.io.netcdf 39 number_of_timesteps = fid.dimensions['number_of_timesteps'] 40 number_of_points = fid.dimensions['number_of_points'] 41 42 """ 43 44 #from Scientific.IO.NetCDF import NetCDFFile 45 #return NetCDFFile(file_name, netcdf_mode) 46 47 from netCDF4 import Dataset 48 return Dataset(file_name, netcdf_mode, format='NETCDF3_64BIT') 49 50 #return Dataset(file_name, netcdf_mode, format='NETCDF3_CLASSIC') 51 52 53 # COMMENT SR; Can't use scipy.io.netcdf as we can't append to 54 # a file as of 2013/03/26 55 #from scipy.io.netcdf import netcdf_file 56 #return netcdf_file(file_name, netcdf_mode, version=2) 57 58 59 24 60 25 61 class Write_nc: -
trunk/anuga_core/source/anuga/file/sts.py
r8143 r8780 1 1 import numpy as num 2 2 import anuga.utilities.log as log 3 from Scientific.IO.NetCDFimport NetCDFFile3 from anuga.file.netcdf import NetCDFFile 4 4 5 5 from anuga.config import max_float … … 275 275 raise IOError(msg) 276 276 277 xllcorner = fid.xllcorner [0]278 yllcorner = fid.yllcorner [0]277 xllcorner = fid.xllcorner 278 yllcorner = fid.yllcorner 279 279 280 280 #Points stored in sts file are normalised to [xllcorner,yllcorner] but -
trunk/anuga_core/source/anuga/file/sww.py
r8757 r8780 17 17 from anuga.utilities.numerical_tools import ensure_numeric 18 18 import anuga.utilities.log as log 19 from Scientific.IO.NetCDFimport NetCDFFile19 from anuga.file.netcdf import NetCDFFile 20 20 21 21 from sts import Write_sts … … 67 67 def __init__(self, domain, 68 68 mode=netcdf_mode_w, max_size=2000000000, recursion=False): 69 from Scientific.IO.NetCDF import NetCDFFile70 69 71 70 self.precision = netcdf_float32 # Use single precision for quantities … … 103 102 fid = NetCDFFile(self.filename, mode) 104 103 if mode[0] == 'w': 105 description = 'Output from anuga.file.sww ' \104 description = 'Output from anuga.file.sww ' \ 106 105 'suitable for plotting' 107 106 … … 165 164 # stores both connectivity (triangulation) and static quantities 166 165 167 from Scientific.IO.NetCDF import NetCDFFile168 166 169 167 domain = self.domain … … 211 209 """ 212 210 213 from Scientific.IO.NetCDF import NetCDFFile214 211 import types 215 212 from time import sleep … … 566 563 outfile.createVariable('y', sww_precision, ('number_of_points',)) 567 564 568 outfile.createVariable('volumes', netcdf_int , ('number_of_volumes',565 outfile.createVariable('volumes', netcdf_int , ('number_of_volumes', 569 566 'number_of_vertices')) 570 567 … … 588 585 589 586 587 outfile.sync() 588 589 590 590 591 591 def store_triangulation(self, … … 639 639 640 640 number_of_points = len(points_utm) 641 volumes = num.array(volumes) 641 volumes = num.array(volumes,num.int32).reshape(-1,3) 642 643 642 644 points_utm = num.array(points_utm) 643 645 … … 668 670 y = points[:,1] 669 671 670 x = x.astype(netcdf_float32)671 y = y.astype(netcdf_float32)672 #x = x.astype(netcdf_float32) 673 #y = y.astype(netcdf_float32) 672 674 673 675 … … 688 690 outfile.variables['x'][:] = x #- geo_ref.get_xllcorner() 689 691 outfile.variables['y'][:] = y #- geo_ref.get_yllcorner() 690 outfile.variables['volumes'][:] = volumes.astype(num.int32) #On Opteron 64 692 693 694 msg = 'Mismatch between shape of volumes array and (number_of_volumes , 3)' 695 assert volumes.shape == outfile.variables['volumes'].shape, msg 696 697 outfile.variables['volumes'][:] = volumes 698 699 outfile.sync() 691 700 692 701 … … 733 742 734 743 outfile.variables['tri_full_flag'][:] = tri_full_flag.astype(num.int32) 744 745 746 outfile.sync() 735 747 736 748 … … 782 794 783 795 784 796 outfile.sync() 785 797 786 798 … … 851 863 outfile.variables[q + Write_sww.RANGE][1] = q_values_max 852 864 865 866 outfile.sync() 867 868 869 853 870 def verbose_quantities(self, outfile): 854 871 log.critical('------------------------------------------------') … … 873 890 """ 874 891 875 from Scientific.IO.NetCDF import NetCDFFile876 892 877 893 #Get NetCDF … … 903 919 """ 904 920 905 from Scientific.IO.NetCDF import NetCDFFile906 921 from anuga.shallow_water.shallow_water_domain import Domain 907 922 … … 920 935 x = fid.variables['x'][:] # x-coordinates of vertices 921 936 y = fid.variables['y'][:] # y-coordinates of vertices 922 elevation = fid.variables['elevation'] # Elevation 923 stage = fid.variables['stage'] # Water level 924 xmomentum = fid.variables['xmomentum'] # Momentum in the x-direction 925 ymomentum = fid.variables['ymomentum'] # Momentum in the y-direction 926 927 starttime = fid.starttime[0] 937 #elevation = fid.variables['elevation'] # Elevation 938 #stage = fid.variables['stage'] # Water level 939 #xmomentum = fid.variables['xmomentum'] # Momentum in the x-direction 940 #ymomentum = fid.variables['ymomentum'] # Momentum in the y-direction 941 942 starttime = fid.starttime 943 #starttime = fid.starttime[0] 928 944 volumes = fid.variables['volumes'][:] # Connectivity 929 945 coordinates = num.transpose(num.asarray([x.tolist(), y.tolist()])) … … 1078 1094 1079 1095 import types 1080 from Scientific.IO.NetCDF import NetCDFFile1081 1096 from anuga.abstract_2d_finite_volumes.neighbour_mesh import Mesh 1082 1097 … … 1085 1100 fid = NetCDFFile(filename, netcdf_mode_r) # Open existing file for read 1086 1101 time = fid.variables['time'][:] # Time vector 1087 time += fid.starttime[0] 1102 #time += fid.starttime[0] 1103 time += fid.starttime 1088 1104 1089 1105 # Get the variables as numeric arrays 1090 1106 x = fid.variables['x'][:] # x-coordinates of nodes 1091 1107 y = fid.variables['y'][:] # y-coordinates of nodes 1108 1109 1092 1110 elevation = fid.variables['elevation'][:] # Elevation 1093 1111 stage = fid.variables['stage'][:] # Water level … … 1095 1113 ymomentum = fid.variables['ymomentum'][:] # Momentum in the y-direction 1096 1114 1115 1116 1097 1117 # Mesh (nodes (Mx2), triangles (Nx3)) 1098 1118 nodes = num.concatenate((x[:,num.newaxis], y[:,num.newaxis]), axis=1) 1099 triangles = fid.variables['volumes'] [:]1119 triangles = fid.variables['volumes'] 1100 1120 1101 1121 # Get geo_reference -
trunk/anuga_core/source/anuga/file/test_mux.py
r8249 r8780 4 4 import os 5 5 from struct import pack, unpack 6 from Scientific.IO.NetCDFimport NetCDFFile6 from anuga.file.netcdf import NetCDFFile 7 7 8 8 from anuga.utilities.numerical_tools import ensure_numeric -
trunk/anuga_core/source/anuga/file/test_sww.py
r8488 r8780 10 10 from sww import load_sww_as_domain, weed, get_mesh_and_quantities_from_file, \ 11 11 Write_sww 12 from Scientific.IO.NetCDFimport NetCDFFile12 from anuga.file.netcdf import NetCDFFile 13 13 14 14 from anuga.config import netcdf_mode_w, netcdf_float … … 184 184 185 185 import time, os 186 from Scientific.IO.NetCDF import NetCDFFile187 186 188 187 # Setup … … 199 198 geo_reference = Geo_reference(56,308500,6189000)) 200 199 201 domain.set_name(' flowtest')200 domain.set_name('test_get_mesh_and_quantities_from_sww_file') 202 201 swwfile = domain.get_name() + '.sww' 203 202 domain.set_datadir('.') … … 247 246 248 247 # Cleanup 249 os.remove(swwfile)248 #os.remove(swwfile) 250 249 251 250 … … 277 276 filename = tempfile.mktemp("_data_manager.sww") 278 277 outfile = NetCDFFile(filename, netcdf_mode_w) 279 points_utm = num.array([[0.,0.],[1.,1.], 280 volumes = (0,1,2)278 points_utm = num.array([[0.,0.],[1.,1.],[0.,1.]]) 279 volumes = [[0,1,2]] 281 280 elevation = [0,1,2] 282 281 new_origin = None … … 312 311 outfile = NetCDFFile(filename, netcdf_mode_w) 313 312 points_utm = num.array([[0.,0.],[1.,1.], [0.,1.]]) 314 volumes = (0,1,2)313 volumes = [[0,1,2]] 315 314 elevation = [0,1,2] 316 315 new_origin = None … … 349 348 outfile = NetCDFFile(filename, netcdf_mode_w) 350 349 points_utm = num.array([[0.,0.],[1.,1.], [0.,1.]]) 351 volumes = (0,1,2)350 volumes = [[0,1,2]] 352 351 elevation = [0,1,2] 353 352 new_origin = None … … 388 387 outfile = NetCDFFile(filename, netcdf_mode_w) 389 388 points_utm = num.array([[0.,0.],[1.,1.], [0.,1.]]) 390 volumes = (0,1,2)389 volumes = [[0,1,2]] 391 390 elevation = [0,1,2] 392 391 new_origin = None … … 424 423 outfile = NetCDFFile(filename, netcdf_mode_w) 425 424 points_utm = num.array([[0.,0.],[1.,1.], [0.,1.]]) 426 volumes = (0,1,2)425 volumes = [[0,1,2]] 427 426 elevation = [0,1,2] 428 427 new_origin = Geo_reference(56, 1, 1) -
trunk/anuga_core/source/anuga/file_conversion/asc2dem.py
r8404 r8780 64 64 65 65 import os 66 from Scientific.IO.NetCDFimport NetCDFFile66 from anuga.file.netcdf import NetCDFFile 67 67 68 68 root = name_in[:-4] -
trunk/anuga_core/source/anuga/file_conversion/csv2sts.py
r7858 r8780 57 57 import getopt 58 58 from anuga.utilities import log 59 from Scientific.IO.NetCDFimport NetCDFFile59 from anuga.file.netcdf import NetCDFFile 60 60 from anuga.file.csv_file import load_csv_as_dict 61 61 from anuga.config import netcdf_mode_w, netcdf_float … … 98 98 fid.createVariable(col, netcdf_float, ('number_of_timesteps',)) 99 99 100 fid.variables[col] .assignValue(timeseries_data[col])100 fid.variables[col][:] = timeseries_data[col] 101 101 102 102 fid.close() -
trunk/anuga_core/source/anuga/file_conversion/dem2dem.py
r7814 r8780 24 24 25 25 import os 26 from Scientific.IO.NetCDFimport NetCDFFile26 from anuga.file.netcdf import NetCDFFile 27 27 28 28 if name_in[-4:] != '.dem': … … 38 38 39 39 # Read metadata (convert from numpy.int32 to int where appropriate) 40 ncols = int(infile.ncols [0])41 nrows = int(infile.nrows [0])42 xllcorner = infile.xllcorner [0]43 yllcorner = infile.yllcorner [0]44 cellsize = int(infile.cellsize [0])45 NODATA_value = int(infile.NODATA_value [0])46 zone = int(infile.zone [0])47 false_easting = infile.false_easting [0]48 false_northing = infile.false_northing [0]40 ncols = int(infile.ncols) 41 nrows = int(infile.nrows) 42 xllcorner = infile.xllcorner 43 yllcorner = infile.yllcorner 44 cellsize = int(infile.cellsize) 45 NODATA_value = int(infile.NODATA_value) 46 zone = int(infile.zone) 47 false_easting = infile.false_easting 48 false_northing = infile.false_northing 49 49 projection = infile.projection 50 50 datum = infile.datum -
trunk/anuga_core/source/anuga/file_conversion/dem2pts.py
r8740 r8780 64 64 65 65 import os 66 from Scientific.IO.NetCDFimport NetCDFFile66 from anuga.file.netcdf import NetCDFFile 67 67 68 68 root = name_in[:-4] … … 86 86 if verbose: log.critical('Reading DEM from %s' % (name_in)) 87 87 88 ncols = infile.ncols [0]89 nrows = infile.nrows [0]90 xllcorner = infile.xllcorner [0]# Easting of lower left corner91 yllcorner = infile.yllcorner [0]# Northing of lower left corner92 cellsize = infile.cellsize [0]93 NODATA_value = infile.NODATA_value [0]88 ncols = infile.ncols 89 nrows = infile.nrows 90 xllcorner = infile.xllcorner # Easting of lower left corner 91 yllcorner = infile.yllcorner # Northing of lower left corner 92 cellsize = infile.cellsize 93 NODATA_value = infile.NODATA_value 94 94 dem_elevation = infile.variables['elevation'] 95 95 96 zone = infile.zone [0]97 false_easting = infile.false_easting [0]98 false_northing = infile.false_northing [0]96 zone = infile.zone 97 false_easting = infile.false_easting 98 false_northing = infile.false_northing 99 99 100 100 # Text strings -
trunk/anuga_core/source/anuga/file_conversion/esri2sww.py
r7814 r8780 37 37 """ 38 38 39 from Scientific.IO.NetCDFimport NetCDFFile39 from anuga.file.netcdf import NetCDFFile 40 40 41 41 from anuga.coordinate_transforms.redfearn import redfearn -
trunk/anuga_core/source/anuga/file_conversion/ferret2sww.py
r7814 r8780 60 60 """ 61 61 62 from Scientific.IO.NetCDFimport NetCDFFile62 from anuga.file.netcdf import NetCDFFile 63 63 64 64 _assert_lat_long(minlat, maxlat, minlon, maxlon) … … 176 176 177 177 # Get missing values 178 nan_ha = file_h.variables['HA'].missing_value [0]179 nan_ua = file_u.variables['UA'].missing_value [0]180 nan_va = file_v.variables['VA'].missing_value [0]178 nan_ha = file_h.variables['HA'].missing_value 179 nan_ua = file_u.variables['UA'].missing_value 180 nan_va = file_v.variables['VA'].missing_value 181 181 if hasattr(file_e.variables[zname],'missing_value'): 182 nan_e = file_e.variables[zname].missing_value [0]182 nan_e = file_e.variables[zname].missing_value 183 183 else: 184 184 nan_e = None -
trunk/anuga_core/source/anuga/file_conversion/file_conversion.py
r8757 r8780 8 8 9 9 #non ANUGA imports 10 from Scientific.IO.NetCDFimport NetCDFFile10 from anuga.file.netcdf import NetCDFFile 11 11 import numpy as num 12 12 import os.path … … 39 39 """ 40 40 41 from Scientific.IO.NetCDF import NetCDFFile42 43 41 if filename[-4:] != '.sww': 44 42 raise IOError('Output file %s should be of type .sww.' % sww_file) … … 186 184 187 185 #Create NetCDF file 188 from Scientific.IO.NetCDF import NetCDFFile189 190 186 fid = NetCDFFile(file_out, netcdf_mode_w) 191 187 -
trunk/anuga_core/source/anuga/file_conversion/sdf2pts.py
r8150 r8780 92 92 93 93 import os 94 from Scientific.IO.NetCDFimport NetCDFFile94 from anuga.file.netcdf import NetCDFFile 95 95 96 96 if name_in[-4:] != '.sdf': -
trunk/anuga_core/source/anuga/file_conversion/sts2sww_mesh.py
r8121 r8780 1 1 import os 2 2 import numpy as num 3 from Scientific.IO.NetCDFimport NetCDFFile3 from anuga.file.netcdf import NetCDFFile 4 4 import pylab as P 5 5 … … 37 37 x_origin = infile.xllcorner 38 38 y_origin = infile.yllcorner 39 origin = num.array([x_origin [0], y_origin[0]])39 origin = num.array([x_origin, y_origin]) 40 40 x = infile.variables['x'][:] 41 41 y = infile.variables['y'][:] -
trunk/anuga_core/source/anuga/file_conversion/sww2array.py
r8690 r8780 100 100 101 101 102 from Scientific.IO.NetCDFimport NetCDFFile102 from anuga.file.netcdf import NetCDFFile 103 103 fid = NetCDFFile(name_in) 104 104 -
trunk/anuga_core/source/anuga/file_conversion/sww2dem.py
r8634 r8780 131 131 log.critical('Output directory is %s' % name_out) 132 132 133 from Scientific.IO.NetCDFimport NetCDFFile133 from anuga.file.netcdf import NetCDFFile 134 134 fid = NetCDFFile(name_in) 135 135 … … 143 143 times = fid.variables['time'][:] 144 144 145 number_of_timesteps = fid.dimensions['number_of_timesteps'] 146 number_of_points = fid.dimensions['number_of_points'] 145 try: # works with netcdf4 146 number_of_timesteps = len(fid.dimensions['number_of_timesteps']) 147 number_of_points = len(fid.dimensions['number_of_points']) 148 except: #works with scientific.io.netcdf 149 number_of_timesteps = fid.dimensions['number_of_timesteps'] 150 number_of_points = fid.dimensions['number_of_points'] 151 152 147 153 148 154 if origin is None: … … 216 222 217 223 # Create result array and start filling, block by block. 224 225 218 226 result = num.zeros(number_of_points, num.float) 219 227 -
trunk/anuga_core/source/anuga/file_conversion/sww2dem_new.py
r8626 r8780 132 132 log.critical('Output directory is %s' % name_out) 133 133 134 from Scientific.IO.NetCDFimport NetCDFFile134 from anuga.file.netcdf import NetCDFFile 135 135 fid = NetCDFFile(name_in) 136 136 -
trunk/anuga_core/source/anuga/file_conversion/sww2pts.py
r8149 r8780 56 56 # Read sww file 57 57 if verbose: log.critical('Reading from %s' % name_in) 58 from Scientific.IO.NetCDFimport NetCDFFile58 from anuga.file.netcdf import NetCDFFile 59 59 fid = NetCDFFile(name_in) 60 60 … … 64 64 volumes = fid.variables['volumes'][:] 65 65 66 number_of_timesteps = fid.dimensions['number_of_timesteps'] 67 number_of_points = fid.dimensions['number_of_points'] 66 67 try: # works with netcdf4 68 number_of_timesteps = len(fid.dimensions['number_of_timesteps']) 69 number_of_points = len(fid.dimensions['number_of_points']) 70 except: #works with scientific.io.netcdf 71 number_of_timesteps = fid.dimensions['number_of_timesteps'] 72 number_of_points = fid.dimensions['number_of_points'] 73 74 68 75 if origin is None: 69 76 # Get geo_reference -
trunk/anuga_core/source/anuga/file_conversion/test_2pts.py
r7814 r8780 29 29 30 30 import time, os 31 from Scientific.IO.NetCDFimport NetCDFFile31 from anuga.file.netcdf import NetCDFFile 32 32 33 33 #Write test asc file … … 160 160 161 161 import time, os 162 from Scientific.IO.NetCDFimport NetCDFFile162 from anuga.file.netcdf import NetCDFFile 163 163 # Used for points that lie outside mesh 164 164 NODATA_value = 1758323 -
trunk/anuga_core/source/anuga/file_conversion/test_csv2sts.py
r7864 r8780 4 4 import unittest 5 5 import numpy as num 6 from Scientific.IO.NetCDFimport NetCDFFile6 from anuga.file.netcdf import NetCDFFile 7 7 8 8 # ANUGA modules -
trunk/anuga_core/source/anuga/file_conversion/test_dem2dem.py
r7814 r8780 39 39 40 40 import os 41 from Scientific.IO.NetCDFimport NetCDFFile41 from anuga.file.netcdf import NetCDFFile 42 42 43 43 #Write test dem file … … 121 121 122 122 import os 123 from Scientific.IO.NetCDFimport NetCDFFile123 from anuga.file.netcdf import NetCDFFile 124 124 125 125 # Write test dem file -
trunk/anuga_core/source/anuga/file_conversion/test_dem2pts.py
r8707 r8780 8 8 from anuga.config import netcdf_mode_r, netcdf_mode_w, netcdf_mode_a, \ 9 9 netcdf_float 10 11 from anuga.file.netcdf import NetCDFFile 10 12 11 13 from dem2pts import dem2pts … … 24 26 25 27 import time, os 26 from Scientific.IO.NetCDF import NetCDFFile 28 27 29 28 30 #Write test asc file … … 93 95 94 96 #Check values 95 assert fid.xllcorner [0]== 2002.096 assert fid.yllcorner [0]== 3003.097 assert fid.xllcorner == 2002.0 98 assert fid.yllcorner == 3003.0 97 99 98 100 #create new reference points … … 136 138 137 139 import time, os 138 from Scientific.IO.NetCDF import NetCDFFile139 140 140 141 #Write test asc file … … 211 212 212 213 #Check values 213 assert fid.xllcorner [0]== 2002.0214 assert fid.yllcorner [0]== 3003.0214 assert fid.xllcorner == 2002.0 215 assert fid.yllcorner == 3003.0 215 216 216 217 #create new reference points … … 264 265 265 266 import time, os 266 from Scientific.IO.NetCDF import NetCDFFile267 267 268 268 #Write test asc file … … 339 339 340 340 #Check values 341 assert fid.xllcorner [0]== 2002.0342 assert fid.yllcorner [0]== 3003.0341 assert fid.xllcorner == 2002.0 342 assert fid.yllcorner == 3003.0 343 343 344 344 #create new reference points -
trunk/anuga_core/source/anuga/file_conversion/test_file_conversion.py
r8757 r8780 11 11 from anuga.file_conversion.urs2nc import lon_lat2grid 12 12 from anuga.config import netcdf_float, epsilon, g 13 from Scientific.IO.NetCDFimport NetCDFFile13 from anuga.file.netcdf import NetCDFFile 14 14 15 15 from anuga.file_conversion.file_conversion import tsh2sww … … 108 108 fid.variables[long_name].point_spacing='uneven' 109 109 fid.variables[long_name].units='degrees_east' 110 fid.variables[long_name] .assignValue(longitudes)110 fid.variables[long_name][:] = longitudes 111 111 112 112 fid.createDimension(lat_name,ny) … … 114 114 fid.variables[lat_name].point_spacing='uneven' 115 115 fid.variables[lat_name].units='degrees_north' 116 fid.variables[lat_name] .assignValue(latitudes)116 fid.variables[lat_name][:] = latitudes 117 117 118 118 fid.createDimension('TIME',six) … … 120 120 fid.variables['TIME'].point_spacing='uneven' 121 121 fid.variables['TIME'].units='seconds' 122 fid.variables['TIME'] .assignValue([0.0, 0.1, 0.6, 1.1, 1.6, 2.1])122 fid.variables['TIME'][:] = [0.0, 0.1, 0.6, 1.1, 1.6, 2.1] 123 123 124 124 … … 129 129 fid.variables[name].missing_value=-1.e+034 130 130 131 fid.variables[name] .assignValue([[[0.3400644, 0, -46.63519, -6.50198],131 fid.variables[name][:] = [[[0.3400644, 0, -46.63519, -6.50198], 132 132 [-0.1214216, 0, 0, 0], 133 133 [0, 0, 0, 0], … … 152 152 [-0.1209405, 0.0009771062, 0.02527271, 2.617787e-005], 153 153 [0.0004811212, 0.0009622425, 0.0009599366, 8.152277e-007], 154 [0, 0.0004811212, 0.0004811212, 0]]] )154 [0, 0.0004811212, 0.0004811212, 0]]] 155 155 156 156 … … 170 170 ferret format (lat/lon) to sww format (UTM) 171 171 """ 172 from Scientific.IO.NetCDF import NetCDFFile173 172 import os, sys 174 173 … … 236 235 """Test that zscale workse 237 236 """ 238 from Scientific.IO.NetCDF import NetCDFFile239 237 import os, sys 240 238 … … 326 324 ferret format (lat/lon) to sww format (UTM) 327 325 """ 328 from Scientific.IO.NetCDF import NetCDFFile329 326 330 327 #The test file has … … 469 466 """Elevation included 470 467 """ 471 from Scientific.IO.NetCDF import NetCDFFile472 468 473 469 #The test file has … … 506 502 fid.variables[long_name].point_spacing='uneven' 507 503 fid.variables[long_name].units='degrees_east' 508 fid.variables[long_name] .assignValue(h1_list)504 fid.variables[long_name][:] = h1_list 509 505 510 506 fid.createDimension(lat_name,ny) … … 512 508 fid.variables[lat_name].point_spacing='uneven' 513 509 fid.variables[lat_name].units='degrees_north' 514 fid.variables[lat_name] .assignValue(h2_list)510 fid.variables[lat_name][:] = h2_list 515 511 516 512 fid.createDimension(time_name,2) … … 518 514 fid.variables[time_name].point_spacing='uneven' 519 515 fid.variables[time_name].units='seconds' 520 fid.variables[time_name] .assignValue([0.,1.])516 fid.variables[time_name][:] = [0.,1.] 521 517 #if fid == fid3: break 522 518 … … 527 523 fid.variables[long_name].point_spacing='uneven' 528 524 fid.variables[long_name].units='degrees_east' 529 fid.variables[long_name] .assignValue(h1_list)525 fid.variables[long_name][:] = h1_list 530 526 531 527 fid.createDimension(lat_name,ny) … … 533 529 fid.variables[lat_name].point_spacing='uneven' 534 530 fid.variables[lat_name].units='degrees_north' 535 fid.variables[lat_name] .assignValue(h2_list)531 fid.variables[lat_name][:] = h2_list 536 532 537 533 name = {} … … 557 553 fid.variables[name[fid]].point_spacing='uneven' 558 554 fid.variables[name[fid]].units=units[fid] 559 fid.variables[name[fid]] .assignValue(values[fid])555 fid.variables[name[fid]][:] = values[fid] 560 556 fid.variables[name[fid]].missing_value = -99999999. 561 557 #if fid == fid3: break … … 565 561 fid.variables[name[fid]].point_spacing='uneven' 566 562 fid.variables[name[fid]].units=units[fid] 567 fid.variables[name[fid]] .assignValue(values[fid])563 fid.variables[name[fid]][:] = values[fid] 568 564 fid.variables[name[fid]].missing_value = -99999999. 569 565 … … 629 625 in files produced by ferret as opposed to MOST 630 626 """ 631 from Scientific.IO.NetCDF import NetCDFFile632 627 633 628 #The test file has … … 670 665 fid.variables[long_name].point_spacing='uneven' 671 666 fid.variables[long_name].units='degrees_east' 672 fid.variables[long_name] .assignValue(h1_list)667 fid.variables[long_name][:] = h1_list 673 668 674 669 fid.createDimension(lat_name,ny) … … 676 671 fid.variables[lat_name].point_spacing='uneven' 677 672 fid.variables[lat_name].units='degrees_north' 678 fid.variables[lat_name] .assignValue(h2_list)673 fid.variables[lat_name][:] = h2_list 679 674 680 675 fid.createDimension(time_name,2) … … 682 677 fid.variables[time_name].point_spacing='uneven' 683 678 fid.variables[time_name].units='seconds' 684 fid.variables[time_name] .assignValue([0.,1.])679 fid.variables[time_name][:] = [0.,1.] 685 680 #if fid == fid3: break 686 681 … … 691 686 fid.variables[long_name].point_spacing='uneven' 692 687 fid.variables[long_name].units='degrees_east' 693 fid.variables[long_name] .assignValue(h1_list)688 fid.variables[long_name][:] = h1_list 694 689 695 690 fid.createDimension(lat_name,ny) … … 697 692 fid.variables[lat_name].point_spacing='uneven' 698 693 fid.variables[lat_name].units='degrees_north' 699 fid.variables[lat_name] .assignValue(h2_list)694 fid.variables[lat_name][:] = h2_list 700 695 701 696 name = {} … … 721 716 fid.variables[name[fid]].point_spacing='uneven' 722 717 fid.variables[name[fid]].units=units[fid] 723 fid.variables[name[fid]] .assignValue(values[fid])718 fid.variables[name[fid]][:] = values[fid] 724 719 fid.variables[name[fid]].missing_value = -99999999. 725 720 #if fid == fid3: break … … 729 724 fid.variables[name[fid]].point_spacing='uneven' 730 725 fid.variables[name[fid]].units=units[fid] 731 fid.variables[name[fid]] .assignValue(values[fid])726 fid.variables[name[fid]][:] = values[fid] 732 727 fid.variables[name[fid]].missing_value = -99999999. 733 728 … … 791 786 792 787 def test_ferret2sww_nz_origin(self): 793 from Scientific.IO.NetCDF import NetCDFFile794 788 from anuga.coordinate_transforms.redfearn import redfearn 795 789 … … 850 844 851 845 import time, os 852 from Scientific.IO.NetCDF import NetCDFFile 846 853 847 854 848 self.domain.set_name('datatest' + str(id(self))) -
trunk/anuga_core/source/anuga/file_conversion/test_sww2dem.py
r8634 r8780 5 5 from anuga.shallow_water.shallow_water_domain import Domain 6 6 from anuga.config import netcdf_mode_r 7 from anuga.file.netcdf import NetCDFFile 7 8 8 9 from anuga.coordinate_transforms.geo_reference import Geo_reference, \ … … 85 86 86 87 import time, os 87 from Scientific.IO.NetCDF import NetCDFFile88 88 89 89 # Setup … … 124 124 125 125 # Check georeferencig: zone, xllcorner and yllcorner 126 assert fid.zone [0]== 56127 assert fid.xllcorner [0]== 308500128 assert fid.yllcorner [0]== 6189000126 assert fid.zone == 56 127 assert fid.xllcorner == 308500 128 assert fid.yllcorner == 6189000 129 129 130 130 … … 300 300 301 301 import time, os 302 from Scientific.IO.NetCDF import NetCDFFile303 302 304 303 #Create basic mesh (100m x 100m) … … 466 465 467 466 import time, os 468 from Scientific.IO.NetCDF import NetCDFFile469 467 470 468 #Setup … … 660 658 661 659 import time, os 662 from Scientific.IO.NetCDF import NetCDFFile663 660 664 661 #Setup … … 825 822 826 823 import time, os 827 from Scientific.IO.NetCDF import NetCDFFile828 824 829 825 #Setup … … 933 929 934 930 import time, os 935 from Scientific.IO.NetCDF import NetCDFFile936 931 937 932 #Setup … … 1038 1033 1039 1034 import time, os 1040 from Scientific.IO.NetCDF import NetCDFFile1041 1035 1042 1036 #Setup … … 1152 1146 1153 1147 import time, os 1154 from Scientific.IO.NetCDF import NetCDFFile1155 1148 1156 1149 #Setup mesh not coinciding with rectangle. … … 1298 1291 1299 1292 import time, os 1300 from Scientific.IO.NetCDF import NetCDFFile1301 1293 1302 1294 … … 1396 1388 1397 1389 import time, os 1398 from Scientific.IO.NetCDF import NetCDFFile1399 1390 1400 1391 base_name = 'tegp' … … 1527 1518 1528 1519 import time, os 1529 from Scientific.IO.NetCDF import NetCDFFile1530 1520 1531 1521 try: … … 1611 1601 1612 1602 import time, os 1613 from Scientific.IO.NetCDF import NetCDFFile1614 1603 1615 1604 try: … … 1747 1736 1748 1737 import time, os 1749 from Scientific.IO.NetCDF import NetCDFFile1750 1738 1751 1739 try: -
trunk/anuga_core/source/anuga/file_conversion/test_urs2sts.py
r8690 r8780 4 4 import os 5 5 import sys 6 from Scientific.IO.NetCDFimport NetCDFFile6 from anuga.file.netcdf import NetCDFFile 7 7 8 8 from anuga.utilities.system_tools import get_pathname_from_package … … 276 276 #print k, time_start_z[k,:] 277 277 starttime = min(time_start_z[k, :]) 278 sts_starttime = fid.starttime [0]278 sts_starttime = fid.starttime 279 279 msg = 'sts starttime for source %d was %f. Should have been %f'\ 280 280 %(source_number, sts_starttime, starttime) … … 440 440 # across all stations (for this source) 441 441 starttime = min(time_start_z[:]) 442 sts_starttime = fid.starttime [0]442 sts_starttime = fid.starttime 443 443 msg = 'sts starttime was %f. Should have been %f'\ 444 444 %(sts_starttime, starttime) … … 2031 2031 # Check the time vector 2032 2032 times = fid.variables['time'][:] 2033 starttime = fid.starttime [0]2033 starttime = fid.starttime 2034 2034 #print times 2035 2035 #print starttime -
trunk/anuga_core/source/anuga/file_conversion/test_urs2sww.py
r7805 r8780 1 1 2 2 # External modules 3 from Scientific.IO.NetCDFimport NetCDFFile3 from anuga.file.netcdf import NetCDFFile 4 4 import sys 5 5 import unittest -
trunk/anuga_core/source/anuga/file_conversion/urs2sts.py
r8149 r8780 68 68 69 69 import os 70 from Scientific.IO.NetCDFimport NetCDFFile70 from anuga.file.netcdf import NetCDFFile 71 71 from operator import __and__ 72 72 -
trunk/anuga_core/source/anuga/file_conversion/urs2sww.py
r8149 r8780 1 1 import os 2 2 import numpy as num 3 from Scientific.IO.NetCDFimport NetCDFFile3 from anuga.file.netcdf import NetCDFFile 4 4 5 5 from anuga.file.urs import Read_urs -
trunk/anuga_core/source/anuga/fit_interpolate/test_interpolate.py
r8709 r8780 13 13 import csv 14 14 15 from Scientific.IO.NetCDFimport NetCDFFile15 from anuga.file.netcdf import NetCDFFile 16 16 17 17 import numpy as num -
trunk/anuga_core/source/anuga/geospatial_data/geospatial_data.py
r8592 r8780 12 12 import copy 13 13 14 from Scientific.IO.NetCDFimport NetCDFFile14 from anuga.file.netcdf import NetCDFFile 15 15 import numpy as num 16 16 from numpy.random import randint, seed … … 1049 1049 geo_reference = None 1050 1050 1051 return geo_reference, keys, fid.dimensions['number_of_points'] 1051 try: # netcdf4 1052 number_of_points = len(fid.dimensions['number_of_points']) 1053 except: #scientific python 1054 number_of_points = fid.dimensions['number_of_points'] 1055 1056 return geo_reference, keys, number_of_points 1052 1057 1053 1058 -
trunk/anuga_core/source/anuga/geospatial_data/test_geospatial_data.py
r8124 r8780 1042 1042 1043 1043 def test_loadpts(self): 1044 from Scientific.IO.NetCDFimport NetCDFFile1044 from anuga.file.netcdf import NetCDFFile 1045 1045 1046 1046 fileName = tempfile.mktemp('.pts') … … 1200 1200 1201 1201 def test_create_from_pts_file(self): 1202 from Scientific.IO.NetCDFimport NetCDFFile1202 from anuga.file.netcdf import NetCDFFile 1203 1203 1204 1204 # NetCDF file definition … … 1240 1240 '''Test if Geospatial data is correctly instantiated from a pts file.''' 1241 1241 1242 from Scientific.IO.NetCDFimport NetCDFFile1242 from anuga.file.netcdf import NetCDFFile 1243 1243 1244 1244 # NetCDF file definition -
trunk/anuga_core/source/anuga/load_mesh/loadASCII.py
r8694 r8780 69 69 import anuga.utilities.log as log 70 70 71 from Scientific.IO.NetCDFimport NetCDFFile71 from anuga.file.netcdf import NetCDFFile 72 72 73 73 import numpy as num -
trunk/anuga_core/source/anuga/shallow_water/forcing.py
r8420 r8780 20 20 from warnings import warn 21 21 import numpy as num 22 from Scientific.IO.NetCDFimport NetCDFFile22 from anuga.file.netcdf import NetCDFFile 23 23 from anuga.config import netcdf_mode_r, netcdf_mode_w, netcdf_mode_a 24 24 from copy import copy -
trunk/anuga_core/source/anuga/shallow_water/most2nc.py
r8124 r8780 8 8 9 9 import sys 10 from Scientific.IO.NetCDFimport NetCDFFile10 from anuga.file.netcdf import NetCDFFile 11 11 from anuga.config import netcdf_mode_r, netcdf_mode_w, netcdf_mode_a 12 12 import anuga.utilities.log as log … … 86 86 out_file.variables[long_name].point_spacing='uneven' 87 87 out_file.variables[long_name].units='degrees_east' 88 out_file.variables[long_name] .assignValue(h1_list)88 out_file.variables[long_name][:] = h1_list 89 89 90 90 out_file.createDimension(lat_name,ny) … … 92 92 out_file.variables[lat_name].point_spacing='uneven' 93 93 out_file.variables[lat_name].units='degrees_north' 94 out_file.variables[lat_name] .assignValue(h2_list)94 out_file.variables[lat_name][:] = h2_list 95 95 96 96 out_file.createVariable(elev_name,'d',(lat_name,long_name)) 97 97 out_file.variables[elev_name].point_spacing='uneven' 98 98 out_file.variables[elev_name].units='meters' 99 out_file.variables[elev_name] .assignValue(depth_list)99 out_file.variables[elev_name][:] = depth_list 100 100 101 101 out_file.close() -
trunk/anuga_core/source/anuga/shallow_water/sww_interrogate.py
r8124 r8780 323 323 from anuga.geometry.polygon import inside_polygon 324 324 from anuga.config import minimum_allowed_height 325 from Scientific.IO.NetCDFimport NetCDFFile325 from anuga.file.netcdf import NetCDFFile 326 326 327 327 dir, base = os.path.split(filename) -
trunk/anuga_core/source/anuga/shallow_water/test_data_manager.py
r8690 r8780 18 18 from struct import pack, unpack 19 19 20 from Scientific.IO.NetCDFimport NetCDFFile20 from anuga.file.netcdf import NetCDFFile 21 21 22 22 … … 142 142 fid.variables[long_name].point_spacing='uneven' 143 143 fid.variables[long_name].units='degrees_east' 144 fid.variables[long_name] .assignValue(longitudes)144 fid.variables[long_name][:] = longitudes 145 145 146 146 fid.createDimension(lat_name,ny) … … 148 148 fid.variables[lat_name].point_spacing='uneven' 149 149 fid.variables[lat_name].units='degrees_north' 150 fid.variables[lat_name] .assignValue(latitudes)150 fid.variables[lat_name][:] = latitudes 151 151 152 152 fid.createDimension('TIME',six) … … 154 154 fid.variables['TIME'].point_spacing='uneven' 155 155 fid.variables['TIME'].units='seconds' 156 fid.variables['TIME'] .assignValue([0.0, 0.1, 0.6, 1.1, 1.6, 2.1])156 fid.variables['TIME'][:] = [0.0, 0.1, 0.6, 1.1, 1.6, 2.1] 157 157 158 158 … … 163 163 fid.variables[name].missing_value=-1.e+034 164 164 165 fid.variables[name] .assignValue([[[0.3400644, 0, -46.63519, -6.50198],165 fid.variables[name][:] = [[[0.3400644, 0, -46.63519, -6.50198], 166 166 [-0.1214216, 0, 0, 0], 167 167 [0, 0, 0, 0], … … 186 186 [-0.1209405, 0.0009771062, 0.02527271, 2.617787e-005], 187 187 [0.0004811212, 0.0009622425, 0.0009599366, 8.152277e-007], 188 [0, 0.0004811212, 0.0004811212, 0]]] )188 [0, 0.0004811212, 0.0004811212, 0]]] 189 189 190 190 … … 495 495 496 496 import time, os 497 from Scientific.IO.NetCDF import NetCDFFile498 497 499 498 self.domain.set_name('datatest' + str(id(self))) … … 549 548 550 549 import time, os, config 551 from Scientific.IO.NetCDF import NetCDFFile552 550 553 551 self.domain.set_name('synctest') … … 596 594 597 595 import time, os 598 from Scientific.IO.NetCDF import NetCDFFile599 596 600 597 self.domain.set_name('datatest' + str(id(self))) -
trunk/anuga_core/source/anuga/shallow_water/test_loadsave.py
r7841 r8780 6 6 import tempfile 7 7 8 from Scientific.IO.NetCDFimport NetCDFFile8 from anuga.file.netcdf import NetCDFFile 9 9 from anuga.file.sww import extent_sww 10 10 -
trunk/anuga_core/source/anuga/shallow_water/test_most2nc.py
r7276 r8780 1 1 import unittest 2 2 import numpy as num 3 from Scientific.IO.NetCDFimport NetCDFFile3 from anuga.file.netcdf import NetCDFFile 4 4 import most2nc 5 5 import os -
trunk/anuga_core/source/anuga/shallow_water/test_shallow_water_domain.py
r8690 r8780 6 6 import tempfile 7 7 8 from Scientific.IO.NetCDFimport NetCDFFile8 from anuga.file.netcdf import NetCDFFile 9 9 from anuga.file.sww import extent_sww 10 10 … … 1825 1825 1826 1826 import time, os 1827 from Scientific.IO.NetCDF import NetCDFFile1828 1827 from mesh_factory import rectangular 1829 1828 … … 1916 1915 1917 1916 import time, os 1918 from Scientific.IO.NetCDF import NetCDFFile1919 1917 from mesh_factory import rectangular 1920 1918 … … 6039 6037 6040 6038 # Read results for specific timesteps t=1 and t=2 6041 from Scientific.IO.NetCDF import NetCDFFile6042 6039 fid = NetCDFFile(domain1.get_name() + '.sww') 6043 6040 … … 6212 6209 6213 6210 # Read results for specific timesteps t=1 and t=2 6214 from Scientific.IO.NetCDF import NetCDFFile6215 6211 fid = NetCDFFile(domain1.get_name() + '.sww') 6216 6212 … … 6388 6384 6389 6385 # Read results for specific timesteps t=1 and t=2 6390 from Scientific.IO.NetCDF import NetCDFFile6391 6386 fid = NetCDFFile(domain1.get_name() + '.sww') 6392 6387 … … 7584 7579 7585 7580 # Check that quantities have been stored correctly 7586 from Scientific.IO.NetCDF import NetCDFFile7587 7581 sww_file = domain.get_name() + '.sww' 7588 7582 fid = NetCDFFile(sww_file) -
trunk/anuga_core/source/anuga/shallow_water/test_sww_interrogate.py
r8404 r8780 40 40 41 41 import time, os 42 from Scientific.IO.NetCDFimport NetCDFFile42 from anuga.file.netcdf import NetCDFFile 43 43 44 44 #Setup … … 200 200 201 201 import time, os 202 from Scientific.IO.NetCDFimport NetCDFFile202 from anuga.file.netcdf import NetCDFFile 203 203 204 204 # Setup … … 326 326 327 327 import time, os 328 from Scientific.IO.NetCDFimport NetCDFFile328 from anuga.file.netcdf import NetCDFFile 329 329 330 330 # Setup … … 428 428 429 429 import time, os 430 from Scientific.IO.NetCDFimport NetCDFFile430 from anuga.file.netcdf import NetCDFFile 431 431 432 432 # Setup -
trunk/anuga_core/source/anuga/shallow_water/test_system.py
r8486 r8780 6 6 import os 7 7 8 from Scientific.IO.NetCDFimport NetCDFFile8 from anuga.file.netcdf import NetCDFFile 9 9 import numpy as num 10 10 -
trunk/anuga_core/source/anuga/utilities/plot_utils.py
r8591 r8780 36 36 37 37 """ 38 from Scientific.IO.NetCDFimport NetCDFFile38 from anuga.file.netcdf import NetCDFFile 39 39 import numpy 40 40 -
trunk/anuga_core/source/anuga/utilities/sww_merge.py
r8760 r8780 6 6 from anuga.utilities.numerical_tools import ensure_numeric 7 7 8 from Scientific.IO.NetCDFimport NetCDFFile8 from anuga.file.netcdf import NetCDFFile 9 9 from anuga.config import netcdf_mode_r, netcdf_mode_w, netcdf_mode_a 10 10 from anuga.config import netcdf_float, netcdf_float32, netcdf_int … … 26 26 fid = NetCDFFile(swwfiles[0], netcdf_mode_r) 27 27 28 number_of_volumes = fid.dimensions['number_of_volumes'] 29 number_of_points = fid.dimensions['number_of_points'] 28 try: # works with netcdf4 29 number_of_volumes = len(fid.dimensions['number_of_volumes']) 30 number_of_points = len(fid.dimensions['number_of_points']) 31 except: # works with scientific.io.netcdf 32 number_of_volumes = len(fid.dimensions['number_of_volumes']) 33 number_of_points = fid.dimensions['number_of_points'] 30 34 31 35 fid.close() … … 111 115 out_tris.append(verts) 112 116 113 num_pts = fid.dimensions['number_of_points'] 117 118 119 try: # works with netcdf4 120 num_pts = len(fid.dimensions['number_of_points']) 121 except: # works with scientific.io.netcdf 122 num_pts = fid.dimensions['number_of_points'] 123 114 124 tri_offset += num_pts 115 125 -
trunk/anuga_core/source/anuga/utilities/test_system_tools.py
r8146 r8780 9 9 import os 10 10 from os.path import join, split, sep 11 from Scientific.IO.NetCDFimport NetCDFFile11 from anuga.file.netcdf import NetCDFFile 12 12 from anuga.config import netcdf_mode_r, netcdf_mode_w, netcdf_mode_a 13 13 from anuga.config import netcdf_float, netcdf_char, netcdf_int … … 82 82 83 83 try: 84 from Scientific.IO.NetCDFimport NetCDFFile84 from anuga.file.netcdf import NetCDFFile 85 85 except ImportError: 86 86 # This code is also used by EQRM which does not require NetCDF -
trunk/anuga_core/source/anuga/visualiser/offline.py
r7452 r8780 1 1 #from Numeric import array, Float, ravel, zeros 2 2 import numpy as num 3 from Scientific.IO.NetCDFimport NetCDFFile3 from anuga.file.netcdf import NetCDFFile 4 4 from Tkinter import Button, E, Tk, W, Label, StringVar, Scale, HORIZONTAL 5 5 from visualiser import Visualiser -
trunk/anuga_core/source/anuga/visualiser_new/sww_visualiser.py
r4621 r8780 1 1 from Numeric import array, Float 2 from Scientific.IO.NetCDFimport NetCDFFile2 from anuga.file.netcdf import NetCDFFile 3 3 from visualiser import Visualiser 4 4 from vtk import vtkCellArray -
trunk/anuga_core/source/anuga_parallel/test_parallel_file_boundary.py
r8757 r8780 24 24 import tempfile 25 25 from struct import pack, unpack 26 from Scientific.IO.NetCDFimport NetCDFFile26 from anuga.file.netcdf import NetCDFFile 27 27 import copy 28 28 -
trunk/anuga_core/source/anuga_validation_tests/Case_studies/Okushiri/compare_timeseries_with_measures.py
r8676 r8780 9 9 10 10 import numpy as num 11 from Scientific.IO.NetCDFimport NetCDFFile11 from anuga.file.netcdf import NetCDFFile 12 12 13 13 import project -
trunk/anuga_core/source/anuga_validation_tests/Case_studies/Okushiri/create_okushiri.py
r8756 r8780 107 107 """ 108 108 109 from Scientific.IO.NetCDFimport NetCDFFile109 from anuga.file.netcdf import NetCDFFile 110 110 111 111 print 'Creating', filename
Note: See TracChangeset
for help on using the changeset viewer.