Changeset 5824


Ignore:
Timestamp:
Oct 8, 2008, 8:39:57 AM (15 years ago)
Author:
kristy
Message:

Updated for Port Hedland

File:
1 edited

Legend:

Unmodified
Added
Removed
  • anuga_work/production/pt_hedland_2008/export_results_all.py

    r5808 r5824  
    1111"""
    1212
    13 import project_250m, os
     13import project, os
    1414import sys
    1515from anuga.shallow_water.data_manager import convert_dem_from_ascii2netcdf, dem2pts
    16 
    1716from anuga.shallow_water.data_manager import sww2dem
    1817from os import sep
    1918
    20 directory = project_250m.output_dir
    2119
    22 #time_dir = '20080526_104946_run_final_0.6_test_kvanputt'
    23 #time_dir = '20080530_170833_run_final_0.6_exmouth_kvanputt'
    24 #time_dir1 = '20080815_103442_run_final_0.0_polyline_alpha0.1_kvanputt'
    25 time_dir = '20080924_123601_run_final_0_27283_250m_none_kvanputt'
     20directory = project.output_dir
     21
     22time_dir1 = '20081003_135518_run_final_0_27283_alpha0.1_jgriffin'
     23time_dirs = [time_dir1]
    2624
    2725#cellsize = 20
    28 cellsize = 30
     26cellsize = 25
     27
     28#timestep = None    # None means no timestep!
    2929timestep = 0
    30 #area = ['Geordie', 'Sorrento', 'Fremantle', 'Rockingham']
    31 #area = ['All']
    32 which_area = 'all'
    33 #var = [1,2] # Absolute momentum and depth
    34 #var = [2] # depth
    35 var = [4] #stage and elevation
    3630
    37 name1 = directory+time_dir+sep+project_250m.scenario_name
    38 #name2 = directory+time_dir+sep+'sww2'+sep+project.scenario_name+'_time_39900_0' #need to get assistance on how to make this into anything
     31######
     32# Set the special areas of interest.  If none, do: area='All'
     33######
     34#area = ['Fremantle']  # strings must match keys in var_equations below
     35area = ['All']      # 'All' means no special areas - the whole thing
    3936
    40 names = [name1]
    41 for name in names:
     37######
     38# Define allowed variable names and associated equations to generate values.
     39# This would not normally change.
     40######
     41var_equations = {'stage':     'stage',
     42                 'momentum':  '(xmomentum**2 + ymomentum**2)**0.5',
     43                 'depth':     'stage-elevation',
     44                 'speed':     '(xmomentum**2 + ymomentum**2)**0.5/(stage-elevation+1.e-6)',
     45                 'elevation': 'elevation' }
    4246
    43 ##        for which_area in area:
    44 ##            if which_area == 'All':
    45 ##           
    46 ##            if which_area == 'Geordie':
    47 ##                easting_min = project.xminGeordie
    48 ##                easting_max = project.xmaxGeordie
    49 ##                northing_min = project.yminGeordie
    50 ##                northing_max = project.ymaxGeordie
    51 ##
    52 ##            if which_area == 'Sorrento':
    53 ##                easting_min = project.xminSorrento
    54 ##                easting_max = project.xmaxSorrento
    55 ##                northing_min = project.yminSorrento
    56 ##                northing_max = project.ymaxSorrento
    57 ##
    58 ##            if which_area == 'Fremantle':
    59 ##                easting_min = project.xminFremantle
    60 ##                easting_max = project.xmaxFremantle
    61 ##                northing_min = project.yminFremantle
    62 ##                northing_max = project.ymaxFremantle
    63 ##
    64 ##            if which_area == 'Rockingham':
    65 ##                easting_min = project.xminRockingham
    66 ##                easting_max = project.xmaxRockingham
    67 ##                northing_min = project.yminRockingham
    68 ##                northing_max = project.ymaxRockingham
     47# one or more key strings from var_equations above
     48var = ['stage','elevation']
    6949
    70          
    71         for which_var in var:
    72             if which_var == 0:  # Stage
    73                 outname = name + which_area + '_stage'
    74                 quantityname = 'stage'
     50######
     51# Start running the various conversions we require.
     52######
     53for time_dir in time_dirs:
     54    name1 = directory+time_dir+sep+project.scenario_name
     55#    name2 = directory+time_dir+sep+project.scenario_name+'_time_39900_0' #need to get assistance on how to make this into anything
     56    names = [name1]
     57   
     58    for name in names:
     59        for which_area in area:
     60            if which_area == 'All':
     61                easting_min = None
     62                easting_max = None
     63                northing_min = None
     64                northing_max = None
     65            else:
     66                try:
     67                    easting_min = eval('project.xmin%s' % which_area)
     68                    easting_max = eval('project.xmax%s' % which_area)
     69                    northing_min = eval('project.ymin%s' % which_area)
     70                    northing_max = eval('project.ymax%s' % which_area)
     71                except AttributeError:
     72                    print 'Unrecognized area name: %s' % which_area
     73                    break
     74             
     75            for which_var in var:
     76                if which_var not in var_equations:
     77                    print 'Unrecognized variable name: %s' % which_var
     78                    break
    7579
    76             if which_var == 1:  # Absolute Momentum
    77                 outname = name + which_area + '_momentum'
    78                 quantityname = '(xmomentum**2 + ymomentum**2)**0.5' 
     80                outname = name + which_area + '_' + which_var
     81                quantityname = var_equations[which_var]
    7982
    80             if which_var == 2:  # Depth
    81                 outname = name + which_area + '_depth'
    82                 quantityname = 'stage-elevation' 
    83 
    84             if which_var == 3:  # Speed
    85                 outname = name + which_area + '_speed'
    86                 #quantityname = '(xmomentum**2 + ymomentum**2)**0.5/(stage-elevation+1.e-6/(stage-elevation))'  #Speed
    87                 quantityname = '(xmomentum**2 + ymomentum**2)**0.5/(stage-elevation+1.e-6)'  #Speed
     83                print 'start sww2dem: time_dir=%s' % time_dir
    8884               
    89             if which_var == 4:  # Elevation
    90                 outname = name + which_area + '_elevation'
    91                 quantityname = 'elevation'  #Elevation
    92 
    93             else:
    94                 print 'start sww2dem',which_area
    9585                sww2dem(name, basename_out = outname,
    9686                            quantity = quantityname,
    9787                            timestep = timestep,
    9888                            cellsize = cellsize,     
     89                            easting_min = easting_min,
     90                            easting_max = easting_max,
     91                            northing_min = northing_min,
     92                            northing_max = northing_max,       
    9993                            reduction = max,
    10094                            verbose = True,
    10195                            format = 'asc')
    102 ##
    103 ##                else:
    104 ##                    print 'start sww2dem',which_area, easting_min
    105 ##                    sww2dem(name, basename_out = outname,
    106 ##                                quantity = quantityname,
    107 ##                                #timestep = timestep,
    108 ##                                cellsize = cellsize,     
    109 ##                                easting_min = easting_min,
    110 ##                                easting_max = easting_max,
    111 ##                                northing_min = northing_min,
    112 ##                                northing_max = northing_max,       
    113 ##                                reduction = max,
    114 ##                                verbose = True,
    115 ##                                format = 'asc')
    116 ##
Note: See TracChangeset for help on using the changeset viewer.