import project, os import sys from anuga.shallow_water.data_manager import sww2dem from os import sep #time_dir = '20080526_104946_run_final_0.6_test_kvanputt' #time_dir = '20080530_170833_run_final_0.6_exmouth_kvanputt' time_dir = '20080619_115643_run_trial_0.6_exmouth_kvanputt' cellsize = 10 #cellsize = 150 timestep = 0 directory = project.output_dir name = directory+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 area = ['Geordie', 'Sorrento', 'Fremantle', 'Rockingham'] for which_area in area: if which_area == 'Geordie': easting_min = project.xminGeordie easting_max = project.xmaxGeordie northing_min = project.yminGeordie northing_max = project.ymaxGeordie if which_area == 'Sorrento': easting_min = project.xminSorrento easting_max = project.xmaxSorrento northing_min = project.yminSorrento northing_max = project.ymaxSorrento if which_area == 'Fremantle': easting_min = project.xminFremantle easting_max = project.xmaxFremantle northing_min = project.yminFremantle northing_max = project.ymaxFremantle if which_area == 'Rockingham': easting_min = project.xminRockingham easting_max = project.xmaxRockingham northing_min = project.yminRockingham northing_max = project.ymaxRockingham # var = [2,3,4] # depth and speed #var = [2] # depth var = [0,4] for which_var in var: if which_var == 0: # Stage outname = name + which_area + '_stage' quantityname = 'stage' if which_var == 1: # Absolute Momentum outname = name + which_area + '_momentum' quantityname = '(xmomentum**2 + ymomentum**2)**0.5' if which_var == 2: # Depth outname = name + which_area + '_depth' quantityname = 'stage-elevation' if which_var == 3: # Speed outname = name + which_area + '_speed' quantityname = '(xmomentum**2 + ymomentum**2)**0.5/(stage-elevation+1.e-6/(stage-elevation))' #Speed if which_var == 4: # Elevation outname = name + which_area + '_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',which_area, easting_min sww2dem(name, basename_out = outname, quantity = quantityname, timestep = timestep, cellsize = cellsize, easting_min = easting_min, easting_max = easting_max, northing_min = northing_min, northing_max = northing_max, reduction = max, verbose = True, format = 'asc')