Opened 18 years ago
Closed 17 years ago
#150 closed enhancement (fixed)
incorporate the Export_data.py script into anuga source
Reported by: | nick | Owned by: | anonymous |
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | Efficiency and optimisation | Version: | 1.0 |
Severity: | minor | Keywords: | |
Cc: |
Description
I feel that importing export_data.py into the anuga source would reduce confusion and increase the usefuliness of it.
1)And the same time it can be slightly refactored to so it uses a dictionary to define the grids it will export.
2) add the ability to automatically determine if it was run in parallel and on how many nodes from the output sww files
3) change name to export_grid
have a look in dampier I:\unixhome\nbartzis\anuga\anuga_work\production\dampier_2006\export_results.py
import project, os import sys
from anuga.shallow_water.data_manager import sww2dem from os import sep
time_dir = '20070418_035124_run' # cellsize = 25 timestep = None directory = project.output_dir #name = directory + time_dir + sep + project.scenario_name name = directory+time_dir+sep+project.scenario_name
is_parallel = False if is_parallel == True: nodes = 4 print 'output dir:', name
which_var = 2 if which_var == 0: # Stage
outname = name + '_stage' quantityname = 'stage'
if which_var == 1: # Absolute Momentum
outname = name + '_momentum_i1' quantityname = '(xmomentum2 + ymomentum2)0.5'
if which_var == 2: # Depth
outname = name + '_depth' quantityname = 'stage-elevation'
if which_var == 3: # Speed
outname = name + '_speed_i0' quantityname = '(xmomentum2 + ymomentum2)0.5/(stage-elevation+1.e-6/(stage-elevation))' #Speed
if which_var == 4: # Elevation
outname = name + '_elevation' quantityname = 'elevation' #Elevation
if is_parallel == True: # print 'is_parallel',is_parallel
for i in range(0,nodes):
namei = name + '_P%d_%d' %(i,nodes) outnamei = outname + '_P%d_%d' %(i,nodes) print 'start sww2dem for sww file %d' %(i) sww2dem(namei, basename_out = outnamei,
quantity = quantityname, timestep = timestep, cellsize = cellsize, easting_min = project.e_min_area, easting_max = project.e_max_area, northing_min = project.n_min_area, northing_max = project.n_max_area, reduction = max, verbose = True, format = 'asc')
else:
print 'start sww2dem' sww2dem(name, basename_out = outname,
quantity = quantityname, timestep = timestep, cellsize = cellsize, easting_min = project.e_min_area, easting_max = project.e_max_area, northing_min = project.n_min_area, northing_max = project.n_max_area, reduction = max, verbose = True, format = 'asc')
Change History (3)
comment:1 Changed 18 years ago by anonymous
- Owner changed from duncan to anonymous
- Status changed from new to assigned
comment:2 Changed 18 years ago by anonymous
- Type changed from defect to enhancement
comment:3 Changed 17 years ago by anonymous
- Resolution set to fixed
- Status changed from assigned to closed
How about the mapping of new quantities to formulas, eg (depth -> stage-elevation) be pushed into sww2dem. This will mean the which_var stuff becomes unnecessary.
For point 2 how will export_grid know if a run is parallel? How about converting all sww files in a directory, if the basename_in is a directory?
I don't understand point 2;
I'm thinking about the best way to handle the output file names