
import sys

from anuga.shallow_water.data_manager import sww2dem
from os import sep
import project

#name='good_simulation/good_simulation_polylinefriction20080529_115703'
#name='good_simulation/good_simulation_ursfriction20080529_160110'
name='good_simulation/good_simulationsourcefriction20080529_160144'

print 'output dir:', name

which_var = 2
if which_var == 0:  # Stage
    outname = name + '_stage-eq-thurs-test'
    quantityname = 'stage'

if which_var == 1:  # Absolute Momentum
    outname = name + '_momentum_i1'
    quantityname = '(xmomentum**2 + ymomentum**2)**0.5'  

if which_var == 2:  # Depth
    outname = name + '_depth'
    quantityname = 'stage-elevation'  

if which_var == 3:  # Speed
    outname = name + '_speed_i0'
    quantityname = '(xmomentum**2 + ymomentum**2)**0.5/(stage-elevation+1.e-6/(stage-elevation))'  #Speed

if which_var == 4:  # Elevation
    outname = name + '_elevation'
    quantityname = 'elevation'  #Elevation

print 'start sww2dem'
sww2dem(name, basename_out = outname,
        quantity = quantityname,
        cellsize = 20,
        easting_min = project.bay_west,
        easting_max = project.bay_east,
        northing_min = project.bay_south,
        northing_max = project.bay_borth,   
        reduction = max, 
        verbose = True,
        format = 'asc')
