OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
dfutils.h File Reference
#include <hdf4utils.h>
Include dependency graph for dfutils.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  idDS
 

Enumerations

enum  ds_format_t { DS_HDF, DS_NCDF }
 
enum  ds_access_t { DS_READ, DS_WRITE }
 

Functions

int s2u (const char *in, char *out)
 
int getProdlist (const char *fname, char **prodlist, int32_t *l2_flags_type)
 
idDS startDS (const char *filename, ds_format_t format, ds_access_t accessmode, int32_t deflate)
 
idDS openDS (const char *filename)
 
int endDS (idDS ds_id)
 
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 *pinfo, int32_t dm[3], const char dm_name[3][80])
 
int32_t selectDS (idDS ds_id, const char *l2_prod_names)
 
int32_t checkDS (idDS ds_id, const char *l2_prod_name)
 
int readDS (idDS ds_id, const char *name, int32_t *start, int32_t *stride, int32_t *count, void *data)
 
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 endaccessDS (idDS ds_id)
 
int fileInfo (idDS ds_id, int32_t *n_datasets, int32_t *n_globalattr)
 
int getDimsDS (idDS ds_id, const char sdsname[], int32_t dims[])
 
int getTypeDS (idDS ds_id, const char sdsname[HDF4_UTILS_MAX_NAME], int32_t *dtype)
 
int setAttr (idDS ds_id, const char *nam, int32_t typ, int32_t cnt, const void *data)
 
int8_t findAttr (idDS ds_id, const char *nam)
 
int readAttr (idDS ds_id, const char *nam, void *data)
 
char * readAttrStr (idDS ds_id, const char *name)
 
int infoAttr (idDS ds_id, const char *nam, int32_t *dtype, int32_t *count)
 
int SetChrGA (idDS ds_id, const char *name, const char *value)
 
int SetF32GA (idDS ds_id, const char *name, float value)
 
int SetF64GA (idDS ds_id, const char *name, double value)
 
int SetI8GA (idDS ds_id, const char *name, uint8_t value)
 
int SetI16GA (idDS ds_id, const char *name, int16_t value)
 
int SetI32GA (idDS ds_id, const char *name, int32_t value)
 
int16_t getDataTypeInt (productInfo_t *p_info)
 
int16_t * float2int16 (float fbuf[], int32_t spix, int32_t npix, int32_t incr, float slope, float offset)
 
int8_t * float2int8 (float fbuf[], int32_t spix, int32_t npix, int32_t incr, float slope, float offset)
 
uint16_t * float2uint16 (float fbuf[], int32_t spix, int32_t npix, int32_t incr, float slope, float offset)
 
uint8_t * float2uint8 (float fbuf[], int32_t spix, int32_t npix, int32_t incr, float slope, float offset)
 
void * scale_sds (float *data, productInfo_t *p, int32_t npix)
 
float * unscale_sds (void *data, productInfo_t *p, int32_t spix, int32_t npix, int incr)
 
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])
 
void nc_init_compress (int32_t nc_id, int32_t var_id, int32_t *dimids, int32_t rank, size_t *chunksize, int deflate_level)
 

Enumeration Type Documentation

◆ ds_access_t

Enumerator
DS_READ 
DS_WRITE 

Definition at line 23 of file dfutils.h.

◆ ds_format_t

Enumerator
DS_HDF 
DS_NCDF 

Definition at line 18 of file dfutils.h.

Function Documentation

◆ checkDS()

int32_t 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

Parameters
ds_idDS structure for netCDF/HDF file
snameshort name
pinfoproductInfo structure defining the product
dmdimension sizes
dm_namedimension names

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.

◆ float2int16()

int16_t* float2int16 ( float  fbuf[],
int32_t  spix,
int32_t  npix,
int32_t  incr,
float  slope,
float  offset 
)

◆ float2int8()

int8_t* float2int8 ( float  fbuf[],
int32_t  spix,
int32_t  npix,
int32_t  incr,
float  slope,
float  offset 
)

◆ float2uint16()

uint16_t* float2uint16 ( float  fbuf[],
int32_t  spix,
int32_t  npix,
int32_t  incr,
float  slope,
float  offset 
)

◆ float2uint8()

uint8_t* float2uint8 ( float  fbuf[],
int32_t  spix,
int32_t  npix,
int32_t  incr,
float  slope,
float  offset 
)

◆ getDataTypeInt()

int16_t getDataTypeInt ( productInfo_t *  p_info)

getDataTypeInt - returns the HDF definitions for the productInfo dataype

Parameters
p_info
Returns

Definition at line 16 of file scale_sds.c.

◆ getDimsDS()

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

◆ 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[HDF4_UTILS_MAX_NAME],
int32_t *  dtype 
)

◆ 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.

◆ nc_init_compress()

void nc_init_compress ( int32_t  nc_id,
int32_t  var_id,
int32_t *  dimids,
int32_t  rank,
size_t *  chunksize,
int  deflate_level 
)

nc_init_compress

R. Healy 9/26/2016

Parameters
[in]

Definition at line 24 of file nc_init_compress.c.

◆ openDS()

idDS openDS ( const char *  filename)

Definition at line 616 of file wrapper.c.

◆ readAttr()

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

◆ 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,
void *  data 
)

◆ s2u()

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

Definition at line 36 of file wrapper.c.

◆ scale_sds()

void* scale_sds ( float *  data,
productInfo_t *  p,
int32_t  npix 
)

◆ selectDS()

int32_t selectDS ( idDS  ds_id,
const char *  l2_prod_names 
)

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,
float  value 
)

◆ SetF64GA()

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

◆ SetI16GA()

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

◆ 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_t  value 
)

◆ 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.

◆ unscale_sds()

float* unscale_sds ( void *  data,
productInfo_t *  p,
int32_t  spix,
int32_t  npix,
int  incr 
)

Definition at line 245 of file scale_sds.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.