RAVE
pyarea.c File Reference

Python version of the Area API. More...

#include "pyravecompat.h"
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include "pyrave_debug.h"
#include "pyarea.h"
#include "pyprojection.h"
#include "rave_alloc.h"

Macros

#define PYAREA_MODULE
 to get correct part in pyarea.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 ("_area")
 Debug this module.
 
 PyDoc_STRVAR (_pyarea_doc, "This class provides functionality for defining an area used in for example cartesian products.\n" "\n" "The area instance is used as a container for a number of attributes that are relevant when defining an area.\n" "Since this instance is used for defining areas it doesn't contain any methods. Instead there are only a number\n" "of members which are:\n\n" " * id - a string identifying this area definition.\n\n" " * description - a string description of this area.\n\n" " * xsize - a integer defining the xsize.\n\n" " * ysize - a integer defining the ysize.\n\n" " * xscale - a float defining the xscale in meters.\n\n" " * yscale - a float defining the yscale in meters.\n\n" " * extent - a tuple of four floats defining the extent of this area (lower left X, lower left Y, upper right X, upper right Y).\n\n" " * projection - the projection definition of type ProjectionCore. When setting this, the pcsid will be reset.\n\n" " * pcsid - the projection id string. When setting this, the projection will be reset.\n\n" "\n" "Usage us quite straight forward when using this class. However, usually, the area registry is used when creating areas.\n" " import _area, _projection, math\n" " a = _area.new()\n" " a.id = \"myid\"\n" " a.description = \"this is an area\"\n" " a.xsize = 100\n" " a.ysize = 100\n" " a.xscale = 1000.0\n" " a.yscale = 1000.0\n" " a.projection = _rave.projection(\"gnom\",\"gnom\",\"+proj=gnom +R=6371000.0 +lat_0=56.3675 +lon_0=12.8544\")\n" " xy = a.projection.fwd((12.8544*math.pi/180.0, 56.3675*math.pi/180.0)))\n" " a.extent = (xy[0] - 50*a.xscale, xy[1] - 50*a.yscale, xy[2] + 50*a.xscale, xy[3] + 50*a.yscale)\n")
 
 MOD_INIT (_area)
 

Variables

PyTypeObject PyArea_Type
 

Detailed Description

Python version of the Area API.

Author
Anders Henja (Swedish Meteorological and Hydrological Institute, SMHI)
Date
2009-12-10

Macro Definition Documentation

◆ PYAREA_MODULE

#define PYAREA_MODULE

to get correct part in pyarea.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 ( "_area" )

Debug this module.