ROPO
Loading...
Searching...
No Matches
pyfmiimage.c
Go to the documentation of this file.
1/* --------------------------------------------------------------------
2Copyright (C) 2011 Swedish Meteorological and Hydrological Institute, SMHI,
3
4This file is part of bRopo.
5
6bRopo 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
11bRopo 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 bRopo. If not, see <http://www.gnu.org/licenses/>.
18------------------------------------------------------------------------*/
25#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
26#include "pyropo_compat.h"
27#include "Python.h"
28#include <math.h>
29#include <stdio.h>
30#include <string.h>
31
32#define PYFMIIMAGE_MODULE
33#include "pyfmiimage.h"
34
35#include <rave.h>
36#include <arrayobject.h>
37#include "pypolarscan.h"
38#include "pypolarvolume.h"
39#include "pyravefield.h"
40#include "pyrave_debug.h"
41#include "rave_alloc.h"
42
46PYRAVE_DEBUG_MODULE("_pyfmiimage");
47
51#define raiseException_gotoTag(tag, type, msg) \
52{PyErr_SetString(type, msg); goto tag;}
53
57#define raiseException_returnNULL(type, msg) \
58{PyErr_SetString(type, msg); return NULL;}
59
63static PyObject *ErrorObject;
64
68
74static RaveFmiImage_t*
76{
77 RAVE_ASSERT((pyfmiimage != NULL), "pyfmiimage == NULL");
78 return RAVE_OBJECT_COPY(pyfmiimage->image);
79}
80
89static PyFmiImage*
90PyFmiImage_New(RaveFmiImage_t* p, int width, int height)
91{
92 PyFmiImage* result = NULL;
93 RaveFmiImage_t* cp = NULL;
94
95 if (p == NULL) {
96 cp = RAVE_OBJECT_NEW(&RaveFmiImage_TYPE);
97 if (cp == NULL) {
98 RAVE_CRITICAL0("Failed to allocate memory for fmi image.");
99 raiseException_returnNULL(PyExc_MemoryError, "Failed to allocate memory for fmi image.");
100 }
101 if (width > 0 && height > 0) {
102 if (!RaveFmiImage_initialize(cp, width, height)) {
103 RAVE_CRITICAL0("Failed to initialize fmi image");
104 raiseException_gotoTag(done, PyExc_MemoryError, "Failed to initialize fmi image");
105 }
106 }
107 } else {
108 cp = RAVE_OBJECT_COPY(p);
109 result = RAVE_OBJECT_GETBINDING(p); // If p already have a binding, then this should only be increfed.
110 if (result != NULL) {
111 Py_INCREF(result);
112 }
113 }
114
115 if (result == NULL) {
116 result = PyObject_NEW(PyFmiImage, &PyFmiImage_Type);
117 if (result != NULL) {
118 PYRAVE_DEBUG_OBJECT_CREATED;
119 result->image = RAVE_OBJECT_COPY(cp);
120 RAVE_OBJECT_BIND(result->image, result);
121 } else {
122 RAVE_CRITICAL0("Failed to create PyFmiImage instance");
123 raiseException_gotoTag(done, PyExc_MemoryError, "Failed to allocate memory for fmi image.");
124 }
125 }
126
127done:
128 RAVE_OBJECT_RELEASE(cp);
129 return result;
130}
131
136static void _pyfmiimage_dealloc(PyFmiImage* obj)
137{
138 /*Nothing yet*/
139 if (obj == NULL) {
140 return;
141 }
142 PYRAVE_DEBUG_OBJECT_DESTROYED;
143 RAVE_OBJECT_UNBIND(obj->image, obj);
144 RAVE_OBJECT_RELEASE(obj->image);
145 PyObject_Del(obj);
146}
147
154static PyObject* _pyfmiimage_new(PyObject* self, PyObject* args)
155{
156 int width = 0, height = 0;
157 if (!PyArg_ParseTuple(args, "|ii", &width, &height)) {
158 return NULL;
159 }
160 return (PyObject*)PyFmiImage_New(NULL, width, height);
161}
162
163static PyObject* _pyfmiimage_fromRave(PyObject* self, PyObject* args)
164{
165 PyObject* inptr = NULL;
166 RaveCoreObject* object = NULL;
167 char* quantity = NULL;
168
169 RaveFmiImage_t* fmiimage = NULL;
170 PyFmiImage* result = NULL;
171
172 if (!PyArg_ParseTuple(args, "O|s", &inptr, &quantity)) {
173 return NULL;
174 }
175
176 if (PyPolarVolume_Check(inptr)) {
177 object = (RaveCoreObject*)PyPolarVolume_GetNative((PyPolarVolume*)inptr);
178 fmiimage = RaveFmiImage_fromPolarVolume((PolarVolume_t*)object, 0, quantity);
179 } else if (PyPolarScan_Check(inptr)) {
180 object = (RaveCoreObject*)PyPolarScan_GetNative((PyPolarScan*)inptr);
181 fmiimage = RaveFmiImage_fromPolarScan((PolarScan_t*)object, quantity);
182 } else if (PyRaveField_Check(inptr)) {
183 object = (RaveCoreObject*)PyRaveField_GetNative((PyRaveField*)inptr);
184 fmiimage = RaveFmiImage_fromRaveField((RaveField_t*)object);
185 } else {
186 raiseException_returnNULL(PyExc_TypeError,"fromRave can handle volumes, scans and rave fields");
187 }
188
189 if (fmiimage != NULL) {
190 result = PyFmiImage_New(fmiimage, 0, 0);
191 } else {
192 PyErr_SetString(PyExc_RuntimeError, "Could not convert rave object into fmiimage");
193 }
194
195 RAVE_OBJECT_RELEASE(fmiimage);
196 RAVE_OBJECT_RELEASE(object);
197
198 return (PyObject*)result;
199}
200
201static PyObject* _pyfmiimage_fromRaveVolume(PyObject* self, PyObject* args)
202{
203 PyObject* inptr = NULL;
204 RaveCoreObject* object = NULL;
205 char* quantity = NULL;
206 int scannr = 0;
207
208 RaveFmiImage_t* fmiimage = NULL;
209 PyFmiImage* result = NULL;
210
211 if (!PyArg_ParseTuple(args, "Oi|s", &inptr, &scannr, &quantity)) {
212 return NULL;
213 }
214
215 if (PyPolarVolume_Check(inptr)) {
216 object = (RaveCoreObject*)PyPolarVolume_GetNative((PyPolarVolume*)inptr);
217 fmiimage = RaveFmiImage_fromPolarVolume((PolarVolume_t*)object, scannr, quantity);
218 } else {
219 raiseException_returnNULL(PyExc_TypeError,"fromRaveVolume only handle volumes");
220 }
221
222 if (fmiimage != NULL) {
223 result = PyFmiImage_New(fmiimage, 0, 0);
224 } else {
225 PyErr_SetString(PyExc_RuntimeError, "Could not convert rave object into fmiimage");
226 }
227
228 RAVE_OBJECT_RELEASE(fmiimage);
229 RAVE_OBJECT_RELEASE(object);
230
231 return (PyObject*)result;
232}
233
242static PyObject* _pyfmiimage_addAttribute(PyFmiImage* self, PyObject* args)
243{
244 RaveAttribute_t* attr = NULL;
245 char* name = NULL;
246 PyObject* obj = NULL;
247 PyObject* result = NULL;
248
249 if (!PyArg_ParseTuple(args, "sO", &name, &obj)) {
250 return NULL;
251 }
252
253 attr = RAVE_OBJECT_NEW(&RaveAttribute_TYPE);
254 if (attr == NULL) {
255 return NULL;
256 }
257
258 if (!RaveAttribute_setName(attr, name)) {
259 raiseException_gotoTag(done, PyExc_MemoryError, "Failed to set name");
260 }
261
262 if (PyLong_Check(obj) || PyInt_Check(obj)) {
263 long value = PyLong_AsLong(obj);
264 RaveAttribute_setLong(attr, value);
265 } else if (PyFloat_Check(obj)) {
266 double value = PyFloat_AsDouble(obj);
267 RaveAttribute_setDouble(attr, value);
268 } else if (PyString_Check(obj)) {
269 char* value = (char*)PyString_AsString(obj);
270 if (!RaveAttribute_setString(attr, value)) {
271 raiseException_gotoTag(done, PyExc_AttributeError, "Failed to set string value");
272 }
273 } else if (PyArray_Check(obj)) {
274 PyArrayObject* arraydata = (PyArrayObject*)obj;
275 if (PyArray_NDIM(arraydata) != 1) {
276 raiseException_gotoTag(done, PyExc_AttributeError, "Only allowed attribute arrays are 1-dimensional");
277 }
278 if (!RaveAttribute_setArrayFromData(attr, PyArray_DATA(arraydata), PyArray_DIM(arraydata, 0), translate_pyarraytype_to_ravetype(PyArray_TYPE(arraydata)))) {
279 raiseException_gotoTag(done, PyExc_AttributeError, "Failed to set array data");
280 }
281 } else {
282 raiseException_gotoTag(done, PyExc_AttributeError, "Unsupported data type");
283 }
284
285 if (!RaveFmiImage_addAttribute(self->image, attr)) {
286 raiseException_gotoTag(done, PyExc_AttributeError, "Failed to add attribute");
287 }
288
289 result = PyBool_FromLong(1);
290done:
291 RAVE_OBJECT_RELEASE(attr);
292 return result;
293}
294
301static PyObject* _pyfmiimage_getAttribute(PyFmiImage* self, PyObject* args)
302{
303 RaveAttribute_t* attribute = NULL;
304 char* name = NULL;
305 PyObject* result = NULL;
306 if (!PyArg_ParseTuple(args, "s", &name)) {
307 return NULL;
308 }
309
310 attribute = RaveFmiImage_getAttribute(self->image, name);
311 if (attribute != NULL) {
312 RaveAttribute_Format format = RaveAttribute_getFormat(attribute);
313 if (format == RaveAttribute_Format_Long) {
314 long value = 0;
315 RaveAttribute_getLong(attribute, &value);
316 result = PyLong_FromLong(value);
317 } else if (format == RaveAttribute_Format_Double) {
318 double value = 0.0;
319 RaveAttribute_getDouble(attribute, &value);
320 result = PyFloat_FromDouble(value);
321 } else if (format == RaveAttribute_Format_String) {
322 char* value = NULL;
323 RaveAttribute_getString(attribute, &value);
324 result = PyString_FromString(value);
325 } else if (format == RaveAttribute_Format_LongArray) {
326 long* value = NULL;
327 int len = 0;
328 int i = 0;
329 npy_intp dims[1];
330 RaveAttribute_getLongArray(attribute, &value, &len);
331 dims[0] = len;
332 result = PyArray_SimpleNew(1, dims, NPY_LONG);
333 for (i = 0; i < len; i++) {
334 *((long*) PyArray_GETPTR1((PyArrayObject*)result, i)) = value[i];
335 }
336 } else if (format == RaveAttribute_Format_DoubleArray) {
337 double* value = NULL;
338 int len = 0;
339 int i = 0;
340 npy_intp dims[1];
341 RaveAttribute_getDoubleArray(attribute, &value, &len);
342 dims[0] = len;
343 result = PyArray_SimpleNew(1, dims, NPY_DOUBLE);
344 for (i = 0; i < len; i++) {
345 *((double*) PyArray_GETPTR1((PyArrayObject*)result, i)) = value[i];
346 }
347 } else {
348 RAVE_CRITICAL1("Undefined format on requested attribute %s", name);
349 raiseException_gotoTag(done, PyExc_AttributeError, "Undefined attribute");
350 }
351 } else {
352 raiseException_gotoTag(done, PyExc_AttributeError, "No such attribute");
353 }
354done:
355 RAVE_OBJECT_RELEASE(attribute);
356 return result;
357}
358
365static PyObject* _pyfmiimage_getAttributeNames(PyFmiImage* self, PyObject* args)
366{
367 RaveList_t* list = NULL;
368 PyObject* result = NULL;
369 int n = 0;
370 int i = 0;
371
373 if (list == NULL) {
374 raiseException_returnNULL(PyExc_MemoryError, "Could not get attribute names");
375 }
376 n = RaveList_size(list);
377 result = PyList_New(0);
378 for (i = 0; result != NULL && i < n; i++) {
379 char* name = RaveList_get(list, i);
380 if (name != NULL) {
381 PyObject* pynamestr = PyString_FromString(name);
382 if (pynamestr == NULL) {
383 goto fail;
384 }
385 if (PyList_Append(result, pynamestr) != 0) {
386 Py_DECREF(pynamestr);
387 goto fail;
388 }
389 Py_DECREF(pynamestr);
390 }
391 }
392 RaveList_freeAndDestroy(&list);
393 return result;
394fail:
395 RaveList_freeAndDestroy(&list);
396 Py_XDECREF(result);
397 return NULL;
398}
399
406static PyObject* _pyfmiimage_toPolarScan(PyFmiImage* self, PyObject* args)
407{
408 char* quantity = NULL;
409 int datatype=0;
410 PolarScan_t* scan = NULL;
411 PyObject* result = NULL;
412
413 if (!PyArg_ParseTuple(args, "|si", &quantity, &datatype)) {
414 return NULL;
415 }
416 scan = RaveFmiImage_toPolarScan(self->image, quantity, datatype);
417 if (scan != NULL) {
418 result = (PyObject*)PyPolarScan_New(scan);
419 }
420 RAVE_OBJECT_RELEASE(scan);
421 return result;
422}
423
430static PyObject* _pyfmiimage_toRaveField(PyFmiImage* self, PyObject* args)
431{
432 RaveField_t* field = NULL;
433 PyObject* result = NULL;
434 int datatype=0;
435
436 if (!PyArg_ParseTuple(args, "|i", &datatype)) {
437 return NULL;
438 }
439 field = RaveFmiImage_toRaveField(self->image, datatype);
440 if (field != NULL) {
441 result = (PyObject*)PyRaveField_New(field);
442 }
443 RAVE_OBJECT_RELEASE(field);
444 return result;
445}
446
453static PyObject* _pyfmiimage_setValue(PyFmiImage* self, PyObject* args)
454{
455 long x,y,v;
456
457 if (!PyArg_ParseTuple(args, "lll", &x, &y, &v)) {
458 return NULL;
459 }
460
461 put_pixel(RaveFmiImage_getImage(self->image), x, y, 0, (Byte)v);
462
463 Py_RETURN_NONE;
464}
465
472static PyObject* _pyfmiimage_getValue(PyFmiImage* self, PyObject* args)
473{
474 long x,y,v;
475
476 if (!PyArg_ParseTuple(args, "ll", &x, &y)) {
477 return NULL;
478 }
479
480 v = get_pixel(RaveFmiImage_getImage(self->image), x, y, 0);
481
482 return PyLong_FromLong(v);
483}
484
491static PyObject* _pyfmiimage_setOriginalValue(PyFmiImage* self, PyObject* args)
492{
493 long x,y;
494 double v;
495
496 if (!PyArg_ParseTuple(args, "lld", &x, &y, &v)) {
497 return NULL;
498 }
499
500 put_pixel_orig(RaveFmiImage_getImage(self->image), x, y, 0, v);
501
502 Py_RETURN_NONE;
503}
504
511static PyObject* _pyfmiimage_getOriginalValue(PyFmiImage* self, PyObject* args)
512{
513 long x,y;
514 double v;
515 if (!PyArg_ParseTuple(args, "ll", &x, &y)) {
516 return NULL;
517 }
518
519 v = get_pixel_orig(RaveFmiImage_getImage(self->image), x, y, 0);
520
521 return PyFloat_FromDouble(v);
522}
523
529static struct PyMethodDef _pyfmiimage_methods[] =
530{
531 {"offset", NULL, METH_VARARGS},
532 {"gain", NULL, METH_VARARGS},
533 {"undetect", NULL, METH_VARARGS},
534 {"nodata", NULL, METH_VARARGS},
535 {"addAttribute", (PyCFunction)_pyfmiimage_addAttribute, 1},
536 {"getAttribute", (PyCFunction)_pyfmiimage_getAttribute, 1},
537 {"getAttributeNames", (PyCFunction)_pyfmiimage_getAttributeNames, 1},
538 {"toPolarScan", (PyCFunction)_pyfmiimage_toPolarScan, 1},
539 {"toRaveField", (PyCFunction)_pyfmiimage_toRaveField, 1},
540 {"setValue", (PyCFunction) _pyfmiimage_setValue, 1},
541 {"getValue", (PyCFunction) _pyfmiimage_getValue, 1},
542 {"setOriginalValue", (PyCFunction) _pyfmiimage_setOriginalValue, 1},
543 {"getOriginalValue", (PyCFunction) _pyfmiimage_getOriginalValue, 1},
544 {NULL, NULL} /* sentinel */
545};
546
550static PyObject* _pyfmiimage_getattro(PyFmiImage* self, PyObject* name)
551{
552 if (PY_COMPARE_STRING_WITH_ATTRO_NAME("offset", name) == 0) {
553 return PyFloat_FromDouble(RaveFmiImage_getOffset(self->image));
554 } else if (PY_COMPARE_STRING_WITH_ATTRO_NAME("gain", name) == 0) {
555 return PyFloat_FromDouble(RaveFmiImage_getGain(self->image));
556 } else if (PY_COMPARE_STRING_WITH_ATTRO_NAME("nodata", name) == 0) {
557 return PyFloat_FromDouble(RaveFmiImage_getNodata(self->image));
558 } else if (PY_COMPARE_STRING_WITH_ATTRO_NAME("undetect", name) == 0) {
559 return PyFloat_FromDouble(RaveFmiImage_getUndetect(self->image));
560 }
561 return PyObject_GenericGetAttr((PyObject*)self, name);
562}
563
567static int _pyfmiimage_setattro(PyFmiImage* self, PyObject* name, PyObject* val)
568{
569 int result = -1;
570 if (name == NULL) {
571 goto done;
572 }
573
574 if (PY_COMPARE_STRING_WITH_ATTRO_NAME("offset", name) == 0) {
575 double v = 0.0;
576 if (PyFloat_Check(val)) {
577 v = PyFloat_AsDouble(val);
578 } else if (PyLong_Check(val)) {
579 v = PyLong_AsDouble(val);
580 } else {
581 raiseException_gotoTag(done, PyExc_TypeError, "offset is a number");
582 }
584 } else if (PY_COMPARE_STRING_WITH_ATTRO_NAME("gain", name) == 0) {
585 double v = 0.0;
586 if (PyFloat_Check(val)) {
587 v = PyFloat_AsDouble(val);
588 } else if (PyLong_Check(val)) {
589 v = PyLong_AsDouble(val);
590 } else {
591 raiseException_gotoTag(done, PyExc_TypeError, "offset is a number");
592 }
593 RaveFmiImage_setGain(self->image, v);
594 } else if (PY_COMPARE_STRING_WITH_ATTRO_NAME("nodata", name) == 0) {
595 double v = 0.0;
596 if (PyFloat_Check(val)) {
597 v = PyFloat_AsDouble(val);
598 } else if (PyLong_Check(val)) {
599 v = PyLong_AsDouble(val);
600 } else {
601 raiseException_gotoTag(done, PyExc_TypeError, "nodata is a number");
602 }
604 } else if (PY_COMPARE_STRING_WITH_ATTRO_NAME("undetect", name) == 0) {
605 double v = 0.0;
606 if (PyFloat_Check(val)) {
607 v = PyFloat_AsDouble(val);
608 } else if (PyLong_Check(val)) {
609 v = PyLong_AsDouble(val);
610 } else {
611 raiseException_gotoTag(done, PyExc_TypeError, "undetect is a number");
612 }
614 } else {
615 raiseException_gotoTag(done, PyExc_AttributeError, PY_RAVE_ATTRO_NAME_TO_STRING(name));
616 }
617
618 result = 0;
619done:
620 return result;
621}
622
628
629PyTypeObject PyFmiImage_Type =
630{
631 PyVarObject_HEAD_INIT(NULL, 0) /*ob_size*/
632 "FmiImageCore", /*tp_name*/
633 sizeof(PyFmiImage), /*tp_size*/
634 0, /*tp_itemsize*/
635 /* methods */
636 (destructor)_pyfmiimage_dealloc, /*tp_dealloc*/
637 0, /*tp_print*/
638 (getattrfunc)0, /*tp_getattr*/
639 (setattrfunc)0, /*tp_setattr*/
640 0, /*tp_compare*/
641 0, /*tp_repr*/
642 0, /*tp_as_number */
643 0,
644 0, /*tp_as_mapping */
645 0, /*tp_hash*/
646 (ternaryfunc)0, /*tp_call*/
647 (reprfunc)0, /*tp_str*/
648 (getattrofunc)_pyfmiimage_getattro, /*tp_getattro*/
649 (setattrofunc)_pyfmiimage_setattro, /*tp_setattro*/
650 0, /*tp_as_buffer*/
651 Py_TPFLAGS_DEFAULT, /*tp_flags*/
652 0, /*tp_doc*/
653 (traverseproc)0, /*tp_traverse*/
654 (inquiry)0, /*tp_clear*/
655 0, /*tp_richcompare*/
656 0, /*tp_weaklistoffset*/
657 0, /*tp_iter*/
658 0, /*tp_iternext*/
659 _pyfmiimage_methods, /*tp_methods*/
660 0, /*tp_members*/
661 0, /*tp_getset*/
662 0, /*tp_base*/
663 0, /*tp_dict*/
664 0, /*tp_descr_get*/
665 0, /*tp_descr_set*/
666 0, /*tp_dictoffset*/
667 0, /*tp_init*/
668 0, /*tp_alloc*/
669 0, /*tp_new*/
670 0, /*tp_free*/
671 0, /*tp_is_gc*/
672};
673
679
680static PyMethodDef functions[] = {
681 {"new", (PyCFunction)_pyfmiimage_new, 1},
682 {"fromRave", (PyCFunction)_pyfmiimage_fromRave, 1},
683 {"fromRaveVolume", (PyCFunction)_pyfmiimage_fromRaveVolume, 1},
684 {NULL,NULL} /*Sentinel*/
685};
686
690MOD_INIT(_fmiimage)
691{
692 PyObject *module=NULL,*dictionary=NULL;
693 static void *PyFmiImage_API[PyFmiImage_API_pointers];
694 PyObject *c_api_object = NULL;
695
696 MOD_INIT_SETUP_TYPE(PyFmiImage_Type, &PyType_Type);
697
698 MOD_INIT_VERIFY_TYPE_READY(&PyFmiImage_Type);
699
700 MOD_INIT_DEF(module, "_fmiimage", NULL/*doc*/, functions);
701 if (module == NULL) {
702 return MOD_INIT_ERROR;
703 }
704
705 PyFmiImage_API[PyFmiImage_Type_NUM] = (void*)&PyFmiImage_Type;
706 PyFmiImage_API[PyFmiImage_GetNative_NUM] = (void *)PyFmiImage_GetNative;
707 PyFmiImage_API[PyFmiImage_New_NUM] = (void*)PyFmiImage_New;
708
709 c_api_object = PyCapsule_New(PyFmiImage_API, PyFmiImage_CAPSULE_NAME, NULL);
710 dictionary = PyModule_GetDict(module);
711 PyDict_SetItemString(dictionary, "_C_API", c_api_object);
712
713 ErrorObject = PyErr_NewException("_fmiimage.error", NULL, NULL);
714 if (ErrorObject == NULL || PyDict_SetItemString(dictionary, "error", ErrorObject) != 0) {
715 Py_FatalError("Can't define _fmiimage.error");
716 return MOD_INIT_ERROR;
717 }
718
719 import_array();
720 import_pypolarscan();
721 import_pypolarvolume();
722 import_pyravefield();
723 PYRAVE_DEBUG_INITIALIZE;
724 return MOD_INIT_SUCCESS(module);
725}
#define raiseException_gotoTag(tag, type, msg)
Definition pyfmiimage.c:51
PyTypeObject PyFmiImage_Type
Definition pyfmiimage.c:629
PYRAVE_DEBUG_MODULE("_pyfmiimage")
#define raiseException_returnNULL(type, msg)
Definition pyfmiimage.c:57
#define PyFmiImage_New
Definition pyfmiimage.h:86
#define PyFmiImage_GetNative
Definition pyfmiimage.h:74
#define PyFmiImage_GetNative_NUM
Definition pyfmiimage.h:40
#define PyFmiImage_API_pointers
Definition pyfmiimage.h:48
#define PyFmiImage_Type_NUM
Definition pyfmiimage.h:38
#define PyFmiImage_New_NUM
Definition pyfmiimage.h:44
FmiImage * RaveFmiImage_getImage(RaveFmiImage_t *self)
double RaveFmiImage_getOffset(RaveFmiImage_t *self)
int RaveFmiImage_addAttribute(RaveFmiImage_t *self, RaveAttribute_t *attribute)
RaveAttribute_t * RaveFmiImage_getAttribute(RaveFmiImage_t *self, const char *name)
void RaveFmiImage_setGain(RaveFmiImage_t *self, double gain)
RaveField_t * RaveFmiImage_toRaveField(RaveFmiImage_t *self, int datatype)
RaveCoreObjectType RaveFmiImage_TYPE
PolarScan_t * RaveFmiImage_toPolarScan(RaveFmiImage_t *self, const char *quantity, int datatype)
void RaveFmiImage_setNodata(RaveFmiImage_t *self, double v)
double RaveFmiImage_getUndetect(RaveFmiImage_t *self)
double RaveFmiImage_getGain(RaveFmiImage_t *self)
RaveList_t * RaveFmiImage_getAttributeNames(RaveFmiImage_t *self)
RaveFmiImage_t * RaveFmiImage_fromPolarVolume(PolarVolume_t *volume, int scannr, const char *quantity)
int RaveFmiImage_initialize(RaveFmiImage_t *self, int width, int height)
double RaveFmiImage_getNodata(RaveFmiImage_t *self)
void RaveFmiImage_setUndetect(RaveFmiImage_t *self, double v)
RaveFmiImage_t * RaveFmiImage_fromRaveField(RaveField_t *field)
RaveFmiImage_t * RaveFmiImage_fromPolarScan(PolarScan_t *scan, const char *quantity)
void RaveFmiImage_setOffset(RaveFmiImage_t *self, double offset)
PyObject_HEAD RaveFmiImage_t * image
Definition pyfmiimage.h:35