RAVE
cartesian_odim_io.c File Reference

Cartesian ODIM decorator. More...

#include "cartesian_odim_io.h"
#include "cartesianparam.h"
#include "rave_hlhdf_utilities.h"
#include "rave_debug.h"
#include "rave_alloc.h"
#include "raveobject_hashtable.h"
#include "odim_io_utilities.h"
#include <math.h>
#include <string.h>
#include "projection_pipeline.h"
#include <stdlib.h>

Classes

struct  CartesianOdimArg
 
struct  _CartesianOdimIO_t
 Represents the adaptor. More...
 

Typedefs

typedef struct CartesianOdimArg CartesianOdimArg
 

Functions

int CartesianOdimIOInternal_addLonLatExtentToAttributeList (RaveObjectList_t *attrs, Projection_t *projection, double llX, double llY, double urX, double urY)
 Adds the lon lat corner extent to the attribute list.
 
void CartesianOdimIO_setVersion (CartesianOdimIO_t *self, RaveIO_ODIM_Version version)
 Sets the version that this io class should handle.
 
RaveIO_ODIM_Version CartesianOdimIO_getVersion (CartesianOdimIO_t *self)
 Returns the version that this io class handles.
 
void CartesianOdimIO_setStrict (CartesianOdimIO_t *self, int strict)
 If writing should be done strictly.
 
int CartesianOdimIO_isStrict (CartesianOdimIO_t *self)
 If writing should be done strictly.
 
const char * CartesianOdimIO_getErrorMessage (CartesianOdimIO_t *self)
 If an error occurs during writing, you might get an indication for why by checking the error message.
 
int CartesianOdimIO_readCartesian (CartesianOdimIO_t *self, LazyNodeListReader_t *lazyReader, Cartesian_t *cartesian)
 Reads a cartesian from the nodelist and sets the data in the cartesian.
 
int CartesianOdimIO_readVolume (CartesianOdimIO_t *self, LazyNodeListReader_t *lazyReader, CartesianVolume_t *volume)
 Reads a volume from the nodelist and sets the data in the volume.
 
int CartesianOdimIO_fillImage (CartesianOdimIO_t *self, HL_NodeList *nodelist, Cartesian_t *cartesian)
 Fills a HL nodelist with information from a cartesian product.
 
int CartesianOdimIO_fillVolume (CartesianOdimIO_t *self, HL_NodeList *nodelist, CartesianVolume_t *volume)
 Fills a HL nodelist with information from a cartesian volume.
 
int CartesianOdimIO_isValidImageAddMsg (Cartesian_t *cartesian, char *msg, int maxlen)
 Validates an image in order to verify if it contains necessary information for writing.
 
int CartesianOdimIO_isValidImage (Cartesian_t *cartesian)
 Validates an image in order to verify if it contains necessary information for writing.
 
int CartesianOdimIO_isValidVolumeImageAddMsg (Cartesian_t *cartesian, char *msg, int maxlen)
 Validates an image belonging to a volume in order to verify if it contains necessary information for writing.
 
int CartesianOdimIO_isValidVolumeImage (Cartesian_t *cartesian)
 Validates an image belonging to a volume in order to verify if it contains necessary information for writing.
 
int CartesianOdimIO_isValidVolumeAddMsg (CartesianVolume_t *volume, char *msg, int maxlen)
 Validates an volume in order to verify if it contains necessary information for writing.
 
int CartesianOdimIO_isValidVolume (CartesianVolume_t *volume)
 Validates an volume in order to verify if it contains necessary information for writing.
 
int CartesianOdimIO_validateVolumeHowAttributes (CartesianOdimIO_t *self, CartesianVolume_t *volume)
 Validates a volume according to strictness and version in order to verify if it contains necessary information.
 
int CartesianOdimIO_validateCartesianHowAttributes (CartesianOdimIO_t *self, Cartesian_t *image)
 Validates an image according to strictness and version in order to verify if it contains necessary information.
 

