import project, os import sys from anuga.shallow_water.data_manager import sww2dem from os import sep #time_dir = '20080630_104134_run_trial_0.6_exmouth_5449_kvanputt' #time_dir = '20080630_111936_run_trial_0.6_exmouth_4695_kvanputt' #time_dir = '20080630_112512_run_trial_0.6_exmouth_4743_kvanputt' time_dir = '20080630_112830_run_trial_0.6_exmouth_4777_kvanputt' #time_dir = '20080630_114135_run_trial_0.6_exmouth_4901_kvanputt' #time_dir = '20080630_114503_run_trial_0.6_exmouth_4874_kvanputt' #time_dir = '20080630_114811_run_trial_0.6_exmouth_4990_kvanputt' #time_dir = '20080630_115238_run_trial_0.6_exmouth_5103_kvanputt' #time_dir = '20080630_115458_run_trial_0.6_exmouth_5185_kvanputt' #time_dir = '20080630_115757_run_trial_0.6_exmouth_5273_kvanputt' cellsize = 25 #cellsize = 150 timestep = 0 directory = project.output_dir name = directory+sep+'test'+sep+time_dir+sep+project.scenario_name from anuga.shallow_water.data_manager import convert_dem_from_ascii2netcdf, dem2pts is_parallel = False #is_parallel = True if is_parallel == True: nodes = 4 print 'output dir:', name #var = [0,4] #var = [2,3] # depth and Speed var = [4] # elevation for which_var in var: if which_var == 0: # Stage outname = name + '_stage' quantityname = 'stage' if which_var == 1: # Absolute Momentum outname = name + '_momentum' quantityname = '(xmomentum**2 + ymomentum**2)**0.5' if which_var == 2: # Depth outname = name + '_depth' quantityname = 'stage-elevation' if which_var == 3: # Speed outname = name + '_speed' quantityname = '(xmomentum**2 + ymomentum**2)**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_grad.e_min_area, easting_max = project_grad.e_max_area, northing_min = project_grad.n_min_area, northing_max = project_grad.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_grad.e_min_area, #easting_max = project_grad.e_max_area, #northing_min = project_grad.n_min_area, #northing_max = project_grad.n_max_area, reduction = max, verbose = True, format = 'asc')