RAVE
pyacrr.c File Reference

Python version of the Acrr API. More...

#include "pyravecompat.h"
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include "pyrave_debug.h"
#include "pyacrr.h"
#include "rave_alloc.h"
#include "pycartesianparam.h"

Macros

#define PYACRR_MODULE
 to get correct part in pyacrr.h
 
#define raiseException_gotoTag(tag, type, msg)
 Sets a python exception and goto tag.
 
#define raiseException_returnNULL(type, msg)
 Sets a python exception and return NULL.
 

Functions

 PYRAVE_DEBUG_MODULE ("_acrr")
 Debug this module.
 
 PyDoc_STRVAR (_pyacrr_doc, "This instance provides functionality for generating accumulated precipitation products.\n" "\n" "Usage is based on the user providing cartesian parameters that should be of same quantity and covered area.\n" "There is no check verifying that extent is same, only checks are x&y-size and quantity.\n" "Assuming that you have a number of catesian products, the usage is straight forward.\n" " import _acrr\n" " acrr = _acrr.new()\n" " acrr.nodata = -1.0\n" " acrr.undetect = 0.0\n" " zr_a = 200.0\n" " zr_b = 1.6\n" " accept = 0 #accept is the required limit for how many nodata-pixels that are allowed in order for the pixel to be used\n" " N = 5 # Note, we have 5 files when covering 1 hour with 15-minute intervals\n" " hours = 1 # One hour\n" " acrr.quality_field_name = \"se.smhi.composite.distance.radar\" # name of quality field\n" " for f in [\"gmap_202001010000.h5\", \"gmap_202001010015.h5\", \"gmap_202001010030.h5\", \"gmap_202001010045.h5\", \"gmap_202001010100.h5\"]:\n" " acrr.sum(_raveio.open(f).object.getParameter(\"DBZH\"), zr_a, zr_b)\n" " result = acrr.accumulate(accept, N, hours)\n" "\n" "There is obviously more to the above example. For example, each parameter must contain required quality field as defined in acrr.quality_field_name\n" "and you need to verify that the opened files are in fact compoisites so that you don't have to convert them first.\n" "\n" "As can seen in the example, there are 3 members used.\n" " * nodata - The nodata value that should be set in the resulting product. Default value is 1.0.\n" " * undetect - The undetect value that should be set in the resulting product. Default value is 0.0.\n" " * quality_field_name - The distance (quality) field that should be used when processing the cartesian parameters.\n" "\n" "Then, there are a few methods that are provided. More information about these can be found by printing the doc about them.\n" " * isInitialized - When first call to sum(...) is performed, the acrr instance is initialized with basic information.\n" " after that, it's not possible to invoke sum with a product with different x/y-size and quality field.\n" "\n" " * getQuantity - Set during initialization.\n" "\n" " * sum - Sums up the provided cartesian parameter. First call to sum in a sequence will initialize the acrr structure.\n" "\n" " * accumulate - Calculates the resulting product from previous calls to sum.\n")
 
 MOD_INIT (_acrr)
 

Variables

PyTypeObject PyAcrr_Type
 

Detailed Description

Python version of the Acrr API.

Author
Anders Henja (Swedish Meteorological and Hydrological Institute, SMHI)
Date
2012-06-01

Macro Definition Documentation

◆ PYACRR_MODULE

#define PYACRR_MODULE

to get correct part in pyacrr.h

◆ raiseException_gotoTag

#define raiseException_gotoTag ( tag,
type,
msg )
Value:
{PyErr_SetString(type, msg); goto tag;}

Sets a python exception and goto tag.

◆ raiseException_returnNULL

#define raiseException_returnNULL ( type,
msg )
Value:
{PyErr_SetString(type, msg); return NULL;}

Sets a python exception and return NULL.

Function Documentation

◆ PYRAVE_DEBUG_MODULE()

PYRAVE_DEBUG_MODULE ( "_acrr" )

Debug this module.