Changeset 5612 for anuga_core/source/anuga/shallow_water/data_manager.py
 Timestamp:
 Aug 5, 2008, 3:46:33 PM (14 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

anuga_core/source/anuga/shallow_water/data_manager.py
r5611 r5612 4888 4888 numSrc=len(filenames) 4889 4889 4890 file_params=1*ones(3,Float) #[nsta,dt,nt]4890 file_params=1*ones(3,Float) #[nsta,dt,nt] 4891 4891 4892 4892 # Convert verbose to int C flag … … 4896 4896 verbose=0 4897 4897 4898 4899 #msg = 'I got the permutation vector:' + str(permutation)4900 #assert permutation is not None, msg4901 4898 if permutation is None: 4902 4899 permutation = ensure_numeric([], Float) 4903 4900 4904 4901 # Call underlying C implementation urs2sts_ext.c 4905 data = read_mux2(numSrc, filenames,weights,file_params,permutation,verbose)4902 data = read_mux2(numSrc, filenames, weights, file_params, permutation, verbose) 4906 4903 4907 4904 msg='File parameter values were not read in correctly from c file' … … 4925 4922 msg='Must have at least one gauge value' 4926 4923 assert nt>0,msg 4927 4924 4928 4925 OFFSET=5 # Number of site parameters p passed back with data 4929 4926 # p=[geolat,geolon,depth,start_tstep,finish_tstep] 4930 4927 4928 # FIXME (Ole): What is the relationship with params and data.shape ? 4929 # It looks as if the following asserts should pass but they don't always 4930 # 4931 4932 #print 4933 #print nsta, nt, data.shape 4934 4935 #msg = 'nt = %d, data.shape[1] == %d' %(nt, data.shape[1]) 4936 #assert nt == data.shape[1]  OFFSET, msg 4937 4938 #msg = 'nsta = %d, data.shape[0] == %d' %(nsta, data.shape[0]) 4939 #assert nsta == data.shape[0], msg 4940 4941 4942 # Number of stations in ordering file 4943 number_of_selected_stations = data.shape[0] 4944 4945 # Index where data ends and parameters begin 4931 4946 parameters_index = data.shape[1]OFFSET 4932 4947 4933 4948 times=dt*arange(parameters_index) 4934 latitudes=zeros( data.shape[0], Float)4935 longitudes=zeros( data.shape[0], Float)4936 elevation=zeros( data.shape[0], Float)4937 quantity=zeros(( data.shape[0], parameters_index), Float)4949 latitudes=zeros(number_of_selected_stations, Float) 4950 longitudes=zeros(number_of_selected_stations, Float) 4951 elevation=zeros(number_of_selected_stations, Float) 4952 quantity=zeros((number_of_selected_stations, parameters_index), Float) 4938 4953 4939 4954 4940 4955 starttime=1e16 4941 for i in range(0, data.shape[0]): 4956 for i in range(number_of_selected_stations): 4957 quantity[i][:]=data[i][:parameters_index] 4958 4942 4959 latitudes[i]=data[i][parameters_index] 4943 4960 longitudes[i]=data[i][parameters_index+1] 4944 4961 elevation[i]=data[i][parameters_index+2] 4945 quantity[i][:]=data[i][:parameters_index] # Was data[i][:OFFSET]4946 4947 4962 first_time_step = data[i][parameters_index+3] 4948 #print 'datamanager:', i, first_time_step, dt*first_time_step4949 starttime=min(dt* data[i][parameters_index+3],starttime)4963 4964 starttime=min(dt*first_time_step, starttime) 4950 4965 4951 4966 return times, latitudes, longitudes, elevation, quantity, starttime
Note: See TracChangeset
for help on using the changeset viewer.