OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
wrapper.c File Reference
#include <netcdf.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <time.h>
#include <math.h>
#include <productInfo.h>
#include <dfutils.h>
#include <genutils.h>
#include <hdf.h>
#include <mfhdf.h>
Include dependency graph for wrapper.c:

Go to the source code of this file.

Macros

#define NEW_CACHE_SIZE   16000000
 
#define NEW_CACHE_NELEMS   2003
 
#define NEW_CACHE_PREEMPTION   .75
 
#define ROUND(x)   ((((x) >= 0)?0.5:-0.5) + (x))
 

Functions

int s2u (const char *in, char *out)
 
int8_t findAttr (idDS ds_id, const char *nam)
 
int readAttr (idDS ds_id, const char *nam, VOIDP data)
 
char * readAttrStr (idDS ds_id, const char *name)
 
int infoAttr (idDS ds_id, const char *nam, int32_t *dtype, int32_t *count)
 
int setAttr (idDS ds_id, const char *nam, int32_t typ, int32_t cnt, const void *data)
 
int SetChrGA (idDS ds_id, const char *name, const char *value)
 
int SetF64GA (idDS ds_id, const char *name, float64 value)
 
int SetF32GA (idDS ds_id, const char *name, float32 value)
 
int SetI16GA (idDS ds_id, const char *name, int16 value)
 
int SetI8GA (idDS ds_id, const char *name, uint8 value)
 
int SetI32GA (idDS ds_id, const char *name, int32_t value)
 
int createDS (idDS ds_id, int sensorId, const char *sname, int32_t dm[3], const char dm_name[3][80])
 
int createDS2 (idDS ds_id, const char *sname, productInfo_t *p_info, int32_t dm[3], const char dm_name[3][80])
 
int32_t selectDS (idDS ds_id, const char *l2_prod_name)
 
int32 checkDS (idDS ds_id, const char *l2_prod_name)
 
int writeDS (idDS ds_id, const char *name, const void *data, int32_t s0, int32_t s1, int32_t s2, int32_t e0, int32_t e1, int32_t e2)
 
int readDS (idDS ds_id, const char *name, int32_t *start, int32_t *stride, int32_t *count, VOIDP data)
 
idDS startDS (const char *filename, ds_format_t format, ds_access_t access, int32_t deflate)
 
idDS openDS (const char *filename)
 
int endaccessDS (idDS ds_id)
 
int endDS (idDS ds_id)
 
int getDimsDS (idDS ds_id, const char sdsname[H4_MAX_NC_NAME], int32_t dims[H4_MAX_VAR_DIMS])
 
int getTypeDS (idDS ds_id, const char sdsname[H4_MAX_NC_NAME], int32_t *dtype)
 
int fileInfo (idDS ds_id, int32_t *n_datasets, int32_t *n_globalattr)
 
int getProdlist (const char *fname, char **prodlist, int32_t *l2_flags_type)
 
int CreateNCDF (idDS ds_id, const char *sname, const char *lname, const char *standard_name, const char *reference, const char *comment, const char *units, double low, double high, float scale_factor, float add_offset, int32_t fillValue, int32_t nt, int32_t rank, int32_t dimids[3])
 

Macro Definition Documentation

◆ NEW_CACHE_NELEMS

#define NEW_CACHE_NELEMS   2003

Definition at line 31 of file wrapper.c.

◆ NEW_CACHE_PREEMPTION

#define NEW_CACHE_PREEMPTION   .75

Definition at line 32 of file wrapper.c.

◆ NEW_CACHE_SIZE

#define NEW_CACHE_SIZE   16000000

Definition at line 30 of file wrapper.c.

◆ ROUND

#define ROUND (   x)    ((((x) >= 0)?0.5:-0.5) + (x))

Definition at line 34 of file wrapper.c.

Function Documentation

◆ checkDS()

int32 checkDS ( idDS  ds_id,
const char *  l2_prod_name 
)

Definition at line 455 of file wrapper.c.

◆ createDS()

int createDS ( idDS  ds_id,
int  sensorId,
const char *  sname,
int32_t  dm[3],
const char  dm_name[3][80] 
)

Definition at line 344 of file wrapper.c.

◆ createDS2()

int createDS2 ( idDS  ds_id,
const char *  sname,
productInfo_t *  pinfo,
int32_t  dm[3],
const char  dm_name[3][80] 
)

create dataset using the productInfo structure

Definition at line 360 of file wrapper.c.

◆ CreateNCDF()

int CreateNCDF ( idDS  ds_id,
const char *  sname,
const char *  lname,
const char *  standard_name,
const char *  reference,
const char *  comment,
const char *  units,
double  low,
double  high,
float  scale_factor,
float  add_offset,
int32_t  fillValue,
int32_t  nt,
int32_t  rank,
int32_t  dimids[3] 
)

