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

# read_netcdf

## PURPOSE

'read_netcdf': reads a list of fields and constants in a netcdf file

## SYNOPSIS

function [cte_detect,var_detect,cte_read,var_read,choice,cte2_detect,var2_detect,cte2_read,var2_read]=read_netcdf(filename,cte1,nb1,var1,cte2,nb2,var2,option)

## DESCRIPTION

    'read_netcdf': reads a list of fields and constants in a netcdf file
    ------------------------------------------------------------------
    [cte_detect,var_detect,cte_read,var_read,choice,cte2_detect,var2_detect,cte2_read,var2_read]=...
     read_netcdf(filename,cte1,nb1,var1,cte2,nb2,var2,option)
    OUTPUT:
    cte_detect: array with the dimension of cte1 or cte2 (option 'or'), =1 if the constant is detected 0 else.
    var_detect: like cte_detect for the variables
    cte_read: list of the values for the constants (global attributes), =0 if not detected
    var_read(ind,:): variable array number ind, the variable #i is determined as var_read(ind(i),:), with ind=cumsum(var_detect);
    choice=1 if the first list is chosen (or with the option 'and'), 2 else.
    cte2_detect,var2_detect, cte2_read,var2_read, second set of v ctes and variables (only with the option 'and')

    INPUT:
    filename (netcdf file)
    cte1: cell array listing the constants (global attributes) to read
    nb1: name (string) of the constant in the netcdf file giving the length of var1 (if absent no variable is read)
    var1: list of variables arrays to read with length nb1
    cte2,nb2,var2: second list of cte and variables (optional)
    option:
    'first' read only the first field series (default)
    'or' : read one of them, the first one in priority if it exists
    'and' : read the two field series

     related FUNCTION
     'varname_generator.m': generates the appropriate list of variables and constants

## CROSS-REFERENCE INFORMATION

This function calls:

This function is called by:

- RUN_STLIN 'RUN_STLIN': combine velocity fields for stereo PIV
- read_scalar 'read_scalar': reads and calculates the vort div or any scalar from a file
- read_vel 'read_vel': reads one or two velocity fields and associated parameters from a file or a pair of files.
- series 'series': master function associated to the GUI series.m for analysis field series