Changeset 5761


Ignore:
Timestamp:
Sep 12, 2008, 12:26:50 PM (16 years ago)
Author:
kristy
Message:

Headers updated to link inputs and outputs

Location:
anuga_work/production/perth
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • anuga_work/production/perth/build_boundary_27255.py

    r5759 r5761  
    11"""
    2 build_boundary script creates a sts file and csv files.
    3 The sts files is necessary for run_perth.py
    4 The csv files are timeseries of the sts file determining the wave input
     2Script for building boundary to run tsunami inundation scenario for Perth,
     3WA, Australia.  The boundary is based on the National Hazard Map.
    54
    6 This script is determined by an inidividual event generated through
    7 the Hazard map, refer to David Burbidge for details of inidivdual events
     5Input: order_filename from project.py
     6Output: creates a sts file and csv files stored in project.boundaries_dir_event.
     7The run_perth.py is reliant on the output of this script.
    88"""
    99import os
     
    102102        s = '%d, %.6f, %.6f, %.6f\n' %(index, x[j], y[j], max(stage))
    103103        fid_max.write(s)
     104     
     105#------------------------------------------------------------------------------
     106# Get Minium wave height throughout timeseries at each index point
     107#------------------------------------------------------------------------------
     108
     109    minname = 'min_sts_stage.csv'
     110    fid_min = open(project.boundaries_dir_event+sep+maxname,'w')
     111    s = 'index, x, y, max_stage \n'
     112    fid_min.write(s)   
     113    for j in range(len(x)):
     114        index= permutation[j]
     115        stage = quantities['stage'][:,j]
     116        xmomentum = quantities['xmomentum'][:,j]
     117        ymomentum = quantities['ymomentum'][:,j]
     118
     119        s = '%d, %.6f, %.6f, %.6f\n' %(index, x[j], y[j], min(stage))
     120        fid_min.write(s)
    104121       
     122
     123
    105124        fid_sts = open(project.boundaries_dir_event+sep+basename+'_'+ str(index)+'.csv', 'w')
    106125        s = 'time, stage, xmomentum, ymomentum \n'
    107126        fid_sts.write(s)
    108        
     127
     128#------------------------------------------------------------------------------
     129# End of the get gauges
     130#------------------------------------------------------------------------------
    109131        for k in range(len(time)-1):
    110132            s = '%.6f, %.6f, %.6f, %.6f\n' %(time[k], stage[k], xmomentum[k], ymomentum[k])
     
    114136
    115137    fid.close()
    116        
     138
     139
    117140    return quantities,elevation,time
    118141
  • anuga_work/production/perth/build_boundary_27283.py

    r5759 r5761  
    11"""
    2 build_boundary script creates a sts file and csv files.
    3 The sts files is necessary for run_perth.py
    4 The csv files are timeseries of the sts file determining the wave input
     2Script for building boundary to run tsunami inundation scenario for Perth,
     3WA, Australia.  The boundary is based on the National Hazard Map.
    54
    6 This script is determined by an inidividual event generated through
    7 the Hazard map, refer to David Burbidge for details of inidivdual events
     5Input: order_filename from project.py
     6Output: creates a sts file and csv files stored in project.boundaries_dir_event.
     7The run_perth.py is reliant on the output of this script.
    88"""
    99import os
     
    141141        s = '%d, %.6f, %.6f, %.6f\n' %(index, x[j], y[j], max(stage))
    142142        fid_max.write(s)
     143     
     144#------------------------------------------------------------------------------
     145# Get Minium wave height throughout timeseries at each index point
     146#------------------------------------------------------------------------------
     147
     148    minname = 'min_sts_stage.csv'
     149    fid_min = open(project.boundaries_dir_event+sep+maxname,'w')
     150    s = 'index, x, y, max_stage \n'
     151    fid_min.write(s)   
     152    for j in range(len(x)):
     153        index= permutation[j]
     154        stage = quantities['stage'][:,j]
     155        xmomentum = quantities['xmomentum'][:,j]
     156        ymomentum = quantities['ymomentum'][:,j]
     157
     158        s = '%d, %.6f, %.6f, %.6f\n' %(index, x[j], y[j], min(stage))
     159        fid_min.write(s)
    143160       
     161
     162
    144163        fid_sts = open(project.boundaries_dir_event+sep+basename+'_'+ str(index)+'.csv', 'w')
    145164        s = 'time, stage, xmomentum, ymomentum \n'
    146165        fid_sts.write(s)
    147        
     166
     167#------------------------------------------------------------------------------
     168# End of the get gauges
     169#------------------------------------------------------------------------------
    148170        for k in range(len(time)-1):
    149171            s = '%.6f, %.6f, %.6f, %.6f\n' %(time[k], stage[k], xmomentum[k], ymomentum[k])
     
    153175
    154176    fid.close()
    155        
     177
     178
    156179    return quantities,elevation,time
    157180
  • anuga_work/production/perth/build_perth.py

    r5759 r5761  
    1 """Script for running tsunami inundation scenario for Perth, WA, Australia.
     1"""
     2Script for building the elevation data to run tsunami inundation scenario
     3for Perth, WA, Australia.
    24
    3 Source data such as elevation and boundary data is assumed to be available in
    4 directories specified by project.py
    5 The output sww file is stored in project.output_time_dir
    6 
    7 The scenario is defined by a triangular mesh created from project.polygon,
    8 the elevation data and a simulated submarine landslide.
    9 
     5Input: elevation data from project.py
     6Output: pts file stored in project.topographies_dir
    107The run_perth.py is reliant on the output of this script.
    118
  • anuga_work/production/perth/export_results_all.py

    r5759 r5761  
    11"""
    2 Generates ascii grids of nominated areas - need sww file created in run_perth.py
     2Generates ascii grids of nominated areas -
     3Input: sww file from run_perth.py
     4       boundaries for grids from project.py
     5Outputs: ascii grids of specified variables
     6Stored in the 'outputs_dir' folder for respective .sww file
     7
     8Note:
    39If producing a grid for the enitre extent cellsize should be greater than 30m
    410If producing grids for inundation area resolution should be greater than mesh (ie ~22m)
     
    1218from os import sep
    1319
     20directory = project.output_dir
     21
    1422#time_dir = '20080526_104946_run_final_0.6_test_kvanputt'
    1523#time_dir = '20080530_170833_run_final_0.6_exmouth_kvanputt'
    16 #time_dir = '20080815_103442_run_final_0.0_polyline_alpha0.1_kvanputt'
    17 time_dir = '20080909_151438_run_final_0.0_polyline_alpha0.1_kvanputt'
     24time_dir1 = '20080815_103442_run_final_0.0_polyline_alpha0.1_kvanputt'
     25time_dir2 = '20080909_151438_run_final_0.0_polyline_alpha0.1_kvanputt'
    1826
    1927#cellsize = 20
     
    2634var = [0,4] #stage and elevation
    2735
     36time_dir = [time_dir1, time_dir2]
     37for time_dir in time_dirs:
    2838
    29 directory = project.output_dir
    30 name1 = directory+time_dir+sep+project.scenario_name
    31 name2 = directory+time_dir+sep+'sww2'+sep+project.scenario_name+'_time_39900_0'
     39    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 anything
    3241
    33 names = [name1, name2]
    34 for name in names:
     42    names = [name1, name2]
     43    for name in names:
    3544
    36     for which_area in area:
    37         if which_area == 'All':
    38        
    39         if which_area == 'Geordie':
    40             easting_min = project.xminGeordie
    41             easting_max = project.xmaxGeordie
    42             northing_min = project.yminGeordie
    43             northing_max = project.ymaxGeordie
     45        for which_area in area:
     46            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
    4453
    45         if which_area == 'Sorrento':
    46             easting_min = project.xminSorrento
    47             easting_max = project.xmaxSorrento
    48             northing_min = project.yminSorrento
    49             northing_max = project.ymaxSorrento
     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
    5059
    51         if which_area == 'Fremantle':
    52             easting_min = project.xminFremantle
    53             easting_max = project.xmaxFremantle
    54             northing_min = project.yminFremantle
    55             northing_max = project.ymaxFremantle
     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
    5665
    57         if which_area == 'Rockingham':
    58             easting_min = project.xminRockingham
    59             easting_max = project.xmaxRockingham
    60             northing_min = project.yminRockingham
    61             northing_max = project.ymaxRockingham
     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
    6271
    63          
    64         for which_var in var:
    65             if which_var == 0:  # Stage
    66                 outname = name + which_area + '_stage'
    67                 quantityname = 'stage'
     72             
     73            for which_var in var:
     74                if which_var == 0:  # Stage
     75                    outname = name + which_area + '_stage'
     76                    quantityname = 'stage'
    6877
    69             if which_var == 1:  # Absolute Momentum
    70                 outname = name + which_area + '_momentum'
    71                 quantityname = '(xmomentum**2 + ymomentum**2)**0.5' 
     78                if which_var == 1:  # Absolute Momentum
     79                    outname = name + which_area + '_momentum'
     80                    quantityname = '(xmomentum**2 + ymomentum**2)**0.5' 
    7281
    73             if which_var == 2:  # Depth
    74                 outname = name + which_area + '_depth'
    75                 quantityname = 'stage-elevation' 
     82                if which_var == 2:  # Depth
     83                    outname = name + which_area + '_depth'
     84                    quantityname = 'stage-elevation' 
    7685
    77             if which_var == 3:  # Speed
    78                 outname = name + which_area + '_speed'
    79                 #quantityname = '(xmomentum**2 + ymomentum**2)**0.5/(stage-elevation+1.e-6/(stage-elevation))'  #Speed
    80                 quantityname = '(xmomentum**2 + ymomentum**2)**0.5/(stage-elevation+1.e-6)'  #Speed
    81                
    82             if which_var == 4:  # Elevation
    83                 outname = name + which_area + '_elevation'
    84                 quantityname = 'elevation'  #Elevation
     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
    8594
    86             if which_area == 'All'
    87                 print 'start sww2dem',which_area
    88                 sww2dem(name, basename_out = outname,
    89                             quantity = quantityname,
    90                             #timestep = timestep,
    91                             cellsize = cellsize,     
    92                             reduction = max,
    93                             verbose = True,
    94                             format = 'asc')
     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')
    95104
    96             else:
    97                 print 'start sww2dem',which_area, easting_min
    98                 sww2dem(name, basename_out = outname,
    99                             quantity = quantityname,
    100                             #timestep = timestep,
    101                             cellsize = cellsize,     
    102                             easting_min = easting_min,
    103                             easting_max = easting_max,
    104                             northing_min = northing_min,
    105                             northing_max = northing_max,       
    106                             reduction = max,
    107                             verbose = True,
    108                             format = 'asc')
     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')
    109118
  • anuga_work/production/perth/get_timeseries.py

    r5759 r5761  
    11"""
    2 Generate time series of nominated "gauges" read from project.gauge_filename. This
    3 is done by running sww2csv_gauges to make 'csv' files in the 'output_dir' containing
    4 the details at the gauges for both these sww files.
     2Generate time series of nominated "gauges".
     3Input: sww file from run_perth.py
     4       gauges project.gauge_filename
     5Output: csv files stage,speed,depth,elevation over time
     6Stored in the 'outputs_dir' folder for respective .sww file
     7
     8Note:
    59Can run different sww files at the same time
    610make sure if there is a second sww file that it is placed into a folder called sww2
  • anuga_work/production/perth/project.py

    r5759 r5761  
    1 """Common filenames and locations for topographic data, meshes and outputs.
    2 Simplified and Commented by Kristy Van Putten
     1"""Common filenames and locations for elevation, meshes and outputs.
     2This script is the heart of all scripts in folder
    33"""
    44#------------------------------------------------------------------------------
  • anuga_work/production/perth/run_perth.py

    r5759 r5761  
    11"""Script for running tsunami inundation scenario for Perth, WA, Australia.
    2 
    3 Source data such as elevation and boundary data is assumed to be available in
    4 directories specified by project.py
    5 The output sww file is stored in project.output_run_time_dir
    62
    73The scenario is defined by a triangular mesh created from project.polygon,
    84the elevation data is combiled into a pts file through build_perth.py
    95and a simulated tsunami is generated through an sts file from build_boundary.py
     6
     7Input: sts file (build_boundary.py for resepective event)
     8       pts file (build_perth.py)
     9       information from project file
     10Outputs: sww file stored in project.output_run_time_dir
     11The export_results_all.py and get_timeseries.py is reliant
     12on the outputs of this script
    1013
    1114Ole Nielsen and Duncan Gray, GA - 2005, Jane Sexton, Nick Bartzis, GA - 2006
Note: See TracChangeset for help on using the changeset viewer.