Changeset 7409


Ignore:
Timestamp:
Aug 27, 2009, 1:25:29 PM (11 years ago)
Author:
kristy
Message:

updated to new export script

File:
1 edited

Legend:

Unmodified
Added
Removed
  • anuga_work/production/patong/new_version/export_results_max.py

    r6984 r7409  
    3232
    3333
    34 time_dirs = [time_dir7] #, time_dir2,time_dir3, time_dir4,time_dir5, time_dir6, time_dir7]
     34time_dirs = [time_dir4] #, time_dir2,time_dir3, time_dir4,time_dir5, time_dir6, time_dir7]
    3535 
    3636
    37 #cellsize = 250
    38 cellsize = 20
     37# sww filename extensions ie. hobart_time_17640_0.sww, input into list 17640
     38# make sure numbers are in sequential order
     39times = []
     40           
     41#Modify the cellsize value to set the size of the raster you require
     42#Take into account mesh size when aplying this paramater
     43cellsize = 10 #250
    3944
    40 timestep = None    # None means no timestep!
    41 #timestep = 0
     45#Now set the timestep at which you want the raster generated.
     46#Either set the actual timestep required or use 'None' to indicate that
     47#you want the maximum values in the raster over all timesteps
     48timestep = None   #0
    4249
    43 ######
    44 # Set the special areas of interest.  If none, do: area='All'
    45 ######
     50# Set the special areas of interest.  If none, do: area=['All']
     51# Areas identified below are specified by cooridinates in project.py 
    4652
    47 area = ['CBD']  # strings must match keys in var_equations below
    48 #area = ['All']      # 'All' means no special areas - the whole thing
     53area = ['CBD'] 
     54#area = ['All']     
     55
     56# one or more key strings from var_equations below
     57var = ['speed']
    4958
    5059######
     
    5867                 'elevation': 'elevation' }
    5968
    60 # one or more key strings from var_equations above
    61 var = ['depth', 'speed']
    6269
    6370######
    64 # Start running the various conversions we require.
     71# Start script, running through variables, area, folder, sww file (determine by times)
     72# Then creates a maximum asci if there is more than one sww file
    6573######
    6674
     
    8795
    8896        for time_dir in time_dirs:
    89 
    90             name1 = join(directory, time_dir, project.scenario_name)
    91             name2 = join(directory, time_dir, project.scenario_name)+'_time_10270_0'
    92             name3 = join(directory, time_dir, project.scenario_name)+'_time_14555_0'
    93 
    94             names = [name1, name2, name3]
    95      
     97            names = [join(directory, time_dir, project.scenario_name)]
     98            for time in times:
     99                names.append(join(directory, time_dir, project.scenario_name)+ '_time_' + str(time) + '_0')
     100           
    96101            asc_name = []   
    97                
     102                          
    98103            for name in names:
    99                          
    100                 outname = name + '_' + which_area + '_' + which_var
     104                outname = name + '_' + which_area + '_' + which_var + '_' + str(cellsize)
    101105                quantityname = var_equations[which_var]
    102 
     106               
    103107                print 'start sww2dem: time_dir=%s' % time_dir
    104                
     108                print 'name=%s' % name
    105109                sww2dem(name, basename_out = outname,
    106110                            quantity = quantityname,
     
    116120
    117121                asc_name.append(outname + '.asc')
    118    
    119             maxasc_outname = join(directory, time_dir, project.scenario_name)+'_'+which_area+'_'+which_var+'_max.asc'
     122           
     123            if len(names) >1:
     124                maxasc_outname = join(directory, time_dir, project.scenario_name)+'_'
     125                +which_area+'_'+which_var+'_'+str(cellsize)+'_max.asc'
    120126
    121             print 'max asc outname ', maxasc_outname
    122             print 'asc_name ', str(asc_name)
    123            
    124             MaxAsc(maxasc_outname, asc_name)
     127                print 'max asc outname ', maxasc_outname
     128                print 'asc_name ', str(asc_name)
     129               
     130                MaxAsc(maxasc_outname, asc_name)
     131            else:
     132                print 'Only one sww file, no Max file required'
Note: See TracChangeset for help on using the changeset viewer.