RAVE
odim_io_utilities.h File Reference

Utilities when working with ODIM H5 files. More...

#include <lazy_nodelist_reader.h>
#include "rave_field.h"
#include "rave_object.h"
#include "rave_types.h"
#include "raveobject_list.h"
#include "raveobject_hashtable.h"
#include "hlhdf.h"
#include <stdarg.h>
#include "rave_legend.h"

Go to the source code of this file.

Classes

struct  OdimIoUtilityArg
 Struct that can be used when passing around objects and associated nodelist between the writing and loading functions. More...
 

Typedefs

typedef struct OdimIoUtilityArg OdimIoUtilityArg
 Struct that can be used when passing around objects and associated nodelist between the writing and loading functions.
 

Functions

int OdimIoUtilities_convertGainOffsetFromInternalRave (const char *quantity, RaveIO_ODIM_Version version, double *gain, double *offset)
 Converts the gain and offset so that quantity is adjusted for ODIM version to be written.
 
int OdimIoUtilities_convertGainOffsetToInternalRave (const char *quantity, RaveIO_ODIM_Version version, double *gain, double *offset)
 Converts the gain and offset so that quantity is adjusted for the internally used quantity.
 
int OdimIoUtilities_addRaveField (RaveField_t *field, HL_NodeList *nodelist, RaveIO_ODIM_Version outversion, const char *fmt,...)
 Adds a rave field to a nodelist.
 
int OdimIoUtilities_addQualityFields (RaveObjectList_t *fields, HL_NodeList *nodelist, RaveIO_ODIM_Version outversion, const char *fmt,...)
 Adds a list of quality fields (RaveField_t) to a nodelist.
 
RaveField_tOdimIoUtilities_loadField (LazyNodeListReader_t *lazyReader, RaveIO_ODIM_Version version, const char *fmt,...)
 Loads a rave field.
 
RaveLegend_tOdimIOUtilities_loadLegend (LazyNodeListReader_t *lazyReader, RaveIO_ODIM_Version version, const char *fmt,...)
 Loads a rave legend.
 
int OdimIoUtilities_getIdFromSource (const char *source, const char *id, char *buf, size_t buflen)
 Gets the specified id from the source string, for example.
 
int OdimIoUtilities_getNodOrCmtFromSource (const char *source, char *buf, size_t buflen)
 Like OdimIoUtilities_getIdFromSource but will first check NOD: and then CMT:
 
int OdimIoUtilities_createLegend (RaveLegend_t *legend, HL_NodeList *nodelist, RaveIO_ODIM_Version version, const char *fmt,...)
 Adds a legend (RaveLegend_t) to a nodelist.
 

Detailed Description

Utilities when working with ODIM H5 files.

Author
Anders Henja (Swedish Meteorological and Hydrological Institute, SMHI)
Date
2011-09-30

Typedef Documentation

◆ OdimIoUtilityArg

typedef struct OdimIoUtilityArg OdimIoUtilityArg

Struct that can be used when passing around objects and associated nodelist between the writing and loading functions.

Function Documentation

◆ OdimIoUtilities_addQualityFields()

int OdimIoUtilities_addQualityFields ( RaveObjectList_t * fields,
HL_NodeList * nodelist,
RaveIO_ODIM_Version version,
const char * fmt,
... )

Adds a list of quality fields (RaveField_t) to a nodelist.

Parameters
[in]fields- the list of fields
[in]nodelist- the hlhdf node list
[in]outversion- the version of file to be written
[in]fmt- the varargs format string
[in]...- the varargs
Returns
1 on success otherwise 0
Parameters
[in]fields- the list of fields
[in]nodelist- the hlhdf node list
[in]fmt- the varargs format string
[in]...- the varargs
Returns
1 on success otherwise 0

◆ OdimIoUtilities_addRaveField()

int OdimIoUtilities_addRaveField ( RaveField_t * field,
HL_NodeList * nodelist,
RaveIO_ODIM_Version outversion,
const char * fmt,
... )

Adds a rave field to a nodelist.

