Changeset 8289


Ignore:
Timestamp:
Dec 20, 2011, 9:44:31 AM (8 years ago)
Author:
steve
Message:

Change the way timesteps are stored in sww_merge to have number_of_timesteps = None

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/anuga_core/source/anuga/utilities/sww_merge.py

    r8285 r8289  
    209209
    210210            times    = fid.variables['time'][:]
    211             number_of_timesteps = len(times)
     211            n_steps = len(times)
     212            number_of_timesteps = fid.dimensions['number_of_timesteps']
     213            starttime = int(fid.starttime)
    212214           
    213215            out_s_quantities = {}
     
    242244            for quantity in dynamic_quantities:
    243245                out_d_quantities[quantity] = \
    244                       num.zeros((number_of_timesteps,number_of_global_nodes),num.float32)
     246                      num.zeros((n_steps,number_of_global_nodes),num.float32)
    245247                 
    246248            description = 'merged:' + getattr(fid, 'description')         
     
    299301            q = fid.variables[quantity]
    300302            #print q.shape
    301             for i in range(number_of_timesteps):
     303            for i in range(n_steps):
    302304                out_d_quantities[quantity][i][node_l2g] = \
    303305                           num.array(q[i],dtype=num.float32)
     
    322324    fido = NetCDFFile(output, netcdf_mode_w)
    323325    sww = Write_sww(static_quantities, dynamic_quantities)
    324     sww.store_header(fido, times,
     326    sww.store_header(fido, starttime,
    325327                             number_of_global_triangles,
    326328                             number_of_global_nodes,
     
    349351    for q in dynamic_quantities:
    350352        q_values = out_d_quantities[q]
    351         for i in range(number_of_timesteps):
     353        for i in range(n_steps):
    352354            fido.variables[q][i] = q_values[i]
    353355       
Note: See TracChangeset for help on using the changeset viewer.