OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
val_extract.c File Reference
#include "val_extract.h"
#include <argpar.h>
#include <olog.h>
#include <olog/loader.h>
#include <pqueue.h>
#include <shash.h>
#include <vincenty.h>
#include <ctype.h>
#include <errno.h>
#include <float.h>
#include <libgen.h>
#include <limits.h>
#include <math.h>
#include <netcdf.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
Include dependency graph for val_extract.c:

Go to the source code of this file.

Classes

struct  optic
 

Macros

#define VALEXTRACT_IMPLEMENTATION   2006007
 
#define VALEXTRACT_IMPLEMENTATION_STR   "2.6.7"
 
#define VALEXTRACT_API_VERSION   2006005
 
#define VALEXTRACT_API_VERSION_STR   "2.6.5"
 
#define str(s)   #s
 
#define expanded_str(s)   str(s)
 
#define VALEXTRACT_OPTICS_DEFAULT   20
 
#define START_LINE_KEY   1
 
#define END_LINE_KEY   2
 
#define START_PIXEL_KEY   3
 
#define END_PIXEL_KEY   4
 
#define BOX_SIZE_KEY   5
 
#define BOX_SIZE_KM_KEY   6
 
#define SLAT_KEY   7
 
#define ELAT_KEY   8
 
#define SLON_KEY   9
 
#define ELON_KEY   10
 
#define L2QC_KEY   11
 
#define RANGES_KEY   12
 
#define IGNORE_KEY   13
 
#define OPTICS_KEY   14
 
#define COUNT_KEY   15
 
#define GLOBAL_ATT_KEY   16
 
#define VAR_ATT_KEY   17
 
#define SKIP_STATS_KEY   18
 
#define ARG_INT_START   START_LINE_KEY
 
#define ARG_INT_END   BOX_SIZE_KEY
 
#define ARG_DBL_START   BOX_SIZE_KM_KEY
 
#define ARG_DBL_END   ELON_KEY
 
#define clean_and_return(ret)
 
#define define_compare(type, suffix)
 
#define define_nc_get_varr(type, suffix)
 

Functions

void val_extract_clear_args (val_extract_arguments *arguments)
 
int val_extract (val_extract_arguments *arguments)
 
int val_extract_clean (val_extract_arguments *arguments)
 
void unflatten_index (int index, int ndims, const int *dims, int *result)
 
const char * val_extract_version ()
 
const char * val_extract_api_version ()
 
 define_compare (int8_t, _int8)
 
size_t nc_get_region_size (nc_region *region)
 
size_t nc_get_region_dim_size (nc_region *region, int dim_index)
 

Variables

long timezone
 
argpar val_extract_argpar = { options, parse_options }
 

Macro Definition Documentation

◆ ARG_DBL_END

#define ARG_DBL_END   ELON_KEY

Definition at line 69 of file val_extract.c.

◆ ARG_DBL_START

#define ARG_DBL_START   BOX_SIZE_KM_KEY

Definition at line 68 of file val_extract.c.

◆ ARG_INT_END

#define ARG_INT_END   BOX_SIZE_KEY

Definition at line 66 of file val_extract.c.

◆ ARG_INT_START

#define ARG_INT_START   START_LINE_KEY

Definition at line 65 of file val_extract.c.

◆ BOX_SIZE_KEY

#define BOX_SIZE_KEY   5

Definition at line 48 of file val_extract.c.

◆ BOX_SIZE_KM_KEY

#define BOX_SIZE_KM_KEY   6

Definition at line 50 of file val_extract.c.

◆ clean_and_return

#define clean_and_return (   ret)

Definition at line 547 of file val_extract.c.

◆ COUNT_KEY

#define COUNT_KEY   15

Definition at line 60 of file val_extract.c.

◆ define_compare

#define define_compare (   type,
  suffix 
)
Value:
int compare ## suffix(const void *a, const void *b){ \
if (*(const type*)a < *(const type*)b){ \
return -1; \
} else if (*(const type*)a > *(const type*)b){ \
return 1; \
} else { \
return 0; \
} \
}

Definition at line 2641 of file val_extract.c.

◆ define_nc_get_varr

#define define_nc_get_varr (   type,
  suffix 
)
Value:
int nc_get_varr ## suffix(int ncid, int varid, nc_region *region, type *p){ \
int i, nc_ret = 0; \
for (i=0;i<region->box_count;i++){ \
if ((nc_ret = nc_get_vara ## suffix(ncid, varid, region->boxes[i].start, region->boxes[i].count, p)) != NC_NOERR){ \
break; \
} \
p += region->boxes[i].count[0] * region->boxes[i].count[1]; \
} \
return nc_ret; \
} \
int nc_get_varrd ## suffix(int ncid, int varid, nc_region *region, int dim_index, type *p){ \
int i, nc_ret = 0; \
for (i=0;i<region->box_count;i++){ \
if ((nc_ret = nc_get_vara ## suffix(ncid, varid, region->boxes[i].start + dim_index, region->boxes[i].count + dim_index, p)) != NC_NOERR){ \
break; \
} \
p += region->boxes[i].count[dim_index]; \
} \
return nc_ret; \
}

Definition at line 2692 of file val_extract.c.

◆ ELAT_KEY

#define ELAT_KEY   8

Definition at line 52 of file val_extract.c.

◆ ELON_KEY

#define ELON_KEY   10

Definition at line 54 of file val_extract.c.

◆ END_LINE_KEY

#define END_LINE_KEY   2

Definition at line 45 of file val_extract.c.