Definition at line 848 of file wrapper.c.

◆ endaccessDS()

int endaccessDS ( idDS  ds_id)

Definition at line 627 of file wrapper.c.

◆ endDS()

int endDS ( idDS  ds_id)

Definition at line 634 of file wrapper.c.

◆ fileInfo()

int fileInfo ( idDS  ds_id,
int32_t *  n_datasets,
int32_t *  n_globalattr 
)

Definition at line 705 of file wrapper.c.

◆ findAttr()

int8_t findAttr ( idDS  ds_id,
const char *  nam 
)

Definition at line 49 of file wrapper.c.

◆ getDimsDS()

int getDimsDS ( idDS  ds_id,
const char  sdsname[H4_MAX_NC_NAME],
int32_t  dims[H4_MAX_VAR_DIMS] 
)

Definition at line 646 of file wrapper.c.

◆ getProdlist()

int getProdlist ( const char *  fname,
char **  prodlist,
int32_t *  l2_flags_type 
)

Definition at line 721 of file wrapper.c.

◆ getTypeDS()

int getTypeDS ( idDS  ds_id,
const char  sdsname[H4_MAX_NC_NAME],
int32_t *  dtype 
)

Definition at line 681 of file wrapper.c.

◆ infoAttr()

int infoAttr ( idDS  ds_id,
const char *  nam,
int32_t *  dtype,
int32_t *  count 
)

get information about an attribute.

Parameters
ds_iddata set structure
namname of the attribute to query
dtypedatatype of the attribute
countnumber of items in the array
Returns
status of 0 if success

Definition at line 191 of file wrapper.c.

◆ openDS()

idDS openDS ( const char *  filename)

Definition at line 616 of file wrapper.c.

◆ readAttr()

int readAttr ( idDS  ds_id,
const char *  nam,
VOIDP  data 
)

Definition at line 75 of file wrapper.c.

◆ readAttrStr()

char* readAttrStr ( idDS  ds_id,
const char *  name 
)

Read a string attribute. Allocating memory for the value which must be freed.

Parameters
ds_iddata set ID for the file or data set
namename of the attribute
Returns
pointer to value string or NULL if not found

Definition at line 102 of file wrapper.c.

◆ readDS()

int readDS ( idDS  ds_id,
const char *  name,
int32_t *  start,
int32_t *  stride,
int32_t *  count,
VOIDP  data 
)

Definition at line 514 of file wrapper.c.

◆ s2u()

int s2u ( const char *  in,
char *  out 
)

Definition at line 36 of file wrapper.c.

◆ selectDS()

int32_t selectDS ( idDS  ds_id,
const char *  l2_prod_name 
)

Definition at line 438 of file wrapper.c.

◆ setAttr()

int setAttr ( idDS  ds_id,
const char *  nam,
int32_t  typ,
int32_t  cnt,
const void *  data 
)

Definition at line 219 of file wrapper.c.

◆ SetChrGA()

int SetChrGA ( idDS  ds_id,
const char *  name,
const char *  value 
)

Definition at line 236 of file wrapper.c.

◆ SetF32GA()

int SetF32GA ( idDS  ds_id,
const char *  name,
float32  value 
)

Definition at line 272 of file wrapper.c.

◆ SetF64GA()

int SetF64GA ( idDS  ds_id,
const char *  name,
float64  value 
)

Definition at line 254 of file wrapper.c.

◆ SetI16GA()

int SetI16GA ( idDS  ds_id,
const char *  name,
int16  value 
)

Definition at line 290 of file wrapper.c.

◆ SetI32GA()

int SetI32GA ( idDS  ds_id,
const char *  name,
int32_t  value 
)

Definition at line 326 of file wrapper.c.

◆ SetI8GA()

int SetI8GA ( idDS  ds_id,
const char *  name,
uint8  value 
)

Definition at line 308 of file wrapper.c.

◆ startDS()

idDS startDS ( const char *  filename,
ds_format_t  format,
ds_access_t  access,
int32_t  deflate 
)

Open a data file. Must close the file using endDS()

Parameters
filenamepath to file
formatDS_HDF for HDF4 file, DS_NCDF for netCDF4 file
accessDS_READ for reading, DS_WRITE for writing
deflatecompression factor, 0 is no compression
Returns
data set structure, ds_id.fid = -1 if there was a problem.

Definition at line 561 of file wrapper.c.

◆ writeDS()

int writeDS ( idDS  ds_id,
const char *  name,
const void *  data,
int32_t  s0,
int32_t  s1,
int32_t  s2,
int32_t  e0,
int32_t  e1,
int32_t  e2 
)

Definition at line 475 of file wrapper.c.