SASHE_VAP  1.0
 All Data Structures Files Functions Variables Typedefs Enumerations Macros Groups
SASHE Utilities

Data Structures

struct  ConfigTable
 SASHE Configuration Table. More...

Macros

#define INTERPOLATE(x, x0, y0, x1, y1)   (y0 + (x - x0) * ((y1 - y0)/(x1 - x0)))
 Macro to interpolate between two values.

Functions

int sashe_find_nearest_float (int n, float *x, float v)
 Find the index of a value in an array of floats.
int sashe_find_nearest_double (int n, double *x, double v)
 Find the index of a value in an array of doubles.
int sashe_find_recset_indexes (const char *site, time_t data_time, size_t ntags, int *tags, int *recsets, size_t *rs_drk, size_t *rs_tot, size_t *rs_sb1, size_t *rs_blk, size_t *rs_sb2)
 Get the start indexes of all complete record sets.
void sashe_free_config_table (ConfigTable *table)
 Free the memory used by a configuration table.
void sashe_get_config_values (ConfigTable *table, size_t nvals, float *col1, float *col2)
 Get values from a configuration table.
void sashe_get_config_values_interpolate (ConfigTable *table, size_t nvals, float *col1, float *col2)
 Get values from a configuration table using interpolation.
double sashe_get_diffuse_correction (void)
 Get the diffuse correction factor from the conf file.
ConfigTablesashe_load_config_table (const char *name)
 Load the values from a SASHE configuration table.
int sashe_print_config_table (const char *file, ConfigTable *table)
 Print a configuration table.

Detailed Description


Function Documentation

int sashe_find_nearest_double ( int  n,
double *  x,
double  v 
)

Find the index of a value in an array of doubles.

This function will find the index of the value in an array of monotonically increasing or decreasing values that is closest to the specified value.

Parameters:
nnumber of values in the array
xarray of monotonically increasing or decreasing values
vthe value to look for
Returns:
The index of the value that is closest to the specified value.

Definition at line 255 of file sashe_utils.c.

int sashe_find_nearest_float ( int  n,
float *  x,
float  v 
)

Find the index of a value in an array of floats.

This function will find the index of the value in an array of monotonically increasing or decreasing values that is closest to the specified value.

Parameters:
nnumber of values in the array
xarray of monotonically increasing or decreasing values
vthe value to look for
Returns:
The index of the value that is closest to the specified value.

Definition at line 307 of file sashe_utils.c.

int sashe_find_recset_indexes ( const char *  site,
time_t  data_time,
size_t  ntags,
int *  tags,
int *  recsets,
size_t *  rs_drk,
size_t *  rs_tot,
size_t *  rs_sb1,
size_t *  rs_blk,
size_t *  rs_sb2 
)

Get the start indexes of all complete record sets.

OLD order before 3/23/2012

Tag sequence 1:

    2  - dark counts
    3  - total
    5  - side blocked
    7  - side blocked (other side)
    9  - blocked (diffuse)

Tag sequence 2:

    11 - dark counts
    12 - total
    14 - side blocked
    16 - side blocked (other side)
    18 - blocked (diffuse)

NEW order starts 3/23/2012

Tag sequence 1:

    4  - dark counts
    5  - total
    7  - side blocked
    9  - blocked (diffuse)
    11 - side blocked (other side)

Tag sequence 2:

    15 - dark counts
    16 - total
    18 - side blocked
    20 - blocked (diffuse)
    22 - side blocked (other side)
Parameters:
[in]sitesite name
[in]data_timestart time of the data being processed
[in]ntagslength of the tags array
[in]tagsarray of tag values
[in]recsetsarray to store the start indexes for each complete record set
[out]rs_drkrecord set index of dark counts
[out]rs_totrecord set index of total
[out]rs_sb1record set index of side blocked 1
[out]rs_blkrecord set index of blocked
[out]rs_sb2record set index of side blocked 2
Returns:
The number of complete record sets found.

Definition at line 401 of file sashe_utils.c.

void sashe_free_config_table ( ConfigTable table)

Free the memory used by a configuration table.

Parameters:
tablepointer to the configuration table

Definition at line 476 of file sashe_utils.c.

void sashe_get_config_values ( ConfigTable table,
size_t  nvals,
float *  col1,
float *  col2 
)

Get values from a configuration table.

Parameters:
tablepointer to the configuration table
nvalsnumber of values to lookup in the configuration table
col1array of column 1 values to lookup in the table
col2array to store the corresponding column 2 values in

Definition at line 493 of file sashe_utils.c.

void sashe_get_config_values_interpolate ( ConfigTable table,
size_t  nvals,
float *  col1,
float *  col2 
)

Get values from a configuration table using interpolation.

Parameters:
tablepointer to the configuration table
nvalsnumber of values to lookup in the configuration table
col1array of column 1 values to lookup in the table
col2array to store the corresponding column 2 values in

Definition at line 546 of file sashe_utils.c.

double sashe_get_diffuse_correction ( void  )

Get the diffuse correction factor from the conf file.

Return values:
diff_corrdiffuse correction factor
0if an error occurred

Definition at line 607 of file sashe_utils.c.

ConfigTable* sashe_load_config_table ( const char *  name)

Load the values from a SASHE configuration table.

The memory used by the returned structure is dynamically allocated and must be freed using the sashe_free_config_table() function.

Parameters:
nameconfiguration table name
Return values:
tablepointer to the configuration table
NULLif an error occurred

Definition at line 730 of file sashe_utils.c.

int sashe_print_config_table ( const char *  file,
ConfigTable table 
)

Print a configuration table.

Parameters:
filename of the output file
tablepointer to the configuration table
Return values:
1if successful
0if an error occurred

Definition at line 767 of file sashe_utils.c.