Changeset 4846


Ignore:
Timestamp:
Nov 22, 2007, 2:36:01 PM (17 years ago)
Author:
nick
Message:

update code so outputs go to data directory on gniess

File:
1 edited

Legend:

Unmodified
Added
Removed
  • anuga_work/development/cocos/grid_data.py

    r4832 r4846  
    22
    33from anuga.geospatial_data.geospatial_data import *
     4from os import sep, environ, getenv, getcwd,umask
    45from anuga.pmesh.mesh_interface import create_mesh_from_regions
    56from anuga.shallow_water import Domain
    67from anuga.shallow_water import Reflective_boundary
    78from anuga.shallow_water.data_manager import export_grid
     9from anuga.shallow_water.data_manager import start_screen_catcher, copy_code_files
    810from math import sqrt
     11from time import localtime, strftime, gmtime
     12
     13umask(002)
     14time = strftime('%Y%m%d_%H%M%S',gmtime())
     15
     16home = getenv('INUNDATIONHOME') + sep +'data'+sep
     17output_dir = home + 'anuga_validation'+sep+'cocos'+sep+'anuga'+sep+'outputs'+sep+time+sep
     18
     19copy_code_files(output_dir,__file__)
     20
     21start_screen_catcher(output_dir)
    922
    1023data_dir='/d/ehn/4/ehn/tsunami/data/bathymetry/Cocos/bathymetry/'
     
    2942#grid1_east_max=439850.00
    3043#grid1_east_min=156494.00
     44grid1_res=370.4
    3145#
    3246#grid2_north_max=8713178.04
     
    3448#grid2_east_max=294652.80
    3549#grid2_east_min=224424.96
     50grid2_res=74.08
    3651#
    3752#grid3_north_max=274295.91
     
    3954#grid3_east_max=8665112.56
    4055#grid3_east_min=8657346.91
     56grid3_res=14.82
    4157#
    4258#grid4_north_max=270900.24
     
    4460#grid4_east_max=8659120.05
    4561#grid4_east_min=8659120.05
     62grid4_res=2.96
    4663
    4764poly1 = [[439850.00,8565314.80],[439850.00, 8783110.00],
     
    6178#        4.3m2
    6279
    63 res = 1
     80res = 10
    6481#G = Geospatial_data(file_name = data_dir_name + '.txt')
    6582#G1=G.clip(poly1)
     
    6784
    6885
    69 interior_polys = [[poly2,2740*res],[poly3,110*res],[poly4,4.3*res]]
     86interior_polys = [[poly2,(grid2_res**2/2)*res],[poly3,(grid3_res**2/2)*res],[poly4,(grid4_res**2/2)*res]]
    7087#interior_polys = [[poly4,4.3*res]]
    7188
     
    8097#create_mesh_from_regions(poly3,
    8198                         boundary_tags={'side': [0,1,2,3]},
    82                          maximum_triangle_area=68500*res,
     99                         maximum_triangle_area=(grid1_res**2/2)*res,
    83100#                         maximum_triangle_area=110*res,
    84101                         interior_regions=interior_polys,
     
    113130
    114131domain.set_name(sww_file)
    115 domain.set_datadir(data_dir)
     132domain.set_datadir(output_dir)
    116133domain.set_default_order(2) # Apply second order scheme
    117134domain.set_minimum_storable_height(0.01) # Don't store anything less than 1cm
     
    129146        domain.write_boundary_statistics(tags = 'side') 
    130147
    131 export_grid(data_dir+sww_file+".sww", extra_name_out = 'grid4',
    132                     quantities = ['elevation'], # '(xmomentum**2 + ymomentum**2)**0.5' defaults to elevation
    133                     timestep = None,
    134                     reduction = max,
    135                     cellsize = 2.96*sqrt(res),
     148export_grid(output_dir+sww_file+".sww", extra_name_out = 'grid4',
     149                    quantities = ['elevation'], # '(xmomentum**2 + ymomentum**2)**0.5' defaults to elevation
     150                    timestep = None,
     151                    reduction = max,
     152                    cellsize = grid4_res*sqrt(res),
    136153                    NODATA_value = -9999,
    137154                    easting_min = 269701.45,
     
    144161                    format = 'asc')
    145162                         
    146 export_grid(data_dir+sww_file+".sww", extra_name_out = 'grid3',
    147                     quantities = ['elevation'], # '(xmomentum**2 + ymomentum**2)**0.5' defaults to elevation
    148                     timestep = None,
    149                     reduction = max,
    150                     cellsize = 14.82*sqrt(res),
     163export_grid(output_dir+sww_file+".sww", extra_name_out = 'grid3',
     164                    quantities = ['elevation'], # '(xmomentum**2 + ymomentum**2)**0.5' defaults to elevation
     165                    timestep = None,
     166                    reduction = max,
     167                    cellsize = grid3_res*sqrt(res),
    151168                    NODATA_value = -9999,
    152169                    easting_min = 266767.44,
     
    159176                    format = 'asc')
    160177
    161 export_grid(data_dir+sww_file+".sww", extra_name_out = 'grid2',
    162                     quantities = ['elevation'], # '(xmomentum**2 + ymomentum**2)**0.5' defaults to elevation
    163                     timestep = None,
    164                     reduction = max,
    165                     cellsize = 74.08*sqrt(res),
     178export_grid(output_dir+sww_file+".sww", extra_name_out = 'grid2',
     179                    quantities = ['elevation'], # '(xmomentum**2 + ymomentum**2)**0.5' defaults to elevation
     180                    timestep = None,
     181                    reduction = max,
     182                    cellsize = grid2_res*sqrt(res),
    166183                    NODATA_value = -9999,
    167184                    easting_min = 224424.96,
     
    174191                    format = 'asc')
    175192
    176 export_grid(data_dir+sww_file+".sww", extra_name_out = 'grid1',
    177                     quantities = ['elevation'], # '(xmomentum**2 + ymomentum**2)**0.5' defaults to elevation
    178                     timestep = None,
    179                     reduction = max,
    180                     cellsize = 370.4*sqrt(res),
     193export_grid(output_dir+sww_file+".sww", extra_name_out = 'grid1',
     194                    quantities = ['elevation'], # '(xmomentum**2 + ymomentum**2)**0.5' defaults to elevation
     195                    timestep = None,
     196                    reduction = max,
     197                    cellsize = grid1_res*sqrt(res),
    181198                    NODATA_value = -9999,
    182199                    easting_min = 156494.00,
Note: See TracChangeset for help on using the changeset viewer.