◆ END_PIXEL_KEY

#define END_PIXEL_KEY   4

Definition at line 47 of file val_extract.c.

◆ expanded_str

#define expanded_str (   s)    str(s)

Definition at line 33 of file val_extract.c.

◆ GLOBAL_ATT_KEY

#define GLOBAL_ATT_KEY   16

Definition at line 61 of file val_extract.c.

◆ IGNORE_KEY

#define IGNORE_KEY   13

Definition at line 58 of file val_extract.c.

◆ L2QC_KEY

#define L2QC_KEY   11

Definition at line 56 of file val_extract.c.

◆ OPTICS_KEY

#define OPTICS_KEY   14

Definition at line 59 of file val_extract.c.

◆ RANGES_KEY

#define RANGES_KEY   12

Definition at line 57 of file val_extract.c.

◆ SKIP_STATS_KEY

#define SKIP_STATS_KEY   18

Definition at line 63 of file val_extract.c.

◆ SLAT_KEY

#define SLAT_KEY   7

Definition at line 51 of file val_extract.c.

◆ SLON_KEY

#define SLON_KEY   9

Definition at line 53 of file val_extract.c.

◆ START_LINE_KEY

#define START_LINE_KEY   1

Definition at line 44 of file val_extract.c.

◆ START_PIXEL_KEY

#define START_PIXEL_KEY   3

Definition at line 46 of file val_extract.c.

◆ str

#define str (   s)    #s

Definition at line 32 of file val_extract.c.

◆ VALEXTRACT_API_VERSION

#define VALEXTRACT_API_VERSION   2006005

Definition at line 4 of file val_extract.c.

◆ VALEXTRACT_API_VERSION_STR

#define VALEXTRACT_API_VERSION_STR   "2.6.5"

Definition at line 5 of file val_extract.c.

◆ VALEXTRACT_IMPLEMENTATION

#define VALEXTRACT_IMPLEMENTATION   2006007

Definition at line 2 of file val_extract.c.

◆ VALEXTRACT_IMPLEMENTATION_STR

#define VALEXTRACT_IMPLEMENTATION_STR   "2.6.7"

Definition at line 3 of file val_extract.c.

◆ VALEXTRACT_OPTICS_DEFAULT

#define VALEXTRACT_OPTICS_DEFAULT   20

Definition at line 39 of file val_extract.c.

◆ VAR_ATT_KEY

#define VAR_ATT_KEY   17

Definition at line 62 of file val_extract.c.

Function Documentation

◆ define_compare()

define_compare ( int8_t  ,
_int8   
)

Definition at line 2652 of file val_extract.c.

◆ nc_get_region_dim_size()

size_t nc_get_region_dim_size ( nc_region region,
int  dim_index 
)

Definition at line 2683 of file val_extract.c.

◆ nc_get_region_size()

size_t nc_get_region_size ( nc_region region)

Definition at line 2675 of file val_extract.c.

◆ unflatten_index()

void unflatten_index ( int  index,
int  ndims,
const int *  dims,
int *  result 
)

Given dimension lengths from an nc_file and a one dimensional index, find the corresponding n-dimension index.

Definition at line 2604 of file val_extract.c.

◆ val_extract()

int val_extract ( val_extract_arguments arguments)

Process a small section of a Level-2 NetCDF file.

Parameters
[in]argumentsval_extract_argument structure.
Returns
0 on success, one of VALEXTRACT_ERR_ on error.

Definition at line 589 of file val_extract.c.

◆ val_extract_api_version()

const char* val_extract_api_version ( )

Returns a string representation of the library's implemented API version number, without a label.

Definition at line 2635 of file val_extract.c.

◆ val_extract_clean()

int val_extract_clean ( val_extract_arguments arguments)

Clean up stuff malloc'd by the argpar callback. Should be called at the end of processing if val_extract_argpar is used.

Definition at line 2540 of file val_extract.c.

◆ val_extract_clear_args()

void val_extract_clear_args ( val_extract_arguments arguments)

Clear an argument struct to make it suitable for using the library without using argpar.

This is sometimes necessary because a freshly malloc'd struct can have valid values for arguments that a user may not want; for example, if start and end coords aren't explicitly unset, omitting them from the arguments won't grab the entire file, as would be expected.

Parameters
[in]argumentsval_extract_argument structure.

Definition at line 127 of file val_extract.c.

◆ val_extract_version()

const char* val_extract_version ( )

Returns a string representation of the library's version number, without a label.

Definition at line 2632 of file val_extract.c.

Variable Documentation

◆ timezone

long timezone

◆ val_extract_argpar

argpar val_extract_argpar = { options, parse_options }

argpar structure used for making programs that inherit options from this library.

Definition at line 523 of file val_extract.c.

nc_box * boxes
Definition: val_extract.h:257
data_t b[NROOTS+1]
Definition: decode_rs.h:77
size_t start[2]
Definition: val_extract.h:238
int box_count
Definition: val_extract.h:256
size_t count[2]
Definition: val_extract.h:238
int i
Definition: decode_rs.h:71
PGE01 indicating that PGE02 PGE01 V6 for and PGE01 V2 for MOD03 were used to produce the granule By convention adopted in all MODIS Terra PGE02 code versions are The fourth digit of the PGE02 version denotes the LUT version used to produce the granule The source of the metadata environment variable ProcessingCenter was changed from a QA LUT value to the Process Configuration A sign used in error in the second order term was changed to a
Definition: HISTORY.txt:424
float p[MODELMAX]
Definition: atrem_corl1.h:131