RAVE
rave_hlhdf_utilities.h
Go to the documentation of this file.
1/* --------------------------------------------------------------------
2Copyright (C) 2009 Swedish Meteorological and Hydrological Institute, SMHI,
3
4This file is part of RAVE.
5
6RAVE is free software: you can redistribute it and/or modify
7it under the terms of the GNU Lesser General Public License as published by
8the Free Software Foundation, either version 3 of the License, or
9(at your option) any later version.
10
11RAVE is distributed in the hope that it will be useful,
12but WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14GNU Lesser General Public License for more details.
15
16You should have received a copy of the GNU Lesser General Public License
17along with RAVE. If not, see <http://www.gnu.org/licenses/>.
18------------------------------------------------------------------------*/
25#ifndef RAVE_HLHDF_UTILITIES_H
26#define RAVE_HLHDF_UTILITIES_H
27#include "hlhdf.h"
28#include "rave_utilities.h"
29#include "rave_types.h"
30#include "rave_value.h"
31#include <stdarg.h>
32
36#define RAVE_ODIM_VERSION_2_0_STR "ODIM_H5/V2_0"
37
41#define RAVE_ODIM_VERSION_2_1_STR "ODIM_H5/V2_1"
42
46#define RAVE_ODIM_VERSION_2_2_STR "ODIM_H5/V2_2"
47
51#define RAVE_ODIM_VERSION_2_3_STR "ODIM_H5/V2_3"
52
56#define RAVE_ODIM_VERSION_2_4_STR "ODIM_H5/V2_4"
57
61#define RAVE_ODIM_H5RAD_VERSION_2_0_STR "H5rad 2.0"
62
66#define RAVE_ODIM_H5RAD_VERSION_2_1_STR "H5rad 2.1"
67
71#define RAVE_ODIM_H5RAD_VERSION_2_2_STR "H5rad 2.2"
72
76#define RAVE_ODIM_H5RAD_VERSION_2_3_STR "H5rad 2.3"
77
81#define RAVE_ODIM_H5RAD_VERSION_2_4_STR "H5rad 2.4"
82
89typedef int (*RaveHL_attr_f)(void* object, RaveAttribute_t* attr);
90
101typedef int (*RaveHL_data_f)(void* object, hsize_t xsize, hsize_t ysize, void* data, RaveDataType dtype, const char* nodeName);
102
110typedef int (*RaveHL_group_f)(void* object, const char* groupname, const char* name);
111
117const char* RaveHL_convertAttributeName(const char* name);
118
124const char* RaveHL_convertQuantity(const char* name);
125
132
139
147
157
165RaveAttribute_t* RaveHL_getAttribute(HL_NodeList* nodelist, const char* fmt, ...);
166
175int RaveHL_hasNodeByName(HL_NodeList* nodelist, const char* fmt, ...);
176
187int RaveHL_getStringValue(HL_NodeList* nodelist, char** value, const char* fmt, ...);
188
195int RaveHL_createGroup(HL_NodeList* nodelist, const char* fmt, ...);
196
203int RaveHL_createGroupUnlessExists(HL_NodeList* nodelist, const char* fmt, ...);
204
205
213int RaveHL_createStringValue(HL_NodeList* nodelist, const char* value, const char* fmt, ...);
214
223int RaveHL_addRaveValue(HL_NodeList* nodelist, RaveValue_t* value, const char* fmt, ...);
224
233int RaveHL_addAttribute(HL_NodeList* nodelist, RaveAttribute_t* attribute, const char* fmt, ...);
234
240RaveList_t* RaveHL_extractSubGroups(const char* attrname);
241
252int RaveHL_addAttributes(HL_NodeList* nodelist, RaveObjectList_t* attributes, const char* name);
253
265int RaveHL_createDataset(HL_NodeList* nodelist, void* data, long xsize, long ysize, RaveDataType dataType, const char* fmt, ...);
266
282 HL_NodeList* nodelist,
283 void* data,
284 long xsize,
285 long ysize,
286 RaveDataType dataType,
287 const char* fmt, ...);
288
289
295HL_FormatSpecifier RaveHL_raveToHlhdfType(RaveDataType format);
296
302RaveDataType RaveHL_hlhdfToRaveType(HL_FormatSpecifier format);
303
315int RaveHL_loadAttributesAndData(HL_NodeList* nodelist, void* object, RaveHL_attr_f attrf, RaveHL_data_f dataf, const char* fmt, ...);
316
317#endif /* RAVE_HLHDF_UTILITIES_H */
struct _RaveAttribute_t RaveAttribute_t
Defines a rave attribute.
Definition rave_attribute.h:47
RaveAttribute_t * RaveHL_createAttribute(HL_Node *node)
Creates a rave attribute from a HLHDF node value.
Definition rave_hlhdf_utilities.c:260
RaveDataType RaveHL_hlhdfToRaveType(HL_FormatSpecifier format)
Translates a hlhdf format specified into a rave data type.
Definition rave_hlhdf_utilities.c:1045
int RaveHL_addAttribute(HL_NodeList *nodelist, RaveAttribute_t *attribute, const char *fmt,...)
Puts an attribute in the nodelist as a hlhdf node.
Definition rave_hlhdf_utilities.c:578
int RaveHL_getStringValue(HL_NodeList *nodelist, char **value, const char *fmt,...)
Gets a string value from a nodelist that is represented by a node named according to the varargs form...
Definition rave_hlhdf_utilities.c:419
int RaveHL_createDataset(HL_NodeList *nodelist, void *data, long xsize, long ysize, RaveDataType dataType, const char *fmt,...)
Creates a dataset with the provided 2-dimensional array.
Definition rave_hlhdf_utilities.c:933
const char * RaveHL_getOdimVersionString(RaveIO_ODIM_Version version)
Returns the string representation of the specified odim version.
Definition rave_hlhdf_utilities.c:209
RaveAttribute_t * RaveHL_getAttribute(HL_NodeList *nodelist, const char *fmt,...)
Tries to find the node as defined by the varargs string and then create a rave attribute from it.
Definition rave_hlhdf_utilities.c:365
const char * RaveHL_getH5RadVersionStringFromOdimVersion(RaveIO_ODIM_Version version)
Returns the h5rad string representation of the specified odim version since we can assume that the h5...
Definition rave_hlhdf_utilities.c:225
int RaveHL_createGroupUnlessExists(HL_NodeList *nodelist, const char *fmt,...)
Creates a group node in the node list unless it already exists.
Definition rave_hlhdf_utilities.c:492
int RaveHL_addAttributes(HL_NodeList *nodelist, RaveObjectList_t *attributes, const char *name)
Stores the attributes from the object into the nodelist name/how/..., name/where/....
Definition rave_hlhdf_utilities.c:843
int RaveHL_addRaveValue(HL_NodeList *nodelist, RaveValue_t *value, const char *fmt,...)
Adds a rave value in the nodelist as a hlhdf node.
Definition rave_hlhdf_utilities.c:681
int RaveHL_createStringValue(HL_NodeList *nodelist, const char *value, const char *fmt,...)
Adds a string value to a nodelist.
Definition rave_hlhdf_utilities.c:527
int RaveHL_addData(HL_NodeList *nodelist, void *data, long xsize, long ysize, RaveDataType dataType, const char *fmt,...)
Adds a data field to the node list according to ODIM H5.
Definition rave_hlhdf_utilities.c:976
RaveIO_ODIM_Version RaveHL_getOdimVersionFromString(const char *str)
Returns the odim version for the string representation of the ODIM version.
Definition rave_hlhdf_utilities.c:240
int RaveHL_hasNodeByName(HL_NodeList *nodelist, const char *fmt,...)
Verifies if the file contains a node with the name as specified by the variable argument list.
Definition rave_hlhdf_utilities.c:403
const char * RaveHL_convertQuantity(const char *name)
Translates a quantity from 2.0/2.1 ODIM into 2.2 ODIM.
Definition rave_hlhdf_utilities.c:193
RaveList_t * RaveHL_extractSubGroups(const char *attrname)
Extract all subgroups for an attribute name.
Definition rave_hlhdf_utilities.c:815
HL_FormatSpecifier RaveHL_raveToHlhdfType(RaveDataType format)
Translates a rave data type into a hlhdf format specifier.
Definition rave_hlhdf_utilities.c:1031
int RaveHL_createGroup(HL_NodeList *nodelist, const char *fmt,...)
Creates a group node in the node list.
Definition rave_hlhdf_utilities.c:461
int(* RaveHL_attr_f)(void *object, RaveAttribute_t *attr)
Attribute function called when an attribute is found.
Definition rave_hlhdf_utilities.h:89
int RaveHL_loadAttributesAndData(HL_NodeList *nodelist, void *object, RaveHL_attr_f attrf, RaveHL_data_f dataf, const char *fmt,...)
Loads the attributes from the nodelist name and calls the attrf and dataf respectively depending on w...
Definition rave_hlhdf_utilities.c:1068
const char * RaveHL_convertAttributeName(const char *name)
Translates an attribute name from 2.0/2.1 ODIM into 2.2 ODIM.
Definition rave_hlhdf_utilities.c:180
int(* RaveHL_group_f)(void *object, const char *groupname, const char *name)
Group function called when a group is found.
Definition rave_hlhdf_utilities.h:110
int(* RaveHL_data_f)(void *object, hsize_t xsize, hsize_t ysize, void *data, RaveDataType dtype, const char *nodeName)
Data function called when an dataset is found.
Definition rave_hlhdf_utilities.h:101
struct _RaveList_t RaveList_t
Defines a list.
Definition rave_list.h:33
Type definitions for RAVE.
RaveIO_ODIM_Version
The /Conventions version in a ODIM HDF5 file.
Definition rave_types.h:43
RaveDataType
Different data types that are supported during transformation.
Definition rave_types.h:130
Contains various utility functions that makes life easier when working with the rave framework.
A value object that can represent standard types like int, double, .
struct _RaveValue_t RaveValue_t
Defines a rave value.
Definition rave_value.h:47
struct _RaveObjectList_t RaveObjectList_t
Defines a list.
Definition raveobject_list.h:38