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

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

Current Hinwood scenario calculating RMSD's

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