Changeset 3851


Ignore:
Timestamp:
Oct 25, 2006, 3:19:29 PM (16 years ago)
Author:
nick
Message:

build_dampier.py is working
run_dampier.py should work... it is still running
project.py is working

Location:
anuga_work/production/dampier_2006
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • anuga_work/production/dampier_2006/build_dampier.py

    r3841 r3851  
    3030from anuga.shallow_water import Reflective_boundary
    3131from anuga.shallow_water.data_manager import convert_dem_from_ascii2netcdf, dem2pts
    32 
    3332from anuga.pmesh.mesh_interface import create_mesh_from_regions
    34 
    3533from anuga.geospatial_data.geospatial_data import *
    3634
     
    3836import project   # Definition of file names and polygons
    3937
    40 
    41 
    4238#------------------------------------------------------------------------------
    4339# Copy scripts to time stamped output directory and capture screen
    4440# output to file
    4541#------------------------------------------------------------------------------
     42#print 'project.build_time', project.build_time
     43#print 'project.output_build_time_dir',project.output_build_time_dir
     44#print '__file__, project.output_time_dir + basename(__file__)', __file__, project.output_build_time_dir + basename(__file__)
     45#print 'dirname(project.__file__) +sep+ project.__name__', dirname(project.__file__) +sep+ project.__name__+'.py'
     46#print'project.topographies_time_dir',project.topographies_time_dir, project.combined_time_dir_name + '.pts'
     47#print project.boundaries_time_dir, project.boundaries_time_dir_name
     48#import sys; sys.exit()
     49if access(project.output_build_time_dir,F_OK) == 0:
     50    mkdir (project.output_build_time_dir)
     51copy (dirname(project.__file__) +sep+ project.__name__+'.py',
     52      project.output_build_time_dir + project.__name__+'.py')     #copies project.py
     53copy (__file__, project.output_build_time_dir + basename(__file__))
     54print 'files '+ project.__name__+'.py and '+ basename(__file__)+' copied to '+ project.output_build_time_dir       #copies this file
     55#import sys; sys.exit()
    4656
    47 
    48 
    49 # creates copy of code in output dir if dir doesn't exist
    50 if access(project.output_time_dir,F_OK) == 0:
    51     mkdir (project.output_time_dir)
    52 copy (dirname(project.__file__) +sep+ project.__name__+'.py',
    53       project.output_time_dir + project.__name__+'.py')     #copies project.py
    54 copy (__file__, project.output_time_dir + basename(__file__))
    55 print 'project.output_time_dir',project.output_time_dir       #copies this file
    56 
    57 
    58 
    59 
    60 boundary_dir_name = project.boundary_dir_name
    61 
    62 
    63 from anuga.shallow_water.data_manager import urs2sww
    64 
    65 print 'minlat=project.north_boundary, maxlat=project.south_boundary',project.north_boundary, project.south_boundary
    66 print 'minlon= project.west_boundary, maxlon=project.east_boundary',project.west_boundary, project.east_boundary
    67 
    68 #import sys; sys.exit()
    69 urs2sww(boundary_dir_name,
    70 #        minlat=project.south, maxlat=project.north,
    71 #        minlon= project.west, maxlon=project.east,
    72 #        mint=0, maxt= 35000,
    73         verbose='true')
    74        
    75 import sys; sys.exit()
    7657#-------------------------------------------------------------------------------
    7758# Preparation of topographic data
     
    10283offshore_dir_name14 = project.offshore_dir_name14
    10384
    104 
    105 
    106 # files to be used
    107 #file_used = []
    108 
    10985# creates DEM from asc data
    11086convert_dem_from_ascii2netcdf(onshore_dir_name, use_cache=True, verbose=True)
     
    12096        verbose=True)
    12197
    122 
    12398#creates pts file for islands DEM
    12499dem2pts(islands_dir_name, use_cache=True, verbose=True)
    125100
    126 
    127 print'create G1'
     101print'create Geospatial data objects from topographies'
    128102G1 = Geospatial_data(file_name = project.onshore_dir_name + '.pts')
    129103G2 = Geospatial_data(file_name = project.coast_dir_name + '.xya')
     
    145119G_off14 = Geospatial_data(file_name = project.offshore_dir_name14 + '.xya')
    146120
    147 print'add G1+G2+G3+all offshore data'
     121print'add all geospatial objects'
    148122G = G1 + G2 + G3 + G_off + G_off1 + G_off2 + G_off3 + G_off4 + G_off5 \
    149123    + G_off6 + G_off7 + G_off8 + G_off9 + G_off10 + G_off11 + G_off12 \
    150124    + G_off13 + G_off14
    151125
     126print'clip combined geospatial object by bounding polygon'
    152127G.clip(project.bounding_polygon)
    153128#FIXME: add a clip function to pts
    154129
    155 print'export G'
    156 G.export_points_file(project.combined_dir_name + '.pts')
    157 import sys; sys.exit()
    158 
    159 
     130print'export combined DEM file'
     131if access(project.topographies_time_dir,F_OK) == 0:
     132    mkdir (project.topographies_time_dir)
     133G.export_points_file(project.combined_time_dir_name + '.pts')
    160134
    161135#-------------------------------------------------------------------------
    162136# Convert URS to SWW file for boundary conditions
    163137#-------------------------------------------------------------------------
    164 
    165 # filenames
    166 meshname = project.mesh_name+'.msh'
    167 source_dir = project.boundarydir
    168 boundary_file = project.boundaryname
    169 
    170 print 'Available boundary tags', domain.get_boundary_tags()
     138print 'starting to create boundary conditions'
     139boundaries_dir_name = project.boundaries_dir_name
    171140
    172141from anuga.shallow_water.data_manager import urs2sww
    173142
    174 urs2sww(boundary_file,
    175         minlat=project.north_boundary, maxlat=project.south_boundary,
     143print 'minlat=project.north_boundary, maxlat=project.south_boundary',project.north_boundary, project.south_boundary
     144print 'minlon= project.west_boundary, maxlon=project.east_boundary',project.west_boundary, project.east_boundary
     145
     146if access(project.boundaries_time_dir,F_OK) == 0:
     147    mkdir (project.boundaries_time_dir)
     148urs2sww(boundaries_dir_name,basename_out= project.boundaries_time_dir_name,
     149        minlat=project.south_boundary, maxlat=project.north_boundary,
    176150        minlon= project.west_boundary, maxlon=project.east_boundary,
     151        mint=0, maxt= 35000,
    177152        verbose='true')
     153       
    178154
    179155
     
    182158
    183159
     160
     161
  • anuga_work/production/dampier_2006/project.py

    r3841 r3851  
    3535
    3636#mesh_name = 'elevation50m'
    37 boundary_name = 'dampier'
    38 boundary_source = 'test'
     37boundaries_name = 'dampier'
     38boundaries_source = 'mag_9_corrected'
    3939
    4040# topography file names
     
    6868gauges_dir = home+sep+state+sep+scenario_datas_name+sep+'anuga'+sep+'gauges'+sep
    6969polygons_dir = home+sep+state+sep+scenario_datas_name+sep+'anuga'+sep+'polygons'+sep
    70 boundaries_dir = home+sep+state+sep+scenario_datas_name+sep+'anuga'+sep+'boundaries'+sep+'urs'+sep+boundary_source+sep
     70boundaries_in_dir = home+sep+state+sep+scenario_datas_name+sep+'anuga'+sep+'boundaries'+sep+'urs'+sep+boundaries_source+sep
    7171#outputdir = home+sep+state+sep+scenario_datas_name+sep+'anuga'+sep+'output'+sep
    7272tide_dir = home+sep+state+sep+scenario_datas_name+sep+'anuga'+sep+'tide_data'+sep
    7373
    7474time = strftime('%Y%m%d_%H%M%S',localtime()) #gets time for new dir
    75 
    76 output_time_dir = home+sep+state+sep+scenario_datas_name+sep+'anuga'+sep+'outputs'+sep+time+sep
    77 topographies_time_dir = home+sep+state+sep+scenario_datas_name+sep+'anuga'+sep+'topographies'+sep+time+sep
    78 boundaries_time_dir = home+sep+state+sep+scenario_datas_name+sep+'anuga'+sep+'boundaries'+sep+time+sep
    79 
     75build_time = time+'_build'
     76run_time = time+'_run'
     77
     78output_build_time_dir = home+sep+state+sep+scenario_datas_name+sep+'anuga'+sep+'outputs'+sep+build_time+sep
     79output_run_time_dir = home+sep+state+sep+scenario_datas_name+sep+'anuga'+sep+'outputs'+sep+run_time+sep
     80topographies_time_dir = topographies_dir+build_time+sep
     81boundaries_dir = home+sep+state+sep+scenario_datas_name+sep+'anuga'+sep+'boundaries'+sep
     82boundaries_time_dir = home+sep+state+sep+scenario_datas_name+sep+'anuga'+sep+'boundaries'+sep+build_time+sep
     83
     84#ideas
     85#boundaries_time_dir = boundaries_in_dir+'urs'+sep+boundaries_source+sep
    8086
    8187
     
    101107offshore_dir_name14 = topographies_dir + offshore_name14
    102108
     109#output dir
    103110combined_dir_name = topographies_dir + combined_name
    104 
    105 mesh_dir_name = meshes_dir + scenario_name
    106 output_dir_name = output_time_dir + scenario_name  #Used by post processing
    107 boundary_dir_name = boundaries_dir + boundary_name  #Used by post processing
     111combined_time_dir_name = topographies_time_dir + combined_name
     112
     113meshes_dir_name = meshes_dir + scenario_name
     114
     115#output_build_time_dir_name = output_build_time_dir + scenario_name  #Used by post processing
     116output_run_time_dir_name = output_run_time_dir + scenario_name  #Used by post processing
     117boundaries_in_dir_name = boundaries_in_dir + boundaries_name
     118boundaries_time_dir_name = boundaries_time_dir + boundaries_name  #Used by post processing
     119
     120
    108121
    109122
     
    113126south = degminsec2decimal_degrees(-20,55,0)
    114127north = degminsec2decimal_degrees(-20,15,0)
     128#north = degminsec2decimal_degrees(-19,15,0)
    115129west = degminsec2decimal_degrees(116,17,0)
    116130east = degminsec2decimal_degrees(117,10,0)
    117131
    118132#only used to clip boundary condition
    119 north_boundary = north + 0.05
    120 south_boundary = south - 0.05
    121 west_boundary = west - 0.05
    122 east_boundary = east + 0.05
     133north_boundary = north + 0.04
     134south_boundary = south - 0.04
     135west_boundary = west - 0.04
     136east_boundary = east + 0.04
    123137
    124138
  • anuga_work/production/dampier_2006/run_dampier.py

    r3828 r3851  
    33Source data such as elevation and boundary data is assumed to be available in
    44directories specified by project.py
    5 The output sww file is stored in project.outputtimedir
     5The output sww file is stored in project.output_run_time_dir
    66
    77The scenario is defined by a triangular mesh created from project.polygon,
     
    4545
    4646# filenames
    47 meshname = project.meshname+'.msh'
    48 source_dir = project.boundarydir
    49 boundary_file = project.boundaryname
    5047
    51 from anuga.shallow_water.data_manager import urs2sww
     48build_time = '20061025_113524_build'
     49boundaries_name = project.boundaries_name
     50meshes_dir_name = project.meshes_dir_name+'.msh'
     51#source_dir = project.boundarydir
     52boundaries_time_dir_name = project.boundaries_dir + build_time + sep + boundaries_name
    5253
    53 
     54#from anuga.shallow_water.data_manager import urs2sww
    5455
    5556# creates copy of code in output dir if dir doesn't exist
    56 if access(project.outputtimedir,F_OK) == 0:
    57     print 'project.outputtimedir',dirname(project.outputtimedir)
    58     mkdir (project.outputtimedir,0777)
     57if access(project.output_run_time_dir,F_OK) == 0:
     58    print 'project.output_run_time_dir',dirname(project.output_run_time_dir)
     59    mkdir (project.output_run_time_dir,0777)
    5960copy (dirname(project.__file__) +sep+ project.__name__+'.py',
    60       project.outputtimedir + project.__name__+'.py')
    61 copy (__file__, project.outputtimedir + basename(__file__))
    62 print 'project.outputtimedir',project.outputtimedir
    63 
    64 
     61      project.output_run_time_dir + project.__name__+'.py')
     62copy (__file__, project.output_run_time_dir + basename(__file__))
     63print 'project.output_run_time_dir',project.output_run_time_dir
    6564
    6665#--------------------------------------------------------------------------
     
    7170#--------------------------------------------------------------------------
    7271
    73 
    7472interior_regions = [#[project.karratha_polygon, 25000],
    7573                    #[project.dampier_polygon, 2000],
     
    7775                    #[project.point_polygon, 2000]]
    7876                    #[project.cipma_polygon, 20000]]
    79                     [project.cipma_polygon, 40000]]    # Caused memory error?
     77                    [project.cipma_polygon, 50000]]    # Caused memory error?
    8078
    8179#---------------------------
     
    103101
    104102print 'start create mesh from regions'
    105 meshname = project.meshname + '.msh'
     103meshes_dir_name = project.meshes_dir_name + '.msh'
    106104create_mesh_from_regions(project.bounding_polygon,
    107105                         boundary_tags={'back': [7, 8], 'side': [0, 6],
    108106                                        'ocean': [1, 2, 3, 4, 5]},
    109                          maximum_triangle_area=200000,
     107                         maximum_triangle_area=300000,
    110108                         interior_regions=interior_regions,
    111                          filename=meshname,
     109                         filename=meshes_dir_name,
    112110                         use_cache=True,
    113111                         verbose=True)
    114 
    115112
    116113#-------------------------------------------------------------------------
    117114# Setup computational domain
    118115#-------------------------------------------------------------------------
    119 domain = Domain(meshname, use_cache=True, verbose=True)
     116print 'Setup computational domain'
     117domain = Domain(meshes_dir_name, use_cache=True, verbose=True)
    120118print domain.statistics()
    121 domain.set_name(project.basename)
    122 domain.set_datadir(project.outputtimedir)
     119domain.set_name(project.scenario_name)
     120domain.set_datadir(project.output_run_time_dir)
    123121domain.set_default_order(2)
    124122domain.set_minimum_storable_height(0.01) # Don't store anything less than 1cm
     
    129127# Setup initial conditions
    130128#-------------------------------------------------------------------------
    131 tide = 0.
     129tide = 2.4
    132130domain.set_quantity('stage', tide)
    133131domain.set_quantity('friction', 0.0)
     132#combined_time_dir_name = project.topographies_dir+build_time+project.combined_name
    134133domain.set_quantity('elevation',
    135                     filename = project.datadir + project.basename + '.pts',
    136                     use_cache = False,
     134                    filename = project.topographies_dir + build_time + sep + project.combined_name + '.pts',
     135                    use_cache = True,
    137136                    verbose = True,
    138137                    alpha = 0.1)
     
    146145print 'Available boundary tags', domain.get_boundary_tags()
    147146
    148 from anuga.shallow_water.data_manager import urs2sww
    149147
    150 urs2sww(boundary_file, verbose='true')
    151 
    152 Bf = File_boundary(source_dir + project.boundary_basename + '.sww',
     148Bf = File_boundary(boundaries_time_dir_name + '.sww',
    153149                   domain, verbose = True)
     150#Bf = File_boundary(source_dir + project.boundary_scenario_name + '.sww',
     151#                   domain, verbose = True)
    154152Br = Reflective_boundary(domain)
    155153Bd = Dirichlet_boundary([tide,0,0])
Note: See TracChangeset for help on using the changeset viewer.