Variables

RaveCoreObjectType CartesianOdimIO_TYPE
 Type definition to use when creating a rave object.
 

Detailed Description

Cartesian ODIM decorator.

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

Function Documentation

◆ CartesianOdimIO_fillImage()

int CartesianOdimIO_fillImage ( CartesianOdimIO_t * self,
HL_NodeList * nodelist,
Cartesian_t * cartesian )

Fills a HL nodelist with information from a cartesian product.

Parameters
[in]self- self
[in]nodelist- the node list
[in]cartesian- the cartesian product
Returns
1 on success, 0 otherwise

◆ CartesianOdimIO_fillVolume()

int CartesianOdimIO_fillVolume ( CartesianOdimIO_t * self,
HL_NodeList * nodelist,
CartesianVolume_t * volume )

Fills a HL nodelist with information from a cartesian volume.

Parameters
[in]self- self
[in]nodelist- the node list
[in]volume- the cartesian volume
Returns
1 on success, 0 otherwise

◆ CartesianOdimIO_getErrorMessage()

const char * CartesianOdimIO_getErrorMessage ( CartesianOdimIO_t * self)

If an error occurs during writing, you might get an indication for why by checking the error message.

Parameters
[in]self- self
Returns
the error message (will be an empty string if nothing to report).

◆ CartesianOdimIO_getVersion()

RaveIO_ODIM_Version CartesianOdimIO_getVersion ( CartesianOdimIO_t * self)

Returns the version that this io class handles.

Parameters
[in]self- self
Returns
- the odim version

◆ CartesianOdimIO_isStrict()

int CartesianOdimIO_isStrict ( CartesianOdimIO_t * self)

If writing should be done strictly.

From ODIM H5 2.4 several how-attributes are mandatory. If any of these are missing and strict is set to true, then the writing will fail.

Parameters
[in]self- self
Returns
if writing should be performed strictly or not

◆ CartesianOdimIO_isValidImage()

int CartesianOdimIO_isValidImage ( Cartesian_t * cartesian)

Validates an image in order to verify if it contains necessary information for writing.

Parameters
[in]self- self
[in]cartesian- the cartesian product to validate
Returns
1 if valid otherwise 0

◆ CartesianOdimIO_isValidImageAddMsg()

int CartesianOdimIO_isValidImageAddMsg ( Cartesian_t * cartesian,
char * msg,
int maxlen )

Validates an image in order to verify if it contains necessary information for writing.

Parameters
[in]self- self
[in]cartesian- the cartesian product to validate
[in]msg- message array to get indication what is wrong
[in]maxlen- max length of message array
Returns
1 if valid otherwise 0

◆ CartesianOdimIO_isValidVolume()

int CartesianOdimIO_isValidVolume ( CartesianVolume_t * volume)

Validates an volume in order to verify if it contains necessary information for writing.

Parameters
[in]self- self
[in]volume- the volume to validate
[in]msg- message array to get indication what is wrong
[in]maxlen- max length of message array
Returns
1 if valid otherwise 0

◆ CartesianOdimIO_isValidVolumeAddMsg()

int CartesianOdimIO_isValidVolumeAddMsg ( CartesianVolume_t * volume,
char * msg,
int maxlen )

Validates an volume in order to verify if it contains necessary information for writing.

Parameters
[in]self- self
[in]volume- the volume to validate
Returns
1 if valid otherwise 0

◆ CartesianOdimIO_isValidVolumeImage()

int CartesianOdimIO_isValidVolumeImage ( Cartesian_t * cartesian)

Validates an image belonging to a volume in order to verify if it contains necessary information for writing.

Parameters
[in]self- self
[in]cartesian- the cartesian product to validate
Returns
1 if valid otherwise 0

◆ CartesianOdimIO_isValidVolumeImageAddMsg()

