"""Common filenames and locations for topographic data, meshes and outputs. Also includes origin for slump scenario. """ from os import sep, environ, getenv, getcwd import sys from time import localtime, strftime from os import mkdir, access, F_OK from anuga.abstract_2d_finite_volumes.util import add_directories, \ copy_code_files from anuga.utilities.system_tools import get_user_name #swollen/ all data output basename = 'source' user = get_user_name() if sys.platform == 'win32': try: home = environ['INUNDATIONHOME'] except: home = '.' else: home = getenv('INUNDATIONHOME', sep+'d'+sep+'cit'+sep+'1'+sep+'cit'+sep+'risk_assessment_methods_project'+sep+'inundation') if not access(home, F_OK): home = '.' # Create the structure of where the output will go create_scenario_dir = ['data','flumes','dam_2006'] scenariodir=add_directories(home, create_scenario_dir) #Derive subdirectories and filenames time = strftime('%Y%m%d_%H%M%S',localtime()) #gets time for new dir outputdir = scenariodir+sep+'output'+sep outputtimedir = outputdir+time+sep meshdir = scenariodir+sep+'meshes'+sep depth_filename = outputtimedir + "depth.csv" velocity_x_filename = outputtimedir + "velocity_x.csv" velocity_y_filename = outputtimedir + "velocity_y.csv" # creates copy of output dir structure, if it doesn't exist if not access(meshdir,F_OK): mkdir (meshdir) if not access(outputdir,F_OK): mkdir (outputdir) if not access(outputtimedir,F_OK): mkdir (outputtimedir) codedir = getcwd()+sep codedirname = codedir + 'project.py' meshname = meshdir + basename outputname = outputtimedir + basename #Used by post processing mesh_filename = meshname+'.msh'