Changeset 5581


Ignore:
Timestamp:
Jul 28, 2008, 6:20:17 PM (11 years ago)
Author:
sexton
Message:

fix script to get gauges from sts file and test run_perth with tide=0

Location:
anuga_work/production/perth
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • anuga_work/production/perth/get_gauges.py

    r5580 r5581  
    99from anuga.utilities.numerical_tools import ensure_numeric
    1010from Scientific.IO.NetCDF import NetCDFFile
    11 
    1211
    1312def get_sts_gauge_data(filename,polygon,verbose=False):
     
    3130        #show()
    3231
     32   
    3333    basename='sts_gauge'
    3434    quantity_names=['stage','xmomentum','ymomentum']
     
    3838        if inside_points is not None:
    3939            quantities[name] = take(quantities[name],indices,1)
    40             for j in range(len(x)-1):
    41                 locx=int(x[j])
    42                 locy=int(y[j])
    43                 fid_sts = open(project.boundaries_dir+sep+basename+'_'+str(locx)+'_'+str(locy)+'.csv', 'w')
    44                 s = 'time, stage, xmomentum, ymomentum \n'
    45                 fid_sts.write(s)
    46                 stage = quantities[name][:,j]
    47                 xmomentum = quantities[name][:,j]
    48                 ymomentum = quantities[name][:,j]
    49                 for k in range(len(time)-1):
    50                     s = '%.2f, %.2f, %.2f, %.2f\n' %(time[k], stage[k], xmomentum[k], ymomentum[k])
    51                     fid_sts.write(s)
    5240        else:
    5341            msg = 'No gauges found inside polygon'
    5442            raise msg
    55             fid_sts.close()
     43           
     44    for j in range(len(x)-1):
     45        locx=int(x[j])
     46        locy=int(y[j])
     47        fid_sts = open(project.boundaries_dir+sep+basename+'_'+str(locx)+'_'+str(locy)+'.csv', 'w')
     48        s = 'time, stage, xmomentum, ymomentum \n'
     49        fid_sts.write(s)
     50        stage = quantities['stage'][:,j]
     51        xmomentum = quantities['xmomentum'][:,j]
     52        ymomentum = quantities['ymomentum'][:,j]
     53        for k in range(len(time)-1):
     54            s = '%.2f, %.2f, %.2f, %.2f\n' %(time[k], stage[k], xmomentum[k], ymomentum[k])
     55            fid_sts.write(s)
     56
     57        fid_sts.close()     
     58
    5659    fid.close()
    57 
     60       
    5861    return inside_points,quantities,elevation,time
    5962
     
    6164points,quantities,elevation,time=get_sts_gauge_data(os.path.join(project.boundaries_dir,project.scenario_name),polygon,verbose=False)
    6265
    63 
    6466assert len(points)==len(elevation)==len(quantities['stage'][0,:])
  • anuga_work/production/perth/project.py

    r5576 r5581  
    3636scenario = 'perth_tsunami_scenario'
    3737
    38 tide = 0.6
     38tide = 0.0 #0.6
    3939
    4040alpha = 0.1
Note: See TracChangeset for help on using the changeset viewer.