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

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

Current Hinwood scenario

File size: 2.0 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        self.plots_dir = join(scenariodir, 'plots')
43
44        # creates copy of output dir structure, if it doesn't exist
45        if not access(self.meshdir,F_OK):
46            mkdir (self.meshdir)       
47        if not access(general_outputdir,F_OK):
48            mkdir (general_outputdir)
49        if not access(self.outputdir,F_OK):
50            mkdir (self.outputdir)
51        if not access(self.plots_dir,F_OK):
52            mkdir (self.plots_dir)
53
54        self.codedir = getcwd()+sep
55
56
57#-------------------------------------------------------------
58if __name__ == "__main__":
59    p = Project(['eagle'], 'lego','.')
60    print p.outputdir
61    print p.meshdir
Note: See TracBrowser for help on using the repository browser.