Changeset 4647
- Timestamp:
- Jul 31, 2007, 11:38:31 AM (17 years ago)
- Location:
- anuga_core/source/anuga/abstract_2d_finite_volumes
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
anuga_core/source/anuga/abstract_2d_finite_volumes/test_util.py
r4645 r4647 1335 1335 return 1336 1336 1337 current_dir=getcwd()+sep+'abstract_2d_finite_volumes' 1338 temp_dir = tempfile.mkdtemp('','figures') 1339 # print 'temp_dir',temp_dir 1340 fileName = temp_dir+sep+'time_series_3.csv' 1341 file = open(fileName,"w") 1342 file.write("Time,Stage,Speed,Momentum,Elevation\n\ 1337 if sys.platform == 'win32': #Windows 1338 1339 current_dir=getcwd()+sep+'abstract_2d_finite_volumes' 1340 temp_dir = tempfile.mkdtemp('','figures') 1341 # print 'temp_dir',temp_dir 1342 fileName = temp_dir+sep+'time_series_3.csv' 1343 file = open(fileName,"w") 1344 file.write("Time,Stage,Speed,Momentum,Elevation\n\ 1343 1345 1.0, 0, 0, 0, 10 \n\ 1344 1346 2.0, 5, 2, 4, 10 \n\ 1345 1347 3.0, 3, 3, 5, 10 \n") 1346 file.close()1347 1348 fileName1 = temp_dir+sep+'time_series_4.csv'1349 file1 = open(fileName1,"w")1350 file1.write("Time,Stage,Speed,Momentum,Elevation\n\1348 file.close() 1349 1350 fileName1 = temp_dir+sep+'time_series_4.csv' 1351 file1 = open(fileName1,"w") 1352 file1.write("Time,Stage,Speed,Momentum,Elevation\n\ 1351 1353 1.0, 0, 0, 0, 5 \n\ 1352 1354 2.0, -5, -2, -4, 5 \n\ 1353 1355 3.0, -4, -3, -5, 5 \n") 1354 file1.close()1355 1356 fileName2 = temp_dir+sep+'time_series_5.csv'1357 file2 = open(fileName2,"w")1358 file2.write("Time,Stage,Speed,Momentum,Elevation\n\1356 file1.close() 1357 1358 fileName2 = temp_dir+sep+'time_series_5.csv' 1359 file2 = open(fileName2,"w") 1360 file2.write("Time,Stage,Speed,Momentum,Elevation\n\ 1359 1361 1.0, 0, 0, 0, 7 \n\ 1360 1362 2.0, 4, -0.45, 57, 7 \n\ 1361 1363 3.0, 6, -0.5, 56, 7 \n") 1362 file2.close() 1363 1364 dir, name=os.path.split(fileName) 1365 make_plots_from_csv_file(directories_dic={dir:['gauge', 0, 0]}, 1366 output_dir=temp_dir, 1367 base_name='time_series_', 1368 plot_numbers=['3-5'], 1369 quantities=['Speed','Stage','Momentum'], 1370 assess_all_csv_files=True, 1371 extra_plot_name='test') 1372 1373 # print 'stage+fileName[:-4]+test.png',dir+sep+'stage_'+name[:-4]+'_test.png' 1374 assert(access(dir+sep+'stage_'+name[:-4]+'_test.png',F_OK)==True) 1375 assert(access(dir+sep+'speed_'+name[:-4]+'_test.png',F_OK)==True) 1376 assert(access(dir+sep+'momentum_'+name[:-4]+'_test.png',F_OK)==True) 1377 1378 dir1, name1=os.path.split(fileName1) 1379 assert(access(dir+sep+'stage_'+name1[:-4]+'_test.png',F_OK)==True) 1380 assert(access(dir+sep+'speed_'+name1[:-4]+'_test.png',F_OK)==True) 1381 assert(access(dir+sep+'momentum_'+name1[:-4]+'_test.png',F_OK)==True) 1382 1383 1384 dir2, name2=os.path.split(fileName2) 1385 assert(access(dir+sep+'stage_'+name2[:-4]+'_test.png',F_OK)==True) 1386 assert(access(dir+sep+'speed_'+name2[:-4]+'_test.png',F_OK)==True) 1387 assert(access(dir+sep+'momentum_'+name2[:-4]+'_test.png',F_OK)==True) 1388 1389 del_dir(temp_dir) 1364 file2.close() 1365 1366 dir, name=os.path.split(fileName) 1367 make_plots_from_csv_file(directories_dic={dir:['gauge', 0, 0]}, 1368 output_dir=temp_dir, 1369 base_name='time_series_', 1370 plot_numbers=['3-5'], 1371 quantities=['Speed','Stage','Momentum'], 1372 assess_all_csv_files=True, 1373 extra_plot_name='test') 1374 1375 # print 'stage+fileName[:-4]+test.png',dir+sep+'stage_'+name[:-4]+'_test.png' 1376 assert(access(dir+sep+'stage_'+name[:-4]+'_test.png',F_OK)==True) 1377 assert(access(dir+sep+'speed_'+name[:-4]+'_test.png',F_OK)==True) 1378 assert(access(dir+sep+'momentum_'+name[:-4]+'_test.png',F_OK)==True) 1379 1380 dir1, name1=os.path.split(fileName1) 1381 assert(access(dir+sep+'stage_'+name1[:-4]+'_test.png',F_OK)==True) 1382 assert(access(dir+sep+'speed_'+name1[:-4]+'_test.png',F_OK)==True) 1383 assert(access(dir+sep+'momentum_'+name1[:-4]+'_test.png',F_OK)==True) 1384 1385 1386 dir2, name2=os.path.split(fileName2) 1387 assert(access(dir+sep+'stage_'+name2[:-4]+'_test.png',F_OK)==True) 1388 assert(access(dir+sep+'speed_'+name2[:-4]+'_test.png',F_OK)==True) 1389 assert(access(dir+sep+'momentum_'+name2[:-4]+'_test.png',F_OK)==True) 1390 1391 del_dir(temp_dir) 1392 1390 1393 1391 1394 -
anuga_core/source/anuga/abstract_2d_finite_volumes/util.py
r4643 r4647 1742 1742 for j, filename in enumerate(which_csv_to_assess): 1743 1743 if assess_all_csv_files==False: 1744 dir_filename=directory+base_name+sep+filename 1744 # dir_filename=directory+sep+base_name+filename 1745 dir_filename=join(directory,base_name+filename) 1745 1746 else: 1746 1747 dir_filename=join(directory,filename) 1747 1748 # print'dir_filename',dir_filename 1748 1749 attribute_dic, title_index_dic = csv2dict(dir_filename+ 1749 1750 '.csv') … … 1785 1786 min_mom, max_mom) 1786 1787 # ion() 1787 pylab.hold()1788 # pylab.hold() 1788 1789 1789 1790
Note: See TracChangeset
for help on using the changeset viewer.