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 <stdarg.h>
31
35#define RAVE_ODIM_VERSION_2_0_STR "ODIM_H5/V2_0"
36
40#define RAVE_ODIM_VERSION_2_1_STR "ODIM_H5/V2_1"
41
45#define RAVE_ODIM_VERSION_2_2_STR "ODIM_H5/V2_2"
46
50#define RAVE_ODIM_VERSION_2_3_STR "ODIM_H5/V2_3"
51
55#define RAVE_ODIM_VERSION_2_4_STR "ODIM_H5/V2_4"
56
60#define RAVE_ODIM_H5RAD_VERSION_2_0_STR "H5rad 2.0"
61
65#define RAVE_ODIM_H5RAD_VERSION_2_1_STR "H5rad 2.1"
66
70#define RAVE_ODIM_H5RAD_VERSION_2_2_STR "H5rad 2.2"
71
75#define RAVE_ODIM_H5RAD_VERSION_2_3_STR "H5rad 2.3"
76
80#define RAVE_ODIM_H5RAD_VERSION_2_4_STR "H5rad 2.4"
81
88typedef int (*RaveHL_attr_f)(void* object, RaveAttribute_t* attr);
89
100typedef int (*RaveHL_data_f)(void* object, hsize_t xsize, hsize_t ysize, void* data, RaveDataType dtype, const char* nodeName);
101
109typedef int (*RaveHL_group_f)(void* object, const char* groupname, const char* name);
110
116const char* RaveHL_convertAttributeName(const char* name);
117
123const char* RaveHL_convertQuantity(const char* name);
124
131
138
146
156
164RaveAttribute_t* RaveHL_getAttribute(HL_NodeList* nodelist, const char* fmt, ...);
165
174int RaveHL_hasNodeByName(HL_NodeList* nodelist, const char* fmt, ...);
175
186int RaveHL_getStringValue(HL_NodeList* nodelist, char** value, const char* fmt, ...);
187
194int RaveHL_createGroup(HL_NodeList* nodelist, const char* fmt, ...);
195
202int RaveHL_createGroupUnlessExists(HL_NodeList* nodelist, const char* fmt, ...);
203
204
212int RaveHL_createStringValue(HL_NodeList* nodelist, const char* value, const char* fmt, ...);
213
222int RaveHL_addAttribute(HL_NodeList* nodelist, RaveAttribute_t* attribute, const char* fmt, ...);
223
234int RaveHL_addAttributes(HL_NodeList* nodelist, RaveObjectList_t* attributes, const char* name);
235
247int RaveHL_createDataset(HL_NodeList* nodelist, void* data, long xsize, long ysize, RaveDataType dataType, const char* fmt, ...);
248
264 HL_NodeList* nodelist,
265 void* data,
266 long xsize,
267 long ysize,
268 RaveDataType dataType,
269 const char* fmt, ...);
270
271
277HL_FormatSpecifier RaveHL_raveToHlhdfType(RaveDataType format);
278
284RaveDataType RaveHL_hlhdfToRaveType(HL_FormatSpecifier format);
285
297int RaveHL_loadAttributesAndData(HL_NodeList* nodelist, void* object, RaveHL_attr_f attrf, RaveHL_data_f dataf, const char* fmt, ...);
298
299#endif /* RAVE_HLHDF_UTILITIES_H */
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:903
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:791
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:701
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:834
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
HL_FormatSpecifier RaveHL_raveToHlhdfType(RaveDataType format)
Translates a rave data type into a hlhdf format specifier.
Definition rave_hlhdf_utilities.c:889
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:88
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:926
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:109
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:100
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.
Represents one scan in a volume.
Definition rave_attribute.c:45
Represents a list.
Definition raveobject_list.c:35