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

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

Current Hinwood scenario

File size: 1.9 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, getenv, getcwd, mkdir, access, F_OK
6import sys
7from time import localtime, strftime
8from os.path import join
9from anuga.shallow_water.data_manager import copy_code_files
10from anuga.abstract_2d_finite_volumes.util import add_directories
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.boundarydir = self.outputdir
41        self.raw_data_dir = join(scenariodir, 'raw_data')
42
43        # creates copy of output dir structure, if it doesn't exist
44        if not access(self.meshdir,F_OK):
45            mkdir (self.meshdir)       
46        if not access(general_outputdir,F_OK):
47            mkdir (general_outputdir)
48        if not access(self.outputdir,F_OK):
49            mkdir (self.outputdir)
50
51        self.codedir = getcwd()+sep
52
53
54#-------------------------------------------------------------
55if __name__ == "__main__":
56    p = Project(['eagle'], 'lego','.')
57    print p.outputdir
58    print p.meshdir
Note: See TracBrowser for help on using the repository browser.