Changeset 5816
- Timestamp:
- Oct 3, 2008, 4:17:21 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
anuga_work/production/Broome_2008/export_results_all.py
r5810 r5816 14 14 import sys 15 15 from anuga.shallow_water.data_manager import convert_dem_from_ascii2netcdf, dem2pts 16 17 16 from anuga.shallow_water.data_manager import sww2dem 18 17 from os import sep 18 19 19 20 20 directory = project.output_dir … … 22 22 #time_dir = '20080526_104946_run_final_0.6_test_kvanputt' 23 23 #time_dir = '20080530_170833_run_final_0.6_exmouth_kvanputt' 24 time_dir1 = '2008 0815_103442_run_final_0.0_polyline_alpha0.1_kvanputt'25 time_dir 2 = '20080909_151438_run_final_0.0_polyline_alpha0.1_kvanputt'24 time_dir1 = '20081002_171412_run_final_0.6_27255_alpha0.1_rwilson' 25 time_dirs = [time_dir1] 26 26 27 27 #cellsize = 20 28 28 cellsize = 30 29 #timestep = 030 #area = ['Geordie', 'Sorrento', 'Fremantle', 'Rockingham']31 area = ['All']32 #var = [1,2] # Absolute momentum and depth33 #var = [2] # depth34 var = [0,4] #stage and elevation35 29 36 time_dir = [time_dir1, time_dir2] 30 #timestep = None # None means no timestep! 31 timestep = 0 32 33 ###### 34 # Set the special areas of interest. If none, do: area='All' 35 ###### 36 #area = ['Geordie', 'Sorrento', 'Fremantle', 'Rockingham'] # strings must match keys in var_equations below 37 area = ['All'] # 'All' means no special areas - the whole thing 38 39 ###### 40 # Define allowed variable names and associated equations to generate values. 41 # This would not normally change. 42 ###### 43 var_equations = {'stage': 'stage', 44 'momentum': '(xmomentum**2 + ymomentum**2)**0.5', 45 'depth': 'stage-elevation', 46 'speed': '(xmomentum**2 + ymomentum**2)**0.5/(stage-elevation+1.e-6)', 47 'elevation': 'elevation' } 48 49 # one or more key strings from var_equations above 50 var = ['stage', 'elevation'] 51 52 ###### 53 # Start running the various conversions we require. 54 ###### 37 55 for time_dir in time_dirs: 38 39 56 name1 = directory+time_dir+sep+project.scenario_name 40 name2 = directory+time_dir+sep+'sww2'+sep+project.scenario_name+'_time_39900_0' #need to get assistance on how to make this into anything41 42 names = [name1, name2]57 # name2 = directory+time_dir+sep+'sww2'+sep+project.scenario_name+'_time_39900_0' #need to get assistance on how to make this into anything 58 names = [name1] 59 43 60 for name in names: 44 45 61 for which_area in area: 46 62 if which_area == 'All': 47 48 if which_area == 'Geordie': 49 easting_min = project.xminGeordie 50 easting_max = project.xmaxGeordie 51 northing_min = project.yminGeordie 52 northing_max = project.ymaxGeordie 53 54 if which_area == 'Sorrento': 55 easting_min = project.xminSorrento 56 easting_max = project.xmaxSorrento 57 northing_min = project.yminSorrento 58 northing_max = project.ymaxSorrento 59 60 if which_area == 'Fremantle': 61 easting_min = project.xminFremantle 62 easting_max = project.xmaxFremantle 63 northing_min = project.yminFremantle 64 northing_max = project.ymaxFremantle 65 66 if which_area == 'Rockingham': 67 easting_min = project.xminRockingham 68 easting_max = project.xmaxRockingham 69 northing_min = project.yminRockingham 70 northing_max = project.ymaxRockingham 71 63 easting_min = None 64 easting_max = None 65 northing_min = None 66 northing_max = None 67 else: 68 try: 69 easting_min = eval('project.xmin%s' % which_area) 70 easting_max = eval('project.xmax%s' % which_area) 71 northing_min = eval('project.ymin%s' % which_area) 72 northing_max = eval('project.ymax%s' % which_area) 73 except AttributeError: 74 print 'Unrecognized area name: %s' % which_area 75 break 76 ### This is replaced by the single 'else' case above 77 ## elif which_area == 'Geordie': 78 ## easting_min = project.xminGeordie 79 ## easting_max = project.xmaxGeordie 80 ## northing_min = project.yminGeordie 81 ## northing_max = project.ymaxGeordie 82 ## elif which_area == 'Sorrento': 83 ## easting_min = project.xminSorrento 84 ## easting_max = project.xmaxSorrento 85 ## northing_min = project.yminSorrento 86 ## northing_max = project.ymaxSorrento 87 ## elif which_area == 'Fremantle': 88 ## easting_min = project.xminFremantle 89 ## easting_max = project.xmaxFremantle 90 ## northing_min = project.yminFremantle 91 ## northing_max = project.ymaxFremantle 92 ## elif which_area == 'Rockingham': 93 ## easting_min = project.xminRockingham 94 ## easting_max = project.xmaxRockingham 95 ## northing_min = project.yminRockingham 96 ## northing_max = project.ymaxRockingham 97 ## else: 98 ## print 'Unrecognized area name: %s' % which_area 99 ## break 72 100 73 101 for which_var in var: 74 if which_var == 0: # Stage75 outname = name + which_area + '_stage'76 quantityname = 'stage'102 if which_var not in var_equations: 103 print 'Unrecognized variable name: %s' % which_var 104 break 77 105 78 if which_var == 1: # Absolute Momentum 79 outname = name + which_area + '_momentum' 80 quantityname = '(xmomentum**2 + ymomentum**2)**0.5' 106 outname = name + which_area + '_' + which_var 107 quantityname = var_equations[which_var] 81 108 82 if which_var == 2: # Depth 83 outname = name + which_area + '_depth' 84 quantityname = 'stage-elevation' 85 86 if which_var == 3: # Speed 87 outname = name + which_area + '_speed' 88 #quantityname = '(xmomentum**2 + ymomentum**2)**0.5/(stage-elevation+1.e-6/(stage-elevation))' #Speed 89 quantityname = '(xmomentum**2 + ymomentum**2)**0.5/(stage-elevation+1.e-6)' #Speed 90 91 if which_var == 4: # Elevation 92 outname = name + which_area + '_elevation' 93 quantityname = 'elevation' #Elevation 94 95 if which_area == 'All' 96 print 'start sww2dem',which_area 97 sww2dem(name, basename_out = outname, 98 quantity = quantityname, 99 #timestep = timestep, 100 cellsize = cellsize, 101 reduction = max, 102 verbose = True, 103 format = 'asc') 104 105 else: 106 print 'start sww2dem',which_area, easting_min 107 sww2dem(name, basename_out = outname, 108 quantity = quantityname, 109 #timestep = timestep, 110 cellsize = cellsize, 111 easting_min = easting_min, 112 easting_max = easting_max, 113 northing_min = northing_min, 114 northing_max = northing_max, 115 reduction = max, 116 verbose = True, 117 format = 'asc') 118 109 print 'start sww2dem: time_dir=%s' % time_dir 110 111 sww2dem(name, basename_out = outname, 112 quantity = quantityname, 113 timestep = timestep, 114 cellsize = cellsize, 115 easting_min = easting_min, 116 easting_max = easting_max, 117 northing_min = northing_min, 118 northing_max = northing_max, 119 reduction = max, 120 verbose = True, 121 format = 'asc')
Note: See TracChangeset
for help on using the changeset viewer.