TECA
The Toolkit for Extreme Climate Analysis
teca_py_array Namespace Reference

Codes for interfacing with numpy arrays. More...

Functions

TECA_EXPORT bool append (teca_variant_array *varr, PyObject *obj)
 Append values from the object to the variant array. More...
 
TECA_EXPORT bool copy (teca_variant_array *varr, PyObject *obj)
 Copy values from the object into variant array. More...
 
TECA_EXPORT bool set (teca_variant_array *varr, unsigned long i, PyObject *obj)
 Set i'th element of the variant array to the value of the object. More...
 
TECA_EXPORT p_teca_variant_array new_variant_array (PyObject *obj, bool deep_copy=false)
 
template<typename NT >
void variant_array_capsule_destrcutor (PyObject *cap)
 a destructor used with the following funciton More...
 
template<typename NT >
TECA_EXPORT PyArrayObject * new_object (teca_variant_array_impl< NT > *varrt, bool deep_copy=false)
 Construct a new numpy array initialized with the contents of the variant array. More...
 
TECA_EXPORT PyArrayObject * new_object (teca_variant_array *varr, bool deep_copy=false)
 Construct a new numpy array initialized with the contents of the variant array. More...
 

Detailed Description

Codes for interfacing with numpy arrays.

Function Documentation

◆ append()

TECA_EXPORT bool teca_py_array::append ( teca_variant_array varr,
PyObject *  obj 
)

Append values from the object to the variant array.

◆ copy()

TECA_EXPORT bool teca_py_array::copy ( teca_variant_array varr,
PyObject *  obj 
)

Copy values from the object into variant array.

◆ new_object() [1/2]

TECA_EXPORT PyArrayObject* teca_py_array::new_object ( teca_variant_array varr,
bool  deep_copy = false 
)

Construct a new numpy array initialized with the contents of the variant array.

◆ new_object() [2/2]

template<typename NT >
TECA_EXPORT PyArrayObject* teca_py_array::new_object ( teca_variant_array_impl< NT > *  varrt,
bool  deep_copy = false 
)

Construct a new numpy array initialized with the contents of the variant array.

◆ new_variant_array()

TECA_EXPORT p_teca_variant_array teca_py_array::new_variant_array ( PyObject *  obj,
bool  deep_copy = false 
)

Construct a new variant array and initialize it from the object. The data is transferred by zero-copy operation if possible and if not then a deep copy is made. One can force a deep copy. Returns a new variant array if successful and a nullptr otherwise.

◆ set()

TECA_EXPORT bool teca_py_array::set ( teca_variant_array varr,
unsigned long  i,
PyObject *  obj 
)

Set i'th element of the variant array to the value of the object.

◆ variant_array_capsule_destrcutor()

template<typename NT >
void teca_py_array::variant_array_capsule_destrcutor ( PyObject *  cap)

a destructor used with the following funciton