Changeset 5937
- Timestamp:
- Nov 11, 2008, 2:41:49 PM (16 years ago)
- Location:
- anuga_core/source/anuga/shallow_water
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
anuga_core/source/anuga/shallow_water/test_data_manager.py
r5935 r5937 6489 6489 6490 6490 #print 'Second station to be written to MUX' 6491 #print 'ha', ha1[ 2,:]6492 #print 'ua', ua1[ 2,:]6493 #print 'va', va1[ 2,:]6491 #print 'ha', ha1[0,:] 6492 #print 'ua', ua1[0,:] 6493 #print 'va', va1[0,:] 6494 6494 6495 6495 # Write second mux file to be combined by urs2sts … … 6502 6502 va=va1) 6503 6503 6504 6505 6506 6507 # Read mux file back and verify it's correcness 6508 6509 #################################################### 6510 # FIXME (Ole): This is where the test should 6511 # verify that the MUX files are correct. 6512 #################################################### 6513 6514 #print filesII 6515 #print 'MUX FILE' 6516 #fid = open(filesII[2], 'rb') 6517 #blop = fid.read() 6518 6519 6520 6521 6522 6523 6524 6504 6525 6505 6526 # Create ordering file … … 6529 6550 # Read stage, u, v enumerated as j 6530 6551 6531 if j < 2:6532 continue6533 6552 6553 #print 'Reading', j, file 6534 6554 data = read_mux2(1, [file], weights, file_params, permutation, verbose) 6535 6555 6536 print 6537 print 'Data received by Python' 6538 print data 6539 #print file_params 6540 print 6541 6542 import sys; sys.exit() 6556 #print 'Data received by Python' 6557 #print data[1][8] 6558 6543 6559 6544 6560 number_of_selected_stations = data.shape[0] … … 6551 6567 6552 6568 for i in range(number_of_selected_stations): 6553 quantity[i][:]=data[i][:parameters_index]6554 6569 6555 6570 #print i, parameters_index … … 6562 6577 # FIXME (Ole): This is where the output is wrong on Win32 6563 6578 6564 print 6565 print j, i 6566 6567 print 'Input' 6568 print 'u', ua1[permutation[i], :] 6569 print 'v', va1[permutation[i], :] 6570 6571 print 'Output' 6572 print 'v ', data[i][:parameters_index] 6573 6574 if j == 2 and i == 1: 6575 pass 6576 # Skip assert for this combination for now as the second error is more obvious 6577 else: 6578 6579 assert allclose(data[i][:parameters_index], va1[permutation[i], :]) 6579 #print 6580 #print j, i 6581 #print 'Input' 6582 #print 'u', ua1[permutation[i], 8] 6583 #print 'v', va1[permutation[i], 8] 6584 6585 #print 'Output' 6586 #print 'v ', data[i][:parameters_index][8] 6587 6588 assert allclose(data[i][:parameters_index], va1[permutation[i], :]) 6580 6589 6581 6590 … … 10930 10939 #suite = unittest.makeSuite(Test_Data_Manager,'test_urs2sts_individual_sources') 10931 10940 #suite = unittest.makeSuite(Test_Data_Manager,'test_urs2sts_ordering_different_sources') 10941 10942 # FIXME (Ole): This is the test that fails under Windows 10932 10943 suite = unittest.makeSuite(Test_Data_Manager,'test_read_mux_platform_problem2') 10933 10944 -
anuga_core/source/anuga/shallow_water/urs_ext.c
r5935 r5937 20 20 #define POFFSET 5 //Number of site_params 21 21 22 static int *fros=NULL; 23 static int *lros=NULL; 22 static int *fros=NULL; // First recorded output step 23 static int *lros=NULL; // Last recorded output step 24 24 static struct tgsrwg* mytgs0=NULL; 25 25 … … 99 99 /* gauge is recording at this time */ 100 100 memcpy(data + it, muxData + offset, sizeof(float)); 101 102 //printf("%d: muxdata=%f\n", it, muxData[offset]); 103 //printf("data[%d]=%f, offset=%d\n", it, data[it], offset); 101 104 offset++; 102 105 } … … 340 343 341 344 342 printf("Getting into the c code\n");343 345 _read_mux2_headers(numSrc, 344 346 muxFileNameArray, … … 428 430 total_number_of_stations); 429 431 430 fread(muxData, numData*sizeof(float), 1, fp);432 fread(muxData, ((int) numData)*sizeof(float), 1, fp); 431 433 fclose(fp); 432 434 435 // FIXME (Ole): This is where Nariman and Ole traced the platform dependent 436 // difference on 11 November 2008. We don't think the problem lies in the 437 // C code. Maybe it is a problem with the MUX files written by the unit test 438 // that fails on Windows but works OK on Linux. 439 440 //printf("\nRead %d elements, ", (int) numData); 441 //printf("muxdata[%d]=%f\n", 39, muxData[39]); 442 //for(i = 0; i < (int) numData; i++) 443 //{ 444 // printf("muxdata[%d]=%f\n", i, muxData[i]); 445 //} 446 447 433 448 // loop over stations present in the permutation array 434 449 // use ista with mux data … … 462 477 sts_data[i][k] = NODATA; 463 478 } 479 //printf("%d: temp_sts_data[%d]=%f\n", i, k, temp_sts_data[k]); 480 464 481 } 482 465 483 466 484 // Update metadata (e.g. start time and end time) … … 501 519 } 502 520 521 //printf("sts_data[1,8]=%f\n", sts_data[1][8]); 522 503 523 free(muxData); 504 524 free(temp_sts_data); … … 707 727 // not recording but at least one other gauge is. 708 728 // Pad the non-recording gauge array with zeros. 709 printf("Data put into the cdata array from C code\n");729 //printf("\nData put into the cdata array from C code\n"); 710 730 for (i = 0; i < number_of_selected_stations; i++) 711 731 { … … 725 745 else 726 746 { 747 //printf("cdata[%d][%d] = %f\n", i, it, cdata[i][it]); 748 727 749 *(double*)(pydata->data + i*pydata->strides[0] 728 750 + time*pydata->strides[1]) = … … 734 756 // Pass back lat,lon,elevation 735 757 for (j = 0; j < POFFSET; j++) 736 { 737 printf("cdata[%d][%d] = %f\n", i, nt+j, cdata[i][nt + j]); 738 *(double*)(pydata->data + i*pydata->strides[0] 739 + (num_ts + j)*pydata->strides[1]) = 740 cdata[i][nt + j]; 758 { 759 *(double*)(pydata->data + i*pydata->strides[0] 760 + (num_ts + j)*pydata->strides[1]) = 761 cdata[i][nt + j]; 741 762 } 742 763 }
Note: See TracChangeset
for help on using the changeset viewer.