source: anuga_work/development/Hinwood_2008/project.py @ 5350

Last change on this file since 5350 was 5350, checked in by duncan, 16 years ago

Checking in Hinwood work

File size: 1.8 KB
Line 
1"""Common filenames and locations for topographic data, meshes and outputs.
2Also includes origin for slump scenario.
3"""
4
5from os import sep, environ, getenv, getcwd
6import sys
7from time import localtime, strftime
8from os import mkdir, access, F_OK
9from anuga.abstract_2d_finite_volumes.util import add_directories, \
10     copy_code_files
11
12from anuga.utilities.system_tools import get_user_name
13
14
15class Project:   
16    def __init__(self,
17                 trunk,
18                 outputdir_name = None,
19                 home = None):
20       
21        self.user = get_user_name()
22        if home is None:
23            try:
24                home = getenv('INUNDATIONHOME') #Sandpit's parent dir
25            except:
26                home = '.'
27        self.home = home
28        # Create the structure of where the output directories will go
29        scenariodir=add_directories(home, trunk)
30
31        #Derive subdirectories and filenames
32        if outputdir_name is None:
33            #gets time for dir
34            outputdir_name = strftime('%Y%m%d_%H%M%S',localtime())
35       
36        general_outputdir = scenariodir+sep+'output'+sep
37        self.outputdir = general_outputdir+outputdir_name+sep
38        self.meshdir = scenariodir+sep+'meshes'+sep
39        self.scenariodir = scenariodir+sep
40        self.boundary_file = self.scenariodir + 'boundary.tsm'
41
42        # creates copy of output dir structure, if it doesn't exist
43        if not access(self.meshdir,F_OK):
44            mkdir (self.meshdir)       
45        if not access(general_outputdir,F_OK):
46            mkdir (general_outputdir)
47        if not access(self.outputdir,F_OK):
48            mkdir (self.outputdir)
49
50        self.codedir = getcwd()+sep
51
52
53#-------------------------------------------------------------
54if __name__ == "__main__":
55    p = Project(['eagle'], 'lego','.')
56    print p.outputdir
57    print p.meshdir
Note: See TracBrowser for help on using the repository browser.