int CartesianOdimIO_isValidVolumeImageAddMsg ( Cartesian_t * cartesian,
char * msg,
int maxlen )

Validates an image belonging to a volume in order to verify if it contains necessary information for writing.

Parameters
[in]self- self
[in]cartesian- the cartesian product to validate
[in]msg- message array to get indication what is wrong
[in]maxlen- max length of message array
Returns
1 if valid otherwise 0

◆ CartesianOdimIO_readCartesian()

int CartesianOdimIO_readCartesian ( CartesianOdimIO_t * self,
LazyNodeListReader_t * lazyReader,
Cartesian_t * cartesian )

Reads a cartesian from the nodelist and sets the data in the cartesian.

Parameters
[in]self- self
[in]lazyReader- the wrapper around the hdf5 node list
[in]cartesian- the cartesian that should get the attribute and data set
Returns
1 on success otherwise 0

◆ CartesianOdimIO_readVolume()

int CartesianOdimIO_readVolume ( CartesianOdimIO_t * self,
LazyNodeListReader_t * lazyReader,
CartesianVolume_t * volume )

Reads a volume from the nodelist and sets the data in the volume.

Parameters
[in]self- self
[in]lazyReader- the wrapper around the hdf5 node list
[in]volume- the volume that should get the attribute and data set
Returns
1 on success otherwise 0

◆ CartesianOdimIO_setStrict()

void CartesianOdimIO_setStrict ( CartesianOdimIO_t * self,
int strict )

If writing should be done strictly.

From ODIM H5 2.4 several how-attributes are mandatory. If any of these are missing and strict is set to true, then the writing will fail.

Parameters
[in]self- self
[in]strict- if writing should be performed strictly or not

◆ CartesianOdimIO_setVersion()

void CartesianOdimIO_setVersion ( CartesianOdimIO_t * self,
RaveIO_ODIM_Version version )

Sets the version that this io class should handle.

Parameters
[in]self- self
[in]version- the odim version

◆ CartesianOdimIO_validateCartesianHowAttributes()

int CartesianOdimIO_validateCartesianHowAttributes ( CartesianOdimIO_t * self,
Cartesian_t * image )

Validates an image according to strictness and version in order to verify if it contains necessary information.

Parameters
[in]self- self
[in]image- the image to validate
Returns
1 if valid otherwise 0

◆ CartesianOdimIO_validateVolumeHowAttributes()

int CartesianOdimIO_validateVolumeHowAttributes ( CartesianOdimIO_t * self,
CartesianVolume_t * volume )

Validates a volume according to strictness and version in order to verify if it contains necessary information.

Parameters
[in]self- self
[in]volume- the volume to validate
Returns
1 if valid otherwise 0

◆ CartesianOdimIOInternal_addLonLatExtentToAttributeList()

int CartesianOdimIOInternal_addLonLatExtentToAttributeList ( RaveObjectList_t * attrs,
Projection_t * projection,
double llX,
double llY,
double urX,
double urY )

Adds the lon lat corner extent to the attribute list.

If llX, llY, urX and urY are all 0.0, then nothing will be added to the attribute list.

Parameters
[in]list- the list to add the attributes to
[in]projection- the projection to use for converting to corner coordinates
[in]llX- the lower left X coordinate
[in]llY- the lower left Y coordinate
[in]urX- the upper right X coordinate
[in]urY- the upper right Y coordinate
Returns
1 on success otherwise 0

Variable Documentation

◆ CartesianOdimIO_TYPE

RaveCoreObjectType CartesianOdimIO_TYPE
Initial value:
= {
"CartesianOdimIO",
CartesianOdimIO_constructor,
CartesianOdimIO_destructor,
CartesianOdimIO_copyconstructor
}
struct _CartesianOdimIO_t CartesianOdimIO_t
Defines the odim h5 adaptor for cartesian products.
Definition cartesian_odim_io.h:37

Type definition to use when creating a rave object.