Parameters
[in]field- the field
[in]nodelist- the hlhdf node list
[in]outversion- the version of file to be written
[in]fmt- the varargs format string
[in]...- the varargs
Returns
1 on success otherwise 0

◆ OdimIoUtilities_convertGainOffsetFromInternalRave()

int OdimIoUtilities_convertGainOffsetFromInternalRave ( const char * quantity,
RaveIO_ODIM_Version version,
double * gain,
double * offset )

Converts the gain and offset so that quantity is adjusted for ODIM version to be written.

Parameters
[in]quantity- the quantity that is affected
[in]version- ODIM version that should be written
[in,out]gain- the gain. Will be adjusted according to needs
[in,out]offset- the offset. Will be adjusted according to needs
Returns
1 on success

◆ OdimIoUtilities_convertGainOffsetToInternalRave()

int OdimIoUtilities_convertGainOffsetToInternalRave ( const char * quantity,
RaveIO_ODIM_Version version,
double * gain,
double * offset )

Converts the gain and offset so that quantity is adjusted for the internally used quantity.

Parameters
[in]quantity- the quantity that is affected
[in]version- ODIM version that should be written
[in,out]gain- the gain. Will be adjusted according to needs
[in,out]offset- the offset. Will be adjusted according to needs
Returns
1 on success

◆ OdimIoUtilities_createLegend()

int OdimIoUtilities_createLegend ( RaveLegend_t * legend,
HL_NodeList * nodelist,
RaveIO_ODIM_Version version,
const char * fmt,
... )

Adds a legend (RaveLegend_t) to a nodelist.

Parameters
[in]legend- the legend
[in]nodelist- the hlhdf node list
[in]outversion- the version of file to be written
[in]fmt- the varargs format string
[in]...- the varargs
Returns
1 on success otherwise 0

◆ OdimIoUtilities_getIdFromSource()

int OdimIoUtilities_getIdFromSource ( const char * source,
const char * id,
char * buf,
size_t buflen )

Gets the specified id from the source string, for example.

If source string contains CMT:abc,NOD:selek,RAD:se50 then if id = NOD: buf will be filled with selek

Parameters
[in]source- the what/source string
[in]id- the id to search for ended with a :, for example NOD:
[in,out]buf- the buffer filled with the found id
[in]buflen- the length of buf
Returns
1 if id was found and did fit into buf, otherwise 0

◆ OdimIoUtilities_getNodOrCmtFromSource()

int OdimIoUtilities_getNodOrCmtFromSource ( const char * source,
char * buf,
size_t buflen )

Like OdimIoUtilities_getIdFromSource but will first check NOD: and then CMT:

Parameters
[in]source- the what/source string
[in]id- the id to search for ended with a :, for example NOD:
[in,out]buf- the buffer filled with the found id
[in]buflen- the length of buf
Returns
1 if id was found and did fit into buf, otherwise 0

◆ OdimIoUtilities_loadField()

RaveField_t * OdimIoUtilities_loadField ( LazyNodeListReader_t * lazyReader,
RaveIO_ODIM_Version version,
const char * fmt,
... )

Loads a rave field.

A rave field can be just about anything with a mapping between attributes and a dataset.

Parameters
[in]lazyReader- the wrapper around the hlhdf node list
[in]version- version of the file read
[in]fmt- the variable argument list string format
[in]...- the variable argument list
Returns
a rave field on success otherwise NULL

A rave field can be just about anything with a mapping between attributes and a dataset.

Parameters
[in]nodelist- the hlhdf node list
[in]nodelist- version of the file read
[in]fmt- the variable argument list string format
[in]...- the variable argument list
Returns
a rave field on success otherwise NULL

◆ OdimIOUtilities_loadLegend()

RaveLegend_t * OdimIOUtilities_loadLegend ( LazyNodeListReader_t * lazyReader,
RaveIO_ODIM_Version version,
const char * fmt,
... )

Loads a rave legend.

The compound type should have been written in a dataset according to the specification.

Parameters
[in]lazyReader- the wrapper around the hlhdf node list
[in]version- version of the file read
[in]fmt- the variable argument list string format
[in]...- the variable argument list
Returns
a rave legend on success otherwise NULL