Ignore:
Timestamp:
Jul 2, 2008, 4:34:48 PM (16 years ago)
Author:
duncan
Message:

Current Hinwood scenario

Location:
anuga_work/development/Hinwood_2008
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • anuga_work/development/Hinwood_2008/plot.py

    r5455 r5459  
    1414                     legend_sim='ANUGA simulation',
    1515                     legend_exp='Measured flume result',
    16                      is_interactive=False):
     16                     is_interactive=False,
     17                     use_axis=None):
    1718    """
    1819    """
     
    4445    legend((legend_sim, legend_exp),'upper left')
    4546    title(plot_title)
    46     #axis([0,60,0.380,0.420])
     47    if use_axis is not None:
     48        axis(use_axis)
    4749   
    4850    if is_interactive:
     
    107109            plot_title = "Scenario: " + outputdir_name + "\n" + \
    108110                         "X Gauge (m):" + str(gauge) + "    " + time_date
    109                          
     111            if gauge < run_data['axis_maximum_x']:
     112                use_axis = run_data['axis']
     113            else:
     114                use_axis = None
    110115            print "Doing ", plot_title
    111116            plot_compare_csv(location_sim=loc_sim,
     
    116121                             y_label='Water '+ quantity +' (m)',
    117122                             is_interactive=False,
    118                              save_as=save_as)
     123                             save_as=save_as,
     124                             use_axis=use_axis)
    119125   
    120126#-------------------------------------------------------------
     
    123129    """
    124130    from scenarios import scenarios
    125     outputdir_tag = "_test_C"
    126     #scenarios = scenarios[1]
     131    outputdir_tag = "_good_tri_area_0.01_C"
     132    #scenarios = scenarios[1:]
    127133    #scenarios = [scenarios[5]]
    128134    plot(scenarios, outputdir_tag)
  • anuga_work/development/Hinwood_2008/prepare_time_boundary.py

    r5455 r5459  
    1515from Scientific.IO.NetCDF import NetCDFFile
    1616from Numeric import array, zeros, Float
     17from os.path import join
    1718 
    1819from anuga.utilities.numerical_tools import ensure_numeric
     
    2021from interp import interp
    2122
    22 from os.path import join
     23
     24import project
    2325
    2426# from os import getenv
     
    115117   
    116118    # Read velocity file
     119    #print "*********************"
     120    #print "velocity_file", velocity_file
    117121    vfid = open(velocity_file)
    118122    lines = vfid.readlines()
     
    133137
    134138    # Read the depth file
     139    #print "depth_file", depth_file
    135140    dfid = open(depth_file)
    136141    lines = dfid.readlines()
     
    159164    #print "len(dtimes)", len(vtimes)
    160165    #print "len(depths_at_vtimes)", len(depths_at_vtimes)
    161 #     for i in range(len(depths_at_vtimes)):
     166    #print "metadata_dic['scenario_id']", metadata_dic['scenario_id']
     167 #    for i in range(len(depths_at_vtimes)):
    162168#         print "i", i
    163169#         print "vtimes[i]", vtimes[i]
    164170#         print "depths_at_vtimes[i]", depths_at_vtimes[i]
    165 #     print "depths_at_vtimes",  depths_at_vtimes
     171
     172    #print "depths_at_vtimes",  depths_at_vtimes
    166173    depths_at_vtimes = depths_at_vtimes/1000.00 # convert from mm to m
    167174    missing=missing/1000.00 # Do to missing what is done to depths_at_vtimes
     
    192199
    193200    fid.close()
     201    print "The start time for is", start_time
     202    if not start_time == metadata_dic['ANUGA_start_time']:
     203        raise ValueError, "The calc'ed and recorded start times are different"
     204    # Modify the sensor array to reflect the new start time
     205    sensors[:,0] -= start_time
    194206   
    195207    # Since there is a new time reference save the depth info using this
    196208    # new reference.
    197209    fid = open(depth_file[:-4] + '_exp_depth.csv','w')
    198     sensors[:,0] -= start_time
    199210    #print "depth_file", depth_file
    200211    #print "start_time", start_time
     
    226237    # new reference.
    227238    fid = open(depth_file[:-4] + '_exp_stage.csv','w')
    228     sensors[:,0] -= start_time
    229239   
    230240    # Write a header
     
    248258def prepare_time_boundary(metadata_dic, raw_data_dir, output_dir):
    249259    """
     260    Use this if a project instance has already been created.
    250261    """
    251262    scenario_id = metadata_dic['scenario_id']
     
    256267   
    257268    final_time = combine_velocity_depth(velocity_file, depth_file, out_file,
    258                                         metadata_dic) 
     269                                        metadata_dic)
     270    #print "metadata_dic['xleft'][1]", metadata_dic['xleft'][1]
    259271    if metadata_dic['xleft'][1] >= 0.0:
    260272        # This should be a -ve value, since the still water level is the
     
    264276    csv2tms(tsm_file, metadata_dic['xleft'][1])
    265277    return final_time
     278
     279# Don't do this, since run-dam changes the  metadata_dic['xleft'][1],
     280# which is used by this function
     281def prepare_time_boundary_for_scenarios_warning(scenarios,
     282                                        outputdir_tag):
     283
     284    for run_data in scenarios:       
     285        id = run_data['scenario_id']
     286        outputdir_name = id + outputdir_tag
     287        pro_instance = project.Project(['data','flumes','Hinwood_2008'],
     288                                       outputdir_name=outputdir_name)
     289        prepare_time_boundary(run_data,
     290                              pro_instance.raw_data_dir,
     291                              pro_instance.boundarydir)
     292       
    266293   
    267294#-------------------------------------------------------------------
    268295if __name__ == "__main__":
    269     pass
     296   
     297    import sys; sys.exit()
     298   
     299    from scenarios import scenarios
     300    outputdir_tag = "XXXX"
     301    prepare_time_boundary_for_scenarios(scenarios,
     302                                        outputdir_tag)
  • anuga_work/development/Hinwood_2008/run_dam.py

    r5455 r5459  
    7878       
    7979    elif run_type == 3:
    80         outputdir_name += '_test_good_time_mesh'
     80        outputdir_name += '_yieldstep_0.1_tri_area_0.01_C'
    8181        yieldstep = 0.1
    8282        finaltime = None       
    83         maximum_triangle_area=0.001
     83        maximum_triangle_area=0.01
    8484    elif run_type == 4:
    8585        outputdir_name += '_good_tri_area_0.01_C'
     
    115115                                       pro_instance.raw_data_dir,
    116116                                       pro_instance.boundarydir)
     117    #return pro_instance
    117118    if finaltime is None:
    118119        finaltime = boundary_final_time
     
    251252    run_type = 1
    252253    #for run_data in [scenarios[5]]:
     254    #scenarios = scenarios[2:]
    253255    for run_data in scenarios:
    254256        pro_instance = main( run_data['scenario_id'] + '_boundary.tsm'  ,
     
    256258                             run_type = run_type,
    257259                             outputdir_name=run_data['scenario_id'])
    258         gauges_for_slope(pro_instance.outputdir,[run_data])
     260        #gauges_for_slope(pro_instance.outputdir,[run_data])
Note: See TracChangeset for help on using the changeset viewer.