Removed rave ropo adaptors. andersFeatureBranch master hudson-bRack-10-SUCCESS
authorAnders Henja <anders@baltrad.eu>
Sat, 3 Sep 2011 07:28:26 +0000 (09:28 +0200)
committerAnders Henja <anders@baltrad.eu>
Sat, 3 Sep 2011 07:28:26 +0000 (09:28 +0200)
15 files changed:
pyrack/Makefile
pyrack/pyfmiimage.c [deleted file]
pyrack/pyfmiimage.h [deleted file]
pyrack/pyropogenerator.c [deleted file]
pyrack/pyropogenerator.h [deleted file]
rack/Makefile
rack/ropo/rave_fmi_image.c [deleted file]
rack/ropo/rave_fmi_image.h [deleted file]
rack/ropo/rave_fmi_volume.c [deleted file]
rack/ropo/rave_fmi_volume.h [deleted file]
rack/ropo/rave_ropo_generator.c [deleted file]
rack/ropo/rave_ropo_generator.h [deleted file]
test/pytest/FmiImageTest.py [deleted file]
test/pytest/PyRopoGeneratorTest.py [deleted file]
test/pytest/RackTestSuite.py

index ae5e309..a9a53db 100644 (file)
@@ -66,14 +66,6 @@ RACK_SOURCE= pyrack.c
 RACK_OBJECTS= $(RACK_SOURCE:.c=.o)
 RACK_TARGET= _rack.so
 
-FMIIMAGE_SOURCE= pyfmiimage.c
-FMIIMAGE_OBJECTS= $(FMIIMAGE_SOURCE:.c=.o)
-FMIIMAGE_TARGET= _fmiimage.so
-
-ROPO_SOURCE= pyropogenerator.c
-ROPO_OBJECTS= $(ROPO_SOURCE:.c=.o)
-ROPO_TARGET= _ropogenerator.so
-
 MAKECDEPEND=$(CC) -MM $(CFLAGS) -MT '$(@D)/$(@F)' -o $(DF).d $<
 
 DEPDIR=.dep
@@ -87,23 +79,15 @@ $(DEPDIR):
 # And the rest of the make file targets
 #
 .PHONY=all
-all:           $(RACK_TARGET) $(FMIIMAGE_TARGET) $(ROPO_TARGET)
+all:           $(RACK_TARGET)
 
 $(RACK_TARGET): $(DEPDIR) $(RACK_OBJECTS) ../drain/libbdrain.so ../rack/libbrack.so
        $(LDSHARED) -o $@ $(RACK_OBJECTS) $(LDFLAGS) $(LIBRARIES)
 
-$(FMIIMAGE_TARGET): $(DEPDIR) $(FMIIMAGE_OBJECTS) ../drain/libbdrain.so ../rack/libbrack.so
-       $(LDSHARED) -o $@ $(FMIIMAGE_OBJECTS) $(LDFLAGS) $(LIBRARIES)
-       
-$(ROPO_TARGET): $(DEPDIR) $(ROPO_OBJECTS) ../drain/libbdrain.so ../rack/libbrack.so
-       $(LDSHARED) -o $@ $(ROPO_OBJECTS) $(LDFLAGS) $(LIBRARIES)
-
 .PHONY=install
 install:
        @mkdir --parents ${prefix}/pyrack/
        @cp -v -u $(RACK_TARGET) ${prefix}/pyrack/
-       @cp -v -u $(FMIIMAGE_TARGET) ${prefix}/pyrack/
-       @cp -v -u $(ROPO_TARGET) ${prefix}/pyrack/
        @echo "$(prefix)/pyrack" > "$(SITEPACK_PYTHON)/pyrack.pth"
 
 .PHONY=clean
@@ -114,8 +98,6 @@ clean:
 .PHONY=distclean                
 distclean:     clean
        @\rm -f $(RACK_TARGET)
-       @\rm -f $(FMIIMAGE_TARGET)
-       @\rm -f $(ROPO_TARGET)
 
 # --------------------------------------------------------------------
 # Rules
