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