Changeset 4587


Ignore:
Timestamp:
Jul 4, 2007, 5:22:18 PM (17 years ago)
Author:
nick
Message:

update model scripts

Location:
anuga_work/production
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • anuga_work/production/broome_2006/build_broome.py

    r4564 r4587  
    5656# topography directory filenames
    5757onshore_in_dir_name = project_urs.onshore_in_dir_name
     58onshore_in_dir_name1 = project_urs.onshore_in_dir_name1
    5859coast_in_dir_name = project_urs.coast_in_dir_name
    5960#island_in_dir_name = project_urs.island_in_dir_name
     
    6162offshore_in_dir_name1 = project_urs.offshore_in_dir_name1
    6263offshore_in_dir_name2 = project_urs.offshore_in_dir_name2
     64offshore_in_dir_name3 = project_urs.offshore_in_dir_name3
    6365
    6466onshore_dir_name = project_urs.onshore_dir_name
     67onshore_dir_name1 = project_urs.onshore_dir_name1
    6568coast_dir_name = project_urs.coast_dir_name
    6669#island_dir_name = project_urs.island_dir_name
     
    6871offshore_dir_name1 = project_urs.offshore_dir_name1
    6972offshore_dir_name2 = project_urs.offshore_dir_name2
    70 '''
     73offshore_dir_name3 = project_urs.offshore_dir_name3
     74
    7175# creates DEM from asc data
    7276print "creates DEMs from asc data"
    7377convert_dem_from_ascii2netcdf(onshore_in_dir_name, basename_out=onshore_dir_name, use_cache=True, verbose=True)
     78convert_dem_from_ascii2netcdf(onshore_in_dir_name1, basename_out=onshore_dir_name1, use_cache=True, verbose=True)
    7479convert_dem_from_ascii2netcdf(offshore_in_dir_name1, basename_out=offshore_dir_name1, use_cache=True, verbose=True)
    7580convert_dem_from_ascii2netcdf(offshore_in_dir_name2, basename_out=offshore_dir_name2, use_cache=True, verbose=True)
     81convert_dem_from_ascii2netcdf(offshore_in_dir_name3, basename_out=offshore_dir_name3, use_cache=True, verbose=True)
    7682
    7783#creates pts file for onshore DEM
     
    8086        use_cache=True,
    8187        verbose=True)
    82 
     88dem2pts(onshore_dir_name1, use_cache=True, verbose=True)
    8389#creates pts file for island DEM
    8490dem2pts(offshore_dir_name1, use_cache=True, verbose=True)
    8591dem2pts(offshore_dir_name2, use_cache=True, verbose=True)
     92dem2pts(offshore_dir_name3, use_cache=True, verbose=True)
    8693
    8794print'create Geospatial data1 objects from topographies',onshore_dir_name + '.pts'
    8895G1 = Geospatial_data(file_name = onshore_dir_name + '.pts')
     96print'create Geospatial data1a objects from topographies',onshore_dir_name1 + '.pts'
     97G1a = Geospatial_data(file_name = onshore_dir_name1 + '.pts')
    8998print'create Geospatial data2 objects from coast', coast_in_dir_name + '.txt'
    9099G2 = Geospatial_data(file_name = coast_in_dir_name + '.txt')
     
    97106print'create Geospatial data4 objects from offshore2',offshore_dir_name2 + '.pts'
    98107G_off2 = Geospatial_data(file_name = offshore_dir_name2 + '.pts')
     108print'create Geospatial data objects from offshore3',offshore_dir_name3 + '.pts'
     109G_off3 = Geospatial_data(file_name = offshore_dir_name3 + '.pts')
    99110
    100111print'add all geospatial objects'
    101 G = G1 + G2 + G_off + G_off1 + G_off2
     112G = G1 + G1a + G2 + G_off + G_off1 + G_off2 + G_off3
    102113
    103114print'clip combined geospatial object by bounding polygon'
     
    112123G.export_points_file(project_urs.combined_dir_name+ '.txt')
    113124
     125'''
    114126print'split'
    115127G_small, G_other = G.split(.10,verbose=True)
     
    121133G_small.export_points_file(project_urs.combined_small_dir_name + '.txt')
    122134#G_clipped.export_points_file(project_urs.combined_dir_name + '.xya')
    123 '''
     135
    124136
    125137
     
    132144print'export 2'
    133145G_all_2.export_points_file(project_urs.combined_dir_name+'_other1' + '.xya')
    134 '''
     146
    135147
    136148#-------------------------------------------------------------------------
  • anuga_work/production/broome_2006/project_urs.py

    r4564 r4587  
    4141finaltime=25000
    4242setup='final'
    43 source='exmouth'
     43source='dampier'
    4444
    4545if setup =='trial':
     
    6262
    6363# onshore data from 30m DTED level 2
    64 onshore_name = 'Broome_topography_DLI' # original
     64#onshore_name = 'Broome_topography_DLI' # original
     65onshore_name = 'town_topo_10m' # original
     66onshore_name1 = 'other_topo_250m' # original
     67
    6568# offshore
    6669offshore_name = 'Broome_Bathymetry'
    67 offshore_name1 = 'inferred_north'
    68 offshore_name2 = 'inferred_south'
     70#offshore_name1 = 'inferred_north'
     71#offshore_name2 = 'inferred_south'
     72offshore_name1 = 'north_250m'
     73offshore_name2 = 'south_250m'
     74offshore_name3 = 'cable_250m'
    6975coast_name = 'Broome_coastline'
    7076
    7177#final topo name
    72 combined_name ='broome_combined_elevation_z51_original'
     78combined_name ='broome_combined_elevation_z51_reduced'
    7379combined_name1 ='broome_combined_elevation1'
    7480combined_name_unclipped1 ='broome_combined_elevation_unclipped1'
     
    8288# input topo file location
    8389onshore_in_dir_name = topographies_in_dir + onshore_name
     90onshore_in_dir_name1 = topographies_in_dir + onshore_name1
    8491coast_in_dir_name = topographies_in_dir + coast_name
    8592offshore_in_dir_name = topographies_in_dir + offshore_name
    8693offshore_in_dir_name1 = topographies_in_dir + offshore_name1
    8794offshore_in_dir_name2 = topographies_in_dir + offshore_name2
     95offshore_in_dir_name3 = topographies_in_dir + offshore_name3
    8896
    8997onshore_dir_name = topographies_dir + onshore_name
     98onshore_dir_name1 = topographies_dir + onshore_name1
    9099coast_dir_name = topographies_dir + coast_name
    91100offshore_dir_name = topographies_dir + offshore_name
    92101offshore_dir_name1 = topographies_dir + offshore_name1
    93102offshore_dir_name2 = topographies_dir + offshore_name2
     103offshore_dir_name3 = topographies_dir + offshore_name3
    94104
    95105#final topo files
     
    124134output_dir = anuga_dir+'outputs'+sep
    125135output_build_time_dir = output_dir+build_time+'_'+source+sep
    126 output_run_time_dir = output_dir +run_time+dir_comment+sep
    127 #output_run_time_dir = output_dir +'20070622_004008_run_final_0_onslow_nbartzis'+sep
     136#output_run_time_dir = output_dir +run_time+dir_comment+sep
     137output_run_time_dir = output_dir +'20070703_062312_run_final_4.9_dampier_nbartzis'+sep
    128138output_run_time_dir_name = output_run_time_dir + scenario_name  #Used by post processing
    129139
     
    137147
    138148buildings_filename = gauges_dir + 'Broome_res_Project.csv'
    139 buildings_filename_out = 'Broome_res_Project_modified.csv'
     149buildings_filename_out = output_run_time_dir+'Broome_res_Project_modified.csv'
    140150
    141151###############################
     
    172182interior_regions = [[poly_0,res_0],[poly_1,res_1],[poly_2,res_2]
    173183                     ,[poly_3,res_3],[poly_4,res_4]]
     184                     
     185boundary_tags={'back': [1, 2],
     186               'side': [0,3],
     187               'ocean': [4]}
    174188
    175189trigs_min = number_mesh_triangles(interior_regions, poly_all, res_poly_all)
  • anuga_work/production/broome_2006/run_broome_urs.py

    r4564 r4587  
    5353
    5454    #copy script must be before screen_catcher
     55    #print kwargs
     56    '''
    5557    print 'tide',kwargs['tide']
    5658    kwargs['est_num_trigs']=project_urs.trigs_min
     
    6668#    kwargs['bathy_file']=project_urs.combined_small_dir_name + '.pts'
    6769    kwargs['boundary_file']=project_urs.boundaries_in_dir_name + '.sww'
    68    
     70    '''
    6971    print 'output_dir',kwargs['output_dir']
    7072    if myid == 0:
     
    101103
    102104        create_mesh_from_regions(project_urs.poly_all,
    103                          boundary_tags={'back': [1, 2], 'side': [0,3],
    104                                         'ocean': [4]},
     105                         boundary_tags=project_urs.boundary_tags,
    105106                             maximum_triangle_area=project_urs.res_poly_all,
    106107                             interior_regions=project_urs.interior_regions,
     
    136137        from polygon import Polygon_function
    137138        #following sets the stage/water to be offcoast only
    138         IC = Polygon_function( [(project_urs.poly_mainland, -1.0)], default = kwargs['tide'],
    139                                  geo_reference = domain.geo_reference)
    140         domain.set_quantity('stage', IC)
     139#        IC = Polygon_function( [(project_urs.poly_mainland, -1.0)], default = kwargs['tide'],
     140#                                 geo_reference = domain.geo_reference)
     141#        domain.set_quantity('stage', IC)
     142        domain.set_quantity('stage', kwargs['tide'])
    141143        domain.set_quantity('friction', kwargs['friction'])
    142144       
     
    228230    kwargs['completed']=str(time.time()-t0)
    229231   
    230     if myid == 0:
     232    if myid==0:
    231233        store_parameters(**kwargs)
    232        
    233         print 'memory usage before del domain',mem_usage()
    234         del domain
    235         print 'memory usage after del domain',mem_usage()
    236    
    237         swwfile = kwargs['output_dir']+kwargs['aa_scenario_name']
    238         print'swwfile',swwfile
    239        
    240         export_grid(swwfile, extra_name_out = 'town',
    241                 quantities = ['speed','depth','elevation','stage'], # '(xmomentum**2 + ymomentum**2)**0.5' defaults to elevation
    242 #                quantities = ['speed','depth'], # '(xmomentum**2 + ymomentum**2)**0.5' defaults to elevation
    243                 timestep = None,
    244                 reduction = max,
    245                 cellsize = 25,
    246                 NODATA_value = -9999,
    247                 easting_min = project_urs.eastingmin,
    248                 easting_max = project_urs.eastingmax,
    249                 northing_min = project_urs.northingmin,
    250                 northing_max = project_urs.northingmax,
    251                 verbose = False,
    252                 origin = None,
    253                 datum = 'GDA94',
    254                 format = 'asc')
    255    
    256         buildings_filename = project_urs.buildings_filename
    257         buildings_filename_out = project_urs.buildings_filename_out
    258                
    259         inundation_damage(swwfile+'.sww', buildings_filename, buildings_filename_out)
    260         print '\n Augmented building file written to %s \n' %buildings_filename_out
    261     barrier()
     234    barrier
     235   
     236    print 'memory usage before del domain1',mem_usage()
     237   
     238def export_model(**kwargs):   
     239    #store_parameters(**kwargs)
     240   
     241    print 'memory usage before del domain',mem_usage()
     242    #del domain
     243    print 'memory usage after del domain',mem_usage()
     244   
     245    swwfile = kwargs['output_dir']+kwargs['aa_scenario_name']
     246    print'swwfile',swwfile
     247   
     248    export_grid(swwfile, extra_name_out = 'town',
     249            quantities = ['speed','depth','elevation','stage'], # '(xmomentum**2 + ymomentum**2)**0.5' defaults to elevation
     250            #quantities = ['speed','depth'], # '(xmomentum**2 + ymomentum**2)**0.5' defaults to elevation
     251            timestep = None,
     252            reduction = max,
     253            cellsize = 25,
     254            NODATA_value = -9999,
     255            easting_min = project_urs.eastingmin,
     256            easting_max = project_urs.eastingmax,
     257            northing_min = project_urs.northingmin,
     258            northing_max = project_urs.northingmax,
     259            verbose = False,
     260            origin = None,
     261            datum = 'GDA94',
     262            format = 'asc')
     263           
     264    inundation_damage(swwfile+'.sww', project_urs.buildings_filename,
     265                      project_urs.buildings_filename_out)
    262266   
    263267#-------------------------------------------------------------
    264268if __name__ == "__main__":
    265 
    266     run_model(file_name=project_urs.home+'detail.csv', aa_scenario_name=project_urs.scenario_name,
    267               ab_time=project_urs.time, res_factor= project_urs.res_factor, tide=project_urs.tide, user=project_urs.user,
    268               alpha = project_urs.alpha, friction=project_urs.friction,
    269               time_thinning = project_urs.time_thinning,
    270               dir_comment=project_urs.dir_comment)
     269   
     270    kwargs={}
     271    kwargs['est_num_trigs']=project_urs.trigs_min
     272    kwargs['num_cpu']=numprocs
     273    kwargs['host']=project_urs.host
     274    kwargs['res_factor']=project_urs.res_factor
     275    kwargs['starttime']=project_urs.starttime
     276    kwargs['yieldstep']=project_urs.yieldstep
     277    kwargs['finaltime']=project_urs.finaltime
     278   
     279    kwargs['output_dir']=project_urs.output_run_time_dir
     280    kwargs['bathy_file']=project_urs.combined_dir_name+'.txt'
     281#    kwargs['bathy_file']=project_urs.combined_small_dir_name + '.pts'
     282    kwargs['boundary_file']=project_urs.boundaries_in_dir_name + '.sww'
     283    kwargs['file_name']=project_urs.home+'detail.csv'
     284    kwargs['aa_scenario_name']=project_urs.scenario_name
     285    kwargs['ab_time']=project_urs.time
     286    kwargs['res_factor']= project_urs.res_factor
     287    kwargs['tide']=project_urs.tide
     288    kwargs['user']=project_urs.user
     289    kwargs['alpha'] = project_urs.alpha
     290    kwargs['friction']=project_urs.friction
     291    kwargs['time_thinning'] = project_urs.time_thinning
     292    kwargs['dir_comment']=project_urs.dir_comment
     293
     294    run_model(**kwargs)
     295     
     296    if myid==0:
     297        export_model(**kwargs)
     298    barrier
  • anuga_work/production/dampier_2006/project_urs.py

    r4546 r4587  
    133133output_build_time_dir = output_dir+build_time+'_'+source+sep
    134134output_run_time_dir = output_dir +run_time+dir_comment+sep
     135#output_run_time_dir = output_dir +'20070618_050232_run_final_0.0_onslow_nbartzis'+sep
    135136output_run_time_dir_name = output_run_time_dir + scenario_name  #Used by post processing
    136137
     
    275276
    276277poly_mainland = read_polygon(polygons_dir+'mainland_only.csv')
    277 
    278 # exporting asc grid - Dampier gas facility
    279 e_min_area = 474000
    280 e_max_area = 480000
    281 n_min_area = 7719000
    282 n_max_area = 7725000
    283 
    284 # residential Dampier
    285 e_min_area_d = 468450
    286 e_max_area_d = 470820
    287 n_min_area_d = 7714050
    288 n_max_area_d = 7716625
     278#
     279## exporting asc grid - Dampier gas facility
     280#e_min_area = 474000
     281#e_max_area = 480000
     282#n_min_area = 7719000
     283#n_max_area = 7725000
     284#
     285## residential Dampier
     286#e_min_area_d = 468450
     287#e_max_area_d = 470820
     288#n_min_area_d = 7714050
     289#n_max_area_d = 7716625
    289290
    290291# residential Karratha
    291 e_min_area_k = 474690
    292 e_max_area_k = 489900
    293 n_min_area_k = 7704760
    294 n_max_area_k = 7712600
     292eastingmin = 474690
     293eastingmax = 489900
     294northingmin = 7704760
     295northingmax = 7712600
  • anuga_work/production/dampier_2006/run_dampier_urs.py

    r4542 r4587  
    3838from anuga.caching import myhash
    3939from anuga.damage_modelling.inundation_damage import add_depth_and_momentum2csv, inundation_damage
     40from anuga.fit_interpolate.benchmark_least_squares import mem_usage
    4041# Application specific imports
    4142import project_urs                 # Definition of file names and polygons
     
    6970    kwargs['boundary_file']=project_urs.boundaries_in_dir_name + '.sww'
    7071#    kwargs['Completed']=''
    71 
     72   
    7273    start_screen_catcher(kwargs['output_dir'], myid, numprocs)
    7374
     
    223224   
    224225    kwargs['completed']=str(time.time()-t0)
    225    
    226     if myid == 0:
    227         store_parameters(**kwargs)
    228 
    229     swwfile = kwargs['output_dir']+kwargs['aa_scenario_name']
    230     export_grid(swwfile, extra_name_out = 'town',
     226     
     227    if myid == 0:
     228 #       store_parameters(**kwargs)
     229       
     230        print 'memory usage before del domain',mem_usage()
     231#        del domain
     232        print 'memory usage after del domain',mem_usage()
     233
     234        swwfile = kwargs['output_dir']+kwargs['aa_scenario_name']
     235        export_grid(swwfile, extra_name_out = 'town',
    231236                quantities = ['elevation','depth','stage','speed'], # '(xmomentum**2 + ymomentum**2)**0.5' defaults to elevation
    232237                timestep = None,
     
    243248                format = 'asc')
    244249   
    245     buildings_filename = project_urs.buildings_filename
    246     buildings_filename_out = project_urs.buildings_filename_out
     250        buildings_filename = project_urs.buildings_filename
     251        buildings_filename_out = project_urs.buildings_filename_out
    247252               
    248     inundation_damage(swwfile+'.sww', buildings_filename, buildings_filename_out)
    249     print '\n Augmented building file written to %s \n' %buildings_filename_out
     253        inundation_damage(swwfile+'.sww', buildings_filename, buildings_filename_out)
     254        print '\n Augmented building file written to %s \n' %buildings_filename_out
    250255   
    251256    barrier()
  • anuga_work/production/exmouth_2006/project.py

    r4581 r4587  
    3939finaltime=25000
    4040setup='final'
    41 source='onslow'
     41#source='onslow'
    4242#source='dampier'
    43 #source='exmouth'
     43source='exmouth'
    4444
    4545if setup =='trial':
     
    5656    print'final'
    5757    res_factor=1
    58     time_thinning=1
     58    time_thinning=4
    5959    yieldstep=60
    6060if setup =='store':
     
    118118
    119119if source=='onslow':
    120     boundaries_name = 'exmouth_3103_18052007' #onslow_hedland_broome gun
     120    boundaries_name = 'exmouth_3859_16052007' #onslow_hedland_broome gun
    121121    boundaries_in_dir = anuga_dir+'boundaries'+sep+'urs'+sep+'onslow_hedland_broome'+sep+'1_10000'+sep
    122122   
    123123if source=='exmouth':
    124     boundaries_name = 'exmouth_3859_16052007' #exmouth gun
     124    boundaries_name = 'exmouth_3103_18052007' #exmouth gun
    125125    boundaries_in_dir = anuga_dir+'boundaries'+sep+'urs'+sep+'exmouth'+sep+'1_10000'+sep
    126126
     
    133133output_dir = anuga_dir+'outputs'+sep
    134134output_build_time_dir = output_dir+build_time+sep
    135 output_run_time_dir = output_dir +run_time+dir_comment+sep
    136 #output_run_time_dir = output_dir +'20070604_022250_run_final_0_onslow_nbartzis'+sep
     135#output_run_time_dir = output_dir +run_time+dir_comment+sep
     136output_run_time_dir = output_dir +'20070619_042140_run_final_0_onslow_nbartzis'+sep
    137137output_run_time_dir_name = output_run_time_dir + scenario_name  #Used by post processing
    138138
     
    224224# exporting asc grid
    225225eastingmin = 200663
    226 eastingmax = 206250
     226eastingmax = 207500
    227227northingmax = 7574000
    228228northingmin = 7564500
  • anuga_work/production/exmouth_2006/run_exmouth.py

    r4546 r4587  
    6666#    kwargs['bathy_file']=project.combined_small_dir_name + '.txt'
    6767    kwargs['boundary_file']=project.boundaries_in_dir_name + '.sww'
    68    
     68    '''
    6969    print 'output_dir',kwargs['output_dir']
    7070    if myid == 0:
     
    226226    #kwargs 'completed' must be added to write the final parameters to file
    227227    kwargs['completed']=str(time.time()-t0)
     228   
     229    '''
    228230    if myid == 0:
    229231        store_parameters(**kwargs)
    230232       
    231233        print 'memory usage before del domain',mem_usage()
    232         del domain
     234        #del domain
    233235        print 'memory usage after del domain',mem_usage()
    234236       
    235237        swwfile = kwargs['output_dir']+kwargs['aa_scenario_name']
    236238        export_grid(swwfile, extra_name_out = 'town',
    237 #                quantities = ['depth'], # '(xmomentum**2 + ymomentum**2)**0.5' defaults to elevation
    238                 quantities = ['elevation','depth','stage','speed'], # '(xmomentum**2 + ymomentum**2)**0.5' defaults to elevation
     239                quantities = ['speed'], # '(xmomentum**2 + ymomentum**2)**0.5' defaults to elevation
     240#                quantities = ['elevation','depth','speed','stage'], # '(xmomentum**2 + ymomentum**2)**0.5' defaults to elevation
    239241                timestep = None,
    240242                reduction = max,
     
    253255        buildings_filename_out = project.buildings_filename_out
    254256               
    255         inundation_damage(swwfile+'.sww', buildings_filename, buildings_filename_out)
     257        #inundation_damage(swwfile+'.sww', buildings_filename, buildings_filename_out)
    256258        print '\n Augmented building file written to %s \n' %buildings_filename_out
    257259   
  • anuga_work/production/onslow_2006/project_urs.py

    r4544 r4587  
    143143output_dir = anuga_dir+'outputs'+sep
    144144output_build_time_dir = output_dir+build_time+'_'+source+sep
    145 output_run_time_dir = output_dir +run_time+dir_comment+sep
    146 #output_run_time_dir = output_dir +'20070613_034754_run_final_1.5_dampier_nbartzis'+sep
     145#output_run_time_dir = output_dir +run_time+dir_comment+sep
     146output_run_time_dir = output_dir +'20070619_042140_run_final_0_onslow_nbartzis'+sep
    147147output_run_time_dir_name = output_run_time_dir + scenario_name  #Used by post processing
    148148
  • anuga_work/production/onslow_2006/run_onslow_urs.py

    r4544 r4587  
    3939from anuga.caching import myhash
    4040from anuga.damage_modelling.inundation_damage import add_depth_and_momentum2csv, inundation_damage
     41from anuga.fit_interpolate.benchmark_least_squares import mem_usage
    4142
    4243# Application specific imports
     
    225226    kwargs['completed']=str(time.time()-t0)
    226227    '''
    227  #   if myid == 0:
    228 #        store_parameters(**kwargs)
    229    
    230    
    231     swwfile = kwargs['output_dir']+kwargs['aa_scenario_name']
    232     print 'swwfile',swwfile
    233     '''
    234     export_grid(swwfile, extra_name_out = 'town',
    235 #                quantities = ['depth'], # '(xmomentum**2 + ymomentum**2)**0.5' defaults to elevation
    236                 quantities = ['elevation','depth','stage','speed'], # '(xmomentum**2 + ymomentum**2)**0.5' defaults to elevation
     228    if myid == 0:
     229        #store_parameters(**kwargs)
     230       
     231        print 'memory usage before del domain',mem_usage()
     232        #del domain
     233        print 'memory usage after del domain',mem_usage()
     234   
     235   
     236        swwfile = kwargs['output_dir']+kwargs['aa_scenario_name']
     237        print 'swwfile',swwfile
     238   
     239        export_grid(swwfile, extra_name_out = 'town',
     240                quantities = ['speed'], # '(xmomentum**2 + ymomentum**2)**0.5' defaults to elevation
     241#                quantities = ['elevation','depth','stage','speed'], # '(xmomentum**2 + ymomentum**2)**0.5' defaults to elevation
    237242                timestep = None,
    238243                reduction = max,
     
    247252                datum = 'WGS84',
    248253                format = 'asc')
    249     '''
    250     buildings_filename = project_urs.buildings_filename
    251     buildings_filename_out = project_urs.buildings_filename_out
     254   
     255        buildings_filename = project_urs.buildings_filename
     256        buildings_filename_out = project_urs.buildings_filename_out
    252257               
    253     inundation_damage(swwfile+'.sww', buildings_filename, buildings_filename_out)
    254     print '\n Augmented building file written to %s \n' \
     258        #inundation_damage(swwfile+'.sww', buildings_filename, buildings_filename_out)
     259        print '\n Augmented building file written to %s \n' \
    255260           %buildings_filename_out
    256 #    barrier()
    257 
     261    barrier()
     262   
    258263#-------------------------------------------------------------
    259264if __name__ == "__main__":
  • anuga_work/production/pt_hedland_2006/build_pt_hedland.py

    r4533 r4587  
    5454#-------------------------------------------------------------------------------
    5555print"project_urs.combined_dir_name",project_urs.combined_dir_name
    56 '''
     56
    5757# topography directory filenames
    5858onshore_in_dir_name = project_urs.onshore_in_dir_name
     
    6767offshore1_dir_name = project_urs.offshore1_dir_name
    6868offshore2_dir_name = project_urs.offshore2_dir_name
    69 
    70 # creates DEM from asc data
    71 print "creates DEMs from asc data"
    72 convert_dem_from_ascii2netcdf(onshore_in_dir_name,
    73                               basename_out=onshore_dir_name,
    74                               use_cache=True, verbose=True)
    75 #creates pts file for onshore DEM
    76 print "creates pts file for onshore DEM"
    77 dem2pts(onshore_dir_name, use_cache=True, verbose=True)
     69'''
     70## creates DEM from asc data
     71#print "creates DEMs from asc data"
     72#convert_dem_from_ascii2netcdf(onshore_in_dir_name,
     73#                              basename_out=onshore_dir_name,
     74#                              use_cache=True, verbose=True)
     75##creates pts file for onshore DEM
     76#print "creates pts file for onshore DEM"
     77#dem2pts(onshore_dir_name, use_cache=True, verbose=True)
    7878
    7979print'create Geospatial onshore objects from topographies'
     
    8181    Geospatial_data(file_name = coast_in_dir_name + '.txt') +\
    8282    Geospatial_data(file_name = offshore_in_dir_name + '.txt')
    83 #    +\
    84 #    Geospatial_data(file_name = offshore1_dir_name + '.pts') +\
    85 #    Geospatial_data(file_name = offshore2_dir_name + '.pts')
    8683     
    8784
     
    10198#G_other.export_points_file(project_urs.combined_dir_name + '_other' + '.pts')
    10299
    103 
     100'''
    104101print 'start reading:',project_urs.combined_dir_name + '.txt'
    105102G = Geospatial_data(file_name = (project_urs.combined_dir_name + '.txt'))
     103print 'start writing',project_urs.combined_dir_name + '.pts'
     104G.export_points_file(project_urs.combined_dir_name + '.pts')
     105'''
    106106G_clipped = G.clip(project_urs.poly_topo_clip)
    107107
     
    112112#G.export_points_file(project_urs.combined_smaller_dir_name + '.txt')
    113113G_clipped.export_points_file(project_urs.combined_smallest_dir_name + '.txt')
    114 '''
     114
    115115#-------------------------------------------------------------------------
    116116# Convert URS to SWW file for boundary conditions
     
    123123                  verbose=True, mint=5000, maxt=35000, zscale=1)
    124124
     125'''
    125126
    126127
    127128
    128 
  • anuga_work/production/pt_hedland_2006/project_urs.py

    r4581 r4587  
    2929
    3030#tide = -3.9
    31 tide = 0.0
    32 #tide = 3.6
     31#tide = 0.0
     32tide = 3.6
    3333
    3434#Maybe will try to make project a class to allow these parameters to be passed in.
     
    3838finaltime=25000
    3939setup='final'
    40 source='exmouth'
     40source='onslow'
    4141
    4242if setup =='trial':
     
    6565# onshore data from 30m DTED level 2
    6666onshore_name = 'dli_dem' # get from Neil/Ingo (DEM or topo data)
    67 offshore_name = 'pt_hedland_bathy_edit'
     67offshore_name = 'pthedland_0607'
    6868offshore1_name = '1'
    6969offshore2_name = '2'
     
    7777anuga_dir = home+state+sep+scenario+sep+'anuga'+sep
    7878
    79 topographies_in_dir = home+state+sep+scenario+sep+'elevation_final'+sep+'20070416'+sep+'points'+sep
     79topographies_in_dir = home+state+sep+scenario+sep+'elevation_final'+sep+'20070416_updated'+sep+'points'+sep
    8080topographies_dir = anuga_dir+'topographies'+sep
    8181
  • anuga_work/production/pt_hedland_2006/run_pt_hedland_urs.py

    r4544 r4587  
    3838from anuga.caching import myhash
    3939from anuga.damage_modelling.inundation_damage import add_depth_and_momentum2csv, inundation_damage
     40from anuga.fit_interpolate.benchmark_least_squares import mem_usage
    4041# Application specific imports
    4142import project_urs                 # Definition of file names and polygons
     
    5354   
    5455    kwargs['output_dir']=project_urs.output_run_time_dir
    55     kwargs['bathy_file']=project_urs.combined_dir_name + '.txt'
     56    kwargs['bathy_file']=project_urs.combined_dir_name + '.pts'
    5657    kwargs['boundary_file']=project_urs.boundaries_in_dir_name + '.sww'
    5758
     
    6162    #------------------------------------------------------------------------------
    6263
    63     start_screen_catcher(kwargs['output_dir'], myid, numprocs)
    64 
    6564    print 'output_dir',kwargs['output_dir']
    6665    if myid == 0:
     
    7170
    7271    barrier()
     72   
     73    start_screen_catcher(kwargs['output_dir'], myid, numprocs)
     74   
    7375
    7476    print "Processor Name:",get_processor_name()
     
    124126        from polygon import Polygon_function
    125127        #following sets the stage/water to be offcoast only
    126         IC = Polygon_function( [(project_urs.poly_mainland, -1.0)], default = kwargs['tide'],
    127                                  geo_reference = domain.geo_reference)
    128         domain.set_quantity('stage', IC)
     128        #IC = Polygon_function( [(project_urs.poly_mainland, -50.0)], default = kwargs['tide'],
     129        #                         geo_reference = domain.geo_reference)
     130        #domain.set_quantity('stage', IC)
     131        domain.set_quantity('stage', kwargs['tide'])
    129132        domain.set_quantity('friction', kwargs['friction'])
    130133       
    131         print 'Start Set quantity'
    132 
     134        print 'Start Set quantity', kwargs['bathy_file'],kwargs['alpha']
     135       
    133136        domain.set_quantity('elevation',
    134137                            filename = kwargs['bathy_file'],
     
    217220    if myid == 0:
    218221        store_parameters(**kwargs)
    219 
    220     swwfile = kwargs['output_dir']+kwargs['aa_scenario_name']
    221     export_grid(swwfile, extra_name_out = 'town',
    222                 quantities = ['elevation','depth','stage','speed'], # '(xmomentum**2 + ymomentum**2)**0.5' defaults to elevation
    223                 timestep = None,
    224                 reduction = max,
    225                 cellsize = 25,
    226                 NODATA_value = -9999,
    227                 easting_min = project_urs.eastingmin,
    228                 easting_max = project_urs.eastingmax,
    229                 northing_min = project_urs.northingmin,
    230                 northing_max = project_urs.northingmax,
    231                 verbose = True,
    232                 origin = None,
    233                 datum = 'WGS84',
    234                 format = 'asc')
    235    
    236     buildings_filename = project_urs.buildings_filename
    237     buildings_filename_out = project_urs.buildings_filename_out
    238                
    239     inundation_damage(swwfile+'.sww', buildings_filename, buildings_filename_out)
    240     print '\n Augmented building file written to %s \n' %buildings_filename_out
     222       
     223        print 'memory usage before del domain',mem_usage()
     224        del domain
     225        print 'memory usage after del domain',mem_usage()
     226   
     227        swwfile = kwargs['output_dir']+kwargs['aa_scenario_name']
     228        print'swwfile',swwfile
     229
     230        export_grid(swwfile, extra_name_out = 'town',
     231                    quantities = ['speed','depth','stage','elevation'], # '(xmomentum**2 + ymomentum**2)**0.5' defaults to elevation
     232                    timestep = None,
     233                    reduction = max,
     234                    cellsize = 25,
     235                    NODATA_value = -9999,
     236                    easting_min = project_urs.eastingmin,
     237                    easting_max = project_urs.eastingmax,
     238                    northing_min = project_urs.northingmin,
     239                    northing_max = project_urs.northingmax,
     240                    verbose = True,
     241                    origin = None,
     242                    datum = 'WGS84',
     243                    format = 'asc')
     244       
     245        buildings_filename = project_urs.buildings_filename
     246        buildings_filename_out = project_urs.buildings_filename_out
     247                   
     248        inundation_damage(swwfile+'.sww', buildings_filename, buildings_filename_out)
     249        print '\n Augmented building file written to %s \n' %buildings_filename_out
    241250   
    242251    barrier()
Note: See TracChangeset for help on using the changeset viewer.