diff --git a/pyrack/pyfmiimage.c b/pyrack/pyfmiimage.c
deleted file mode 100644 (file)
index 105e0c2..0000000
+++ /dev/null
@@ -1,393 +0,0 @@
-/* --------------------------------------------------------------------
-Copyright (C) 2011 Swedish Meteorological and Hydrological Institute, SMHI,
-
-This file is part of bRack.
-
-bRack is free software: you can redistribute it and/or modify
-it under the terms of the GNU Lesser General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
-
-bRack is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public License
-along with bRack.  If not, see <http://www.gnu.org/licenses/>.
-------------------------------------------------------------------------*/
-/**
- * Python version of the fmi image.
- * @file
- * @author Anders Henja (Swedish Meteorological and Hydrological Institute, SMHI)
- * @date 2011-08-31
- */
-#include "Python.h"
-#include <math.h>
-#include <stdio.h>
-#include <string.h>
-
-#define PYFMIIMAGE_MODULE   /**< to get correct part in pyfmiimage */
-#include "pyfmiimage.h"
-
-#include "pypolarscan.h"
-#include "pypolarvolume.h"
-#include "pyravefield.h"
-#include "pyrave_debug.h"
-#include "rave_alloc.h"
-
-/**
- * Debug this module
- */
-PYRAVE_DEBUG_MODULE("_pyfmiimage");
-
-/**
- * Sets a python exception and goto tag
- */
-#define raiseException_gotoTag(tag, type, msg) \
-{PyErr_SetString(type, msg); goto tag;}
-
-/**
- * Sets python exception and returns NULL
- */
-#define raiseException_returnNULL(type, msg) \
-{PyErr_SetString(type, msg); return NULL;}
-
-/**
- * Error object for reporting errors to the python interpreeter
- */
-static PyObject *ErrorObject;
-
-/// --------------------------------------------------------------------
-/// FmiImage
-/// --------------------------------------------------------------------
-/*@{ FmiImage */
-/**
- * Returns the native RaveFmiImage_t instance.
- * @param[in] pyfmiimage - the python fmi image instance
- * @returns the native fmi image instance.
- */
-static RaveFmiImage_t*
-PyFmiImage_GetNative(PyFmiImage* pyfmiimage)
-{
-  RAVE_ASSERT((pyfmiimage != NULL), "pyfmiimage == NULL");
-  return RAVE_OBJECT_COPY(pyfmiimage->image);
-}
-
-/**
- * Creates a python fmi image from a native fmi image or will create an
- * initial native FmiImage if p is NULL.
- * @param[in] p - the native fmi image (or NULL)
- * @param[in] width - the width (only used if p != NULL and > 0)
- * @param[in] height - the height (only used if p != NULL and > 0)
- * @returns the python fmi image.
- */
-static PyFmiImage*
-PyFmiImage_New(RaveFmiImage_t* p, int width, int height)
-{
-  PyFmiImage* result = NULL;
-  RaveFmiImage_t* cp = NULL;
-
-  if (p == NULL) {
-    cp = RAVE_OBJECT_NEW(&RaveFmiImage_TYPE);
-    if (cp == NULL) {
-      RAVE_CRITICAL0("Failed to allocate memory for fmi image.");
-      raiseException_returnNULL(PyExc_MemoryError, "Failed to allocate memory for fmi image.");
-    }
-    if (width > 0 && height > 0) {
-      if (!RaveFmiImage_initialize(cp, width, height)) {
-        RAVE_CRITICAL0("Failed to initialize fmi image");
-        raiseException_gotoTag(done, PyExc_MemoryError, "Failed to initialize fmi image");
-      }
-    }
-  } else {
-    cp = RAVE_OBJECT_COPY(p);
-    result = RAVE_OBJECT_GETBINDING(p); // If p already have a binding, then this should only be increfed.
-    if (result != NULL) {
-      Py_INCREF(result);
-    }
-  }
-
-  if (result == NULL) {
-    result = PyObject_NEW(PyFmiImage, &PyFmiImage_Type);
-    if (result != NULL) {
-      PYRAVE_DEBUG_OBJECT_CREATED;
-      result->image = RAVE_OBJECT_COPY(cp);
-      RAVE_OBJECT_BIND(result->image, result);
-    } else {
-      RAVE_CRITICAL0("Failed to create PyFmiImage instance");
-      raiseException_gotoTag(done, PyExc_MemoryError, "Failed to allocate memory for fmi image.");
-    }
-  }
-
-done:
-  RAVE_OBJECT_RELEASE(cp);
-  return result;
-}
-
-/**
- * Deallocates the fmi image
- * @param[in] obj the object to deallocate.
- */
-static void _pyfmiimage_dealloc(PyFmiImage* obj)
-{
-  /*Nothing yet*/
-  if (obj == NULL) {
-    return;
-  }
-  PYRAVE_DEBUG_OBJECT_DESTROYED;
-  RAVE_OBJECT_UNBIND(obj->image, obj);
-  RAVE_OBJECT_RELEASE(obj->image);
-  PyObject_Del(obj);
-}
-
-/**
- * Creates a new instance of the fmi image
- * @param[in] self this instance.
- * @param[in] args arguments for creation empty or width,height.
- * @return the object on success, otherwise NULL
- */
-static PyObject* _pyfmiimage_new(PyObject* self, PyObject* args)
-{
-  int width = 0, height = 0;
-  if (!PyArg_ParseTuple(args, "|ii", &width, &height)) {
-    return NULL;
-  }
-  return (PyObject*)PyFmiImage_New(NULL, width, height);
-}
-
-static PyObject* _pyfmiimage_fromRave(PyObject* self, PyObject* args)
-{
-  PyObject* inptr = NULL;
-  RaveCoreObject* object = NULL;
-  char* quantity = NULL;
-
-  RaveFmiImage_t* fmiimage = NULL;
-  PyFmiImage* result = NULL;
-
-  if (!PyArg_ParseTuple(args, "O|s", &inptr, &quantity)) {
-    return NULL;
-  }
-
-  if (PyPolarVolume_Check(inptr)) {
-    object = (RaveCoreObject*)PyPolarVolume_GetNative((PyPolarVolume*)inptr);
-    fmiimage = RaveFmiImage_fromPolarVolume((PolarVolume_t*)object, 0, quantity);
-  } else if (PyPolarScan_Check(inptr)) {
-    object = (RaveCoreObject*)PyPolarScan_GetNative((PyPolarScan*)inptr);
-    fmiimage = RaveFmiImage_fromPolarScan((PolarScan_t*)object, quantity);
-  } else if (PyRaveField_Check(inptr)) {
-    object = (RaveCoreObject*)PyRaveField_GetNative((PyRaveField*)inptr);
-    fmiimage = RaveFmiImage_fromRaveField((RaveField_t*)object);
-  } else {
-    raiseException_returnNULL(PyExc_TypeError,"fromRave can handle volumes, scans and rave fields");
-  }
-
-  if (fmiimage != NULL) {
-    result = PyFmiImage_New(fmiimage, 0, 0);
-  }
-
-  RAVE_OBJECT_RELEASE(fmiimage);
-  RAVE_OBJECT_RELEASE(object);
-
-  return (PyObject*)result;
-}
-
-static PyObject* _pyfmiimage_fromRaveVolume(PyObject* self, PyObject* args)
-{
-  PyObject* inptr = NULL;
-  RaveCoreObject* object = NULL;
-  char* quantity = NULL;
-  int scannr = 0;
-
-  RaveFmiImage_t* fmiimage = NULL;
-  PyFmiImage* result = NULL;
-
-  if (!PyArg_ParseTuple(args, "Oi|s", &inptr, &scannr, &quantity)) {
-    return NULL;
-  }
-
-  if (PyPolarVolume_Check(inptr)) {
-    object = (RaveCoreObject*)PyPolarVolume_GetNative((PyPolarVolume*)inptr);
-    fmiimage = RaveFmiImage_fromPolarVolume((PolarVolume_t*)object, scannr, quantity);
-  } else {
-    raiseException_returnNULL(PyExc_TypeError,"fromRaveVolume only handle volumes");
-  }
-
-  if (fmiimage != NULL) {
-    result = PyFmiImage_New(fmiimage, 0, 0);
-  }
-
-  RAVE_OBJECT_RELEASE(fmiimage);
-  RAVE_OBJECT_RELEASE(object);
-
-  return (PyObject*)result;
-}
-
-/**
- * Returns the rave polar scan
- * @param[in] self - self
- * @param[in] args - a string specifying quantity. Default is DBZH.
- * @return the rave polar scan
- */
-static PyObject* _pyfmiimage_toPolarScan(PyFmiImage* self, PyObject* args)
-{
-  char* quantity = NULL;
-  PolarScan_t* scan = NULL;
-  PyObject* result = NULL;
-
-  if (!PyArg_ParseTuple(args, "|s", &quantity)) {
-    return NULL;
-  }
-  scan = RaveFmiImage_toPolarScan(self->image, quantity);
-  if (scan != NULL) {
-    result = (PyObject*)PyPolarScan_New(scan);
-  }
-  RAVE_OBJECT_RELEASE(scan);
-  return result;
-}
-
-/**
- * Returns the rave field
- * @param[in] self - self
- * @param[in] args - N/A
- * @return the rave field
- */
-static PyObject* _pyfmiimage_toRaveField(PyFmiImage* self, PyObject* args)
-{
-  RaveField_t* field = NULL;
-  PyObject* result = NULL;
-
-  if (!PyArg_ParseTuple(args, "")) {
-    return NULL;
-  }
-  field = RaveFmiImage_toRaveField(self->image);
-  if (field != NULL) {
-    result = (PyObject*)PyRaveField_New(field);
-  }
-  RAVE_OBJECT_RELEASE(field);
-  return result;
-}
-
-/*@} End Of FmiImage */
-
-/**
- * All methods a fmi image can have
- */
-static struct PyMethodDef _pyfmiimage_methods[] =
-{
-  {"toPolarScan", (PyCFunction)_pyfmiimage_toPolarScan, 1},
-  {"toRaveField", (PyCFunction)_pyfmiimage_toRaveField, 1},
-  /*{"longitude", NULL},
-  {"getDistance", (PyCFunction) _pypolarvolume_getDistance, 1},*/
-    /*
-  {"fromRave", (PyCFunction)_pyfmiimage_fromRave, 1},
-  {"toRave", (PyCFunction)_pyfmiimage_toRave, 1},
-  */
-  {NULL, NULL} /* sentinel */
-};
-
-/**
- * Returns the specified attribute in the fmi image
- */
-static PyObject* _pyfmiimage_getattr(PyFmiImage* self, char* name)
-{
-  PyObject* res = NULL;
-  res = Py_FindMethod(_pyfmiimage_methods, (PyObject*) self, name);
-  if (res)
-    return res;
-
-  PyErr_Clear();
-  PyErr_SetString(PyExc_AttributeError, name);
-  return NULL;
-}
-
-/**
- * Returns the specified attribute in the polar volume
- */
-static int _pyfmiimage_setattr(PyFmiImage* self, char* name, PyObject* val)
-{
-  int result = -1;
-  if (name == NULL) {
-    goto done;
-  }
-
-  raiseException_gotoTag(done, PyExc_AttributeError, name);
-
-  result = 0;
-done:
-  return result;
-}
-
-/*@} End of Fmi Image */
-
-/// --------------------------------------------------------------------
-/// Type definitions
-/// --------------------------------------------------------------------
-/*@{ Type definitions */
-PyTypeObject PyFmiImage_Type =
-{
-  PyObject_HEAD_INIT(NULL)0, /*ob_size*/
-  "FmiImageCore", /*tp_name*/
-  sizeof(PyFmiImage), /*tp_size*/
-  0, /*tp_itemsize*/
-  /* methods */
-  (destructor)_pyfmiimage_dealloc, /*tp_dealloc*/
-  0, /*tp_print*/
-  (getattrfunc)_pyfmiimage_getattr, /*tp_getattr*/
-  (setattrfunc)_pyfmiimage_setattr, /*tp_setattr*/
-  0, /*tp_compare*/
-  0, /*tp_repr*/
-  0, /*tp_as_number */
-  0,
-  0, /*tp_as_mapping */
-  0 /*tp_hash*/
-};
-/*@} End of Type definitions */
-
-/// --------------------------------------------------------------------
-/// Module setup
-/// --------------------------------------------------------------------
-/*@{ Module setup */
-static PyMethodDef functions[] = {
-  {"new", (PyCFunction)_pyfmiimage_new, 1},
-  {"fromRave", (PyCFunction)_pyfmiimage_fromRave, 1},
-  {"fromRaveVolume", (PyCFunction)_pyfmiimage_fromRaveVolume, 1},
-  {NULL,NULL} /*Sentinel*/
-};
-
-/**
- * Initializes polar volume.
- */
-void init_fmiimage(void)
-{
-  PyObject *module=NULL,*dictionary=NULL;
-  static void *PyFmiImage_API[PyFmiImage_API_pointers];
-  PyObject *c_api_object = NULL;
-  PyFmiImage_Type.ob_type = &PyType_Type;
-
-  module = Py_InitModule("_fmiimage", functions);
-  if (module == NULL) {
-    return;
-  }
-  PyFmiImage_API[PyFmiImage_Type_NUM] = (void*)&PyFmiImage_Type;
-  PyFmiImage_API[PyFmiImage_GetNative_NUM] = (void *)PyFmiImage_GetNative;
-  PyFmiImage_API[PyFmiImage_New_NUM] = (void*)PyFmiImage_New;
-
-  c_api_object = PyCObject_FromVoidPtr((void *)PyFmiImage_API, NULL);
-
-  if (c_api_object != NULL) {
-    PyModule_AddObject(module, "_C_API", c_api_object);
-  }
-
-  dictionary = PyModule_GetDict(module);
-  ErrorObject = PyString_FromString("_fmiimage.error");
-  if (ErrorObject == NULL || PyDict_SetItemString(dictionary, "error", ErrorObject) != 0) {
-    Py_FatalError("Can't define _fmiimage.error");
-  }
-
-  import_pypolarscan();
-  import_pypolarvolume();
-  import_pyravefield();
-  PYRAVE_DEBUG_INITIALIZE;
-}
-/*@} End of Module setup */
diff --git a/pyrack/pyfmiimage.h b/pyrack/pyfmiimage.h
deleted file mode 100644 (file)
index f60b609..0000000
+++ /dev/null
@@ -1,120 +0,0 @@
-/* --------------------------------------------------------------------
-Copyright (C) 2011 Swedish Meteorological and Hydrological Institute, SMHI,
-
-This file is part of bRack.
-
-bRack is free software: you can redistribute it and/or modify
-it under the terms of the GNU Lesser General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
-
-bRack is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public License
-along with bRack.  If not, see <http://www.gnu.org/licenses/>.
-------------------------------------------------------------------------*/
-/**
- * Python version of the fmi image.
- * @file
- * @author Anders Henja (Swedish Meteorological and Hydrological Institute, SMHI)
- * @date 2011-08-31
- */
-#ifndef PYFMIIMAGE_H
-#define PYFMIIMAGE_H
-#include "rack/ropo/rave_fmi_image.h"
-
-/**
- * The fmi image object
- */
-typedef struct {
-   PyObject_HEAD /*Always have to be on top*/
-   RaveFmiImage_t* image;  /**< the fmi image */
-} PyFmiImage;
-
-#define PyFmiImage_Type_NUM 0                              /**< index of type */
-
-#define PyFmiImage_GetNative_NUM 1                         /**< index of GetNative*/
-#define PyFmiImage_GetNative_RETURN RaveFmiImage_t*         /**< return type for GetNative */
-#define PyFmiImage_GetNative_PROTO (PyFmiImage*)        /**< arguments for GetNative */
-
-#define PyFmiImage_New_NUM 2                               /**< index of New */
-#define PyFmiImage_New_RETURN PyFmiImage*                  /**< return type for New */
-#define PyFmiImage_New_PROTO (RaveFmiImage_t*, int, int)        /**< arguments for New */
-
-#define PyFmiImage_API_pointers 3                          /**< number of type and function pointers */
-
-#ifdef PYFMIIMAGE_MODULE
-/** Forward declaration of type */
-extern PyTypeObject PyFmiImage_Type;
-
-/** Checks if the object is a PyPolarVolume or not */
-#define PyFmiImage_Check(op) ((op)->ob_type == &PyFmiImage_Type)
-
-/** Forward declaration of PyFmiImage_GetNative */
-static PyFmiImage_GetNative_RETURN PyFmiImage_GetNative PyFmiImage_GetNative_PROTO;
-
-/** Forward declaration of PyFmiImage_New */
-static PyFmiImage_New_RETURN PyFmiImage_New PyFmiImage_New_PROTO;
-
-#else
-/** Pointers to types and functions */
-static void **PyFmiImage_API;
-
-/**
- * Returns a pointer to the internal fmi image, remember to release the reference
- * when done with the object. (RAVE_OBJECT_RELEASE).
- */
-#define PyFmiImage_GetNative \
-  (*(PyFmiImage_GetNative_RETURN (*)PyFmiImage_GetNative_PROTO) PyFmiImage_API[PyFmiImage_GetNative_NUM])
-
-/**
- * Creates a new fmi image instance. Release this object with Py_DECREF. If a FmiImage_t instance is
- * provided and this instance already is bound to a python instance, this instance will be increfed and
- * returned.
- * @param[in] image - the RaveFmiImage_t intance.
- * @param[in] width - the width, only used if image == NULL and width > 0 and height > 0
- * @param[in] height - the height, only used if image == NULL and width > 0 and height > 0
- * @returns the PyFmiImage instance.
- */
-#define PyFmiImage_New \
-  (*(PyFmiImage_New_RETURN (*)PyFmiImage_New_PROTO) PyFmiImage_API[PyFmiImage_New_NUM])
-
-/**
- * Checks if the object is a python fmi image.
- */
-#define PyFmiImage_Check(op) \
-   ((op)->ob_type == (PyTypeObject *)PyFmiImage_API[PyFmiImage_Type_NUM])
-
-/**
- * Imports the PyFmiImage module (like import _fmiimage in python).
- */
-static int
-import_fmiimage(void)
-{
-  PyObject *module;
-  PyObject *c_api_object;
-
-  module = PyImport_ImportModule("_fmiimage");
-  if (module == NULL) {
-    return -1;
-  }
-
-  c_api_object = PyObject_GetAttrString(module, "_C_API");
-  if (c_api_object == NULL) {
-    Py_DECREF(module);
-    return -1;
-  }
-  if (PyCObject_Check(c_api_object)) {
-    PyFmiImage_API = (void **)PyCObject_AsVoidPtr(c_api_object);
-  }
-  Py_DECREF(c_api_object);
-  Py_DECREF(module);
-  return 0;
-}
-
-#endif
-
-#endif /* PYFMIIMAGE_H */
diff --git a/pyrack/pyropogenerator.c b/pyrack/pyropogenerator.c
deleted file mode 100644 (file)
index 8ec7e2f..0000000
+++ /dev/null
@@ -1,553 +0,0 @@
-/* --------------------------------------------------------------------
-Copyright (C) 2011 Swedish Meteorological and Hydrological Institute, SMHI,
-
-This file is part of bRack.
-
-bRack is free software: you can redistribute it and/or modify
-it under the terms of the GNU Lesser General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
-
-bRack is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public License
-along with bRack.  If not, see <http://www.gnu.org/licenses/>.
-------------------------------------------------------------------------*/
-/**
- * Python API to the ropo functions
- * @file
- * @author Anders Henja (Swedish Meteorological and Hydrological Institute, SMHI)
- * @date 2011-08-31
- */
-#include "Python.h"
-#include <math.h>
-#include <stdio.h>
-#include <string.h>
-
-#define PYROPOGENERATOR_MODULE   /**< to get correct part in pyropogenerator */
-#include "pyropogenerator.h"
-
-#include "pyfmiimage.h"
-#include "pyrave_debug.h"
-#include "rave_alloc.h"
-
-/**
- * Debug this module
- */
-PYRAVE_DEBUG_MODULE("_ropogenerator");
-
-/**
- * Sets a python exception and goto tag
- */
-#define raiseException_gotoTag(tag, type, msg) \
-{PyErr_SetString(type, msg); goto tag;}
-
-/**
- * Sets python exception and returns NULL
- */
-#define raiseException_returnNULL(type, msg) \
-{PyErr_SetString(type, msg); return NULL;}
-
-/**
- * Error object for reporting errors to the python interpreeter
- */
-static PyObject *ErrorObject;
-
-/// --------------------------------------------------------------------
-/// RopoGenerator
-/// --------------------------------------------------------------------
-/*@{ RopoGenerator */
-/**
- * Returns the native RaveRopoGenerator_t instance.
- * @param[in] ropogenerator - the python ropo generator instance
- * @returns the native RaveRopoGenerator_t instance.
- */
-static RaveRopoGenerator_t*
-PyRopoGenerator_GetNative(PyRopoGenerator* ropogenerator)
-{
-  RAVE_ASSERT((ropogenerator != NULL), "ropogenerator == NULL");
-  return RAVE_OBJECT_COPY(ropogenerator->generator);
-}
-
-/**
- * Creates a python ropo generator from a native ropo generator or will create an
- * initial native ropo generator if p is NULL.
- * @param[in] p - the native ropo generator (or NULL)
- * @param[in] image - the fmi image (only used if p != NULL)
- * @returns the python fmi image.
- */
-static PyRopoGenerator*
-PyRopoGenerator_New(RaveRopoGenerator_t* p, RaveFmiImage_t* image)
-{
-  PyRopoGenerator* result = NULL;
-  RaveRopoGenerator_t* cp = NULL;
-
-  if (p == NULL) {
-    cp = RAVE_OBJECT_NEW(&RaveRopoGenerator_TYPE);
-    if (cp == NULL) {
-      RAVE_CRITICAL0("Failed to allocate memory for ropo generator.");
-      raiseException_returnNULL(PyExc_MemoryError, "Failed to allocate memory for ropo generator.");
-    }
-
-    if (image != NULL) {
-      RaveRopoGenerator_setImage(cp, image);
-    }
-  } else {
-    cp = RAVE_OBJECT_COPY(p);
-    result = RAVE_OBJECT_GETBINDING(p); // If p already have a binding, then this should only be increfed.
-    if (result != NULL) {
-      Py_INCREF(result);
-    }
-  }
-
-  if (result == NULL) {
-    result = PyObject_NEW(PyRopoGenerator, &PyRopoGenerator_Type);
-    if (result != NULL) {
-      PYRAVE_DEBUG_OBJECT_CREATED;
-      result->generator = RAVE_OBJECT_COPY(cp);
-      RAVE_OBJECT_BIND(result->generator, result);
-    } else {
-      RAVE_CRITICAL0("Failed to create PyRopoGenerator instance");
-      raiseException_gotoTag(done, PyExc_MemoryError, "Failed to allocate memory for ropo generator.");
-    }
-  }
-
-done:
-  RAVE_OBJECT_RELEASE(cp);
-  return result;
-}
-
-/**
- * Deallocates the ropo generator
- * @param[in] obj the object to deallocate.
- */
-static void _pyropogenerator_dealloc(PyRopoGenerator* obj)
-{
-  /*Nothing yet*/
-  if (obj == NULL) {
-    return;
-  }
-  PYRAVE_DEBUG_OBJECT_DESTROYED;
-  RAVE_OBJECT_UNBIND(obj->generator, obj);
-  RAVE_OBJECT_RELEASE(obj->generator);
-  PyObject_Del(obj);
-}
-
-/**
- * Creates a new instance of the ropo generator
- * @param[in] self this instance.
- * @param[in] args arguments for creation or a rave fmi image.
- * @return the object on success, otherwise NULL
- */
-static PyObject* _pyropogenerator_new(PyObject* self, PyObject* args)
-{
-  PyObject* inptr = NULL;
-
-  if (!PyArg_ParseTuple(args, "|O", &inptr)) {
-    return NULL;
-  }
-  if (inptr != NULL && !PyFmiImage_Check(inptr)) {
-    raiseException_returnNULL(PyExc_TypeError, "Generator only takes FmiImageCore instances");
-  }
-  if (inptr != NULL) {
-    return (PyObject*)PyRopoGenerator_New(NULL, ((PyFmiImage*)inptr)->image);
-  } else {
-    return (PyObject*)PyRopoGenerator_New(NULL, NULL);
-  }
-}
-
-static PyObject* _pyropogenerator_getImage(PyRopoGenerator* self, PyObject* args)
-{
-  RaveFmiImage_t* image = NULL;
-  PyObject* result = NULL;
-  if (!PyArg_ParseTuple(args, "")) {
-    return NULL;
-  }
-  image = RaveRopoGenerator_getImage(self->generator);
-  if (image != NULL) {
-    result = (PyObject*)PyFmiImage_New(image,0,0);
-  }
-  RAVE_OBJECT_RELEASE(image);
-
-  if (result != NULL) {
-    return result;
-  }
-
-  Py_RETURN_NONE;
-}
-
-static PyObject* _pyropogenerator_setImage(PyRopoGenerator* self, PyObject* args)
-{
-  PyObject* inptr = NULL;
-  if (!PyArg_ParseTuple(args, "O", &inptr)) {
-    return NULL;
-  }
-  if (!PyFmiImage_Check(inptr)) {
-    raiseException_returnNULL(PyExc_TypeError, "Generator can only be set with fmi images");
-  }
-  RaveRopoGenerator_setImage(self->generator, ((PyFmiImage*)inptr)->image);
-  Py_RETURN_NONE;
-}
-
-static PyObject* _pyropogenerator_speck(PyRopoGenerator* self, PyObject* args)
-{
-  int intensity = 0, sz = 0;
-  if (!PyArg_ParseTuple(args, "ii", &intensity, &sz)) {
-    return NULL;
-  }
-  if (!RaveRopoGenerator_speck(self->generator, intensity, sz)) {
-    raiseException_returnNULL(PyExc_RuntimeWarning, "Failed to run speck");
-  }
-  return (PyObject*)PyRopoGenerator_New(self->generator, NULL);
-}
-
-static PyObject* _pyropogenerator_emitter(PyRopoGenerator* self, PyObject* args)
-{
-  int intensity = 0, sz = 0;
-  if (!PyArg_ParseTuple(args, "ii", &intensity, &sz)) {
-    return NULL;
-  }
-  if (!RaveRopoGenerator_emitter(self->generator, intensity, sz)) {
-    raiseException_returnNULL(PyExc_RuntimeWarning, "Failed to run emitter");
-  }
-  return (PyObject*)PyRopoGenerator_New(self->generator, NULL);
-}
-
-static PyObject* _pyropogenerator_classify(PyRopoGenerator* self, PyObject* args)
-{
-  if (!PyArg_ParseTuple(args, "")) {
-    return NULL;
-  }
-  if (!RaveRopoGenerator_classify(self->generator)) {
-    raiseException_returnNULL(PyExc_RuntimeWarning, "Failed to classify detector sequence");
-  }
-  return (PyObject*)PyRopoGenerator_New(self->generator, NULL);
-}
-
-static PyObject* _pyropogenerator_restore(PyRopoGenerator* self, PyObject* args)
-{
-  RaveFmiImage_t* image = NULL;
-  PyObject* result = NULL;
-  int threshold = 0;
-  if (!PyArg_ParseTuple(args, "i", &threshold)) {
-    return NULL;
-  }
-  image = RaveRopoGenerator_restore(self->generator, threshold);
-  if (image == NULL) {
-    raiseException_returnNULL(PyExc_RuntimeWarning, "Failed to classify detector sequence");
-  }
-  result = (PyObject*)PyFmiImage_New(image, 0, 0);
-  RAVE_OBJECT_RELEASE(image);
-  return result;
-}
-
-static PyObject* _pyropogenerator_getClassification(PyRopoGenerator* self, PyObject* args)
-{
-  RaveFmiImage_t* image = NULL;
-  PyObject* result = NULL;
-
-  if (!PyArg_ParseTuple(args, "")) {
-    return NULL;
-  }
-
-  image = RaveRopoGenerator_getClassification(self->generator);
-  if (image == NULL) {
-    raiseException_returnNULL(PyExc_RuntimeWarning, "Failed to get classification");
-  }
-  result = PyFmiImage_New(image,0,0);
-  RAVE_OBJECT_RELEASE(image);
-  return (PyObject*)result;
-}
-
-/**
- * All methods a ropo generator can have
- */
-static struct PyMethodDef _pyropogenerator_methods[] =
-{
-  {"getImage", (PyCFunction)_pyropogenerator_getImage, 1},
-  {"setImage", (PyCFunction)_pyropogenerator_setImage, 1},
-  {"speck", (PyCFunction)_pyropogenerator_speck, 1},
-  {"emitter", (PyCFunction)_pyropogenerator_emitter, 1},
-  {"classify", (PyCFunction)_pyropogenerator_classify, 1},
-  {"restore", (PyCFunction)_pyropogenerator_restore, 1},
-  {"getClassification", (PyCFunction)_pyropogenerator_getClassification, 1},
-  {NULL, NULL} /* sentinel */
-};
-
-/**
- * Returns the specified attribute in the fmi image
- */
-static PyObject* _pyropogenerator_getattr(PyRopoGenerator* self, char* name)
-{
-  PyObject* res = NULL;
-  res = Py_FindMethod(_pyropogenerator_methods, (PyObject*) self, name);
-  if (res)
-    return res;
-
-  PyErr_Clear();
-  PyErr_SetString(PyExc_AttributeError, name);
-  return NULL;
-}
-
-/**
- * Returns the specified attribute in the polar volume
- */
-static int _pyropogenerator_setattr(PyRopoGenerator* self, char* name, PyObject* val)
-{
-  int result = -1;
-  if (name == NULL) {
-    goto done;
-  }
-
-  raiseException_gotoTag(done, PyExc_AttributeError, name);
-
-  result = 0;
-done:
-  return result;
-}
-
-/*@} End of Fmi Image */
-
-/// --------------------------------------------------------------------
-/// Type definitions
-/// --------------------------------------------------------------------
-/*@{ Type definitions */
-PyTypeObject PyRopoGenerator_Type =
-{
-  PyObject_HEAD_INIT(NULL)0, /*ob_size*/
-  "RopoGeneratorCore", /*tp_name*/
-  sizeof(PyRopoGenerator), /*tp_size*/
-  0, /*tp_itemsize*/
-  /* methods */
-  (destructor)_pyropogenerator_dealloc, /*tp_dealloc*/
-  0, /*tp_print*/
-  (getattrfunc)_pyropogenerator_getattr, /*tp_getattr*/
-  (setattrfunc)_pyropogenerator_setattr, /*tp_setattr*/
-  0, /*tp_compare*/
-  0, /*tp_repr*/
-  0, /*tp_as_number */
-  0,
-  0, /*tp_as_mapping */
-  0 /*tp_hash*/
-};
-/*@} End of Type definitions */
-
-#ifdef KALLE
-/*@{ Functions */
-static void _pyropointernal_update_classification(FmiImage *prob,FmiImage *master_prob,FmiImage *mark,Byte marker)
-{
-  register int i;
-  for (i = 0; i < prob->volume;i++) {
-    if (prob->array[i] >= master_prob->array[i]) {
-      if (mark != NULL) {
-        mark->array[i]=marker;
-      }
-      master_prob->array[i]=prob->array[i];
-    }
-  }
-}
-
-static PyObject* _pyropo_speck(PyObject* self, PyObject* args)
-{
-  PyObject* inptr = NULL;
-  PyObject* result = NULL;
-  PyFmiImage* image = NULL;
-  RaveFmiImage_t* prob = NULL;
-  FmiImage* sourceSweep = NULL; /* Do not release, internal memory */
-  FmiImage* probSweep = NULL;   /* Do not release, internal memory */
-
-  int sweep = 0;
-  int intensity = 0, sz = 0; /* min DBZ, max area */
-  if (!PyArg_ParseTuple(args, "Oii|i", &inptr, &intensity, &sz, &sweep)) {
-    return NULL;
-  }
-
-  if (!PyFmiImage_Check(inptr)) {
-    raiseException_returnNULL(PyExc_TypeError, "speck takes FmiImages as input");
-  }
-  image = (PyFmiImage*)inptr;
-  sourceSweep = RaveFmiImage_getSweep(image->image, sweep);
-  if (sourceSweep == NULL) {
-    raiseException_returnNULL(PyExc_TypeError, "Input fmi image does not contain that sweep");
-  }
-
-  prob = RaveFmiImage_new(1);
-  if (prob == NULL) {
-    return NULL;
-  }
-  probSweep = RaveFmiImage_getSweep(prob, 0);
-  detect_specks(sourceSweep, probSweep, intensity, histogram_area);
-  semisigmoid_image(probSweep, sz);
-  invert_image(probSweep);
-  translate_intensity(probSweep, 255, 0);
-
-  result = (PyObject*)PyFmiImage_New(prob, 0);
-  RAVE_OBJECT_RELEASE(prob);
-  return result;
-}
-
-static PyObject* _pyropo_emitter(PyObject* self, PyObject* args)
-{
-  PyObject* inptr = NULL;
-  PyObject* result = NULL;
-  PyFmiImage* image = NULL;
-  RaveFmiImage_t* prob = NULL;
-  FmiImage* sourceSweep = NULL; /* Do not release, internal memory */
-  FmiImage* probSweep = NULL;   /* Do not release, internal memory */
-
-  int sweep = 0;
-  int intensity = 0, sz = 0; /* min DBZ, max area */
-  if (!PyArg_ParseTuple(args, "Oii|i", &inptr, &intensity, &sz, &sweep)) {
-    return NULL;
-  }
-
-  if (!PyFmiImage_Check(inptr)) {
-    raiseException_returnNULL(PyExc_TypeError, "speck takes FmiImages as input");
-  }
-  image = (PyFmiImage*)inptr;
-  sourceSweep = RaveFmiImage_getSweep(image->image, sweep);
-  if (sourceSweep == NULL) {
-    raiseException_returnNULL(PyExc_TypeError, "Input fmi image does not contain that sweep");
-  }
-
-  prob = RaveFmiImage_new(1);
-  if (prob == NULL) {
-    return NULL;
-  }
-  probSweep = RaveFmiImage_getSweep(prob, 0);
-  detect_emitters(sourceSweep, probSweep, intensity, sz);
-
-  result = (PyObject*)PyFmiImage_New(prob, 0);
-  RAVE_OBJECT_RELEASE(prob);
-  return result;
-}
-
-static PyObject* _pyropo_restore(PyObject* self, PyObject* args)
-{
-  PyObject* sweepptr = NULL;
-  PyObject* inprobabilityptr = NULL;
-  PyFmiImage* sweep = NULL;
-  PyFmiImage* probability = NULL;
-  RaveFmiImage_t* resultimage = NULL;
-  PyObject* result = NULL;
-  FmiImage* sourceSweep = NULL; /* Do not release, internal memory */
-  FmiImage* probabilitySweep = NULL; /* Do not release, internal memory */
-  int threshold = 255;
-  int sweepnr = 0;
-
-  if (!PyArg_ParseTuple(args, "OOi|i", &sweepptr, &inprobabilityptr, &threshold, &sweepnr)) {
-    return NULL;
-  }
-
-  if (!PyFmiImage_Check(sweepptr) || !PyFmiImage_Check(inprobabilityptr)) {
-    raiseException_returnNULL(PyExc_TypeError, "restore takes sweep, probability field and threshold as input");
-  }
-  sweep = (PyFmiImage*)sweepptr;
-  probability = (PyFmiImage*)inprobabilityptr;
-
-  sourceSweep = RaveFmiImage_getSweep(sweep->image, sweepnr);
-  if (sourceSweep == NULL) {
-    raiseException_returnNULL(PyExc_TypeError, "Input fmi image does not contain that sweep");
-  }
-  probabilitySweep = RaveFmiImage_getSweep(probability->image, 0);
-  if (probabilitySweep == NULL) {
-    raiseException_returnNULL(PyExc_TypeError, "Probability field is empty");
-  }
-
-  resultimage = RaveFmiImage_new(1);
-  if (resultimage == NULL) {
-    return NULL;
-  }
-
-  restore_image(sourceSweep, RaveFmiImage_getSweep(resultimage, 0), probabilitySweep, threshold);
-
-  result = (PyObject*)PyFmiImage_New(resultimage, 0);
-  RAVE_OBJECT_RELEASE(resultimage);
-  return result;
-}
-
-static PyObject* _pyropo_update_classification(PyObject* self, PyObject* args)
-{
-  PyObject *classificationptr = NULL, *probabilityptr = NULL, *targetprobabilityptr = NULL;
-  PyFmiImage *classification = NULL, *probability = NULL, *targetprobability = NULL;
-  FmiImage *cSweep = NULL, *pSweep = NULL, *tSweep = NULL;
-
-  FmiRadarPGMCode marker = CLEAR;
-
-  if (!PyArg_ParseTuple(args, "OOi|O", &probabilityptr, &targetprobabilityptr, &marker, &classificationptr)) {
-    return NULL;
-  }
-
-  if (!PyFmiImage_Check(probabilityptr) || !PyFmiImage_Check(targetprobabilityptr)) {
-    raiseException_returnNULL(PyExc_TypeError, "Input types must be either OOi|O with probfield, targetprobfield, marker, classification field");
-  }
-  if (classificationptr != NULL && !PyFmiImage_Check(classificationptr)) {
-    raiseException_returnNULL(PyExc_TypeError, "Input types must be either OOi|O with probfield, targetprobfield, marker, classification field");
-  }
-  classification = (PyFmiImage*)classificationptr;
-  probability = (PyFmiImage*)probabilityptr;
-  targetprobability = (PyFmiImage*)targetprobabilityptr;
-
-  if (RaveFmiImage_getSweepCount(probability->image) != 1 ||
-      RaveFmiImage_getSweepCount(targetprobability->image) != 1 ||
-      (classification != NULL && RaveFmiImage_getSweepCount(targetprobability->image) != 1)) {
-    raiseException_returnNULL(PyExc_TypeError, "Input types must be either OOi|O with probfield, targetprobfield, marker, classification field with sweep count 1");
-  }
-  if (classification != NULL) {
-    cSweep = RaveFmiImage_getSweep(classification->image, 0);
-  }
-  pSweep = RaveFmiImage_getSweep(probability->image, 0);
-  tSweep = RaveFmiImage_getSweep(targetprobability->image, 0);
-
-  canonize_image(pSweep, cSweep);
-  canonize_image(pSweep, tSweep);
-
-  _pyropointernal_update_classification(pSweep, tSweep, cSweep, marker);
-
-  Py_RETURN_NONE;
-}
-#endif
-
-/*@} End of Functions */
-
-/*@{ Module setup */
-static PyMethodDef functions[] = {
-  {"new", (PyCFunction)_pyropogenerator_new, 1},
-  {NULL,NULL} /*Sentinel*/
-};
-
-PyMODINIT_FUNC
-init_ropogenerator(void)
-{
-  PyObject *module=NULL,*dictionary=NULL;
-  static void *PyRopoGenerator_API[PyRopoGenerator_API_pointers];
-  PyObject *c_api_object = NULL;
-  PyRopoGenerator_Type.ob_type = &PyType_Type;
-
-  module = Py_InitModule("_ropogenerator", functions);
-  if (module == NULL) {
-    return;
-  }
-  PyRopoGenerator_API[PyRopoGenerator_Type_NUM] = (void*)&PyRopoGenerator_Type;
-  PyRopoGenerator_API[PyRopoGenerator_GetNative_NUM] = (void *)PyRopoGenerator_GetNative;
-  PyRopoGenerator_API[PyRopoGenerator_New_NUM] = (void*)PyRopoGenerator_New;
-
-  c_api_object = PyCObject_FromVoidPtr((void *)PyRopoGenerator_API, NULL);
-
-  if (c_api_object != NULL) {
-    PyModule_AddObject(module, "_C_API", c_api_object);
-  }
-
-  dictionary = PyModule_GetDict(module);
-  ErrorObject = PyString_FromString("_ropogenerator.error");
-
-  if (ErrorObject == NULL || PyDict_SetItemString(dictionary, "error", ErrorObject) != 0) {
-    Py_FatalError("Can't define _ropogenerator.error");
-  }
-  import_fmiimage();
-  PYRAVE_DEBUG_INITIALIZE;
-}
-/*@} End of Module setup */
diff --git a/pyrack/pyropogenerator.h b/pyrack/pyropogenerator.h
deleted file mode 100644 (file)
index dc7680e..0000000
+++ /dev/null
@@ -1,119 +0,0 @@
-/* --------------------------------------------------------------------
-Copyright (C) 2011 Swedish Meteorological and Hydrological Institute, SMHI,
-
-This file is part of bRack.
-
-bRack is free software: you can redistribute it and/or modify
-it under the terms of the GNU Lesser General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
-
-bRack is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public License
-along with bRack.  If not, see <http://www.gnu.org/licenses/>.
-------------------------------------------------------------------------*/
-/**
- * Python version of the ropo generator
- * @file
- * @author Anders Henja (Swedish Meteorological and Hydrological Institute, SMHI)
- * @date 2011-08-31
- */
-#ifndef PYROPOGENERATOR_H
-#define PYROPOGENERATOR_H
-#include "rack/ropo/rave_ropo_generator.h"
-
-/**
- * The fmi image object
- */
-typedef struct {
-   PyObject_HEAD /*Always have to be on top*/
-   RaveRopoGenerator_t* generator;  /**< the generator */
-} PyRopoGenerator;
-
-#define PyRopoGenerator_Type_NUM 0                              /**< index of type */
-
-#define PyRopoGenerator_GetNative_NUM 1                         /**< index of GetNative*/
-#define PyRopoGenerator_GetNative_RETURN RaveRopoGenerator_t*         /**< return type for GetNative */
-#define PyRopoGenerator_GetNative_PROTO (PyRopoGenerator*)        /**< arguments for GetNative */
-
-#define PyRopoGenerator_New_NUM 2                               /**< index of New */
-#define PyRopoGenerator_New_RETURN PyRopoGenerator*                  /**< return type for New */
-#define PyRopoGenerator_New_PROTO (RaveRopoGenerator_t*, RaveFmiImage_t*)        /**< arguments for New */
-
-#define PyRopoGenerator_API_pointers 3                          /**< number of type and function pointers */
-
-#ifdef PYROPOGENERATOR_MODULE
-/** Forward declaration of type */
-extern PyTypeObject PyRopoGenerator_Type;
-
-/** Checks if the object is a PyPolarVolume or not */
-#define PyRopoGenerator_Check(op) ((op)->ob_type == &PyRopoGenerator_Type)
-
-/** Forward declaration of PyRopoGenerator_GetNative */
-static PyRopoGenerator_GetNative_RETURN PyRopoGenerator_GetNative PyRopoGenerator_GetNative_PROTO;
-
-/** Forward declaration of PyRopoGenerator_New */
-static PyRopoGenerator_New_RETURN PyRopoGenerator_New PyRopoGenerator_New_PROTO;
-
-#else
-/** Pointers to types and functions */
-static void **PyRopoGenerator_API;
-
-/**
- * Returns a pointer to the internal fmi image, remember to release the reference
- * when done with the object. (RAVE_OBJECT_RELEASE).
- */
-#define PyRopoGenerator_GetNative \
-  (*(PyRopoGenerator_GetNative_RETURN (*)PyRopoGenerator_GetNative_PROTO) PyRopoGenerator_API[PyRopoGenerator_GetNative_NUM])
-
-/**
- * Creates a new ropo generator instance. Release this object with Py_DECREF. If a RaveRopoGenerator_t instance is
- * provided and this instance already is bound to a python instance, this instance will be increfed and
- * returned.
- * @param[in] generator - the RaveRopoGenerator_t instance.
- * @param[in] image - the ropo generator for this object only used if generator == NULL
- * @returns the PyRopoGenerator instance.
- */
-#define PyRopoGenerator_New \
-  (*(PyRopoGenerator_New_RETURN (*)PyRopoGenerator_New_PROTO) PyRopoGenerator_API[PyRopoGenerator_New_NUM])
-
-/**
- * Checks if the object is a python fmi image.
- */
-#define PyRopoGenerator_Check(op) \
-   ((op)->ob_type == (PyTypeObject *)PyRopoGenerator_API[PyRopoGenerator_Type_NUM])
-
-/**
- * Imports the PyRopoGenerator module (like import _ropogenerator in python).
- */
-static int
-import_ropogenerator(void)
-{
-  PyObject *module;
-  PyObject *c_api_object;
-
-  module = PyImport_ImportModule("_ropogenerator");
-  if (module == NULL) {
-    return -1;
-  }
-
-  c_api_object = PyObject_GetAttrString(module, "_C_API");
-  if (c_api_object == NULL) {
-    Py_DECREF(module);
-    return -1;
-  }
-  if (PyCObject_Check(c_api_object)) {
-    PyRopoGenerator_API = (void **)PyCObject_AsVoidPtr(c_api_object);
-  }
-  Py_DECREF(c_api_object);
-  Py_DECREF(module);
-  return 0;
-}
-
-#endif
-
-#endif /* PYROPOGENERATOR_H */
index acb9872..804f65a 100644 (file)
@@ -73,7 +73,7 @@ RACK_SOURCES= rack/Rack.cpp rack/RackIf.cpp
 ROPO_CSOURCES= ropo/fmi_image_arith.c ropo/fmi_image.c ropo/fmi_image_filter.c ropo/fmi_image_filter_line.c \
                                ropo/fmi_image_filter_morpho.c ropo/fmi_image_filter_speck.c ropo/fmi_image_filter_texture.c \
                                ropo/fmi_image_histogram.c ropo/fmi_image_restore.c ropo/fmi_meteosat.c ropo/fmi_radar_image.c \
