Changeset 5602
- Timestamp:
- Aug 4, 2008, 1:41:59 PM (17 years ago)
- Location:
- anuga_core/source/anuga/shallow_water
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
anuga_core/source/anuga/shallow_water/data_manager.py
r5589 r5602 4926 4926 assert nt>0,msg 4927 4927 4928 OFFSET=5 #number of site parameters p passed back with data 4929 #p=[geolat,geolon,depth,start_tstep,finish_tstep] 4930 4931 times=dt*arange(1,(data.shape[1]-OFFSET)+1) 4932 latitudes=zeros(data.shape[0],Float) 4933 longitudes=zeros(data.shape[0],Float) 4934 elevation=zeros(data.shape[0],Float) 4935 quantity=zeros((data.shape[0],data.shape[1]-OFFSET),Float) 4928 OFFSET=5 # Number of site parameters p passed back with data 4929 # p=[geolat,geolon,depth,start_tstep,finish_tstep] 4930 4931 parameters_index = data.shape[1]-OFFSET 4932 4933 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) 4938 4939 4936 4940 starttime=1e16 4937 for i in range(0,data.shape[0]): 4938 latitudes[i]=data[i][data.shape[1]-OFFSET] 4939 longitudes[i]=data[i][data.shape[1]-OFFSET+1] 4940 elevation[i]=-data[i][data.shape[1]-OFFSET+2] 4941 quantity[i]=data[i][:-OFFSET] 4942 starttime=min(dt*data[i][data.shape[1]-OFFSET+3],starttime) 4941 for i in range(0, data.shape[0]): 4942 latitudes[i]=data[i][parameters_index] 4943 longitudes[i]=data[i][parameters_index+1] 4944 elevation[i]=-data[i][parameters_index+2] 4945 quantity[i][:]=data[i][:parameters_index] # Was data[i][:-OFFSET] 4946 4947 starttime=min(dt*data[i][parameters_index+3],starttime) 4943 4948 4944 4949 return times, latitudes, longitudes, elevation, quantity, starttime 4950 4945 4951 4946 4952 def mux2sww_time(mux_times, mint, maxt): -
anuga_core/source/anuga/shallow_water/test_data_manager.py
r5601 r5602 6147 6147 msg='time array has incorrect length' 6148 6148 assert times.shape[0]==time_step_count,msg 6149 6149 6150 msg = 'time array is incorrect' 6150 assert allclose(times,time_step*arange(1,time_step_count+1)),msg 6151 #assert allclose(times,time_step*arange(1,time_step_count+1)),msg 6152 assert allclose(times,time_step*arange(time_step_count)), msg 6153 6151 6154 msg='Incorrect gauge positions returned' 6152 6155 for i,point in enumerate(lat_long_points): … … 6612 6615 msg = 'sts starttime for source %d was %f. Should have been %f'\ 6613 6616 %(source_number, sts_starttime, starttime) 6617 6614 6618 #assert allclose(sts_starttime-delta_t, starttime), msg 6615 6619 ## FIXME - have done a dodgy to get it through here ### 6620 6621 #print source_filename, sts_starttime, starttime 6616 6622 assert allclose(sts_starttime, starttime), msg 6617 6623 -
anuga_core/source/anuga/shallow_water/urs_ext.c
r5582 r5602 35 35 void fillDataArray(int ista, int total_number_of_stations, int nt, int ig, int *nst, 36 36 int *nft, float *data, int *istart_p, 37 37 int *istop_p, float *muxData) 38 38 { 39 39 int it, last_it, jsta; … … 42 42 43 43 last_it = -1; 44 /* make arrays of starting and finishing time steps for the tide gauges */44 /* Make arrays of starting and finishing time steps for the tide gauges */ 45 45 /* and fill them from the file */ 46 46 47 /* update start and stop timesteps for this gauge */47 /* Update start and stop timesteps for this gauge */ 48 48 if (nst[ista]!= -1) 49 49 { … … 158 158 //Internal Functions 159 159 int _read_mux2_headers(int numSrc, 160 161 162 163 164 165 160 char **muxFileNameArray, 161 int* total_number_of_stations, 162 int* number_of_time_steps, 163 double* delta_t, 164 //long* numDataMax, 165 int verbose) 166 166 { 167 167 FILE *fp; … … 415 415 fseek(fp, offset, 0); 416 416 417 numData = getNumData(fros + isrc*total_number_of_stations, lros + isrc*total_number_of_stations, total_number_of_stations); 417 numData = getNumData(fros + isrc*total_number_of_stations, 418 lros + isrc*total_number_of_stations, 419 total_number_of_stations); 420 418 421 fread(muxData, numData*sizeof(float), 1, fp); 419 422 fclose(fp);
Note: See TracChangeset
for help on using the changeset viewer.