Ignore:
Timestamp:
Aug 5, 2008, 3:46:33 PM (14 years ago)
Author:
ole
Message:

A bit more cleanup in urs2sts - all tests pass, but I think we need a few more.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • anuga_core/source/anuga/shallow_water/data_manager.py

    r5611 r5612  
    48884888    numSrc=len(filenames)
    48894889
    4890     file_params=-1*ones(3,Float)#[nsta,dt,nt]
     4890    file_params=-1*ones(3,Float) #[nsta,dt,nt]
    48914891   
    48924892    # Convert verbose to int C flag
     
    48964896        verbose=0
    48974897       
    4898        
    4899     #msg = 'I got the permutation vector:' + str(permutation)
    4900     #assert permutation is not None, msg
    49014898    if permutation is None:
    49024899        permutation = ensure_numeric([], Float)   
    49034900
    49044901    # Call underlying C implementation urs2sts_ext.c   
    4905     data = read_mux2(numSrc,filenames,weights,file_params,permutation,verbose)
     4902    data = read_mux2(numSrc, filenames, weights, file_params, permutation, verbose)
    49064903
    49074904    msg='File parameter values were not read in correctly from c file'
     
    49254922    msg='Must have at least one gauge value'
    49264923    assert nt>0,msg
    4927     
     4924   
    49284925    OFFSET=5 # Number of site parameters p passed back with data
    49294926             # p=[geolat,geolon,depth,start_tstep,finish_tstep]
    4930 
     4927     
     4928    # FIXME (Ole): What is the relationship with params and data.shape ?
     4929    # It looks as if the following asserts should pass but they don't always
     4930    #
     4931             
     4932    #print
     4933    #print nsta, nt, data.shape
     4934       
     4935    #msg = 'nt = %d, data.shape[1] == %d' %(nt, data.shape[1])
     4936    #assert nt == data.shape[1] - OFFSET, msg
     4937   
     4938    #msg = 'nsta = %d, data.shape[0] == %d' %(nsta, data.shape[0])   
     4939    #assert nsta == data.shape[0], msg
     4940
     4941   
     4942    # Number of stations in ordering file
     4943    number_of_selected_stations = data.shape[0]
     4944
     4945    # Index where data ends and parameters begin
    49314946    parameters_index = data.shape[1]-OFFSET         
    49324947             
    49334948    times=dt*arange(parameters_index)   
    4934     latitudes=zeros(data.shape[0], Float)
    4935     longitudes=zeros(data.shape[0], Float)
    4936     elevation=zeros(data.shape[0], Float)
    4937     quantity=zeros((data.shape[0], parameters_index), Float)
     4949    latitudes=zeros(number_of_selected_stations, Float)
     4950    longitudes=zeros(number_of_selected_stations, Float)
     4951    elevation=zeros(number_of_selected_stations, Float)
     4952    quantity=zeros((number_of_selected_stations, parameters_index), Float)
    49384953   
    49394954   
    49404955    starttime=1e16
    4941     for i in range(0, data.shape[0]):
     4956    for i in range(number_of_selected_stations):
     4957        quantity[i][:]=data[i][:parameters_index]
     4958   
    49424959        latitudes[i]=data[i][parameters_index]
    49434960        longitudes[i]=data[i][parameters_index+1]
    49444961        elevation[i]=-data[i][parameters_index+2]
    4945         quantity[i][:]=data[i][:parameters_index] # Was data[i][:-OFFSET]
    4946        
    49474962        first_time_step = data[i][parameters_index+3]
    4948         #print 'datamanager:', i, first_time_step, dt*first_time_step
    4949         starttime=min(dt*data[i][parameters_index+3],starttime)
     4963       
     4964        starttime=min(dt*first_time_step, starttime)
    49504965       
    49514966    return times, latitudes, longitudes, elevation, quantity, starttime
Note: See TracChangeset for help on using the changeset viewer.