-                               ropo/fmi_sunpos.c ropo/fmi_util.c ropo/ropo_hdf.c ropo/rave_fmi_image.c ropo/rave_fmi_volume.c ropo/rave_ropo_generator.c
+                               ropo/fmi_sunpos.c ropo/fmi_util.c ropo/ropo_hdf.c
                                
 ROPO_CPPSOURCES= ropo/convertImage.cpp ropo/Ropo.cpp
 
diff --git a/rack/ropo/rave_fmi_image.c b/rack/ropo/rave_fmi_image.c
deleted file mode 100644 (file)
index 5630212..0000000
+++ /dev/null
@@ -1,545 +0,0 @@
-/* --------------------------------------------------------------------
-Copyright (C) 2011 Swedish Meteorological and Hydrological Institute, SMHI,
-
-This file is part of bRack.
-
-bRack is free software: you can redistribute it and/or modify
-it under the terms of the GNU Lesser General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
-
-bRack is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public License
-along with bRack.  If not, see <http://www.gnu.org/licenses/>.
-------------------------------------------------------------------------*/
-
-/**
- * rave object wrapper for the fmi_image.
- * This object supports \ref #RAVE_OBJECT_CLONE.
- * @file
- * @author Anders Henja (Swedish Meteorological and Hydrological Institute, SMHI)
- * @date 2011-08-31
- */
-#include "rack/ropo/rave_fmi_image.h"
-#include "raveobject_hashtable.h"
-#include "rave_debug.h"
-#include "rave_alloc.h"
-#include <string.h>
-
-/**
- * Represents a rave fmi image
- */
-struct _RaveFmiImage_t {
-  RAVE_OBJECT_HEAD /** Always on top */
-  FmiImage* image; /**< the fmi image */
-  RaveObjectHashTable_t* attrs; /**< attributes */
-};
-
-/*@{ Private functions */
-
-/**
- * Releases all memory allocated in the fmi image.
- * @param[in] img - the rave fmi image to reset
- */
-static void RaveFmiImageInternal_resetImage(RaveFmiImage_t* img)
-{
-  if (img->image != NULL) {
-    if (img->image->heights != NULL) {
-      free(img->image->heights);
-    }
-    if (img->image->array != NULL) {
-      free(img->image->array);
-    }
-    free(img->image);
-  }
-  img->image = NULL;
-}
-
-/**
- * Constructor
- */
-static int RaveFmiImage_constructor(RaveCoreObject* obj)
-{
-  RaveFmiImage_t* this = (RaveFmiImage_t*)obj;
-  this->image = new_image(1);
-  this->attrs = RAVE_OBJECT_NEW(&RaveObjectHashTable_TYPE);
-  if (this->image == NULL || this->attrs == NULL) {
-    goto error;
-  }
-
-  return 1;
-error:
-  RaveFmiImageInternal_resetImage(this);
-  RAVE_OBJECT_RELEASE(this->attrs);
-  return 0;
-}
-
-/**
- * Destructor
- */
-static void RaveFmiImage_destructor(RaveCoreObject* obj)
-{
-  RaveFmiImage_t* src = (RaveFmiImage_t*)obj;
-  RaveFmiImageInternal_resetImage(src);
-  RAVE_OBJECT_RELEASE(src->attrs);
-}
-
-/**
- * Copy constructor
- */
-/**
- * Copy constructor.
- */
-static int RaveFmiImage_copyconstructor(RaveCoreObject* obj, RaveCoreObject* srcobj)
-{
-  RaveFmiImage_t* this = (RaveFmiImage_t*)obj;
-  RaveFmiImage_t* src = (RaveFmiImage_t*)srcobj;
-  this->image = new_image(1);
-  this->attrs = RAVE_OBJECT_CLONE(src->attrs);
-  if (this->image == NULL || this->attrs == NULL) {
-    goto error;
-  }
-  canonize_image(src->image, this->image);
-  return 1;
-error:
-  RAVE_OBJECT_RELEASE(this->image);
-  RAVE_OBJECT_RELEASE(this->attrs);
-  return 0;
-}
-
-/**
- * Converts a rave polar scan into a fmi image
- * @param[in] scan - the rave polar scan
- * @param[in] quantity - the quantity to use (if NULL, default parameter is assumed)
- * @param[in] image - the image to be filled
- * @return 1 on success otherwise 0
- */
-static int RaveFmiImageInternal_scanToFmiImage(PolarScan_t* scan, const char* quantity, FmiImage* image)
-{
-  int i = 0, j = 0;
-  int result = 0;
-  PolarScanParam_t* param = NULL;
-
-  RAVE_ASSERT((scan != NULL), "scan == NULL");
-  RAVE_ASSERT((image != NULL), "image == NULL");
-
-  image->width=PolarScan_getNbins(scan);
-  image->height=PolarScan_getNrays(scan);
-  image->bin_depth=PolarScan_getRscale(scan);
-  image->elevation_angle=PolarScan_getElangle(scan) * 180.0 / M_PI; /* elangles in degrees for ropo */
-  image->max_value=255;
-  image->channels=1;
-
-  initialize_image(image);
-
-  if (quantity == NULL) {
-    param = PolarScan_getParameter(scan, "DBZH");
-  } else {
-    param = PolarScan_getParameter(scan, quantity);
-  }
-
-  if (param == NULL) {
-    RAVE_WARNING1("Failed to extract parameter %s from scan", quantity);
-    goto done;
-  }
-  if (PolarScanParam_getDataType(param) != RaveDataType_CHAR &&
-      PolarScanParam_getDataType(param) != RaveDataType_UCHAR) {
-    RAVE_WARNING0("FmiImages can only support 8-bit data");
-    goto done;
-  }
-
-  for (j = 0; j < image->height; j++) {
-    for (i = 0; i < image->width; i++) {
-      double value = 0.0;
-      PolarScanParam_getValue(param, i, j, &value);
-      put_pixel(image, i, j, 0, (Byte)(value)); // why + 0.5 ?
-    }
-  }
-
-  result = 1;
-done:
-  RAVE_OBJECT_RELEASE(param);
-  return result;
-}
-
-/**
- * Converts a rave field into a fmi image
- * @param[in] field - the rave field
- * @param[in] image - the image to be filled
- * @return 1 on success otherwise 0
- */
-static int RaveFmiImageInternal_fieldToFmiImage(RaveField_t* field, FmiImage* image)
-{
-  int i = 0, j = 0;
-  int result = 0;
-
-  RAVE_ASSERT((field != NULL), "field == NULL");
-  RAVE_ASSERT((image != NULL), "image == NULL");
-
-  image->width=RaveField_getXsize(field);
-  image->height=RaveField_getYsize(field);
-  image->channels=1;
-  initialize_image(image);
-
-  if (RaveField_getDataType(field) != RaveDataType_CHAR &&
-      RaveField_getDataType(field) != RaveDataType_UCHAR) {
-    RAVE_WARNING0("FmiImages can only support 8-bit data");
-    goto done;
-  }
-
-  for (j = 0; j < image->height; j++) {
-    for (i = 0; i < image->width; i++) {
-      double value = 0.0;
-      RaveField_getValue(field, i, j, &value);
-      put_pixel(image, i, j, 0, (Byte)(value)); // why + 0.5 ?
-    }
-  }
-
-  result = 1;
-done:
-  return result;
-}
-
-/**
- * Creates a polar scan from an fmi image.
- * @param[in] image - the fmi image
- * @param[in] quantity - the quantity of the parameter. If null, default is DBZH.
- * @return the polar scan on success otherwise NULL
- */
-static PolarScan_t* RaveFmiImageInternal_fmiImageToScan(FmiImage* image, const char* quantity)
-{
-  PolarScan_t* scan = NULL;
-  PolarScan_t* result = NULL;
-  PolarScanParam_t* param = NULL;
-  int ray = 0, bin = 0;
-  RAVE_ASSERT((image != NULL), "image == NULL");
-
-  scan = RAVE_OBJECT_NEW(&PolarScan_TYPE);
-  param = RAVE_OBJECT_NEW(&PolarScanParam_TYPE);
-  if (scan == NULL || param == NULL) {
-    RAVE_CRITICAL0("Failed to allocate memory for polar scan");
-    goto done;
-  }
-
-  PolarScanParam_setGain(param, 1.0);
-  PolarScanParam_setOffset(param, 0.0);
-  PolarScanParam_setNodata(param, 255.0);
-  PolarScanParam_setUndetect(param, 0.0);
-  if (quantity != NULL) {
-    PolarScanParam_setQuantity(param, quantity);
-  } else {
-    PolarScanParam_setQuantity(param, "DBZH");
-  }
-  if (!PolarScanParam_createData(param, image->width, image->height, RaveDataType_UCHAR)) {
-    RAVE_CRITICAL0("Failed to allocate memory for data");
-    goto done;
-  }
-
-  for (ray = 0; ray < image->height; ray++) {
-    for (bin = 0; bin < image->width; bin++) {
-      PolarScanParam_setValue(param, bin, ray, (double)get_pixel(image, bin, ray, 0));
-    }
-  }
-  if (!PolarScan_addParameter(scan, param)) {
-    RAVE_CRITICAL0("Failed to add parameter to scan");
-    goto done;
-  }
-  PolarScan_setRscale(scan, image->bin_depth);
-  PolarScan_setElangle(scan, image->elevation_angle * M_PI / 180.0);
-  PolarScan_setRstart(scan, 0.0);
-
-  result = RAVE_OBJECT_COPY(scan);
-done:
-  RAVE_OBJECT_RELEASE(scan);
-  RAVE_OBJECT_RELEASE(param);
-  return result;
-}
-
-/**
- * Creates a rave field from an fmi image.
- * @param[in] image - the fmi image
- * @param[in] quantity - the quantity of the parameter. If null, default is DBZH.
- * @return the rave field on success otherwise NULL
- */
-static RaveField_t* RaveFmiImageInternal_fmiImageToField(FmiImage* image)
-{
-  RaveField_t* field = NULL;
-  RaveField_t* result = NULL;
-  int ray = 0, bin = 0;
-  RAVE_ASSERT((image != NULL), "image == NULL");
-
-  field = RAVE_OBJECT_NEW(&RaveField_TYPE);
-  if (field == NULL) {
-    RAVE_CRITICAL0("Failed to allocate memory for field");
-    goto done;
-  }
-
-  if (!RaveField_createData(field, image->width, image->height, RaveDataType_UCHAR)) {
-    RAVE_CRITICAL0("Failed to allocate memory for data");
-    goto done;
-  }
-
-  for (ray = 0; ray < image->height; ray++) {
-    for (bin = 0; bin < image->width; bin++) {
-      RaveField_setValue(field, bin, ray, (double)get_pixel(image, bin, ray, 0));
-    }
-  }
-
-  result = RAVE_OBJECT_COPY(field);
-done:
-  RAVE_OBJECT_RELEASE(field);
-  return result;
-}
-
-/*@} End of Private functions */
-
-/*@{ Interface functions */
-int RaveFmiImage_initialize(RaveFmiImage_t* self, int width, int height)
-{
-  int result = 0;
-  RAVE_ASSERT((self != NULL), "self == NULL");
-  if (width <= 0 || height <= 0) {
-    RAVE_ERROR0("You can not initialize a fmi image with width or height = 0");
-  } else {
-    FmiImage* images = new_image(1);
-    if (images != NULL) {
-      RaveFmiImageInternal_resetImage(self);
-      self->image = images;
-      self->image->width = width;
-      self->image->height = height;
-      initialize_image(self->image);
-      result = 1;
-    }
-  }
-  return result;
-}
-
-void RaveFmiImage_clear(RaveFmiImage_t* self, unsigned char v)
-{
-  RAVE_ASSERT((self != NULL), "self == NULL");
-  if (self->image != NULL) {
-    fill_image(self->image, (Byte)v);
-  }
-}
-
-FmiImage* RaveFmiImage_getImage(RaveFmiImage_t* self)
-{
-  RAVE_ASSERT((self != NULL), "self == NULL");
-  return self->image;
-}
-
-PolarScan_t* RaveFmiImage_toPolarScan(RaveFmiImage_t* self, const char* quantity)
-{
-  PolarScan_t* result = NULL;
-  PolarScan_t* scan = NULL;
-
-  int i = 0;
-
-  RAVE_ASSERT((self != NULL), "self == NULL");
-
-  scan = RaveFmiImageInternal_fmiImageToScan(&self->image[i], quantity);
-  if (scan == NULL) {
-    RAVE_CRITICAL0("Failed to convert image to scan");
-    goto done;
-  }
-
-  result = RAVE_OBJECT_COPY(scan);
-done:
-  RAVE_OBJECT_RELEASE(scan);
-  return result;
-}
-
-RaveField_t* RaveFmiImage_toRaveField(RaveFmiImage_t* self)
-{
-  RaveField_t* result = NULL;
-  RaveField_t* field = NULL;
-
-  int i = 0;
-
-  RAVE_ASSERT((self != NULL), "self == NULL");
-
-  field = RaveFmiImageInternal_fmiImageToField(&self->image[i]);
-  if (field == NULL) {
-    RAVE_CRITICAL0("Failed to convert image to field");
-    goto done;
-  }
-
-  result = RAVE_OBJECT_COPY(field);
-done:
-  RAVE_OBJECT_RELEASE(field);
-  return result;
-}
-
-int RaveFmiImage_addAttribute(RaveFmiImage_t* self,  RaveAttribute_t* attribute)
-{
-  char* aname = NULL;
-  char* gname = NULL;
-  const char* name = NULL;
-  int result = 0;
-
-  RAVE_ASSERT((self != NULL), "self == NULL");
-
-  name = RaveAttribute_getName(attribute);
-  if (!RaveAttributeHelp_extractGroupAndName(name, &gname, &aname)) {
-    RAVE_ERROR1("Failed to extract group and name from %s", name);
-    goto done;
-  }
-
-  if ((strcasecmp("how", gname)==0 ||
-       strcasecmp("what", gname)==0 ||
-       strcasecmp("where", gname)==0) &&
-    strchr(aname, '/') == NULL) {
-    result = RaveObjectHashTable_put(self->attrs, name, (RaveCoreObject*)attribute);
-  }
-
-done:
-  RAVE_FREE(gname);
-  RAVE_FREE(aname);
-  return result;
-}
-
-RaveAttribute_t* RaveFmiImage_getAttribute(RaveFmiImage_t* self, const char* name)
-{
-  RAVE_ASSERT((self != NULL), "self == NULL");
-  if (name == NULL) {
-    RAVE_ERROR0("Trying to get an attribute with NULL name");
-    return NULL;
-  }
-  return (RaveAttribute_t*)RaveObjectHashTable_get(self->attrs, name);
-}
-
-RaveList_t* RaveFmiImage_getAttributeNames(RaveFmiImage_t* self)
-{
-  RAVE_ASSERT((self != NULL), "self == NULL");
-  return RaveObjectHashTable_keys(self->attrs);
-}
-
-RaveFmiImage_t* RaveFmiImage_new(int width, int height)
-{
-  RaveFmiImage_t* result = RAVE_OBJECT_NEW(&RaveFmiImage_TYPE);
-  if (result != NULL) {
-    if (!RaveFmiImage_initialize(result, width, height)) {
-      RAVE_OBJECT_RELEASE(result);
-    }
-  }
-  return result;
-}
-
-RaveFmiImage_t* RaveFmiImage_fromPolarVolume(PolarVolume_t* volume, int scannr, const char* quantity)
-{
-  int nrScans = 0;
-  PolarScan_t* scan = NULL;
-  RaveFmiImage_t* image = NULL;
-  RaveFmiImage_t* result = NULL;
-
-  RAVE_ASSERT((volume != NULL), "volume == NULL");
-
-  nrScans = PolarVolume_getNumberOfScans(volume);
-
-  if (scannr < 0 || scannr >= nrScans) {
-    RAVE_ERROR1("There is no scan at index %d for this volume.", scannr);
-    goto done;
-  }
-
-  image = RAVE_OBJECT_NEW(&RaveFmiImage_TYPE);
-  if (image == NULL) {
-    RAVE_CRITICAL0("Failed to create fmi image");
-    goto done;
-  }
-
-  scan = PolarVolume_getScan(volume, scannr);
-  if (scan == NULL) {
-    RAVE_ERROR1("Could not read scan at index %d.", scannr);
-    goto done;
-  }
-  if (quantity == NULL || PolarScan_hasParameter(scan, quantity)) {
-    if (!RaveFmiImageInternal_scanToFmiImage(scan, quantity, &image->image[0])) {
-      RAVE_ERROR0("Failed to convert scan to fmi image");
-      goto done;
-    }
-  }
-
-  result = RAVE_OBJECT_COPY(image);
-done:
-  RAVE_OBJECT_RELEASE(scan);
-  RAVE_OBJECT_RELEASE(image);
-  return result;
-}
-
-RaveFmiImage_t* RaveFmiImage_fromPolarScan(PolarScan_t* scan, const char* quantity)
-{
-  RaveFmiImage_t* image = NULL;
-  RaveFmiImage_t* result = NULL;
-
-  RAVE_ASSERT((scan != NULL), "scan == NULL");
-
-  image = RAVE_OBJECT_NEW(&RaveFmiImage_TYPE);
-  if (image == NULL) {
-    RAVE_CRITICAL0("Failed to create fmi image");
-    goto done;
-  }
-
-  if (quantity == NULL || PolarScan_hasParameter(scan, quantity)) {
-    if (!RaveFmiImageInternal_scanToFmiImage(scan, quantity, &image->image[0])) {
-      RAVE_ERROR0("Failed to convert scan to fmi image");
-      goto done;
-    }
-  }
-
-  result = RAVE_OBJECT_COPY(image);
-done:
-  RAVE_OBJECT_RELEASE(image);
-  return result;
-}
-
-RaveFmiImage_t* RaveFmiImage_fromRaveField(RaveField_t* field)
-{
-  RaveFmiImage_t* image = NULL;
-  RaveFmiImage_t* result = NULL;
-
-  RAVE_ASSERT((field != NULL), "field == NULL");
-
-  image = RAVE_OBJECT_NEW(&RaveFmiImage_TYPE);
-  if (image == NULL) {
-    RAVE_CRITICAL0("Failed to create fmi image");
-    goto done;
-  }
-
-  if (!RaveFmiImageInternal_fieldToFmiImage(field, &image->image[0])) {
-    RAVE_ERROR0("Failed to convert rave field to fmi image");
-    goto done;
-  }
-
-  result = RAVE_OBJECT_COPY(image);
-done:
-  RAVE_OBJECT_RELEASE(image);
-  return result;
-}
-
-RaveFmiImage_t* RaveFmiImage_fromRave(RaveCoreObject* object, const char* quantity)
-{
-  RAVE_ASSERT((object != NULL), "object == NULL");
-  if (RAVE_OBJECT_CHECK_TYPE(object, &PolarVolume_TYPE)) {
-    return RaveFmiImage_fromPolarVolume((PolarVolume_t*)object, 0, quantity);
-  } else if (RAVE_OBJECT_CHECK_TYPE(object, &PolarScan_TYPE)) {
-    return RaveFmiImage_fromPolarScan((PolarScan_t*)object, quantity);
-  } else if (RAVE_OBJECT_CHECK_TYPE(object, &RaveField_TYPE)) {
-    return RaveFmiImage_fromRaveField((RaveField_t*)object);
-  } else {
-    RAVE_ERROR1("RaveFmiImage_fromRave does not support %s", object->roh_type->name);
-  }
-  return NULL;
-}
-
-/*@} End of Interface functions */
-RaveCoreObjectType RaveFmiImage_TYPE = {
-    "RaveFmiImage",
-    sizeof(RaveFmiImage_t),
-    RaveFmiImage_constructor,
-    RaveFmiImage_destructor,
-    RaveFmiImage_copyconstructor /* No copy constructor */
-};
diff --git a/rack/ropo/rave_fmi_image.h b/rack/ropo/rave_fmi_image.h
deleted file mode 100644 (file)
index 26a94c7..0000000
+++ /dev/null
@@ -1,149 +0,0 @@
-/* --------------------------------------------------------------------
-Copyright (C) 2011 Swedish Meteorological and Hydrological Institute, SMHI,
-
-This file is part of bRack.
-
-bRack is free software: you can redistribute it and/or modify
-it under the terms of the GNU Lesser General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
-
-bRack is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public License
-along with bRack.  If not, see <http://www.gnu.org/licenses/>.
-------------------------------------------------------------------------*/
-
-/**
- * rave object wrapper for the fmi_image.
- * This object support \ref #RAVE_OBJECT_CLONE.
- * @file
- * @author Anders Henja (Swedish Meteorological and Hydrological Institute, SMHI)
- * @date 2011-08-31
- */
-#ifndef RAVE_FMI_IMAGE_H
-#define RAVE_FMI_IMAGE_H
-#include "rack/ropo/fmi_image.h"
-#include "rave_object.h"
-#include "polarvolume.h"
-#include "polarscan.h"
-#include "rave_field.h"
-
-/**
- * Defines a RaveFmiImage
- */
-typedef struct _RaveFmiImage_t RaveFmiImage_t;
-
-/**
- * Type definition to use when creating a rave object.
- */
-extern RaveCoreObjectType RaveFmiImage_TYPE;
-
-/**
- * Initializes the rave image with the specific width and height.
- * @see \ref RaveFmiImage_new for short cut version
- * @param[in] self - self
- * @param[in] width - width
- * @param[in] height - height
- * @return 1 on success otherwise 0
- */
-int RaveFmiImage_initialize(RaveFmiImage_t* self, int width, int height);
-
-/**
- * Clears the image with the provided value.
- * @param[in] self - self
- * @param[in] v - the pixel value to set for all pixels
- */
-void RaveFmiImage_clear(RaveFmiImage_t* self, unsigned char v);
-
-/**
- * Returns the internal FmiImage.
- * @param[in] self - self
- * @return the internal fmi image (NOTE, THIS IS AN INTERNAL POINTER SO DO NOT RELEASE)
- */
-FmiImage* RaveFmiImage_getImage(RaveFmiImage_t* self);
-
-/**
- * Creates a polar scan from a fmi image
- * @param[in] self - self
- * @param[in] quantity - the quantity to be set for the parameters (may be NULL)
- * @return a polar volume on success otherwise NULL
- */
-PolarScan_t* RaveFmiImage_toPolarScan(RaveFmiImage_t* self, const char* quantity);
-
-/**
- * Creates a rave field from a fmi image
- * @param[in] self - self
- * @return a polar volume on success otherwise NULL
- */
-RaveField_t* RaveFmiImage_toRaveField(RaveFmiImage_t* self);
-
-/**
- * Adds a rave attribute to the image.
- * @param[in] self - self
- * @param[in] attribute - the attribute
- * @return 1 on success otherwise 0
- */
-int RaveFmiImage_addAttribute(RaveFmiImage_t* self,  RaveAttribute_t* attribute);
-
-/**
- * Returns the rave attribute that is named accordingly.
- * @param[in] self - self
- * @param[in] name - the name of the attribute
- * @returns the attribute if found otherwise NULL
- */
-RaveAttribute_t* RaveFmiImage_getAttribute(RaveFmiImage_t* self, const char* name);
-
-/**
- * Returns a list of attribute names. Release with \@ref #RaveList_freeAndDestroy.
- * @param[in] self - self
- * @returns a list of attribute names
- */
-RaveList_t* RaveFmiImage_getAttributeNames(RaveFmiImage_t* self);
-
-/**
- * Creates a rave fmi image with specified dimension
- * @param[in] width - the width
- * @param[in] height - the height
- * @return the fmi image on success otherwise NULL
- */
-RaveFmiImage_t* RaveFmiImage_new(int width, int height);
-
-/**
- * Creates a fmi image from a specific scan in a polar volume
- * @param[in] volume - the polar volume
- * @param[in] scannr - the polar scan in the volume
- * @param[in] quantity - the quantity to use for building the fmi image (NULL == default parameter)
- * @return the object on success otherwise NULL
- */
-RaveFmiImage_t* RaveFmiImage_fromPolarVolume(PolarVolume_t* volume, int scannr, const char* quantity);
-
-/**
- * Creates a fmi image from a polar scan
- * @param[in] scan - the polar scan
- * @param[in] quantity - the quantity to use for building the fmi image (NULL == default parameter)
- * @return the object on success otherwise NULL
- */
-RaveFmiImage_t* RaveFmiImage_fromPolarScan(PolarScan_t* scan, const char* quantity);
-
-/**
- * Creates a fmi image from a rave field
- * @param[in] field - the rave field
- * @return the object on success otherwise NULL
- */
-RaveFmiImage_t* RaveFmiImage_fromRaveField(RaveField_t* field);
-
-/**
- * Creates a fmi image from a rave object. Currently supported object types
- * are. PolarVolume_t, PolarScan_t and RaveField_t. If it is a polar volume
- * scan 0 is assumed.
- * @param[in] object - the object to generate an fmi image from
- * @param[in] quantity - the specific quantity (NULL == default parameter if applicable)
- * @return the object on success otherwise NULL
- */
-RaveFmiImage_t* RaveFmiImage_fromRave(RaveCoreObject* object, const char* quantity);
-
-#endif /* RAVE_FMI_IMAGE_H */
diff --git a/rack/ropo/rave_fmi_volume.c b/rack/ropo/rave_fmi_volume.c
deleted file mode 100644 (file)
index f59848b..0000000
+++ /dev/null
@@ -1,468 +0,0 @@
-/* --------------------------------------------------------------------
-Copyright (C) 2011 Swedish Meteorological and Hydrological Institute, SMHI,
-
-This file is part of bRack.
-
-bRack is free software: you can redistribute it and/or modify
-it under the terms of the GNU Lesser General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
-
-bRack is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public License
-along with bRack.  If not, see <http://www.gnu.org/licenses/>.
-------------------------------------------------------------------------*/
-
-/**
- * rave object wrapper for the fmi_image as a volume.
- * This object DOES NOT support \ref #RAVE_OBJECT_CLONE.
- * @file
- * @author Anders Henja (Swedish Meteorological and Hydrological Institute, SMHI)
- * @date 2011-08-31
- */
-#include "rack/ropo/rave_fmi_volume.h"
-#include "rave_debug.h"
-#include "rave_alloc.h"
-
-/**
- * Represents a rave fmi image
- */
-struct _RaveFmiVolume_t {
-  RAVE_OBJECT_HEAD /** Always on top */
-  FmiImage* image; /**< the fmi image */
-  int sweepCount;  /**< the sweep count */
-};
-
-/*@{ Private functions */
-/**
- * Constructor
- */
-static int RaveFmiVolume_constructor(RaveCoreObject* obj)
-{
-  RaveFmiVolume_t* this = (RaveFmiVolume_t*)obj;
-  this->image = NULL;
-  this->sweepCount = 0;
-  return 1;
-}
-
-/**
- * Releases all memory allocated in the fmi image.
- * @param[in] img - the rave fmi volume to reset
- */
-static void RaveFmiVolumeInternal_resetImage(RaveFmiVolume_t* img)
-{
-  int i = 0;
-  if (img->image != NULL) {
-    for (i = 0; i < img->sweepCount; i++) {
-      if (img->image[i].heights != NULL) {
-        free(img->image[i].heights);
-      }
-      if (img->image[i].array != NULL) {
-        free(img->image[i].array);
-      }
-    }
-    free(img->image);
-  }
-  img->image = NULL;
-  img->sweepCount = 0;
-}
-
-/**
- * Destructor
- */
-static void RaveFmiVolume_destructor(RaveCoreObject* obj)
-{
-  RaveFmiVolume_t* src = (RaveFmiVolume_t*)obj;
-  RaveFmiVolumeInternal_resetImage(src);
-}
-
-/**
- * Counts the number of sweeps that a volume would result in.
- * @param[in] volume - the rave volume
- * @param[in] quantity - the quantity of the parameter (if NULL, default parameter will be used)
- */
-static int RaveFmiVolumeInternal_getSweepCount(PolarVolume_t* volume, const char* quantity)
-{
-  int sweepCount = 0;
-  int i = 0;
-  int nrScans = 0;
-  RAVE_ASSERT((volume != NULL), "volume == NULL");
-
-  nrScans = PolarVolume_getNumberOfScans(volume);
-
-  /**
-   * Count number of scans with wanted quantity
-   */
-  for (i = 0; i < nrScans; i++) {
-    PolarScan_t* scan = PolarVolume_getScan(volume, i);
-    if (scan != NULL) {
-      if (quantity == NULL || PolarScan_hasParameter(scan, quantity)) {
-        sweepCount++;
-      }
-    }
-    RAVE_OBJECT_RELEASE(scan);
-  }
-
-  return sweepCount;
-}
-
-/**
- * Converts a rave polar scan into a fmi image
- * @param[in] scan - the rave polar scan
- * @param[in] quantity - the quantity to use (if NULL, default parameter is assumed)
- * @param[in] image - the image to be filled
- * @return 1 on success otherwise 0
- */
-static int RaveFmiVolumeInternal_scanToFmiImage(PolarScan_t* scan, const char* quantity, FmiImage* image)
-{
-  int i = 0, j = 0;
-  int result = 0;
-  PolarScanParam_t* param = NULL;
-
-  RAVE_ASSERT((scan != NULL), "scan == NULL");
-  RAVE_ASSERT((image != NULL), "image == NULL");
-
-  image->width=PolarScan_getNbins(scan);
-  image->height=PolarScan_getNrays(scan);
-  image->bin_depth=PolarScan_getRscale(scan);
-  image->elevation_angle=PolarScan_getElangle(scan) * 180.0 / M_PI; /* elangles in degrees for ropo */
-  image->max_value=255;
-  image->channels=1;
-
-  initialize_image(image);
-
-  if (quantity == NULL) {
-    param = PolarScan_getParameter(scan, "DBZH");
-  } else {
-    param = PolarScan_getParameter(scan, quantity);
-  }
-
-  if (param == NULL) {
-    RAVE_WARNING1("Failed to extract parameter %s from scan", quantity);
-    goto done;
-  }
-  if (PolarScanParam_getDataType(param) != RaveDataType_CHAR &&
-      PolarScanParam_getDataType(param) != RaveDataType_UCHAR) {
-    RAVE_WARNING0("FmiImages can only support 8-bit data");
-    goto done;
-  }
-
-  for (j = 0; j < image->height; j++) {
-    for (i = 0; i < image->width; i++) {
-      double value = 0.0;
-      PolarScanParam_getValue(param, i, j, &value);
-      put_pixel(image, i, j, 0, (Byte)(value)); // why + 0.5 ?
-    }
-  }
-
-  result = 1;
-done:
-  RAVE_OBJECT_RELEASE(param);
-  return result;
-}
-
-/**
- * Converts a rave field into a fmi image
- * @param[in] field - the rave field
- * @param[in] image - the image to be filled
- * @return 1 on success otherwise 0
- */
-static int RaveFmiVolumeInternal_fieldToFmiImage(RaveField_t* field, FmiImage* image)
-{
-  int i = 0, j = 0;
-  int result = 0;
-
-  RAVE_ASSERT((field != NULL), "field == NULL");
-  RAVE_ASSERT((image != NULL), "image == NULL");
-
-  image->width=RaveField_getXsize(field);
-  image->height=RaveField_getYsize(field);
-  image->channels=1;
-
-  initialize_image(image);
-
-  if (RaveField_getDataType(field) != RaveDataType_CHAR &&
-      RaveField_getDataType(field) != RaveDataType_UCHAR) {
-    RAVE_WARNING0("FmiImages can only support 8-bit data");
-    goto done;
-  }
-
-  for (j = 0; j < image->height; j++) {
-    for (i = 0; i < image->width; i++) {
-      double value = 0.0;
-      RaveField_getValue(field, i, j, &value);
-      put_pixel(image, i, j, 0, (Byte)(value)); // why + 0.5 ?
-    }
-  }
-
-  result = 1;
-done:
-  return result;
-}
-
-/**
- * Creates a polar scan from an fmi image.
- * @param[in] image - the fmi image
- * @param[in] quantity - the quantity of the parameter. If null, default is DBZH.
- * @return the polar scan on success otherwise NULL
- */
-static PolarScan_t* RaveFmiVolumeInternal_fmiImageToScan(FmiImage* image, const char* quantity)
-{
-  PolarScan_t* scan = NULL;
-  PolarScan_t* result = NULL;
-  PolarScanParam_t* param = NULL;
-  int ray = 0, bin = 0;
-  RAVE_ASSERT((image != NULL), "image == NULL");
-
-  scan = RAVE_OBJECT_NEW(&PolarScan_TYPE);
-  param = RAVE_OBJECT_NEW(&PolarScanParam_TYPE);
-  if (scan == NULL || param == NULL) {
-    RAVE_CRITICAL0("Failed to allocate memory for polar scan");
-    goto done;
-  }
-
-  PolarScanParam_setGain(param, 1.0);
-  PolarScanParam_setOffset(param, 0.0);
-  PolarScanParam_setNodata(param, 255.0);
-  PolarScanParam_setUndetect(param, 0.0);
-  if (quantity != NULL) {
-    PolarScanParam_setQuantity(param, quantity);
-  } else {
-    PolarScanParam_setQuantity(param, "DBZH");
-  }
-  if (!PolarScanParam_createData(param, image->width, image->height, RaveDataType_UCHAR)) {
-    RAVE_CRITICAL0("Failed to allocate memory for data");
-    goto done;
-  }
-
-  for (ray = 0; ray < image->height; ray++) {
-    for (bin = 0; bin < image->width; bin++) {
-      PolarScanParam_setValue(param, bin, ray, (double)get_pixel(image, bin, ray, 0));
-    }
-  }
-  if (!PolarScan_addParameter(scan, param)) {
-    RAVE_CRITICAL0("Failed to add parameter to scan");
-    goto done;
-  }
-  PolarScan_setRscale(scan, image->bin_depth);
-  PolarScan_setElangle(scan, image->elevation_angle * M_PI / 180.0);
-  PolarScan_setRstart(scan, 0.0);
-
-  result = RAVE_OBJECT_COPY(scan);
-done:
-  RAVE_OBJECT_RELEASE(scan);
-  RAVE_OBJECT_RELEASE(param);
-  return result;
-}
-
-/*@} End of Private functions */
-
-/*@{ Interface functions */
-int RaveFmiVolume_initialize(RaveFmiVolume_t* self, int sweepCount)
-{
-  int result = 0;
-  RAVE_ASSERT((self != NULL), "self == NULL");
-  if (sweepCount <= 0) {
-    RAVE_ERROR0("You can not initialize a fmi image with sweepCount <= 0");
-  } else {
-    FmiImage* images = new_image(sweepCount);
-    if (images != NULL) {
-      RaveFmiVolumeInternal_resetImage(self);
-      self->image = images;
-      self->sweepCount = sweepCount;
-      result = 1;
-    }
-  }
-  return result;
-}
-
-int RaveFmiVolume_getSweepCount(RaveFmiVolume_t* self)
-{
-  RAVE_ASSERT((self != NULL), "self == NULL");
-  return self->sweepCount;
-}
-
-FmiImage* RaveFmiVolume_getImage(RaveFmiVolume_t* self)
-{
-  RAVE_ASSERT((self != NULL), "self == NULL");
-  return self->image;
-}
-
-FmiImage* RaveFmiVolume_getSweep(RaveFmiVolume_t* self, int sweep)
-{
-  RAVE_ASSERT((self != NULL), "self == NULL");
-  if (sweep >= 0 && sweep < self->sweepCount) {
-    return &self->image[sweep];
-  }
-  return NULL;
-}
-
-PolarVolume_t* RaveFmiVolume_toRave(RaveFmiVolume_t* self, const char* quantity)
-{
-  PolarVolume_t* result = NULL;
-  PolarVolume_t* volume = NULL;
-  PolarScan_t* scan = NULL;
-
-  int i = 0;
-
-  RAVE_ASSERT((self != NULL), "self == NULL");
-
-  volume = RAVE_OBJECT_NEW(&PolarVolume_TYPE);
-  if (volume == NULL) {
-    RAVE_CRITICAL0("Failed to create volume");
-    goto done;
-  }
-
-  for (i = 0; i < self->sweepCount; i++) {
-    scan = RaveFmiVolumeInternal_fmiImageToScan(&self->image[i], quantity);
-    if (scan == NULL) {
-      RAVE_CRITICAL0("Failed to convert image to scan");
-      goto done;
-    }
-    if (!PolarVolume_addScan(volume, scan)) {
-      RAVE_CRITICAL0("Failed to add scan to volume");
-      goto done;
-    }
-    RAVE_OBJECT_RELEASE(scan);
-  }
-
-  result = RAVE_OBJECT_COPY(volume);
-done:
-  RAVE_OBJECT_RELEASE(scan);
-  RAVE_OBJECT_RELEASE(volume);
-  return result;
-}
-
-RaveFmiVolume_t* RaveFmiVolume_new(int sweepCount)
-{
-  RaveFmiVolume_t* result = RAVE_OBJECT_NEW(&RaveFmiVolume_TYPE);
-  if (result != NULL) {
-    if (!RaveFmiVolume_initialize(result, sweepCount)) {
-      RAVE_OBJECT_RELEASE(result);
-    }
-  }
-  return result;
-}
-
-RaveFmiVolume_t* RaveFmiVolume_fromPolarVolume(PolarVolume_t* volume, const char* quantity)
-{
-  int sweepCount = 0;
-  int nrScans = 0;
-  int i = 0;
-  int sweepIndex = 0;
-  RaveFmiVolume_t* image = NULL;
-  RaveFmiVolume_t* result = NULL;
-
-  RAVE_ASSERT((volume != NULL), "volume == NULL");
-
-  PolarVolume_sortByElevations(volume, 1);
-  nrScans = PolarVolume_getNumberOfScans(volume);
-  sweepCount = RaveFmiVolumeInternal_getSweepCount(volume, quantity);
-
-  if (sweepCount <= 0) {
-    RAVE_WARNING0("Volume does not contain any wanted parameters");
-    goto done;
-  }
-
-  image = RaveFmiVolume_new(sweepCount);
-  if (image == NULL) {
-    RAVE_CRITICAL0("Failed to create fmi image");
-    goto done;
-  }
-
-  for (i = 0; i < nrScans; i++) {
-    PolarScan_t* scan = PolarVolume_getScan(volume, i);
-    if (quantity == NULL || PolarScan_hasParameter(scan, quantity)) {
-      if (!RaveFmiVolumeInternal_scanToFmiImage(scan, quantity, &image->image[sweepIndex])) {
-        RAVE_ERROR0("Failed to convert scan to fmi image");
-        RAVE_OBJECT_RELEASE(scan);
-        goto done;
-      }
-      sweepIndex++;
-    }
-    RAVE_OBJECT_RELEASE(scan);
-  }
-
-  result = RAVE_OBJECT_COPY(image);
-done:
-  RAVE_OBJECT_RELEASE(image);
-  return result;
-}
-
-RaveFmiVolume_t* RaveFmiVolume_fromPolarScan(PolarScan_t* scan, const char* quantity)
-{
-  RaveFmiVolume_t* image = NULL;
-  RaveFmiVolume_t* result = NULL;
-
-  RAVE_ASSERT((scan != NULL), "scan == NULL");
-
-  image = RaveFmiVolume_new(1);
-  if (image == NULL) {
-    RAVE_CRITICAL0("Failed to create fmi image");
-    goto done;
-  }
-
-  if (quantity == NULL || PolarScan_hasParameter(scan, quantity)) {
-    if (!RaveFmiVolumeInternal_scanToFmiImage(scan, quantity, &image->image[0])) {
-      RAVE_ERROR0("Failed to convert scan to fmi image");
-      goto done;
-    }
-  }
-
-  result = RAVE_OBJECT_COPY(image);
-done:
-  RAVE_OBJECT_RELEASE(image);
-  return result;
-}
-
-RaveFmiVolume_t* RaveFmiVolume_fromRaveField(RaveField_t* field)
-{
-  RaveFmiVolume_t* image = NULL;
-  RaveFmiVolume_t* result = NULL;
-
-  RAVE_ASSERT((field != NULL), "field == NULL");
-
-  image = RaveFmiVolume_new(1);
-  if (image == NULL) {
-    RAVE_CRITICAL0("Failed to create fmi image");
-    goto done;
-  }
-
-  if (!RaveFmiVolumeInternal_fieldToFmiImage(field, &image->image[0])) {
-    RAVE_ERROR0("Failed to convert rave field to fmi image");
-    goto done;
-  }
-
-  result = RAVE_OBJECT_COPY(image);
-done:
-  RAVE_OBJECT_RELEASE(image);
-  return result;
-}
-
-RaveFmiVolume_t* RaveFmiVolume_fromRave(RaveCoreObject* object, const char* quantity)
-{
-  RAVE_ASSERT((object != NULL), "object == NULL");
-  if (RAVE_OBJECT_CHECK_TYPE(object, &PolarVolume_TYPE)) {
-    return RaveFmiVolume_fromPolarVolume((PolarVolume_t*)object, quantity);
-  } else if (RAVE_OBJECT_CHECK_TYPE(object, &PolarScan_TYPE)) {
-    return RaveFmiVolume_fromPolarScan((PolarScan_t*)object, quantity);
-  } else if (RAVE_OBJECT_CHECK_TYPE(object, &RaveField_TYPE)) {
-    return RaveFmiVolume_fromRaveField((RaveField_t*)object);
-  } else {
-    RAVE_ERROR1("RaveFmiVolume_fromRave does not support %s", object->roh_type->name);
-  }
-  return NULL;
-}
-
-/*@} End of Interface functions */
-RaveCoreObjectType RaveFmiVolume_TYPE = {
-    "RaveFmiVolume",
-    sizeof(RaveFmiVolume_t),
-    RaveFmiVolume_constructor,
-    RaveFmiVolume_destructor,
-    NULL /* No copy constructor */
-};
diff --git a/rack/ropo/rave_fmi_volume.h b/rack/ropo/rave_fmi_volume.h
deleted file mode 100644 (file)
index 82852b4..0000000
+++ /dev/null
@@ -1,122 +0,0 @@
-/* --------------------------------------------------------------------
-Copyright (C) 2011 Swedish Meteorological and Hydrological Institute, SMHI,
-
-This file is part of bRack.
-
-bRack is free software: you can redistribute it and/or modify
-it under the terms of the GNU Lesser General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
-
-bRack is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public License
-along with bRack.  If not, see <http://www.gnu.org/licenses/>.
-------------------------------------------------------------------------*/
-
-/**
- * rave object wrapper for the fmi_image.
- * This object DOES NOT support \ref #RAVE_OBJECT_CLONE.
- * @file
- * @author Anders Henja (Swedish Meteorological and Hydrological Institute, SMHI)
- * @date 2011-09-02
- */
-#ifndef RAVE_FMI_VOLUME_H
-#define RAVE_FMI_VOLUME_H
-#include "rack/ropo/fmi_image.h"
-#include "rave_object.h"
-#include "polarvolume.h"
-#include "polarscan.h"
-
-/**
- * Defines a RaveFmiVolume
- */
-typedef struct _RaveFmiVolume_t RaveFmiVolume_t;
-
-/**
- * Type definition to use when creating a rave object.
- */
-extern RaveCoreObjectType RaveFmiVolume_TYPE;
-
-/**
- * Initializes the rave image with the specific number of sweeps.
- * @see \ref RaveFmiVolume_new for short cut version
- * @param[in] self - self
- * @param[in] sweepCount - number of sweeps this image should consist of > 0
- * @return 1 on success otherwise 0
- */
-int RaveFmiVolume_initialize(RaveFmiVolume_t* self, int sweepCount);
-
-/**
- * Returns the number of sweeps this image is built from
- * @param[in] self - self
- * @return number of sweeps
- */
-int RaveFmiVolume_getSweepCount(RaveFmiVolume_t* self);
-
-/**
- * Returns the internal FmiImage.
- * @param[in] self - self
- * @return the internal fmi image (NOTE, THIS IS AN INTERNAL POINTER SO DO NOT RELEASE)
- */
-FmiImage* RaveFmiVolume_getImage(RaveFmiVolume_t* self);
-
-/**
- * Returns the internal sweep pointer.
- * @param[in] self - self
- * @param[in] sweep - the sweep index
- * @return the sweep at specified index
- */
-FmiImage* RaveFmiVolume_getSweep(RaveFmiVolume_t* self, int sweep);
-
-/**
- * Creates a polar volume from a fmi image
- * @param[in] self - self
- * @param[in] quantity - the quantity to be set for the parameters (may be NULL)
- * @return a polar volume on success otherwise NULL
- */
-PolarVolume_t* RaveFmiVolume_toRave(RaveFmiVolume_t* self, const char* quantity);
-
-/**
- * Creates a rave fmi image with specified number of sweeps
- * @param[in] sweepCount - the number of sweeps > 0
- * @return the fmi image on success otherwise NULL
- */
-RaveFmiVolume_t* RaveFmiVolume_new(int sweepCount);
-
-/**
- * Creates a fmi image from a polar volume
- * @param[in] volume - the polar volume
- * @param[in] quantity - the quantity to use for building the fmi image (NULL == default parameter)
- * @return the object on success otherwise NULL
- */
-RaveFmiVolume_t* RaveFmiVolume_fromPolarVolume(PolarVolume_t* volume, const char* quantity);
-
-/**
- * Creates a fmi image from a polar scan
- * @param[in] scan - the polar scan
- * @param[in] quantity - the quantity to use for building the fmi image (NULL == default parameter)
- * @return the object on success otherwise NULL
- */
-RaveFmiVolume_t* RaveFmiVolume_fromPolarScan(PolarScan_t* scan, const char* quantity);
-
-/**
- * Creates a fmi image from a rave field
- * @param[in] field - the rave field
- * @return the object on success otherwise NULL
- */
-RaveFmiVolume_t* RaveFmiVolume_fromRaveField(RaveField_t* field);
-
-/**
- * Creates a fmi image from a rave object. Currently supported object types
- * are. PolarVolume_t, PolarScan_t and RaveField_t
- * @param[in] object - the object to generate an fmi image from
- * @param[in] quantity - the specific quantity (NULL == default parameter if applicable)
- * @return the object on success otherwise NULL
- */
-RaveFmiVolume_t* RaveFmiVolume_fromRave(RaveCoreObject* object, const char* quantity);
-
-#endif /* RAVE_FMI_VOLUME_H */
diff --git a/rack/ropo/rave_ropo_generator.c b/rack/ropo/rave_ropo_generator.c
deleted file mode 100644 (file)
index 3f767de..0000000
+++ /dev/null
@@ -1,526 +0,0 @@
-/* --------------------------------------------------------------------
-Copyright (C) 2011 Swedish Meteorological and Hydrological Institute, SMHI,
-
-This file is part of bRack.
-
-bRack is free software: you can redistribute it and/or modify
-it under the terms of the GNU Lesser General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
-
-bRack is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public License
-along with bRack.  If not, see <http://www.gnu.org/licenses/>.
-------------------------------------------------------------------------*/
-
-/**
- * rave object wrapper for the ropo generator
- * This object DOES NOT support \ref #RAVE_OBJECT_CLONE.
- * @file
- * @author Anders Henja (Swedish Meteorological and Hydrological Institute, SMHI)
- * @date 2011-09-02
- */
-#include <limits.h>
-#include <math.h>
-#include <stdio.h>
-#include <string.h>
-#include <stdarg.h>
-#include <rack/ropo/fmi_util.h>
-#include <rack/ropo/fmi_image.h>
-#include <rack/ropo/fmi_image_filter.h>
-#include <rack/ropo/fmi_image_filter_line.h>
-#include <rack/ropo/fmi_image_histogram.h>
-#include <rack/ropo/fmi_image_filter_speck.h>
-#include <rack/ropo/fmi_image_filter_morpho.h>
-#include <rack/ropo/fmi_image_restore.h>
-#include <rack/ropo/fmi_meteosat.h>
-#include <rack/ropo/fmi_radar_image.h>
-
-#include "rack/ropo/rave_ropo_generator.h"
-#include "rave_debug.h"
-#include "rave_alloc.h"
-#include "raveobject_list.h"
-
-/**
- * Represents a rave fmi image
- */
-struct _RaveRopoGenerator_t {
-  RAVE_OBJECT_HEAD       /** Always on top */
-  RaveFmiImage_t* image; /**< the fmi image */
-  RaveObjectList_t* probabilities; /**< a list of probabilities */
-  RaveFmiImage_t* classification; /**< the classification field */
-  RaveFmiImage_t* markers; /**< the markers identifying what type of detector indicating probability */
-};
-
-/*@{ Private functions */
-static const char RopoGenerator_CLEAR_STR[] = "CLEAR:";
-static const char RopoGenerator_CUTOFF_STR[] = "CUTOFF:";
-static const char RopoGenerator_BIOMET_STR[] = "BIOMET:";
-static const char RopoGenerator_SHIP_STR[] = "SHIP:";
-static const char RopoGenerator_SUN_STR[] = "SUN:";
-static const char RopoGenerator_EMITTER_STR[] = "EMITTER:";
-static const char RopoGenerator_EMITTER2_STR[] = "EMITTER2:";
-static const char RopoGenerator_CLUTTER_STR[] = "CLUTTER:";
-static const char RopoGenerator_CLUTTER2_STR[] = "CLUTTER2:";
-static const char RopoGenerator_SPECK_STR[] = "SPECK:";
-static const char RopoGenerator_DOPPLER_STR[] = "DOPPLER:";
-static const char RopoGenerator_GROUND_STR[] = "GROUND:";
-static const char RopoGenerator_METEOSAT_STR[] = "METEOSAT:";
-static const char RopoGenerator_THRESH1_STR[] = "THRESH1:";
-static const char RopoGenerator_EMITTER3_STR[] = "EMITTER3:";
-static const char RopoGenerator_DATA_MIN_STR[] = "DATA_MIN:";
-static const char RopoGenerator_DATA_MAX_STR[] = "DATA_MAX:";
-static const char RopoGenerator_NO_DATA_STR[] = "NO_DATA:";
-
-struct RopoGenerator_PgmCodeMapping {
-  FmiRadarPGMCode type;  /**< the pgm code */
-  const char* str;       /**< the string representation */
-};
-
-/**
- * The product type mapping table.
- */
-static const struct RopoGenerator_PgmCodeMapping PGM_CODE_MAPPING[] =
-{
-  {CLEAR,  RopoGenerator_CLEAR_STR},
-  {CUTOFF,  RopoGenerator_CUTOFF_STR},
-  {BIOMET,  RopoGenerator_BIOMET_STR},
-  {SHIP,  RopoGenerator_SHIP_STR},
-  {SUN,  RopoGenerator_SUN_STR},
-  {EMITTER,  RopoGenerator_EMITTER_STR},
-  {EMITTER2,  RopoGenerator_EMITTER2_STR},
-  {CLUTTER,  RopoGenerator_CLUTTER_STR},
-  {CLUTTER2,  RopoGenerator_CLUTTER2_STR},
-  {SPECK,  RopoGenerator_SPECK_STR},
-  {DOPPLER,  RopoGenerator_DOPPLER_STR},
-  {METEOSAT,  RopoGenerator_METEOSAT_STR},
-  {THRESH1,  RopoGenerator_THRESH1_STR},
-  {EMITTER3,  RopoGenerator_EMITTER3_STR},
-  {DATA_MIN,  RopoGenerator_DATA_MIN_STR},
-  {DATA_MAX,  RopoGenerator_DATA_MAX_STR},
-  {NO_DATA,  RopoGenerator_NO_DATA_STR},
-  {-1, NULL}
-};
-
-/**
- * Constructor
- */
-static int RaveRopoGenerator_constructor(RaveCoreObject* obj)
-{
-  RaveRopoGenerator_t* this = (RaveRopoGenerator_t*)obj;
-  this->image = NULL;
-  this->classification = NULL;
-  this->markers = NULL;
-  this->probabilities = RAVE_OBJECT_NEW(&RaveObjectList_TYPE);
-
-  if (this->probabilities == NULL) {
-    goto error;
-  }
-  return 1;
-error:
-  RAVE_OBJECT_RELEASE(this->probabilities);
-  return 0;
-}
-
-/**
- * Destructor
- */
-static void RaveRopoGenerator_destructor(RaveCoreObject* obj)
-{
-  RaveRopoGenerator_t* src = (RaveRopoGenerator_t*)obj;
-  RAVE_OBJECT_RELEASE(src->image);
-  RAVE_OBJECT_RELEASE(src->probabilities);
-  RAVE_OBJECT_RELEASE(src->classification);
-  RAVE_OBJECT_RELEASE(src->markers);
-}
-
-/**
- * Adds how/task to the image.
- * @param[in] image - the image
- * @param[in] taskname - the name of the task executed
- * @return 1 on success otherwise 0
- */
-static int RaveRopoGeneratorInternal_addTask(RaveFmiImage_t* image, const char* taskname)
-{
-  RaveAttribute_t* attribute = NULL;
-  int result = 0;
-  RAVE_ASSERT((image != NULL), "image == NULL");
-  RAVE_ASSERT((taskname != NULL), "taskname == NULL");
-
-  attribute = RaveAttributeHelp_createString("how/task", taskname);
-  if (attribute == NULL || !RaveFmiImage_addAttribute(image, attribute)) {
-    RAVE_CRITICAL0("Failed to add attribute to image");
-    goto done;
-  }
-  result = 1;
-
-done:
-  RAVE_OBJECT_RELEASE(attribute);
-  return result;
-}
-
-/**
- * Adds how/task to the image.
- * @param[in] image - the image
- * @param[in] format - the var args format
- * @param[in] ... - the arguments
- * @return 1 on success otherwise 0
- */
-static int RaveRopoGeneratorInternal_addTaskArgs(RaveFmiImage_t* image, const char* fmt, ...)
-{
-  RaveAttribute_t* attribute = NULL;
-  int result = 0;
-  char fmtstring[1024];
-  va_list ap;
-  int n = 0;
-
-  RAVE_ASSERT((image != NULL), "image == NULL");
-  RAVE_ASSERT((fmt != NULL), "fmt == NULL");
-
-  va_start(ap, fmt);
-  n = vsnprintf(fmtstring, 1024, fmt, ap);
-  va_end(ap);
-  if (n < 0 || n >= 1024) {
-    RAVE_ERROR0("Failed to generate name");
-    goto done;
-  }
-
-  attribute = RaveAttributeHelp_createString("how/task_args", fmtstring);
-  if (attribute == NULL || !RaveFmiImage_addAttribute(image, attribute)) {
-    RAVE_CRITICAL0("Failed to add attribute to image");
-    goto done;
-  }
-  result = 1;
-
-done:
-  RAVE_OBJECT_RELEASE(attribute);
-  return result;
-}
-
-static int RaveRopoGeneratorInternal_addProbabilityTaskArgs(RaveFmiImage_t* image, RaveObjectList_t* probs)
-{
-  RaveFmiImage_t* field = NULL;
-  RaveAttribute_t* attr = NULL;
-  int sz = 0;
-  int i = 0;
-  int result = 0;
-  char pstr[1024];
-
-  RAVE_ASSERT((image != NULL), "image == NULL");
-  RAVE_ASSERT((probs != NULL), "probs == NULL");
-
-  memset(pstr, '\0', 1024);
-
-  sz = RaveObjectList_size(probs);
-  for (i = 0; i < sz; i++) {
-    field = (RaveFmiImage_t*)RaveObjectList_get(probs, i);
-    attr = RaveFmiImage_getAttribute(field, "how/task_args");
-    if (attr != NULL) {
-      char* attrstr = NULL;
-      if (!RaveAttribute_getString(attr, &attrstr) || attrstr == NULL) {
-        goto done;
-      }
-      if (strlen(pstr) > 0) {
-        strcat(pstr, ";");
-        strcat(pstr, attrstr);
-      }
-    }
-    RAVE_OBJECT_RELEASE(attr);
-    RAVE_OBJECT_RELEASE(field);
-  }
-
-  attr = RaveAttributeHelp_createString("how/task_args", pstr);
-  if (attr == NULL || !RaveFmiImage_addAttribute(image, attr)) {
-    RAVE_CRITICAL0("Failed to add attribute to image");
-    goto done;
-  }
-
-  result = 1;
-done:
-  RAVE_OBJECT_RELEASE(field);
-  RAVE_OBJECT_RELEASE(attr);
-  return result;
-}
-
-/**
- * Gets the attribute how/task_args and atempts to determine a FmiRadarPGMCode from
- * the string.
- * @param[in] image - the image
- * @return the identified PGM code on success or CLEAR if nothing could be identified
- */
-static FmiRadarPGMCode RaveRopoGeneratorInternal_getPgmCode(RaveFmiImage_t* image)
-{
-  RaveAttribute_t* taskargs = NULL;
-  FmiRadarPGMCode result = CLEAR;
-  RAVE_ASSERT((image != NULL), "image == NULL");
-
-  taskargs = RaveFmiImage_getAttribute(image, "how/task_args");
-  if (taskargs != NULL) {
-    char* argument = NULL;
-    int index = 0;
-    if (!RaveAttribute_getString(taskargs, &argument)) {
-      goto done;
-    }
-    if (argument == NULL) {
-      goto done;
-    }
-    while (PGM_CODE_MAPPING[index].str != NULL) {
-      if (strncmp(PGM_CODE_MAPPING[index].str, argument, strlen(PGM_CODE_MAPPING[index].str))==0) {
-        result = PGM_CODE_MAPPING[index].type;
-        goto done;
-      }
-      index++;
-    }
-  }
-done:
-  RAVE_OBJECT_RELEASE(taskargs);
-  return result;
-}
-
-/*@} End of Private functions */
-
-/*@{ Interface functions */
-void RaveRopoGenerator_setImage(RaveRopoGenerator_t* self, RaveFmiImage_t* image)
-{
-  RAVE_ASSERT((self != NULL), "self == NULL");
-  RAVE_ASSERT((image != NULL), "image == NULL");
-
-  RaveObjectList_clear(self->probabilities);
-  RAVE_OBJECT_RELEASE(self->image);
-  self->image = RAVE_OBJECT_COPY(image);
-}
-
-RaveFmiImage_t* RaveRopoGenerator_getImage(RaveRopoGenerator_t* self)
-{
-  RAVE_ASSERT((self != NULL), "self == NULL");
-  return RAVE_OBJECT_COPY(self->image);
-}
-
-int RaveRopoGenerator_speck(RaveRopoGenerator_t* self, int intensity, int sz)
-{
-  RaveFmiImage_t* probability = NULL;
-
-  int result = 0;
-
-  RAVE_ASSERT((self != NULL), "self == NULL");
-
-  if (self->image == NULL) {
-    RAVE_ERROR0("Calling speck when there is no image to operate on?");
-    goto done;
-  }
-
-  probability = RAVE_OBJECT_CLONE(self->image);
-  if (probability == NULL) {
-    RAVE_CRITICAL0("Failed to clone image");
-    goto done;
-  }
-
-  if (!RaveRopoGeneratorInternal_addTask(probability, "fi.fmi.ropo.detector") ||
-      !RaveRopoGeneratorInternal_addTaskArgs(probability, "SPECK: %d,%d",intensity, sz)) {
-    RAVE_CRITICAL0("Failed to add task arguments");
-    goto done;
-  }
-
-  detect_specks(RaveFmiImage_getImage(self->image),
-                RaveFmiImage_getImage(probability),
-                intensity, histogram_area);
-  semisigmoid_image(RaveFmiImage_getImage(probability), sz);
-  invert_image(RaveFmiImage_getImage(probability));
-  translate_intensity(RaveFmiImage_getImage(probability), 255, 0);
-
-  if (!RaveObjectList_add(self->probabilities, (RaveCoreObject*)probability)) {
-    RAVE_ERROR0("Failed to add probability field to probabilities");
-    goto done;
-  }
-
-  result = 1;
-done:
-  RAVE_OBJECT_RELEASE(probability);
-  return result;
-}
-
-int RaveRopoGenerator_emitter(RaveRopoGenerator_t* self, int intensity, int sz)
-{
-  RaveFmiImage_t* probability = NULL;
-
-  int result = 0;
-
-  RAVE_ASSERT((self != NULL), "self == NULL");
-
-  if (self->image == NULL) {
-    RAVE_ERROR0("Calling speck when there is no image to operate on?");
-    goto done;
-  }
-
-  probability = RAVE_OBJECT_CLONE(self->image);
-  if (probability == NULL) {
-    RAVE_CRITICAL0("Failed to clone image");
-    goto done;
-  }
-
-  if (!RaveRopoGeneratorInternal_addTask(probability, "fi.fmi.ropo.detector") ||
-      !RaveRopoGeneratorInternal_addTaskArgs(probability, "EMITTER: %d,%d",intensity, sz)) {
-    RAVE_CRITICAL0("Failed to add task arguments");
-    goto done;
-  }
-
-  detect_emitters(RaveFmiImage_getImage(self->image),
-                  RaveFmiImage_getImage(probability),
-                  intensity, sz);
-
-  if (!RaveObjectList_add(self->probabilities, (RaveCoreObject*)probability)) {
-    RAVE_ERROR0("Failed to add probability field to probabilities");
-    goto done;
-  }
-
-  result = 1;
-done:
-  RAVE_OBJECT_RELEASE(probability);
-  return result;
-}
-
-int RaveRopoGenerator_classify(RaveRopoGenerator_t* self)
-{
-  RaveFmiImage_t* probability = NULL;
-  RaveFmiImage_t* markers = NULL;
-  FmiImage* fmiProbImage = NULL;
-  FmiImage* fmiMarkersImage = NULL;
-  int result = 0;
-  int probCount = 0;
-  int i = 0;
-
-  RAVE_ASSERT((self != NULL), "self == NULL");
-
-  if (self->image == NULL) {
-    RAVE_ERROR0("Calling speck when there is no image to operate on?");
-    goto done;
-  }
-
-  probability = RAVE_OBJECT_CLONE(self->image);
-  markers = RAVE_OBJECT_CLONE(self->image);
-  if (probability == NULL || markers == NULL) {
-    RAVE_CRITICAL0("Failed to clone image");
-    goto done;
-  }
-
-  RaveFmiImage_clear(probability, CLEAR);
-  RaveFmiImage_clear(markers, CLEAR);
-
-  probCount = RaveObjectList_size(self->probabilities);
-
-  fmiProbImage = RaveFmiImage_getImage(probability);
-  fmiMarkersImage = RaveFmiImage_getImage(markers);
-
-  for (i = 0; i < probCount; i++) {
-    int j = 0;
-    RaveFmiImage_t* image = (RaveFmiImage_t*)RaveObjectList_get(self->probabilities, i);
-    FmiImage* probImage = RaveFmiImage_getImage(image);
-    FmiRadarPGMCode pgmCode = RaveRopoGeneratorInternal_getPgmCode(image);
-    for (j = 0; j < fmiProbImage->volume; j++) {
-      if (probImage->array[j] >= fmiProbImage->array[j]) {
-        fmiMarkersImage->array[j]=pgmCode;
-        fmiProbImage->array[j]=probImage->array[j];
-      }
-    }
-    RAVE_OBJECT_RELEASE(image);
-  }
-
-  if (!RaveRopoGeneratorInternal_addTask(probability, "fi.fmi.ropo.detector_classification") ||
-      !RaveRopoGeneratorInternal_addProbabilityTaskArgs(probability, self->probabilities)) {
-    RAVE_CRITICAL0("Failed to add task arguments");
-    goto done;
-  }
-
-  if (!RaveRopoGeneratorInternal_addTask(markers, "fi.fmi.ropo.detector_classification_marker") ||
-      !RaveRopoGeneratorInternal_addProbabilityTaskArgs(markers, self->probabilities)) {
-    RAVE_CRITICAL0("Failed to add task arguments");
-    goto done;
-  }
-
-  RAVE_OBJECT_RELEASE(self->classification);
-  RAVE_OBJECT_RELEASE(self->markers);
-  self->classification = RAVE_OBJECT_COPY(probability);
-  self->markers = RAVE_OBJECT_COPY(markers);
-
-  result = 1;
-done:
-  RAVE_OBJECT_RELEASE(probability);
-  RAVE_OBJECT_RELEASE(markers);
-  return result;
-}
-
-RaveFmiImage_t* RaveRopoGenerator_restore(RaveRopoGenerator_t* self, int threshold)
-{
-  RaveFmiImage_t* restored = NULL;
-  RaveFmiImage_t* result = NULL;
-
-  RAVE_ASSERT((self != NULL), "self == NULL");
-
-  if (self->classification == NULL || self->markers == NULL) {
-    RaveRopoGenerator_classify(self);
-  }
-  restored = RAVE_OBJECT_CLONE(self->image);
-  if (restored == NULL) {
-    RAVE_CRITICAL0("Failed to clone image");
-    goto done;
-  }
-
-  RaveFmiImage_clear(restored, CLEAR);
-
-  restore_image(RaveFmiImage_getImage(self->image),
-                RaveFmiImage_getImage(restored),
-                RaveFmiImage_getImage(self->classification),
-                threshold);
-
-  result = RAVE_OBJECT_COPY(restored);
-done:
-  RAVE_OBJECT_RELEASE(restored);
-  return result;
-}
-
-RaveFmiImage_t* RaveRopoGenerator_getClassification(RaveRopoGenerator_t* self)
-{
-  RAVE_ASSERT((self != NULL), "self == NULL");
-  if (self->classification == NULL || self->markers == NULL) {
-    RaveRopoGenerator_classify(self);
-  }
-  return RAVE_OBJECT_COPY(self->classification);
-}
-
-RaveFmiImage_t* RaveRopoGenerator_getMarkers(RaveRopoGenerator_t* self)
-{
-  RAVE_ASSERT((self != NULL), "self == NULL");
-  if (self->classification == NULL || self->markers == NULL) {
-    RaveRopoGenerator_classify(self);
-  }
-  return RAVE_OBJECT_COPY(self->markers);
-}
-
-RaveRopoGenerator_t* RaveRopoGenerator_new(RaveFmiImage_t* image)
-{
-  RaveRopoGenerator_t* result = NULL;
-  RAVE_ASSERT((image != NULL), "image == NULL");
-
-  result = RAVE_OBJECT_NEW(&RaveRopoGenerator_TYPE);
-
-  if (result == NULL) {
-    RAVE_CRITICAL0("Failed to allocate memory for generator");
-    return NULL;
-  }
-  result->image = RAVE_OBJECT_COPY(image);
-
-  return result;
-}
-
-/*@} End of Interface functions */
-RaveCoreObjectType RaveRopoGenerator_TYPE = {
-    "RaveRopoGenerator",
-    sizeof(RaveRopoGenerator_t),
-    RaveRopoGenerator_constructor,
-    RaveRopoGenerator_destructor,
-    NULL /* No copy constructor */
-};
diff --git a/rack/ropo/rave_ropo_generator.h b/rack/ropo/rave_ropo_generator.h
deleted file mode 100644 (file)
index 882de29..0000000
+++ /dev/null
@@ -1,105 +0,0 @@
-/* --------------------------------------------------------------------
-Copyright (C) 2011 Swedish Meteorological and Hydrological Institute, SMHI,
-
-This file is part of bRack.
-
-bRack is free software: you can redistribute it and/or modify
-it under the terms of the GNU Lesser General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
-
-bRack is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public License
-along with bRack.  If not, see <http://www.gnu.org/licenses/>.
-------------------------------------------------------------------------*/
-
-/**
- * rave object wrapper for the ropo generator
- * This object DOES NOT support \ref #RAVE_OBJECT_CLONE.
- * @file
- * @author Anders Henja (Swedish Meteorological and Hydrological Institute, SMHI)
- * @date 2011-09-02
- */
-#ifndef RAVE_ROPO_GENERATOR_H
-#define RAVE_ROPO_GENERATOR_H
-
-#include "rack/ropo/rave_fmi_image.h"
-#include "rave_object.h"
-
-/**
- * Defines a RaveRopoGenerator
- */
-typedef struct _RaveRopoGenerator_t RaveRopoGenerator_t;
-
-/**
- * Type definition to use when creating a rave object.
- */
-extern RaveCoreObjectType RaveRopoGenerator_TYPE;
-
-/**
- * Sets the rave fmi image to use during this generation. This will
- * clear all previous calculations.
- * @param[in] self - self
- * @param[in] image - the image to perform operations on
- */
-void RaveRopoGenerator_setImage(RaveRopoGenerator_t* self, RaveFmiImage_t* image);
-
-/**
- * Returns the fmi image associated with this generator
- * @param[in] self - self
- * @return the fmi image
- */
-RaveFmiImage_t* RaveRopoGenerator_getImage(RaveRopoGenerator_t* self);
-
-/**
- *
- */
-int RaveRopoGenerator_speck(RaveRopoGenerator_t* self, int intensity, int sz);
-
-/**
- *
- */
-int RaveRopoGenerator_emitter(RaveRopoGenerator_t* self, int intensity, int sz);
-
-/**
- * Updates the classifications with the currently kept probability fields
- * @param[in] self - self
- * @return 1 on success otherwise 0
- */
-int RaveRopoGenerator_classify(RaveRopoGenerator_t* self);
-
-/**
- * Creates a restored image according to the classification table.
- * @param[in] self - self
- * @return the restored image.
- */
-RaveFmiImage_t* RaveRopoGenerator_restore(RaveRopoGenerator_t* self, int threshold);
-
-/**
- * Returns the a classification probability field.
- * @param[in] self - self
- * @return the classification field that is determined from all run detectors.
- */
-RaveFmiImage_t* RaveRopoGenerator_getClassification(RaveRopoGenerator_t* self);
-
-/**
- * Returns the a field containing information what detector has
- * contributed to the probability field.
- * @param[in] self - self
- * @return the markers field
- */
-RaveFmiImage_t* RaveRopoGenerator_getMarkers(RaveRopoGenerator_t* self);
-
-
-/**
- * Creates a ropo generator with the provided fmi image.
- * @param[in] image - the image this generator should work on
- * @return a ropo generator on success otherwise NULL
- */
-RaveRopoGenerator_t* RaveRopoGenerator_new(RaveFmiImage_t* image);
-
-#endif /* RAVE_ROPO_GENERATOR_H */
diff --git a/test/pytest/FmiImageTest.py b/test/pytest/FmiImageTest.py
deleted file mode 100644 (file)
index 6d9d6f6..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-'''
-Created on Sep 1, 2011
-
-@author: anders
-'''
-import unittest
-import string
-import _raveio
-import _fmiimage
-import _rave
-
-class FmiImageTest(unittest.TestCase):
-  PVOL_TESTFILE="fixtures/pvol_seang_20090501T120000Z.h5"
-
-  def setUp(self):
-    pass
-
-  def tearDown(self):
-    pass
-
-  def testFromRave_scan(self):
-    a = _raveio.open(self.PVOL_TESTFILE)
-    b = _fmiimage.fromRave(a.object.getScan(0))
-    self.assertNotEqual(-1, string.find(`type(b)`, "FmiImageCore"))
-
-  def testFromRave_withQuantity_scan(self):
-    a = _raveio.open(self.PVOL_TESTFILE)
-    b = _fmiimage.fromRave(a.object.getScan(0), "DBZH")
-    self.assertNotEqual(-1, string.find(`type(b)`, "FmiImageCore"))
-
-  def testFromRave_volume(self):
-    a = _raveio.open(self.PVOL_TESTFILE)
-    b = _fmiimage.fromRave(a.object)
-    self.assertNotEqual(-1, string.find(`type(b)`, "FmiImageCore"))
-
-  def testFromRave_withQuantity_volume(self):
-    a = _raveio.open(self.PVOL_TESTFILE)
-    b = _fmiimage.fromRave(a.object, "DBZH")
-    self.assertNotEqual(-1, string.find(`type(b)`, "FmiImageCore"))
-
-  def testFromRaveVolume(self):
-    a = _raveio.open(self.PVOL_TESTFILE)
-    b = _fmiimage.fromRaveVolume(a.object, 0)
-    self.assertNotEqual(-1, string.find(`type(b)`, "FmiImageCore"))
-
-  def testFromRaveVolume_withQuantity(self):
-    a = _raveio.open(self.PVOL_TESTFILE)
-    b = _fmiimage.fromRaveVolume(a.object, 0, "DBZH")
-    self.assertNotEqual(-1, string.find(`type(b)`, "FmiImageCore"))
-
-  def testToPolarScan(self):
-    a = _raveio.open(self.PVOL_TESTFILE).object
-    b = _fmiimage.fromRave(a.getScan(0), "DBZH")
-    c = b.toPolarScan("DBZH")
-    self.assertAlmostEqual(a.getScan(0).elangle, c.elangle, 4)
-    self.assertTrue(c.hasParameter("DBZH"))
-
-  def testToRaveField(self):
-    a = _raveio.open(self.PVOL_TESTFILE).object
-    b = _fmiimage.fromRave(a.getScan(0), "DBZH")
-    c = b.toRaveField()
-    self.assertNotEqual(-1, string.find(`type(c)`, "RaveFieldCore"))
-    
-if __name__ == "__main__":
-  #import sys;sys.argv = ['', 'Test.testName']
-  unittest.main()
\ No newline at end of file
diff --git a/test/pytest/PyRopoGeneratorTest.py b/test/pytest/PyRopoGeneratorTest.py
deleted file mode 100644 (file)
index f53f0cd..0000000
+++ /dev/null
@@ -1,127 +0,0 @@
-'''
-Created on Sep 1, 2011
-
-@author: anders
-'''
-import unittest
-
-import _fmiimage
-import _raveio
-import _ropogenerator
-import os, string
-import _rave
-import _polarscanparam
-
-class PyRopoGeneratorTest(unittest.TestCase):
-  PVOL_TESTFILE="fixtures/pvol_seang_20090501T120000Z.h5"
-  PVOL_RIX_TESTFILE="fixtures/pvol_rix.h5"
-  
-  TEMPORARY_FILE="ropotest_file1.h5"
-  TEMPORARY_FILE2="ropotest_file2.h5"
-  
-  def setUp(self):
-    if os.path.isfile(self.TEMPORARY_FILE):
-      os.unlink(self.TEMPORARY_FILE)
-    if os.path.isfile(self.TEMPORARY_FILE2):
-      os.unlink(self.TEMPORARY_FILE2)
-
-  def tearDown(self):
-    if os.path.isfile(self.TEMPORARY_FILE):
-      os.unlink(self.TEMPORARY_FILE)
-    if os.path.isfile(self.TEMPORARY_FILE2):
-      os.unlink(self.TEMPORARY_FILE2)  
-  
-  def testNew(self):
-    a = _ropogenerator.new()
-    self.assertNotEqual(-1, string.find(`type(a)`, "RopoGeneratorCore"))
-    self.assertTrue(None==a.getImage())
-
-  def testNew_withImage(self):
-    image = _fmiimage.fromRave(_raveio.open(self.PVOL_TESTFILE).object.getScan(0), "DBZH")
-    a = _ropogenerator.new(image)
-    self.assertNotEqual(-1, string.find(`type(a)`, "RopoGeneratorCore"))
-    self.assertTrue(image==a.getImage())
-  
-  def testSetImage(self):
-    volume = _raveio.open(self.PVOL_TESTFILE).object
-    image = _fmiimage.fromRave(volume.getScan(0), "DBZH")
-    image2 = _fmiimage.fromRave(volume.getScan(1), "DBZH")
-    a = _ropogenerator.new()
-    a.setImage(image)
-    self.assertTrue(image==a.getImage())
-    a.setImage(image2)
-    self.assertTrue(image2==a.getImage())
-  
-  def testSpeck(self):
-    a = _raveio.open(self.PVOL_RIX_TESTFILE).object.getScan(0)
-    b = _ropogenerator.new(_fmiimage.fromRave(a, "DBZH"))
-    b.speck(-20, 5);
-    
-    output = _raveio.new()
-    output.object = b.getImage().toPolarScan("DBZH")
-    output.filename = self.TEMPORARY_FILE
-    output.save()
-
-  def testEmitter(self):
-    a = _raveio.open(self.PVOL_RIX_TESTFILE).object.getScan(0)
-    b = _ropogenerator.new(_fmiimage.fromRave(a, "DBZH"))
-    b.speck(3, 6);
-    
-    output = _raveio.new()
-    output.object = b.getImage().toPolarScan("DBZH")
-    output.filename = self.TEMPORARY_FILE
-    output.save()
-
-  def testSpeckAndEmitter(self):
-    a = _raveio.open(self.PVOL_RIX_TESTFILE).object.getScan(0)
-    b = _ropogenerator.new(_fmiimage.fromRave(a, "DBZH"))
-    b.speck(-20, 5).emitter(3,6)
-    
-    output = _raveio.new()
-    output.object = b.getImage().toPolarScan("DBZH")
-    output.filename = self.TEMPORARY_FILE
-    output.save()
-
-  def testGenerator_generateClassification(self):
-    a = _raveio.open(self.PVOL_RIX_TESTFILE).object.getScan(0)
-    b = _ropogenerator.new(_fmiimage.fromRave(a, "DBZH"))
-
-    b.speck(-20, 5)
-    b.emitter(3, 6)
-    b.classify()
-    c = b.getClassification()
-
-    output = _raveio.new()
-    output.object = c.toPolarScan("DBZH")
-    output.filename = self.TEMPORARY_FILE
-    output.save()
-  def testGeneratorSequence_generateClassification(self):
-    a = _raveio.open(self.PVOL_RIX_TESTFILE).object.getScan(0)
-    b = _ropogenerator.new(_fmiimage.fromRave(a, "DBZH"))
-
-    c = b.speck(-20, 5).emitter(3, 6).classify().getClassification()
-
-    output = _raveio.new()
-    output.object = c.toPolarScan("DBZH")
-    output.filename = self.TEMPORARY_FILE
-    output.save()
-
-  def testGeneratorSequence_fullExample(self):
-    a = _raveio.open(self.PVOL_RIX_TESTFILE).object.getScan(0)
-    b = _ropogenerator.new(_fmiimage.fromRave(a, "DBZH"))
-
-    classification = b.speck(-20, 5).emitter(3, 6).classify().getClassification().toRaveField()
-    restored = b.restore(50).toRaveField()
-    
-    a.addQualityField(classification)
-    a.addQualityField(restored)
-    
-    output = _raveio.new()
-    output.object = a
-    output.filename = self.TEMPORARY_FILE
-    output.save()
-      
-if __name__ == "__main__":
-  #import sys;sys.argv = ['', 'Test.testName']
-  unittest.main()
\ No newline at end of file
index 14d173e..2c5d009 100644 (file)
@@ -25,9 +25,7 @@ Test suite for bRack
 '''
 import unittest
 
-#from RaveRackTest import *
-from FmiImageTest import *
-from PyRopoGeneratorTest import *
+from RaveRackTest import *
 
 if __name__ == "__main__":
   unittest.main()
\ No newline at end of file