import os import sys from anuga.shallow_water.data_manager import sww2dem from os import sep name2= 'gap' time_dir = '2550_1_2700_20000gap' # sww file location cellsize = 5 #cellsize = 150 timestep = None output_dir = sep+'d'+sep+'xrd'+sep+'gem'+sep+'5'+sep+'nhi'+sep+'inundation'+sep+'data'+sep+'idealised_bathymetry_study'+sep+'final_models'+sep+'gap'+sep+'transect'+sep directory = output_dir name = directory+time_dir+sep+str(name2) 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 = [2,3,4] # depth and speed #var = [2] # depth #var = [4] var = [0] 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')