[GRASS-dev] Re: [GRASS-user] XY trace plots

Glynn Clements glynn at gclements.plus.com
Mon May 21 19:07:59 EDT 2012


Hamish wrote:

> > The argument must be a pointer, try
> > 
> > G_is_null_value(byref(in_rast[col]), data_type)
> > 
> > or
> > in_val = in_rast[col]
> > G_is_null_value(byref(in_val), data_type)
> 
> no joy, both those come back with:
> 
>     if not G_is_null_value(byref(in_rast[col]), data_type):
> TypeError: byref() argument must be a ctypes instance, not 'int'

	import grass.lib.raster as rast
	...
	in_val = rast.CELL(in_rast[col])
	G_is_null_value(byref(in_val), data_type)

ctypes automatically converts the result of an array acces to a Python
type, while byref() requires a ctypes type. And pointer arithmetic
still isn't implemented (i.e. there's no simple way to get a pointer
to any element of an array other than the first).

-- 
Glynn Clements <glynn at gclements.plus.com>


More information about the grass-dev mailing list