Ignore:
Timestamp:
Jun 20, 2007, 6:34:21 PM (18 years ago)
Author:
ole
Message:

Got the shark bay scenario to build

File:
1 edited

Legend:

Unmodified
Added
Removed
  • anuga_work/production/shark_bay_2007/build_shark_bay.py

    r4505 r4552  
    33Source data such as elevation and boundary data is assumed to be available in
    44directories specified by project_urs.py
    5 The output sww file is stored in project_urs.output_time_dir
     5The output sww file is stored in project.output_time_dir
    66
    77The scenario is defined by a triangular mesh created from project_urs.polygon,
     
    3131from anuga.pmesh.mesh_interface import create_mesh_from_regions
    3232from anuga.geospatial_data.geospatial_data import Geospatial_data
    33 from anuga.abstract_2d_finite_volumes.util import start_screen_catcher, copy_code_files
     33from anuga.shallow_water.data_manager import start_screen_catcher
     34from anuga.shallow_water.data_manager import copy_code_files
     35
    3436from anuga_parallel.parallel_abstraction import get_processor_name
    3537
    3638# Application specific imports
    37 import project_urs   # Definition of file names and polygons
     39import project   # Definition of file names and polygons
     40
    3841
    3942#------------------------------------------------------------------------------
     
    4245#------------------------------------------------------------------------------
    4346
    44 copy_code_files(project_urs.output_build_time_dir,__file__,
    45                dirname(project_urs.__file__)+sep+ project_urs.__name__+'.py' )
     47copy_code_files(project.output_build_time_dir,__file__,
     48               dirname(project.__file__)+sep+ project.__name__+'.py' )
    4649
    47 start_screen_catcher(project_urs.output_build_time_dir)
     50start_screen_catcher(project.output_build_time_dir)
    4851
    49 print "Processor Name:",get_processor_name()
    50 print 'USER: ', project_urs.user
     52print 'Processor Name:', get_processor_name()
     53print 'User: ', project.user
     54
    5155
    5256#-------------------------------------------------------------------------------
     
    5761# Fine pts file to be clipped to area of interest
    5862#-------------------------------------------------------------------------------
    59 print"project_urs.combined_dir_name",project_urs.combined_dir_name
    60 '''
    61 # topography directory filenames
    62 onshore_in_dir_name = project_urs.onshore_in_dir_name
    63 coast_in_dir_name = project_urs.coast_in_dir_name
    64 offshore_in_dir_name = project_urs.offshore_in_dir_name
    65 offshore1_in_dir_name = project_urs.offshore1_in_dir_name
    66 offshore2_in_dir_name = project_urs.offshore2_in_dir_name
    6763
    68 onshore_dir_name = project_urs.onshore_dir_name
    69 coast_dir_name = project_urs.coast_dir_name
    70 offshore_dir_name = project_urs.offshore_dir_name
    71 offshore1_dir_name = project_urs.offshore1_dir_name
    72 offshore2_dir_name = project_urs.offshore2_dir_name
     64print 'project.combined_dir_name', project.combined_dir_name
    7365
    74 # creates DEM from asc data
    75 print "creates DEMs from asc data"
    76 convert_dem_from_ascii2netcdf(onshore_in_dir_name,
    77                               basename_out=onshore_dir_name,
    78                               use_cache=True, verbose=True)
    79 #creates pts file for onshore DEM
    80 print "creates pts file for onshore DEM"
    81 dem2pts(onshore_dir_name, use_cache=True, verbose=True)
    8266
    83 print'create Geospatial onshore objects from topographies'
    84 G = Geospatial_data(file_name = onshore_dir_name + '.pts') +\
    85     Geospatial_data(file_name = coast_in_dir_name + '.txt') +\
    86     Geospatial_data(file_name = offshore_in_dir_name + '.txt')
    87 #    +\
    88 #    Geospatial_data(file_name = offshore1_dir_name + '.pts') +\
    89 #    Geospatial_data(file_name = offshore2_dir_name + '.pts')
    90      
     67geospatial_data = None
     68# create DEMs from asc data
     69print 'creating geospatial data objects from asc data (via dem and pts formats)'
     70for filename in project.ascii_grid_filenames:
     71    convert_dem_from_ascii2netcdf(filename,
     72                                  basename_out=filename,
     73                                  use_cache=True, verbose=True)
     74    dem2pts(filename, use_cache=True, verbose=True)
    9175
    92 print'clip combined geospatial object by bounding polygon'
    93 G_clipped = G.clip(project_urs.poly_all)
     76    geospatial_data += Geospatial_data(file_name = filename + '.pts', verbose=True)
    9477
    95 print'export combined DEM file'
    96 if access(project_urs.topographies_dir,F_OK) == 0:
    97     mkdir (project_urs.topographies_dir)
    98 G.export_points_file(project_urs.combined_dir_name + '.txt')
    9978
    100 print'split combined data set'
    101 G_small, G_other = G_clipped.split(0.1, True)
     79print 'creating geospatial data objects from txt data'
     80for filename in project.point_filenames:
     81    geospatial_data += Geospatial_data(file_name = filename + '.txt', verbose=True)
    10282
    103 print'export split DEM file'
    104 G_small.export_points_file(project_urs.combined_dir_name + '_small' + '.txt')
    105 #G_other.export_points_file(project_urs.combined_dir_name + '_other' + '.pts')
    10683
    107 '''
    108 print 'start reading:',project_urs.combined_dir_name + '.txt'
    109 G = Geospatial_data(file_name = (project_urs.combined_dir_name + '.txt'))
    110 G_clipped = G.clip(project_urs.poly_topo_clip)
     84print 'clip combined geospatial object by bounding polygon'
     85G = geospatial_data.clip(project.poly_all)
    11186
    112 print 'start split'
    113 #G_smallest, G_other = G.split(0.1,True)
    11487
    115 print 'start export',project_urs.combined_smallest_dir_name + '.txt'
    116 #G.export_points_file(project_urs.combined_smaller_dir_name + '.txt')
    117 G_clipped.export_points_file(project_urs.combined_smallest_dir_name + '.txt')
     88print 'export combined geospatial data'
     89if access(project.topographies_dir, F_OK) == 0:
     90    mkdir (project.topographies_dir)
     91G.export_points_file(project.combined_dir_name + '.txt')
    11892
     93
     94#print 'split combined data set'
     95#G_small, _ = G.split(0.1, True)
     96#
     97#print 'export sub sampled DEM file'
     98#G_small.export_points_file(project.combined_dir_name + '_small' + '.txt')
     99
     100
     101 
    119102#-------------------------------------------------------------------------
    120103# Convert URS to SWW file for boundary conditions
    121104#-------------------------------------------------------------------------
    122 print 'starting to create boundary conditions'
    123 #boundaries_in_dir_name = project_urs.boundaries_in_dir_name
     105print 'converting boundary conditions to sww format'
     106#boundaries_in_dir_name = project.boundaries_in_dir_name
    124107
    125 #print 'minlat=project_urs.north_boundary, maxlat=project_urs.south_boundary',project_urs.north_boundary, project_urs.south_boundary
    126 #print 'minlon= project_urs.west_boundary, maxlon=project_urs.east_boundary',project_urs.west_boundary, project_urs.east_boundary
    127 '''       
     108#print 'minlat=project.north_boundary, maxlat=project.south_boundary',project.north_boundary, project.south_boundary
     109#print 'minlon= project.west_boundary, maxlon=project.east_boundary',project.west_boundary, project.east_boundary
     110       
    128111from anuga.shallow_water.data_manager import urs_ungridded2sww
    129112
    130 print 'boundaries_in_dir_name',project_urs.boundaries_in_dir_name
    131 print 'project.boundaries_dir_name',project_urs.boundaries_dir_name
     113print 'boundaries_dir', project.boundaries_dir
     114print 'project.boundaries_name', project.boundaries_name
    132115
    133 urs_ungridded2sww(project_urs.boundaries_in_dir_name, project_urs.boundaries_dir_name,
     116urs_ungridded2sww(project.boundaries_name,
    134117                  verbose=True, mint=5000, maxt=35000, zscale=1)
    135 '''
    136118
    137119
     120print 'Finished building the %s scenario' %project.scenario_name
    138121
    139122
Note: See TracChangeset for help on using the changeset viewer.