Changeset 9322
- Timestamp:
- Sep 4, 2014, 1:36:40 PM (11 years ago)
- Location:
- trunk/anuga_work/development/gareth/template_scenarios/tsunami/tsunami1/scripts
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/anuga_work/development/gareth/template_scenarios/tsunami/tsunami1/scripts/project.py
r9321 r9322 40 40 yieldStep=20.0 41 41 42 42 ## Spatial Information 43 # 44 # Give UTM Zone as an integer (negative for Southern Hemisphere) 45 utm_zone = 54 43 46 44 47 ##################################################################### … … 141 144 # pixle size (m) for output tifs 142 145 output_tif_cellsize = 250. 143 # EPSG CODE (projection information) for outputs tifs 144 EPSG_CODE = 32647 146 # Polygon for output tif [either a filename, or if None the bounding_polygon is used] 147 output_tif_bounding_polygon = None 148 145 149 146 150 ## Storage of max quantities … … 214 218 [bounding_polygon, interior_regions, riverWalls, \ 215 219 breakLines, RegionPtAreas, default_res, BoundaryInfo]) ).hexdigest() 220 221 # Fix the output tif bounding polygon 222 if output_tif_bounding_polygon is None: 223 output_tif_bounding_polygon = bounding_polygon 224 else: 225 output_tif_bounding_polygon = su.read_polygon(output_tif_bounding_polygon) 216 226 217 227 # Set up directories etc -
trunk/anuga_work/development/gareth/template_scenarios/tsunami/tsunami1/scripts/raster_outputs.py
r9321 r9322 10 10 import numpy 11 11 import gdal 12 from pyproj import Proj 12 13 from anuga.utilities import plot_utils as util 13 14 from anuga.utilities import spatialInputUtil as su … … 19 20 # 20 21 21 def make_resampled_elevation(elevation_raster, rasterExtent, CellSize, clipPolygon, clipPolygonLayer, EPSG_CODE, tif_output_dir):22 def make_resampled_elevation(elevation_raster, rasterExtent, CellSize, clipPolygon, clipPolygonLayer, proj4string , tif_output_dir): 22 23 """ 23 24 Call gdalwarp to get the resampled elevation data … … 42 43 yres=CellSize 43 44 44 allSRS='EPSG:'+str(EPSG_CODE) 45 #allSRS='EPSG:'+str(EPSG_CODE) 46 allSRS = proj4string 45 47 newDEM=tif_output_dir+'LIDAR_resampled.tif' 46 48 newMask=tif_output_dir+'Mask_resampled.tif' … … 66 68 67 69 return 70 71 ############################################################################## 68 72 69 73 def gdal_calc_command(stage, depth, elevation, mask, depth_threshold): … … 89 93 def make_me_some_tifs(swwFile, 90 94 bounding_polygon, 91 EPSG_CODE,95 utm_zone, 92 96 myTimeStep='collected_max', 93 97 tif_output_subdir='/TIFS/', … … 104 108 - swwFile -- Full path name of sww to read outputs from 105 109 - bounding_polygon -- ANUGA's bounding polygon, or another polygon to clip the rasters to 106 - EPSG_CODE -- EPSG projection info as an integer like 3123 [which is over Manila, Philippines]110 - utm_zone -- UTM zone as an integer [make negative for Southern Hemisphere] 107 111 - myTimeStep -- option from util.Make_Geotif 108 112 use 'max' to plot the maxima … … 125 129 """ 126 130 131 # Convert utm_zone to proj4string 132 p=Proj(proj='utm', south=(utm_zone<0.), zone=abs(utm_zone), ellps='WGS84') 133 proj4string = p.srs 134 127 135 tif_output_dir=os.path.dirname(swwFile)+tif_output_subdir 128 136 # Make the geotifs … … 144 152 tmpArr=maxQs[:,[0, 1, i+2]] 145 153 util.Make_Geotif(tmpArr, output_quantities=[quant+'_MAX'], 146 CellSize=CellSize, EPSG_CODE=EPSG_CODE, verbose=True,154 CellSize=CellSize, proj4string = proj4string , verbose=True, 147 155 bounding_polygon=bounding_polygon, output_dir=tif_output_dir) 148 156 … … 150 158 util.Make_Geotif(swwFile, myTimeStep=[0], 151 159 output_quantities=['elevation', 'friction'], 152 CellSize=CellSize, EPSG_CODE=EPSG_CODE, verbose=True,160 CellSize=CellSize, proj4string = proj4string , verbose=True, 153 161 bounding_polygon=bounding_polygon, 154 162 output_dir=tif_output_dir) … … 156 164 util.Make_Geotif(swwFile, myTimeStep=myTimeStep, 157 165 output_quantities=['depth', 'stage', 'elevation', 'velocity', 'depthIntegratedVelocity', 'friction'], 158 CellSize=CellSize, EPSG_CODE=EPSG_CODE, verbose=True,166 CellSize=CellSize, proj4string = proj4string , verbose=True, 159 167 bounding_polygon=bounding_polygon, 160 168 output_dir=tif_output_dir) … … 169 177 170 178 # Make the resampled elevation data 171 make_resampled_elevation(elevation_raster, rasterExtent, CellSize, clipPolygon, clipPolygonLayer, EPSG_CODE, tif_output_dir)179 make_resampled_elevation(elevation_raster, rasterExtent, CellSize, clipPolygon, clipPolygonLayer, proj4string, tif_output_dir) 172 180 173 181 elevation=glob.glob(tif_output_dir+'LIDAR_resampled*')[0] -
trunk/anuga_work/development/gareth/template_scenarios/tsunami/tsunami1/scripts/run_model.py
r9321 r9322 62 62 # 63 63 #################################################################################### 64 print 'Making rainfall conditions'65 setup_rainfall.setup_rainfall(domain, project)66 print 'Making inlets '67 setup_inlets.setup_inlets(domain, project)64 # print 'Making rainfall conditions' 65 # setup_rainfall.setup_rainfall(domain, project) 66 # print 'Making inlets ' 67 # setup_inlets.setup_inlets(domain, project) 68 68 69 69 ##################################################################################### … … 138 138 raster_outputs.make_me_some_tifs(swwFile = './'+project.scenario+'.sww', 139 139 bounding_polygon=project.bounding_polygon, 140 EPSG_CODE = project.EPSG_CODE,140 utm_zone = project.utm_zone, 141 141 CellSize= project.output_tif_cellsize) 142 142 except: -
trunk/anuga_work/development/gareth/template_scenarios/tsunami/tsunami1/scripts/setup_boundary_conditions.py
r9320 r9322 49 49 THE USER MUST MODIFY THIS TO SETUP THE BOUNDARIES AS DESIRED 50 50 51 1) First make sure the r ightboundary conditions are created51 1) First make sure the required boundary conditions are created 52 52 (see examples below, modify or add new ones as required) 53 53 -
trunk/anuga_work/development/gareth/template_scenarios/tsunami/tsunami1/scripts/setup_initial_conditions.py
r9320 r9322 63 63 #START EDITING HERE 64 64 #@@@@@@@@@@@@@@@@@# 65 66 67 ############################################################################## 68 # 69 # PRELIMINARY DEFINITIONS 70 # 71 ############################################################################## 72 73 # If the earthquake slip is given then convert to deformation here 74 # So that we can add it to both elevation AND stage 75 make_earthquake_deformation_from_source_model=False 76 77 if make_earthquake_deformation_from_source_model: 78 source_model='../anuga/source/XXXXX.csv' 79 # Make an earthquake source model 80 eq_function = okada_tsunami.earthquake_source(source=None, 81 filename=source_model, 82 domain=domain, 83 lon_lat_degrees=True, 84 lon_before_lat=False, 85 utm_zone=project.utm_zone, 86 verbose=False) 87 else: 88 # Make a function that is zero everywhere 89 # If we pass this to add_quantity, nothing should happen 90 def eq_function(x,y): 91 return x*0. 65 92 66 93 … … 80 107 elevation_default = numpy.genfromtxt('../anuga/topographies/andaman_3s_grid_Clip2_Project.txt', delimiter=",",skip_header=1) 81 108 82 109 # Set_quantity data 83 110 elevation_Data=[ 84 111 ['../anuga/polygons/patong_10m.txt', elevation_patong_10m], … … 88 115 ] 89 116 117 # Define a function for add_quantity in the same way 118 # [ ['All', 0.] ] will do nothing 119 elevation_additions = [ 120 ['All', eq_function] 121 ] 122 90 123 91 124 ############################################################################## … … 96 129 97 130 default_friction=0.025 131 # Set_quantity data 98 132 friction_Data =[ 99 133 ['All', default_friction] 100 134 ] 135 136 # Add_quantity data 137 friction_additions = [ 138 ['All', 0.] 139 ] 101 140 102 141 ############################################################################### … … 106 145 ############################################################################### 107 146 147 # Set_quantity data 108 148 stage_Data = [ 109 149 ['All', project.tide] 110 150 ] 111 151 152 153 # Add_quantity data 154 stage_additions = [ 155 ['All', eq_function] 156 ] 112 157 ############################################################################### 113 158 # … … 117 162 ############################################################################### 118 163 164 # Set_quantity data 119 165 xmomentum_Data = [ 120 166 ['All', 0.] 121 167 ] 122 168 169 # Add_quantity data 170 xmomentum_additions = [ 171 ['All', 0.] 172 ] 173 174 # Set_quantity data 123 175 ymomentum_Data = [ 124 176 ['All', 0.] 125 177 ] 178 179 # Add_quantity data 180 ymomentum_additions = [ 181 ['All', 0.] 182 ] 126 183 127 184 #@@@@@@@@@@@@@@@@@# … … 140 197 elevFun=qs.composite_quantity_setting_function(elevation_Data, domain) 141 198 domain.set_quantity('elevation', elevFun, location='vertices') 199 elevAddFun=qs.composite_quantity_setting_function(elevation_additions, domain) 200 domain.add_quantity('elevation', elevAddFun) 142 201 143 202 frictionFun=qs.composite_quantity_setting_function(friction_Data, domain) 144 203 domain.set_quantity('friction', frictionFun, location='centroids') 204 frictionAddFun=qs.composite_quantity_setting_function(friction_additions, domain) 205 domain.add_quantity('friction', frictionAddFun) 145 206 146 207 stageFun=qs.composite_quantity_setting_function(stage_Data, domain) 147 208 domain.set_quantity('stage', stageFun, location='centroids') 209 stageAddFun=qs.composite_quantity_setting_function(stage_additions, domain) 210 domain.add_quantity('stage', stageAddFun) 148 211 149 212 xmomentumFun=qs.composite_quantity_setting_function(xmomentum_Data, domain) 150 213 domain.set_quantity('xmomentum', xmomentumFun, location='centroids') 214 xmomentumAddFun=qs.composite_quantity_setting_function(xmomentum_additions, domain) 215 domain.add_quantity('xmomentum', xmomentumAddFun) 151 216 152 217 ymomentumFun=qs.composite_quantity_setting_function(ymomentum_Data, domain) 153 218 domain.set_quantity('ymomentum', ymomentumFun, location='centroids') 219 ymomentumAddFun=qs.composite_quantity_setting_function(ymomentum_additions, domain) 220 domain.add_quantity('ymomentum', ymomentumAddFun) 154 221 155 222 ################################################################################
Note: See TracChangeset
for help on using the changeset viewer.