RAVE
rave_data2d.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------------------------------------------------------------------------*/
26#ifndef RAVE_DATA2D_H
27#define RAVE_DATA2D_H
28#include "rave_object.h"
29#include "rave_types.h"
30
35
40
47void RaveData2D_useNodata(RaveData2D_t* self, int use);
48
55
60void RaveData2D_setNodata(RaveData2D_t* self, double nodata);
61
67
74
81
88
95
105int RaveData2D_setData(RaveData2D_t* self, long xsize, long ysize, void* data, RaveDataType type);
106
116int RaveData2D_createData(RaveData2D_t* self, long xsize, long ysize, RaveDataType type, double value);
117
124int RaveData2D_fill(RaveData2D_t* self, double v);
125
134int RaveData2D_setValue(RaveData2D_t* self, long x, long y, double v);
135
145int RaveData2D_setValueUnchecked(RaveData2D_t* self, long x, long y, double v);
146
156int RaveData2D_getValue(RaveData2D_t* self, long x, long y, double* v);
157
167int RaveData2D_getValueUnchecked(RaveData2D_t* self, long x, long y, double* v);
168
175
181double RaveData2D_min(RaveData2D_t* self);
182
188double RaveData2D_max(RaveData2D_t* self);
189
199
209
217RaveData2D_t* RaveData2D_circshift(RaveData2D_t* field, int nx, int ny);
218
226int RaveData2D_circshiftData(RaveData2D_t* field, int nx, int ny);
227
235
243
251
259
266
275
282
290
299RaveData2D_t* RaveData2D_medfilt2(RaveData2D_t* field, long winXsize, long winYsize);
300
309
316RaveData2D_t* RaveData2D_movingstd(RaveData2D_t* field, long nx, long ny);
317
340long* RaveData2D_hist(RaveData2D_t* field, int bins, long* nnodata);
341
349int RaveData2D_entropy(RaveData2D_t* field, int bins, double* entropy);
350
355void RaveData2D_disp(RaveData2D_t* field);
356
363const char* RaveData2D_str(RaveData2D_t* field);
364
371void RaveData2D_replace(RaveData2D_t* field, double v, double v2);
372
381
390
399
400#endif /* RAVE_DATA2D_H */
void RaveData2D_useNodata(RaveData2D_t *self, int use)
Sets if the operations should take into account nodata value or not.
Definition rave_data2d.c:205
RaveData2D_t * RaveData2D_add(RaveData2D_t *field, RaveData2D_t *other)
Adds the array value to field and returns a new field.
Definition rave_data2d.c:762
RaveData2D_t * RaveData2D_circshift(RaveData2D_t *field, int nx, int ny)
Circular shift of the field in x & y dimension.
Definition rave_data2d.c:679
int RaveData2D_getValue(RaveData2D_t *self, long x, long y, double *v)
Returns the value at the specified x and y position.
Definition rave_data2d.c:433
int RaveData2D_hasData(RaveData2D_t *self)
Returns if this object contains data and a xsize and ysize > 0.
Definition rave_data2d.c:527
RaveData2D_t * RaveData2D_mulNumber(RaveData2D_t *field, double v)
Multiplicates all values in field with v and returns a new field.
Definition rave_data2d.c:787
RaveData2D_t * RaveData2D_zeros(long xsize, long ysize, RaveDataType type)
Utility function for creating a new rave data 2d object filled with zeros.
Definition rave_data2d.c:1262
int RaveData2D_circshiftData(RaveData2D_t *field, int nx, int ny)
Circular shift of the internal field in x & y dimension.
Definition rave_data2d.c:728
void * RaveData2D_getData(RaveData2D_t *self)
Returns a pointer to the internal data storage.
Definition rave_data2d.c:254
RaveData2D_t * RaveData2D_addNumber(RaveData2D_t *field, double v)
Adds the specified value to field and returns a new field.
Definition rave_data2d.c:757
double RaveData2D_min(RaveData2D_t *self)
Returns min in self.
Definition rave_data2d.c:538
long * RaveData2D_hist(RaveData2D_t *field, int bins, long *nnodata)
Creates a histogram of field with bins number of bins.
Definition rave_data2d.c:1047
RaveData2D_t * RaveData2D_subNumber(RaveData2D_t *field, double v)
Substracts the specified value from field and returns a new field.
Definition rave_data2d.c:772
int RaveData2D_entropy(RaveData2D_t *field, int bins, double *entropy)
Calculate the entropy value for the field.
Definition rave_data2d.c:1128
const char * RaveData2D_str(RaveData2D_t *field)
Helper function that returns the matrix as a string.
Definition rave_data2d.c:1201
int RaveData2D_setData(RaveData2D_t *self, long xsize, long ysize, void *data, RaveDataType type)
Sets the data.
Definition rave_data2d.c:260
double RaveData2D_max(RaveData2D_t *self)
Returns max in self.
Definition rave_data2d.c:559
RaveData2D_t * RaveData2D_emul(RaveData2D_t *field, RaveData2D_t *other)
Element wise multiplication.
Definition rave_data2d.c:792
void RaveData2D_replace(RaveData2D_t *field, double v, double v2)
Replaces all occurances of v with v2 in the provided data field.
Definition rave_data2d.c:1247
double RaveData2D_getNodata(RaveData2D_t *self)
Definition rave_data2d.c:227
RaveData2D_t * RaveData2D_movingstd(RaveData2D_t *field, long nx, long ny)
Computes the standard deviation over a given number of pixels (nx * ny).
Definition rave_data2d.c:961
int RaveData2D_setValue(RaveData2D_t *self, long x, long y, double v)
Sets the value at the specified coordinates.
Definition rave_data2d.c:328
RaveData2D_t * RaveData2D_createObject(long xsize, long ysize, RaveDataType type)
Utility function for creating a new rave data 2d object.
Definition rave_data2d.c:1280
RaveData2D_t * RaveData2D_powNumber(RaveData2D_t *field, double v)
Element wise pow on a matrix.
Definition rave_data2d.c:802
RaveData2D_t * RaveData2D_medfilt2(RaveData2D_t *field, long winXsize, long winYsize)
Executes a median filtering in 2D.
Definition rave_data2d.c:875
RaveData2D_t * RaveData2D_cumsum(RaveData2D_t *field, int dir)
Runs a cummulative sum of either columns or rows.
Definition rave_data2d.c:921
long RaveData2D_getYsize(RaveData2D_t *self)
Returns the ysize.
Definition rave_data2d.c:240
RaveData2D_t * RaveData2D_concatY(RaveData2D_t *field, RaveData2D_t *other)
Concatenates field with other vertically and returns the new field.
Definition rave_data2d.c:630
int RaveData2D_createData(RaveData2D_t *self, long xsize, long ysize, RaveDataType type, double value)
Creates a data field with the specified size and type.
Definition rave_data2d.c:278
int RaveData2D_usingNodata(RaveData2D_t *self)
Returns if the calculations are taking into account the nodata value.
Definition rave_data2d.c:215
RaveData2D_t * RaveData2D_ones(long xsize, long ysize, RaveDataType type)
Utility function for creating a new rave data 2d object filled with ones.
Definition rave_data2d.c:1271
RaveData2D_t * RaveData2D_epow(RaveData2D_t *field, RaveData2D_t *other)
Element wise pow on a matrix This means that others x&y size must either be 1 or the same as selfs xs...
Definition rave_data2d.c:807
void RaveData2D_setNodata(RaveData2D_t *self, double nodata)
Definition rave_data2d.c:221
int RaveData2D_setValueUnchecked(RaveData2D_t *self, long x, long y, double v)
Same as RaveData2D_setValue but there is no boundary checking performed.
Definition rave_data2d.c:342
int RaveData2D_getValueUnchecked(RaveData2D_t *self, long x, long y, double *v)
Same as RaveData2D_getValue but there is no boundary checking performed.
Definition rave_data2d.c:454
void RaveData2D_disp(RaveData2D_t *field)
Helper function to print field to stdout.
Definition rave_data2d.c:1176
RaveDataType RaveData2D_getType(RaveData2D_t *self)
Returns the data type.
Definition rave_data2d.c:247
RaveData2D_t * RaveData2D_sub(RaveData2D_t *field, RaveData2D_t *other)
Substracts the array value from field and returns a new field.
Definition rave_data2d.c:777
RaveCoreObjectType RaveData2D_TYPE
Type definition to use when creating a rave object.
Definition rave_data2d.c:1293
RaveData2D_t * RaveData2D_concatX(RaveData2D_t *field, RaveData2D_t *other)
Concatenates field with other horizontally and returns the new field.
Definition rave_data2d.c:580
int RaveData2D_fill(RaveData2D_t *self, double v)
Fills the field with the specified value.
Definition rave_data2d.c:311
long RaveData2D_getXsize(RaveData2D_t *self)
Returns the xsize.
Definition rave_data2d.c:234
Generic implementation of an object that is used within rave.
Type definitions for RAVE.
RaveDataType
Different data types that are supported during transformation.
Definition rave_types.h:130
Represents a date time instance.
Definition rave_data2d.c:38
long ysize
ysize
Definition rave_data2d.c:41
double nodata
the nodata value
Definition rave_data2d.c:43
RAVE_OBJECT_HEAD long xsize
Always on top.
Definition rave_data2d.c:40
void * data
data ptr
Definition rave_data2d.c:45
The rave object type definition.
Definition rave_object.h:52