Changeset 2093


Ignore:
Timestamp:
Nov 29, 2005, 2:43:38 PM (18 years ago)
Author:
duncan
Message:

adding # of triangles to file names

Location:
production/gippsland_2005
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • production/gippsland_2005/create_mesh.py

    r2084 r2093  
    6161                        + mesh_file[-4:]
    6262        m.export_mesh_file(mesh_file)
    63         return triangle_count
     63        return mesh_file, triangle_count
    6464
    6565
  • production/gippsland_2005/project.py

    r2086 r2093  
    1010#Making assumptions about the location of scenario data
    1111# Assumes the INUNDATIONHOME environ variable exists
    12 def Project():
    13     def __init__(self):
    14         scenario_dir_name = 'gippsland_storm_surge_scenario_2005'
    15         basename = 'lakes_100'
    16         boundary_basename = 'csiro_bondary'
    1712
    18         if sys.platform == 'win32':
    19             home = environ["INUNDATIONHOME"]     #Sandpit's parent dir
    20         else:   
    21             home = expanduser('~')
     13scenario_dir_name = 'gippsland_storm_surge_scenario_2005'
     14basename = 'lakes_100'
     15boundary_basename = 'csiro_bondary'
     16
     17if sys.platform == 'win32':
     18    home = environ["INUNDATIONHOME"]     #Sandpit's parent dir
     19else:   
     20    home = expanduser('~')
    2221
    2322
    24         #Derive subdirectories and filenames
    25         meshdir = home+sep+scenario_dir_name+sep+'meshes'+sep
    26         datadir = home+sep+scenario_dir_name+sep+'topographies'+sep
    27         outputdir = home+sep+scenario_dir_name+sep+'output'+sep
    28         boundarydir = home+sep+scenario_dir_name+sep+'boundaries'+sep
    29         bath_dir = boundarydir + 'bathymetry_expanded'
    30         elevation_dir =  boundarydir + 'elev_expanded'
    31         ucur_dir =  boundarydir + 'ucur_expanded'
    32         vcur_dir =  boundarydir + 'vcur_expanded'
     23#Derive subdirectories and filenames
     24meshdir = home+sep+scenario_dir_name+sep+'meshes'+sep
     25datadir = home+sep+scenario_dir_name+sep+'topographies'+sep
     26outputdir = home+sep+scenario_dir_name+sep+'output'+sep
     27boundarydir = home+sep+scenario_dir_name+sep+'boundaries'+sep
     28bath_dir = boundarydir + 'bathymetry_expanded'
     29elevation_dir =  boundarydir + 'elev_expanded'
     30ucur_dir =  boundarydir + 'ucur_expanded'
     31vcur_dir =  boundarydir + 'vcur_expanded'
    3332
    34         meshname = meshdir + basename + '.msh'
    35         mesh_elevname = meshdir + basename + '_elev' + '.msh'
    36         demname = datadir + basename + '.dem'
    37         pointname = datadir + basename + '.pts'
    38         boundaryname = boundarydir + boundary_basename + '.sww'
    39         outputname = outputdir + basename  + '.sww' #Used by post processing
     33meshname = meshdir + basename + '.msh'
     34mesh_elevname = meshdir + basename + '_elev' + '.msh'
     35demname = datadir + basename + '.dem'
     36#demname = datadir + 'lakes_100'
     37pointname = datadir + basename + '.pts'
     38boundaryname = boundarydir + boundary_basename + '.sww'
     39outputname = outputdir + basename  + '.sww' #Used by post processing
    4040
    41         gauge_filename = 'all_bld_ind.csv'
     41gauge_filename = 'all_bld_ind.csv'
    4242
    43         tide = 0.0
     43tide = 0.0
    4444
    45 
    46     def update_names(new_info):
    47         """
    48         Update the mesh_elevname and outputname, based on the string passed in.
    49         Used to add the number of triangles to names.
    50 
    51         """
    52         self.mesh_elevname = self.mesh_elevname[:-9] + '_' + \
    53                              str(new_info) +  \
    54                              self.mesh_elevname[-9:]
    55         self.outputname = self.outputname[:-4] + '_' + str(new_info) \
    56                           + self.outputname[-4:]
    5745
    5846#-------------------------------------------------------------
  • production/gippsland_2005/run_gippsland.py

    r2084 r2093  
    4949      )
    5050
     51meshname = project.meshname
     52pointname = project.pointname
     53mesh_elevname = project.mesh_elevname
     54outputname = project.outputname
    5155
    5256#Create the mesh without elevation data
    5357# 100000 very course
    54 triagle_count = cache(create_mesh,(5000),
    55                       {'mesh_file':project.meshname,
     58meshname, triagle_count = cache(create_mesh,(5000),
     59                      {'mesh_file':meshname,
    5660                       'triangles_in_name':True}
    5761                      ,dependencies = ['create_mesh.py']
    5862                      #,evaluate = True     
    5963                      )
    60 print "project.meshname",project.meshname
    61 project.update_names(triagle_count)
    62 print "project.meshname",project.meshname
     64
     65mesh_elevname = mesh_elevname[:-9] + '_' + str(triagle_count) +  \
     66                mesh_elevname[-9:]
     67outputname = outputname[:-4] + '_' + str(triagle_count) + outputname[-4:]
     68
    6369
    6470#Add elevation data to the mesh
    6571#fit_to_mesh_file(mesh_file, point_file, mesh_output_file, DEFAULT_ALPHA,
    6672#                 verbose=True, expand_search=True, precrop=True)     
    67 cache(fit_to_mesh_file,(project.meshname,
    68                  project.pointname,
    69                  project.mesh_elevname,
     73cache(fit_to_mesh_file,(meshname,
     74                 pointname,
     75                 mesh_elevname,
    7076                 DEFAULT_ALPHA),
    7177      {'verbose': True,
    7278       'expand_search': True,
    7379       'precrop': True}
    74       ,dependencies = [project.meshname, project.pointname]
     80      ,dependencies = [meshname, pointname]
    7581      ,evaluate = True     
    7682      ,verbose = False
     
    7985
    8086#Setup domain
    81 domain = cache(pmesh_to_domain_instance, (project.mesh_elevname, Domain),
    82                dependencies = [project.mesh_elevname]                   
     87domain = cache(pmesh_to_domain_instance, (mesh_elevname, Domain),
     88               dependencies = [mesh_elevname]                   
    8389               ,verbose = False
    8490               )               
Note: See TracChangeset for help on using the changeset viewer.