Changeset 5602


Ignore:
Timestamp:
Aug 4, 2008, 1:41:59 PM (11 years ago)
Author:
ole
Message:

Changed time vector in urs2sts to start at 0.0 insteade of delta_t

Location:
anuga_core/source/anuga/shallow_water
Files:
3 edited

Legend:

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

    r5589 r5602  
    49264926    assert nt>0,msg
    49274927   
    4928     OFFSET=5 #number of site parameters p passed back with data
    4929     #p=[geolat,geolon,depth,start_tstep,finish_tstep]
    4930 
    4931     times=dt*arange(1,(data.shape[1]-OFFSET)+1)
    4932     latitudes=zeros(data.shape[0],Float)
    4933     longitudes=zeros(data.shape[0],Float)
    4934     elevation=zeros(data.shape[0],Float)
    4935     quantity=zeros((data.shape[0],data.shape[1]-OFFSET),Float)
     4928    OFFSET=5 # Number of site parameters p passed back with data
     4929             # p=[geolat,geolon,depth,start_tstep,finish_tstep]
     4930
     4931    parameters_index = data.shape[1]-OFFSET         
     4932             
     4933    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)
     4938   
     4939   
    49364940    starttime=1e16
    4937     for i in range(0,data.shape[0]):
    4938         latitudes[i]=data[i][data.shape[1]-OFFSET]
    4939         longitudes[i]=data[i][data.shape[1]-OFFSET+1]
    4940         elevation[i]=-data[i][data.shape[1]-OFFSET+2]
    4941         quantity[i]=data[i][:-OFFSET]
    4942         starttime=min(dt*data[i][data.shape[1]-OFFSET+3],starttime)
     4941    for i in range(0, data.shape[0]):
     4942        latitudes[i]=data[i][parameters_index]
     4943        longitudes[i]=data[i][parameters_index+1]
     4944        elevation[i]=-data[i][parameters_index+2]
     4945        quantity[i][:]=data[i][:parameters_index] # Was data[i][:-OFFSET]
     4946       
     4947        starttime=min(dt*data[i][parameters_index+3],starttime)
    49434948       
    49444949    return times, latitudes, longitudes, elevation, quantity, starttime
     4950   
    49454951
    49464952def mux2sww_time(mux_times, mint, maxt):
  • anuga_core/source/anuga/shallow_water/test_data_manager.py

    r5601 r5602  
    61476147        msg='time array has incorrect length'
    61486148        assert times.shape[0]==time_step_count,msg
     6149       
    61496150        msg = 'time array is incorrect'
    6150         assert allclose(times,time_step*arange(1,time_step_count+1)),msg
     6151        #assert allclose(times,time_step*arange(1,time_step_count+1)),msg
     6152        assert allclose(times,time_step*arange(time_step_count)), msg
     6153       
    61516154        msg='Incorrect gauge positions returned'
    61526155        for i,point in enumerate(lat_long_points):
     
    66126615            msg = 'sts starttime for source %d was %f. Should have been %f'\
    66136616                %(source_number, sts_starttime, starttime)
     6617               
    66146618            #assert allclose(sts_starttime-delta_t, starttime), msg
    66156619            ## FIXME - have done a dodgy to get it through here ###   
     6620           
     6621            #print source_filename, sts_starttime, starttime
    66166622            assert allclose(sts_starttime, starttime), msg             
    66176623           
  • anuga_core/source/anuga/shallow_water/urs_ext.c

    r5582 r5602  
    3535void fillDataArray(int ista, int total_number_of_stations, int nt, int ig, int *nst,
    3636                   int *nft, float *data, int *istart_p,
    37            int *istop_p, float *muxData)
     37                   int *istop_p, float *muxData)
    3838{
    3939    int it, last_it, jsta;
     
    4242
    4343    last_it = -1;
    44     /* make arrays of starting and finishing time steps for the tide gauges */
     44    /* Make arrays of starting and finishing time steps for the tide gauges */
    4545    /* and fill them from the file */
    4646
    47     /* update start and stop timesteps for this gauge */
     47    /* Update start and stop timesteps for this gauge */
    4848    if (nst[ista]!= -1)
    4949    {
     
    158158//Internal Functions
    159159int _read_mux2_headers(int numSrc,
    160                         char **muxFileNameArray,
    161                         int* total_number_of_stations,
    162                                                 int* number_of_time_steps,
    163                                                 double* delta_t,
    164                         //long* numDataMax,
    165                         int verbose)
     160                       char **muxFileNameArray,
     161                       int* total_number_of_stations,
     162                       int* number_of_time_steps,
     163                       double* delta_t,
     164                       //long* numDataMax,
     165                       int verbose)
    166166{
    167167    FILE *fp;
     
    415415        fseek(fp, offset, 0);
    416416
    417         numData = getNumData(fros + isrc*total_number_of_stations, lros + isrc*total_number_of_stations, total_number_of_stations);
     417        numData = getNumData(fros + isrc*total_number_of_stations,
     418                             lros + isrc*total_number_of_stations,
     419                             total_number_of_stations);
     420                             
    418421        fread(muxData, numData*sizeof(float), 1, fp);
    419422        fclose(fp);
Note: See TracChangeset for help on using the changeset viewer.