source: development/dam_2006/project.py @ 3533

Last change on this file since 3533 was 3533, checked in by duncan, 18 years ago

Tidy up dam simulation and minimum depth

File size: 1.6 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
9               
10#Making assumptions about the location of scenario data
11scenario_dir_name = 'dam_2006'
12
13#swollen/ all data output
14basename = 'source'
15
16if sys.platform == 'win32':
17    try:
18        home = environ['INUNDATIONHOME']     #Sandpit's parent dir
19    except:
20        home = '.'
21else:   
22    home = getenv('INUNDATIONHOME', sep+'d'+sep+'cit'+sep+'1'+sep+'cit'+sep+'risk_assessment_methods_project'+sep+'inundation')     
23
24
25if not access(home, F_OK):
26    home = '.'
27   
28#Derive subdirectories and filenames
29time = strftime('%Y%m%d_%H%M%S',localtime()) #gets time for new dir
30scenariodir =  home+sep+scenario_dir_name
31outputdir = scenariodir+sep+'output'+sep
32outputtimedir = outputdir+time+sep
33meshdir = scenariodir+sep+'meshes'+sep
34
35depth_filename = outputtimedir + "depth.csv"
36velocity_x_filename = outputtimedir + "velocity_x.csv"
37velocity_y_filename = outputtimedir + "velocity_y.csv"
38
39
40# creates copy of output dir structure, if it doesn't exist
41if not access(scenariodir,F_OK):
42    mkdir (scenariodir)
43
44if not access(meshdir,F_OK):
45    mkdir (meshdir)
46
47if not access(outputdir,F_OK):
48    mkdir (outputdir)
49       
50if not access(outputtimedir,F_OK):
51    mkdir (outputtimedir)
52
53codedir = getcwd()+sep
54                               
55codedirname = codedir + 'project.py'
56
57meshname = meshdir + basename
58
59outputname = outputtimedir + basename  #Used by post processing
60
61mesh_filename = meshname+'.msh'
62
Note: See TracBrowser for help on using the repository browser.