Home > coriolis > bigone > PROJETS > UVMAT.new > read_vel.m

# read_vel

## PURPOSE

'read_vel': reads one or two velocity fields and associated parameters from a file or a pair of files.

## SYNOPSIS

function [dt,time,pixcmx,pixcmy,vec_X,vec_Y,vec_Z,vec_U,vec_V,vec_W,vec_C,vec_F,fixflag,vel_type_out,error,nb_coord,nb_dim,Civ,CivStage]=read_vel(filename,vel_type,scal_type,vec_X_in,vec_Y_in,vec_Z_in);

## DESCRIPTION

    'read_vel': reads one or two velocity fields and associated parameters from a file or a pair of files.
     In the case of two velocity fields, the difference of the two fields (linearly interpolated to the positions of
     the first field) is given as the default output. Any other operation on the two
     fields can be introduced by an external function 'usrtransform'.
     OBSOLETE: REPLACED BY read_ncfield
    ------------------------------------------------------------------
     [dt,time,pixcmx,pixcmy,vec_X,vec_Y,vec_Z,vec_U,vec_V,vec_W,vec_C,vec_F,fixflag,vel_type_out,error,nb_coord,nb_dim,Ima,CivStage]...
     =read_vel(filename,vel_type,scal_type,vec_X_in,vec_Y_in,vec_Z_in);
     OUTPUT:
     dt:time interval of the image pair red from a single file, or vector with
     two values for a pair of files
     time: absolute time of the first file
     pixcmx,pixcmy: scaling factors (from the first file)
     vec_X,vec_Y,vec_Z: matlab vectors, representing the set of coordinates for
     the velocity vectors, vec_Z=zeros(size(vec_X)) for a 2D planar field
     vec_U,vec_V,vec_W: matlab vectors, representing the set of velocity components for
     the velocity vectors, vec_W=zeros(size(vec_X)) for a 2 component field
     vec_C: matlab vector, representing the set of image correlations, or any scalar set by the input 'scal_type'.
     vec_F: matlab vector, representing the set of vector flags vec_F for quality warning.
     fixflag: matlab vector, representing the set of vector flags for removal.
     RMQ: when two fields are read, the flags and vec_C correspond
     to the first field. By default vec_C=1,vec_F=1,fixflag=0 if
     it is not defined. (faulse vectors of the second field  are removed before interpolation)
     vel_type_out: string representing the selected velocity type (civ1,civ2,filter1...)
     error: error flag
     error=0; OK
     error=1; first field of file 1 not detected
     error=2; second field of file 1 not detected
     error=3; first field of file 2 not detected
     error=4; second field of file 2 not detected
     error=5; the scalar cannot be obtained

     INPUT:
     filename: cell of names (length 1 or 2) representing the file names.
     vel_type: cell of imposed velocity types 'civ1','filter1'...if
     vel_type={} or vel_type{1}=[], the best choice is made (first civ2, then civ1)
     scal_type: string of a scalar name. If defined vec_C represents the value of this scalar
     vec_X_in,vec_Y_in,vec_Z_in: optional imposed set of positions on which data are linearly interpolated (not yet implemented)
     transform: transform.vel: name of an optional user defined function
     [vec_U,vec_V,vec_W,vec_X,vec_Y,vec_Z]=usrtransform(vec_U,vec_V,vec_W,vec2_U,vec2_V,vec2_W,vec_X,vec_Y,vec_Z)
     transform.scal: name of a transform function for a scalar (used if vec_C is a scalar)

     FUNCTIONS called:
     'varname_generator.m':, sets the names in the netcdf file from 'vel_type'
     'read_netcdf.m': reads the netcdf file with a given set of variable names
     'calc_scal.m': calculates the scalar (used for arrow colors)

## CROSS-REFERENCE INFORMATION

This function calls:

- calc_scal 'calc_scal': defines scalars and calculate them from stored fields. OBSOLETE to replace by calc_field
- griddata_uvmat 'griddata_uvmat': function griddata_uvmat(vec2_X,vec2_Y,vec2_U,vec_X,vec_Y,'linear')
- read_netcdf 'read_netcdf': reads a list of fields and constants in a netcdf file
- varname_generator 'varname_generator': defines the names of constants and variable fields to read in the netcdf files

This function is called by:

- RUN_STLIN 'RUN_STLIN': combine velocity fields for stereo PIV