RAVE
cartesian.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------------------------------------------------------------------------*/
27#ifndef CARTESIAN_H
28#define CARTESIAN_H
29#include "rave_proj.h"
30#include "projection.h"
31#include "area.h"
32#include "rave_object.h"
33#include "rave_types.h"
34#include "rave_list.h"
35#include "raveobject_list.h"
36#include "rave_attribute.h"
37#include "rave_field.h"
38#include "cartesianparam.h"
39
44
49
56int Cartesian_setTime(Cartesian_t* cartesian, const char* value);
57
63const char* Cartesian_getTime(Cartesian_t* cartesian);
64
71int Cartesian_setDate(Cartesian_t* cartesian, const char* value);
72
78const char* Cartesian_getDate(Cartesian_t* cartesian);
79
86int Cartesian_setStartTime(Cartesian_t* cartesian, const char* value);
87
93const char* Cartesian_getStartTime(Cartesian_t* cartesian);
94
101int Cartesian_setStartDate(Cartesian_t* cartesian, const char* value);
102
108const char* Cartesian_getStartDate(Cartesian_t* cartesian);
109
116int Cartesian_setEndTime(Cartesian_t* cartesian, const char* value);
117
123const char* Cartesian_getEndTime(Cartesian_t* cartesian);
124
131int Cartesian_setEndDate(Cartesian_t* cartesian, const char* value);
132
138const char* Cartesian_getEndDate(Cartesian_t* cartesian);
139
146int Cartesian_setSource(Cartesian_t* cartesian, const char* value);
147
153const char* Cartesian_getSource(Cartesian_t* cartesian);
154
161int Cartesian_setProdname(Cartesian_t* cartesian, const char* value);
162
168const char* Cartesian_getProdname(Cartesian_t* cartesian);
169
177
184
190void Cartesian_setXSize(Cartesian_t* self, long xsize);
191
197void Cartesian_setYSize(Cartesian_t* self, long ysize);
198
204long Cartesian_getXSize(Cartesian_t* cartesian);
205
211long Cartesian_getYSize(Cartesian_t* cartesian);
212
221void Cartesian_setAreaExtent(Cartesian_t* cartesian, double llX, double llY, double urX, double urY);
222
231void Cartesian_getAreaExtent(Cartesian_t* cartesian, double* llX, double* llY, double* urX, double* urY);
232
245int Cartesian_getExtremeLonLatBoundaries(Cartesian_t* self, double* ulLon, double* ulLat, double* lrLon, double* lrLat);
246
252void Cartesian_setXScale(Cartesian_t* cartesian, double xscale);
253
259double Cartesian_getXScale(Cartesian_t* cartesian);
260
266void Cartesian_setYScale(Cartesian_t* cartesian, double yscale);
267
273double Cartesian_getYScale(Cartesian_t* cartesian);
274
282
289
295double Cartesian_getNodata(Cartesian_t* self);
296
303
311double Cartesian_getLocationX(Cartesian_t* cartesian, long x);
312
320double Cartesian_getLocationY(Cartesian_t* cartesian, long y);
321
329long Cartesian_getIndexX(Cartesian_t* cartesian, double x);
330
338long Cartesian_getIndexY(Cartesian_t* cartesian, double y);
339
348int Cartesian_getLonLatFromXY(Cartesian_t* self, int x, int y, double* lon, double* lat);
349
358int Cartesian_getLonLatFromXYLocation(Cartesian_t* self, double x, double y, double* lon, double* lat);
359
368int Cartesian_getXYFromLonLat(Cartesian_t* self, double lon, double lat, int* x, int* y);
369
378int Cartesian_getXYLocationFromLonLat(Cartesian_t* self, double lon, double lat, double* x, double* y);
379
386int Cartesian_setDefaultParameter(Cartesian_t* self, const char* name);
387
394
403
411
417const char* Cartesian_getProjectionString(Cartesian_t* cartesian);
418
427int Cartesian_setValue(Cartesian_t* cartesian, long x, long y, double v);
428
433int Cartesian_setConvertedValue(Cartesian_t* cartesian, long x, long y, double v);
434
443RaveValueType Cartesian_getValue(Cartesian_t* cartesian, long x, long y, double* v);
444
453RaveValueType Cartesian_getConvertedValue(Cartesian_t* cartesian, long x, long y, double* v);
454
464RaveValueType Cartesian_getValueAtLocation(Cartesian_t* cartesian, double lx, double ly, double* v);
465
475RaveValueType Cartesian_getConvertedValueAtLocation(Cartesian_t* cartesian, double lx, double ly, double* v);
476
486RaveValueType Cartesian_getConvertedValueAtLonLat(Cartesian_t* cartesian, double lon, double lat, double* v);
487
499int Cartesian_getQualityValueAtLocation(Cartesian_t* cartesian, double lx, double ly, const char* name, double *v);
500
512int Cartesian_getConvertedQualityValueAtLocation(Cartesian_t* cartesian, double lx, double ly, const char* name, double *v);
513
525int Cartesian_getQualityValueAtLonLat(Cartesian_t* cartesian, double lon, double lat, const char* name, double *v);
526
539int Cartesian_getConvertedQualityValueAtLonLat(Cartesian_t* cartesian, double lon, double lat, const char* name, double *v);
540
548void Cartesian_init(Cartesian_t* cartesian, Area_t* area);
549
559RaveValueType Cartesian_getMean(Cartesian_t* cartesian, long x, long y, int N, double* v);
560
568
577int Cartesian_addAttribute(Cartesian_t* cartesian, RaveAttribute_t* attribute);
578
589
596RaveAttribute_t* Cartesian_getAttribute(Cartesian_t* cartesian, const char* name);
597
607
614
623
633
643
650int Cartesian_hasAttribute(Cartesian_t* cartesian, const char* name);
651
659
667
674
680void Cartesian_removeQualityField(Cartesian_t* cartesian, int index);
681
689
697RaveField_t* Cartesian_getQualityFieldByHowTask(Cartesian_t* cartesian, const char* name);
698
705
714
721CartesianParam_t* Cartesian_getParameter(Cartesian_t* self, const char* name);
722
729int Cartesian_hasParameter(Cartesian_t* self, const char* name);
730
736void Cartesian_removeParameter(Cartesian_t* self, const char* name);
737
744
751
763CartesianParam_t* Cartesian_createParameter(Cartesian_t* self, const char* quantity, RaveDataType type, double datavalue);
764#endif
Defines an area, the extent, projection, etc.
RaveObjectList_t * Cartesian_getQualityFields(Cartesian_t *cartesian)
Returns all quality fields belonging to this cartesian.
Definition cartesian.c:1085
RaveField_t * Cartesian_getQualityFieldByHowTask(Cartesian_t *cartesian, const char *name)
Returns a quality field based on the value of how/task that should be a string.
Definition cartesian.c:1091
int Cartesian_setEndTime(Cartesian_t *cartesian, const char *value)
Sets the end time.
Definition cartesian.c:315
double Cartesian_getXScale(Cartesian_t *cartesian)
Returns the xscale.
Definition cartesian.c:543
void Cartesian_setXSize(Cartesian_t *self, long xsize)
The xsize to use for the parameters.
Definition cartesian.c:413
long Cartesian_getIndexY(Cartesian_t *cartesian, double y)
Returns the y index Evaluated as: (upperRight.y - y)/yscale.
Definition cartesian.c:611
void Cartesian_getAreaExtent(Cartesian_t *cartesian, double *llX, double *llY, double *urX, double *urY)
Gets the area extent for this cartesian product.
Definition cartesian.c:447
void Cartesian_removeQualityField(Cartesian_t *cartesian, int index)
Removes the quality field at the specified location.
Definition cartesian.c:1077
CartesianParam_t * Cartesian_getParameter(Cartesian_t *self, const char *name)
Returns the parameter with the specified quantity.
Definition cartesian.c:1167
void Cartesian_init(Cartesian_t *cartesian, Area_t *area)
Initializes this cartesian product with basic information.
Definition cartesian.c:896
int Cartesian_setStartTime(Cartesian_t *cartesian, const char *value)
Sets the start time.
Definition cartesian.c:285
RaveField_t * Cartesian_getQualityField(Cartesian_t *cartesian, int index)
Returns the quality field at the specified location.
Definition cartesian.c:1065
int Cartesian_addParameter(Cartesian_t *self, CartesianParam_t *param)
Adds a parameter to the cartesian product.
Definition cartesian.c:1130
long Cartesian_getYSize(Cartesian_t *cartesian)
Returns the ysize.
Definition cartesian.c:432
int Cartesian_setObjectType(Cartesian_t *self, Rave_ObjectType type)
Sets the object type this cartesian product should represent.
Definition cartesian.c:397
int Cartesian_getXYFromLonLat(Cartesian_t *self, double lon, double lat, int *x, int *y)
Converts a lon/lat position into a x/y position.
Definition cartesian.c:638
int Cartesian_getXYLocationFromLonLat(Cartesian_t *self, double lon, double lat, double *x, double *y)
Converts a lon/lat position into a x/y cartesian coordinate.
Definition cartesian.c:660
void Cartesian_setAreaExtent(Cartesian_t *cartesian, double llX, double llY, double urX, double urY)
Sets the area extent for this cartesian product.
Definition cartesian.c:438
double Cartesian_getLocationX(Cartesian_t *cartesian, long x)
Returns the location within the area as identified by a x-position.
Definition cartesian.c:592
RaveValueType Cartesian_getValueAtLocation(Cartesian_t *cartesian, double lx, double ly, double *v)
Returns the value from the location as defined by the area definition.
Definition cartesian.c:785
void Cartesian_removeParameter(Cartesian_t *self, const char *name)
Removes the parameter with the specified quantity.
Definition cartesian.c:1183
int Cartesian_addAttribute(Cartesian_t *cartesian, RaveAttribute_t *attribute)
Adds a rave attribute to the cartesian product.
Definition cartesian.c:976
RaveAttribute_t * Cartesian_getAttribute(Cartesian_t *cartesian, const char *name)
Returns the rave attribute that is named accordingly.
Definition cartesian.c:1013
int Cartesian_setValue(Cartesian_t *cartesian, long x, long y, double v)
Sets the value at the specified coordinates.
Definition cartesian.c:749
RaveList_t * Cartesian_getAttributeNamesVersion(Cartesian_t *cartesian, RaveIO_ODIM_Version version)
Returns a list of attribute names actual for specified version.
Definition cartesian.c:1035
RaveValueType Cartesian_getConvertedValueAtLocation(Cartesian_t *cartesian, double lx, double ly, double *v)
Returns the converted value from the location as defined by the area definition.
Definition cartesian.c:797
RaveValueType Cartesian_getConvertedValue(Cartesian_t *cartesian, long x, long y, double *v)
Returns the converted value at the specified x and y position.
Definition cartesian.c:776
int Cartesian_getNumberOfQualityFields(Cartesian_t *cartesian)
Returns the number of quality fields.
Definition cartesian.c:1071
CartesianParam_t * Cartesian_createParameter(Cartesian_t *self, const char *quantity, RaveDataType type, double datavalue)
Creates a parameter.
Definition cartesian.c:1202
RaveValueType Cartesian_getConvertedValueAtLonLat(Cartesian_t *cartesian, double lon, double lat, double *v)
Returns the converted value from the lon/lat position within the area.
Definition cartesian.c:809
const char * Cartesian_getDefaultParameter(Cartesian_t *self)
Returns the default parameter.
Definition cartesian.c:698
RaveAttribute_t * Cartesian_getAttributeVersion(Cartesian_t *cartesian, const char *name, RaveIO_ODIM_Version version)
Returns the rave attribute that is named accordingly for specified version.
Definition cartesian.c:1019
int Cartesian_getParameterCount(Cartesian_t *self)
Return the number of parameters.
Definition cartesian.c:1190
long Cartesian_getXSize(Cartesian_t *cartesian)
Returns the xsize.
Definition cartesian.c:426
RaveValueType Cartesian_getValue(Cartesian_t *cartesian, long x, long y, double *v)
Returns the value at the specified x and y position.
Definition cartesian.c:767
double Cartesian_getYScale(Cartesian_t *cartesian)
Returns the yscale.
Definition cartesian.c:555
int Cartesian_setDefaultParameter(Cartesian_t *self, const char *name)
Sets the default parameter.
Definition cartesian.c:673
const char * Cartesian_getSource(Cartesian_t *cartesian)
Returns the source.
Definition cartesian.c:365
const char * Cartesian_getEndDate(Cartesian_t *cartesian)
Returns the end date.
Definition cartesian.c:336
int Cartesian_setSource(Cartesian_t *cartesian, const char *value)
Sets the source.
Definition cartesian.c:345
int Cartesian_setConvertedValue(Cartesian_t *cartesian, long x, long y, double v)
Scales the value v according to gain and offset before setting it.
Definition cartesian.c:758
int Cartesian_hasParameter(Cartesian_t *self, const char *name)
Returns if the product contains the specified parameter or not.
Definition cartesian.c:1176
Rave_ObjectType Cartesian_getObjectType(Cartesian_t *self)
Returns the object type this cartesian product represents.
Definition cartesian.c:407
int Cartesian_setProduct(Cartesian_t *cartesian, Rave_ProductType type)
Sets the product this cartesian represents.
Definition cartesian.c:561
void Cartesian_setXScale(Cartesian_t *cartesian, double xscale)
Sets the xscale.
Definition cartesian.c:537
long Cartesian_getIndexX(Cartesian_t *cartesian, double x)
Returns the x index Evaluated as: (x - lowerLeft.x)/xscale.
Definition cartesian.c:604
void Cartesian_setYScale(Cartesian_t *cartesian, double yscale)
Sets the yscale.
Definition cartesian.c:549
int Cartesian_getConvertedQualityValueAtLonLat(Cartesian_t *cartesian, double lon, double lat, const char *name, double *v)
Returns the scaled quality value at the specified lon/lat from the specified quality field.
Definition cartesian.c:878
double Cartesian_getNodata(Cartesian_t *self)
Returns the nodata value.
Definition cartesian.c:574
int Cartesian_isTransformable(Cartesian_t *cartesian)
Verifies that all preconditions are met in order to perform a transformation.
Definition cartesian.c:942
Projection_t * Cartesian_getProjection(Cartesian_t *cartesian)
Returns a copy of the projection that is used for this cartesian product.
Definition cartesian.c:731
const char * Cartesian_getStartTime(Cartesian_t *cartesian)
Returns the start time.
Definition cartesian.c:291
int Cartesian_setProjection(Cartesian_t *cartesian, Projection_t *projection)
Sets the projection that defines this cartesian product.
Definition cartesian.c:704
double Cartesian_getLocationY(Cartesian_t *cartesian, long y)
Returns the location within the area as identified by a y-position.
Definition cartesian.c:598
const char * Cartesian_getProdname(Cartesian_t *cartesian)
Returns the product name.
Definition cartesian.c:391
Rave_ProductType Cartesian_getProduct(Cartesian_t *cartesian)
Returns the product this cartesian represents.
Definition cartesian.c:568
int Cartesian_getLonLatFromXYLocation(Cartesian_t *self, double x, double y, double *lon, double *lat)
Converts a x/y cartesian coordinate into lon/lat.
Definition cartesian.c:628
RaveList_t * Cartesian_getAttributeNames(Cartesian_t *cartesian)
Returns a list of attribute names.
Definition cartesian.c:1029
int Cartesian_getQualityValueAtLocation(Cartesian_t *cartesian, double lx, double ly, const char *name, double *v)
Returns the quality value at the specified location from the specified quality field.
Definition cartesian.c:822
int Cartesian_setProdname(Cartesian_t *cartesian, const char *value)
Sets the product name.
Definition cartesian.c:371
int Cartesian_addQualityField(Cartesian_t *cartesian, RaveField_t *field)
Adds a quality field to this cartesian product.
Definition cartesian.c:1059
int Cartesian_addAttributeVersion(Cartesian_t *cartesian, RaveAttribute_t *attribute, RaveIO_ODIM_Version version)
Adds a rave attribute to the cartesian product for specified version.
Definition cartesian.c:982
RaveValueType Cartesian_getMean(Cartesian_t *cartesian, long x, long y, int N, double *v)
Returns the mean value over a NxN square around the specified x and y position.
Definition cartesian.c:914
int Cartesian_setStartDate(Cartesian_t *cartesian, const char *value)
Sets the start date.
Definition cartesian.c:300
int Cartesian_getLonLatFromXY(Cartesian_t *self, int x, int y, double *lon, double *lat)
Converts a x/y position into lon/lat.
Definition cartesian.c:618
RaveField_t * Cartesian_findQualityFieldByHowTask(Cartesian_t *self, const char *value)
Same as Cartesian_getQualityFieldByHowTask but it first tries if there are any quality fields in the ...
Definition cartesian.c:1113
const char * Cartesian_getTime(Cartesian_t *cartesian)
Returns the nominal time.
Definition cartesian.c:267
RaveList_t * Cartesian_getParameterNames(Cartesian_t *self)
Returns a list of parameter names.
Definition cartesian.c:1196
const char * Cartesian_getEndTime(Cartesian_t *cartesian)
Returns the end time.
Definition cartesian.c:321
RaveObjectList_t * Cartesian_getAttributeValuesVersion(Cartesian_t *cartesian, RaveIO_ODIM_Version version)
Returns a list of attribute values that has been set for this product.
Definition cartesian.c:1047
int Cartesian_hasAttribute(Cartesian_t *cartesian, const char *name)
Returns if the cartesian product has got the specified attribute.
Definition cartesian.c:1053
RaveObjectList_t * Cartesian_getAttributeValues(Cartesian_t *cartesian)
Returns a list of attribute values that should be stored for this cartesian product.
Definition cartesian.c:1041
const char * Cartesian_getProjectionString(Cartesian_t *cartesian)
Returns the projection string defining this cartesian product.
Definition cartesian.c:740
int Cartesian_getExtremeLonLatBoundaries(Cartesian_t *self, double *ulLon, double *ulLat, double *lrLon, double *lrLat)
Determines the extreme lon lat boundaries for this area.
Definition cartesian.c:464
int Cartesian_getConvertedQualityValueAtLocation(Cartesian_t *cartesian, double lx, double ly, const char *name, double *v)
Returns the scaled quality value at the specified location from the specified quality field.
Definition cartesian.c:841
double Cartesian_getUndetect(Cartesian_t *self)
Returns the undetect value.
Definition cartesian.c:583
int Cartesian_setEndDate(Cartesian_t *cartesian, const char *value)
Sets the end date.
Definition cartesian.c:330
const char * Cartesian_getDate(Cartesian_t *cartesian)
Returns the nominal date.
Definition cartesian.c:279
void Cartesian_setYSize(Cartesian_t *self, long ysize)
The ysize to use for the parameters.
Definition cartesian.c:420
const char * Cartesian_getStartDate(Cartesian_t *cartesian)
Returns the start date.
Definition cartesian.c:306
int Cartesian_setDate(Cartesian_t *cartesian, const char *value)
Sets the nominal date.
Definition cartesian.c:273
RaveCoreObjectType Cartesian_TYPE
Type definition to use when creating a rave object.
Definition cartesian.c:1220
int Cartesian_getQualityValueAtLonLat(Cartesian_t *cartesian, double lon, double lat, const char *name, double *v)
Returns the quality value at the specified lon/lat from the specified quality field.
Definition cartesian.c:860
int Cartesian_setTime(Cartesian_t *cartesian, const char *value)
Sets the nominal time.
Definition cartesian.c:261
Defines the functions available when working with a cartesian field.
Wrapper around PROJ.4.
Used for keeping track on attributes.
Generic field that only provides a 2-dim data field and a number of dynamic attributes.
Implementation of a simple list.
Generic implementation of an object that is used within rave.
Handles compatibility issues related to PROJ versions and the definitions.
Type definitions for RAVE.
RaveIO_ODIM_Version
The /Conventions version in a ODIM HDF5 file.
Definition rave_types.h:43
Rave_ProductType
Product types that defines the <datasetX>/what/product in the ODIM format.
Definition rave_types.h:101
RaveDataType
Different data types that are supported during transformation.
Definition rave_types.h:130
Rave_ObjectType
Object types that defines the /what/object in the ODIM format.
Definition rave_types.h:82
RaveValueType
Different value types.
Definition rave_types.h:72
Implementation of a rave object list that ensures that the objects contained within the list are rele...
Represents the area.
Definition area.c:34
Represents the cartesian field product.
Definition cartesianparam.c:40
Represents the cartesian product.
Definition cartesian.c:41
double urX
upper right x-coordinate
Definition cartesian.c:57
double yscale
yscale
Definition cartesian.c:46
double llX
lower left x-coordinate
Definition cartesian.c:55
long xsize
xsize to use
Definition cartesian.c:49
Projection_t * projection
the projection
Definition cartesian.c:70
long ysize
ysize to use
Definition cartesian.c:50
double llY
lower left y-coordinate
Definition cartesian.c:56
double urY
upper right x-coordinate
Definition cartesian.c:58
RAVE_OBJECT_HEAD double xscale
Always on top.
Definition cartesian.c:45
Represents one projection.
Definition projection.c:55
Represents one scan in a volume.
Definition rave_attribute.c:45
Represents the cartesian volume.
Definition rave_field.c:36
Represents a list.
Definition rave_list.c:36
Represents a list.
Definition raveobject_list.c:35
The rave object type definition.
Definition rave_object.h:52