Changeset 5470
- Timestamp:
- Jul 7, 2008, 12:18:29 PM (17 years ago)
- Location:
- anuga_core/source/anuga/shallow_water
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
anuga_core/source/anuga/shallow_water/data_manager.py
r5466 r5470 4838 4838 NORTH_VELOCITY_MUX2_LABEL = '-n-mux2' 4839 4839 4840 def read_mux2_py(filenames,weights ):4840 def read_mux2_py(filenames,weights,verbose=False): 4841 4841 4842 4842 from Numeric import ones,Float,compress,zeros,arange … … 4846 4846 4847 4847 file_params=-1*ones(3,Float)#[nsta,dt,nt] 4848 write=0 #if true write txt files to current directory as well 4849 data=read_mux2(numSrc,filenames,weights,file_params,write) 4848 4849 # Convert verbose to int C flag 4850 if verbose: 4851 verbose=1 4852 else: 4853 verbose=0 4854 4855 data=read_mux2(numSrc,filenames,weights,file_params,verbose) 4850 4856 4851 4857 msg='File parameter values were not read in correctly from c file' … … 5034 5040 for i,quantity in enumerate(quantities): 5035 5041 # For each quantity read the associated list of source mux2 file with extenstion associated with that quantity 5036 times, latitudes_urs, longitudes_urs, elevation, mux[quantity],starttime = read_mux2_py(files_in[i],weights )5042 times, latitudes_urs, longitudes_urs, elevation, mux[quantity],starttime = read_mux2_py(files_in[i],weights,verbose=verbose) 5037 5043 if quantity!=quantities[0]: 5038 5044 msg='%s, %s and %s have inconsitent gauge data'%(files_in[0],files_in[1],files_in[2]) -
anuga_core/source/anuga/shallow_water/urs_ext.c
r5469 r5470 29 29 30 30 Python call: 31 read_mux2(numSrc,filenames,weights,file_params, write)31 read_mux2(numSrc,filenames,weights,file_params,verbose) 32 32 33 33 NOTE: … … 43 43 float *weights; 44 44 long numSrc; 45 long write;45 long verbose; 46 46 47 47 float **cdata; … … 58 58 // Convert Python arguments to C 59 59 if (!PyArg_ParseTuple(args, "iOOOi", 60 &numSrc,&filenames,&pyweights,&file_params,& write)) {60 &numSrc,&filenames,&pyweights,&file_params,&verbose)) { 61 61 62 62 PyErr_SetString(PyExc_RuntimeError, … … 117 117 118 118 // Read in mux2 data from file 119 cdata=_read_mux2((int)numSrc,muxFileNameArray,weights,(double*)file_params->data,(int) write);119 cdata=_read_mux2((int)numSrc,muxFileNameArray,weights,(double*)file_params->data,(int)verbose); 120 120 121 121 … … 181 181 free(weights); 182 182 free(muxFileNameArray); 183 free(cdata); 183 184 return PyArray_Return(pydata); 184 185 185 186 } 186 187 187 float** _read_mux2(int numSrc, char **muxFileNameArray, float *weights, double *params, int write)188 float** _read_mux2(int numSrc, char **muxFileNameArray, float *weights, double *params, int verbose) 188 189 { 189 190 FILE *fp; … … 225 226 } 226 227 227 228 /* open the first muxfile */ 229 if((fp=fopen(muxFileNameArray[0],"r"))==NULL) 230 { 228 if (verbose){ 229 printf("Reading mux header information\n"); 230 } 231 232 /* Open the first muxfile */ 233 if((fp=fopen(muxFileNameArray[0],"r"))==NULL){ 231 234 fprintf(stderr, "cannot open file %s\n", muxFileNameArray[0]); 232 235 exit(-1); 233 236 } 234 237 235 /* read in the header */236 /* first read the number of stations*/238 /* Read in the header */ 239 /* First read the number of stations*/ 237 240 fread(&nsta0,sizeof(int),1,fp); 238 241 … … 364 367 exit(-1); 365 368 } 369 370 if (verbose){ 371 printf("Reading mux file %s\n",muxFileName); 372 } 366 373 367 374 offset=sizeof(int)+nsta0*(sizeof(struct tgsrwg)+2*sizeof(int));
Note: See TracChangeset
for help on using the changeset viewer.