Changeset 7271
- Timestamp:
- Jun 29, 2009, 10:45:27 AM (15 years ago)
- Location:
- DVD_images
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
DVD_images/extra_files/BatemansBay/modifications.html
r7265 r7271 24 24 <a name="modifications"><h2><b>Modifying a simulation</b></h2></a> 25 25 26 [some introductory text here] 26 Here we talk about how you change a simulation. Why would you need to change a simulation? Well, 27 you might have some better elevation data, you want to run the simulation on a finer mesh in certain 28 areas, or maybe you want to see the result of different events. 29 <p> 30 First we describe the uses of the script files you might change, then we walk through a few examples 31 of changes you might make. 27 32 <p> 28 33 … … 32 37 <table class="code"> 33 38 <tr><td><font color="red">project.py</font></td><td>Defines the input data used, where to place output, etc.</td></tr> 39 <tr><td><font color="red">build_boundary.py</font></td><td>Builds ...</td></tr> 34 40 <tr><td><font color="red">setup_model.py</font></td><td>Prepares the simulation before actually running it</td></tr> 35 41 <tr><td><font color="red">run_model.py</font></td><td>Runs the simulation</td></tr> … … 37 43 38 44 <a name="project.py"><h4><b>project.py</b></h4></a> 39 [text about project.py] 45 46 This file is the heart of the simulation. Here we specify many things, including the tide level, the simulation 47 star and stop times, input data files, and so on. Because we are using python as the programming language in 48 these files, we can use the power of the language to speed up our development. We use this by <i>parameterising</i> 49 data as much as possible. 50 <p> 51 As an example, let's look at the <b>model</b> variable we define in <font color="red">project.py</font>: 52 <table class="code"> 53 <tr><td>model = 'small' # different size model - 'small' or 'large'</td></tr> 54 </table> 55 <p> 56 We define this variable solely to quickly change other input filenames. Where we want a different input file 57 depending on whether we want a 'small' or 'large' model, we build the filenames using the <b>model</b> variable. 58 Some examples are: 59 <p> 60 <table class="code"> 61 <tr><td>bounding_polygon_filename = 'bounding_polygon_'+ model + '.csv'</td></tr> 62 <tr><td>land_initial_conditions_filename = [['initial_conditions_' + model +'.csv', 0]]</td></tr> 63 <tr><td>landward_boundary_filename = 'landward_boundary_'+ model +'.csv'</td></tr> 64 </table> 65 <p> 66 We must, of course, ensure that there are input files <font color="red">bounding_polygon_small.csv</font> 67 and <font color="red">bounding_polygon_large.csv</font>, and so on. 68 <p> 69 Now, if we need to change the simulation model from 'small' to 'large', we need only change the 70 value of the <b>model</b> variable, and all the input files that depend on the model will change. 71 This speeds up development and make errors less likely. If you want to add another model to the two 72 we show above, just set <b>model</b> to 'medium' and create appropriate input files with the string 73 'medium' in the filename. 74 75 <a name="build_boundary.py"><h4><b>build_boundary.py</b></h4></a> 76 77 [text about build_boundary.py]<br> 78 [In particular, need to run this if elevation data changes.] 40 79 <p> 41 80 42 81 <a name="setup_model.py"><h4><b>setup_model.py</b></h4></a> 82 43 83 [text about project.py] 44 84 <p> 45 85 46 86 <a name="run_model.py"><h4><b>run_model.py</b></h4></a> 87 47 88 [text about project.py] 48 89 <p> 49 90 50 <a name="events"><h3><b>Changing events</b></h3></a> 91 <a name="change"><h3><b>Making changes to a simulation</b></h3></a> 92 93 Now we walk through some examples of changes you might make. There are many ways to change a simulation - here 94 we discuss just a few. 95 <p> 96 97 <a name="events"><h4><b>Changing events</b></h4></a> 51 98 52 99 [some events text here] 53 100 <p> 54 101 55 <a name="elevation"><h 3><b>Changing elevation data</b></h3></a>102 <a name="elevation"><h4><b>Changing elevation data</b></h4></a> 56 103 57 104 [some elevation text here] -
DVD_images/update_DVD_images.py
r7266 r7271 40 40 'data_src_path': 'data/tasmania/hobart_tsunami_scenario_2009/anuga', 41 41 'arcgis_src_path': 'data/tasmania/hobart_tsunami_scenario_2009/ArcGIS', 42 'proj_src_path': 'sandpits/kvanputten/ANUGA/anuga_work/production/hobart_2009', 42 'viz_src_path': 'data/tasmania/hobart_tsunami_scenario_2009/visualisations', 43 'proj_src_path': 'sandpits/kvanputten/ANUGA/anuga_work/production/hobart_2009/For_DVD', 43 44 44 45 # paths to destination directories (under 'jurisdiction' root) 45 46 'data_dst_path': 'data/tasmania/hobart_tsunami_scenario_2009/anuga', 46 47 'proj_dst_path': 'project', 48 'viz_dst_path': 'documents', 47 49 'arcgis_dst_path': 'data/tasmania/hobart_tsunami_scenario_2009/ArcGIS', 48 50 49 51 # copy or create whole directories 50 'make_dst_dirs': [' meshes', 'gauges', 'outputs', 'topographies/elevation_fix'],51 'copy_data_dirs': [' boundaries', 'polygons'],52 'make_dst_dirs': ['outputs', 'topographies'], 53 'copy_data_dirs': ['gauges','boundaries', 'polygons'], 52 54 53 55 # copy 'data' files or directories 54 'copy_data_files': ['gauges/schema.ini', 'gauges/tsunamipointsMGA.csv', 56 'copy_data_files': ['outputs/Event1_HAT', 57 'outputs/Event1_MSL', 58 'outputs/Event2_HAT', 59 'outputs/Event2_MSL', 60 'outputs/Event3_MSL', 55 61 'topographies/hobart_combined_elevation.pts', 56 'topographies/hobart_combined_elevation.txt', 57 'topographies/elevation_fix/topo_grid_notsw.pts', 58 'topographies/elevation_fix/topo_grid_notsw.dem', 59 'topographies/elevation_fix/topo_grid_notsw.asc', 60 'topographies/elevation_fix/topo_grid_notsw.prj'], 62 'topographies/hobart_combined_elevation.txt'], 61 63 62 64 # copy 'project' files or directories 63 'copy_proj_files': ['build_elevation.py', 'build_urs_boundary.py', 'combine_gauges.py', 64 'export_results_max.py', 'file_length.py', 'get_runup_v2.py', 65 'get_timeseries.py', 'project.py', 'run_model.py', 'setup_model.py'], 65 'copy_proj_files': ['build_elevation.py', 'project.py', 'run_model.py', 66 'export_results_max.py', 'get_timeseries.py', 67 'setup_model.py'], 68 69 # copy 'visualisations' files or directories 70 'copy_viz_files': ['Figures'], 66 71 67 72 # copy 'arcgis' files or directories … … 75 80 'data_src_path': 'data/new_south_wales/batemans_bay_tsunami_scenario_2009/anuga', 76 81 'arcgis_src_path': 'data/new_south_wales/batemans_bay_tsunami_scenario_2009/ArcGIS', 82 'viz_src_path': 'data/tasmania/hobart_tsunami_scenario_2009/visualisations', 77 83 'proj_src_path': 'sandpits/jgriffin/ANUGA/anuga_work/production/new_south_wales/batemans_bay', 78 84 … … 80 86 'data_dst_path': 'data/new_south_wales/batemans_bay_tsunami_scenario_2009/anuga', 81 87 'proj_dst_path': 'project', 88 'viz_dst_path': 'documents', 82 89 'arcgis_dst_path': 'data/new_south_wales/batemans_bay_tsunami_scenario_2009/ArcGIS', 83 90 … … 101 108 'outputs/New_Hebrides_1000yr', 102 109 'outputs/New_Hebrides_2000yr', 103 'outputs/New_Hebrides_5000yr'], 110 'outputs/New_Hebrides_5000yr', 111 'outputs/elevation'], 112 113 # copy 'visualisations' files or directories 114 'copy_viz_files': ['Figures'], 104 115 105 116 # copy 'project' files or directories … … 119 130 'data_src_path': 'data/new_south_wales/gosford_tsunami_scenario_2009/anuga', 120 131 'arcgis_src_path': 'data/new_south_wales/gosford_tsunami_scenario_2009/ArcGIS', 132 'viz_src_path': 'data/tasmania/hobart_tsunami_scenario_2009/visualisations', 121 133 'proj_src_path': 'sandpits/jgriffin/ANUGA/anuga_work/production/new_south_wales/gosford', 122 134 … … 124 136 'data_dst_path': 'data/new_south_wales/gosford_tsunami_scenario_2009/anuga', 125 137 'proj_dst_path': 'project', 138 'viz_dst_path': 'documents', 126 139 'arcgis_dst_path': 'data/new_south_wales/gosford_tsunami_scenario_2009/ArcGIS', 127 140 … … 140 153 'outputs/Puysegur_500yr', 141 154 'outputs/Puysegur_1000yr', 142 'outputs/Puysegur_5000yr' 155 'outputs/Puysegur_5000yr', 156 'outputs/elevation' 143 157 ], 158 159 # copy 'visualisations' files or directories 160 'copy_viz_files': ['Figures'], 144 161 145 162 # copy 'project' files or directories … … 159 176 'data_src_path': 'data/queensland/gold_coast_tsunami_scenario_2009/anuga', 160 177 'arcgis_src_path': 'data/queensland/gold_coast_tsunami_scenario_2009/ArcGIS', 178 'viz_src_path': 'data/tasmania/hobart_tsunami_scenario_2009/visualisations', 161 179 'proj_src_path': 'sandpits/lfountain/anuga_work/production/gold_coast_2009', 162 180 … … 164 182 'data_dst_path': 'data/queensland/gold_coast_tsunami_scenario_2009/anuga', 165 183 'proj_dst_path': 'project', 184 'viz_dst_path': 'documents', 166 185 'arcgis_dst_path': 'data/queensland/gold_coast_tsunami_scenario_2009/ArcGIS', 167 186 168 187 # copy or create whole directories 169 'make_dst_dirs': [' meshes', 'outputs', 'polygons', 'topographies', 'gauges'],188 'make_dst_dirs': ['outputs', 'polygons', 'topographies', 'gauges'], 170 189 'copy_data_dirs': ['boundaries'], 171 190 … … 180 199 'gauges/gauges.csv', 181 200 'polygons/images.csv', 182 'topographies/gold_coast_combined_elevation _250m.pts'201 'topographies/gold_coast_combined_elevation.pts' 183 202 ], 203 204 # copy 'visualisations' files or directories 205 'copy_viz_files': ['Figures'], 184 206 185 207 # copy 'project' files or directories … … 190 212 191 213 # copy 'arcgis' files or directories 192 'copy_arc_files': ['gold_coast.mxd' ]214 'copy_arc_files': ['gold_coast.mxd', 'gold_coast.gdb'] 193 215 } 194 216 … … 241 263 proj_src_path = os.path.join(main_path, j_dict['proj_src_path']) 242 264 proj_dst_path = os.path.join(os.getcwd(), j_name, j_dict['proj_dst_path']) 265 viz_src_path = os.path.join(main_path, j_dict['viz_src_path']) 266 viz_dst_path = os.path.join(os.getcwd(), j_name, j_dict['viz_dst_path']) 243 267 arcgis_src_path = os.path.join(main_path, j_dict['arcgis_src_path']) 244 268 arcgis_dst_path = os.path.join(os.getcwd(), j_name, j_dict['arcgis_dst_path']) … … 274 298 src_file = os.path.join(data_src_path, copy_file) 275 299 new_file = os.path.join(data_dst_path, copy_file) 300 log('Copying: %s' % copy_file) 301 copy_file_or_dir(src_file, new_file) 302 303 # copy required visualisation files 304 log('Creating directory: %s' % viz_dst_path) 305 os.makedirs(viz_dst_path) 306 for copy_file in j_dict['copy_viz_files']: 307 src_file = os.path.join(viz_src_path, copy_file) 308 new_file = os.path.join(viz_dst_path, copy_file) 276 309 log('Copying: %s' % copy_file) 277 310 copy_file_or_dir(src_file, new_file)
Note: See TracChangeset
for help on using the changeset viewer.