[3125] | 1 | """Common filenames and locations for topographic data, meshes and outputs. |
---|
| 2 | Also includes origin for slump scenario. |
---|
| 3 | """ |
---|
| 4 | |
---|
| 5 | from os import sep, environ, getenv, getcwd |
---|
| 6 | import sys |
---|
| 7 | from time import localtime, strftime |
---|
| 8 | from os import mkdir, access, F_OK |
---|
[4007] | 9 | from anuga.abstract_2d_finite_volumes.util import add_directories, \ |
---|
| 10 | copy_code_files |
---|
[3125] | 11 | |
---|
[4033] | 12 | from anuga.utilities.system_tools import get_user_name |
---|
[4007] | 13 | |
---|
[3125] | 14 | #swollen/ all data output |
---|
| 15 | basename = 'source' |
---|
| 16 | |
---|
[4033] | 17 | user = get_user_name() |
---|
[3125] | 18 | if sys.platform == 'win32': |
---|
[3533] | 19 | try: |
---|
[4033] | 20 | home = environ['INUNDATIONHOME'] |
---|
[3533] | 21 | except: |
---|
[4007] | 22 | home = '.' |
---|
[3125] | 23 | else: |
---|
| 24 | home = getenv('INUNDATIONHOME', sep+'d'+sep+'cit'+sep+'1'+sep+'cit'+sep+'risk_assessment_methods_project'+sep+'inundation') |
---|
| 25 | |
---|
[3533] | 26 | if not access(home, F_OK): |
---|
| 27 | home = '.' |
---|
[4033] | 28 | |
---|
[4007] | 29 | # Create the structure of where the output will go |
---|
| 30 | create_scenario_dir = ['data','flumes','dam_2006'] |
---|
| 31 | |
---|
| 32 | scenariodir=add_directories(home, create_scenario_dir) |
---|
| 33 | |
---|
| 34 | |
---|
[3125] | 35 | #Derive subdirectories and filenames |
---|
| 36 | time = strftime('%Y%m%d_%H%M%S',localtime()) #gets time for new dir |
---|
| 37 | outputdir = scenariodir+sep+'output'+sep |
---|
| 38 | outputtimedir = outputdir+time+sep |
---|
| 39 | meshdir = scenariodir+sep+'meshes'+sep |
---|
| 40 | |
---|
[4007] | 41 | |
---|
| 42 | |
---|
[3423] | 43 | depth_filename = outputtimedir + "depth.csv" |
---|
[3456] | 44 | velocity_x_filename = outputtimedir + "velocity_x.csv" |
---|
| 45 | velocity_y_filename = outputtimedir + "velocity_y.csv" |
---|
[3125] | 46 | |
---|
| 47 | |
---|
| 48 | # creates copy of output dir structure, if it doesn't exist |
---|
| 49 | if not access(meshdir,F_OK): |
---|
| 50 | mkdir (meshdir) |
---|
| 51 | |
---|
| 52 | if not access(outputdir,F_OK): |
---|
| 53 | mkdir (outputdir) |
---|
| 54 | |
---|
| 55 | if not access(outputtimedir,F_OK): |
---|
| 56 | mkdir (outputtimedir) |
---|
| 57 | |
---|
[4007] | 58 | codedir = getcwd()+sep |
---|
[3125] | 59 | codedirname = codedir + 'project.py' |
---|
| 60 | |
---|
| 61 | meshname = meshdir + basename |
---|
| 62 | |
---|
| 63 | outputname = outputtimedir + basename #Used by post processing |
---|
| 64 | |
---|
| 65 | mesh_filename = meshname+'.msh' |
---|
| 66 | |
---|