/* Generated by Cython 0.20.2 (Debian 0.20.2-1) on Fri Feb 27 23:55:26 2015 */

#define PY_SSIZE_T_CLEAN
#ifndef CYTHON_USE_PYLONG_INTERNALS
#ifdef PYLONG_BITS_IN_DIGIT
#define CYTHON_USE_PYLONG_INTERNALS 0
#else
#include "pyconfig.h"
#ifdef PYLONG_BITS_IN_DIGIT
#define CYTHON_USE_PYLONG_INTERNALS 1
#else
#define CYTHON_USE_PYLONG_INTERNALS 0
#endif
#endif
#endif
#include "Python.h"
#ifndef Py_PYTHON_H
    #error Python headers needed to compile C extensions, please install development version of Python.
#elif PY_VERSION_HEX < 0x02040000
    #error Cython requires Python 2.4+.
#else
#define CYTHON_ABI "0_20_2"
#include <stddef.h> /* For offsetof */
#ifndef offsetof
#define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
#endif
#if !defined(WIN32) && !defined(MS_WINDOWS)
  #ifndef __stdcall
    #define __stdcall
  #endif
  #ifndef __cdecl
    #define __cdecl
  #endif
  #ifndef __fastcall
    #define __fastcall
  #endif
#endif
#ifndef DL_IMPORT
  #define DL_IMPORT(t) t
#endif
#ifndef DL_EXPORT
  #define DL_EXPORT(t) t
#endif
#ifndef PY_LONG_LONG
  #define PY_LONG_LONG LONG_LONG
#endif
#ifndef Py_HUGE_VAL
  #define Py_HUGE_VAL HUGE_VAL
#endif
#ifdef PYPY_VERSION
#define CYTHON_COMPILING_IN_PYPY 1
#define CYTHON_COMPILING_IN_CPYTHON 0
#else
#define CYTHON_COMPILING_IN_PYPY 0
#define CYTHON_COMPILING_IN_CPYTHON 1
#endif
#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600
#define Py_OptimizeFlag 0
#endif
#if PY_VERSION_HEX < 0x02050000
  typedef int Py_ssize_t;
  #define PY_SSIZE_T_MAX INT_MAX
  #define PY_SSIZE_T_MIN INT_MIN
  #define PY_FORMAT_SIZE_T ""
  #define CYTHON_FORMAT_SSIZE_T ""
  #define PyInt_FromSsize_t(z) PyInt_FromLong(z)
  #define PyInt_AsSsize_t(o)   __Pyx_PyInt_As_int(o)
  #define PyNumber_Index(o)    ((PyNumber_Check(o) && !PyFloat_Check(o)) ? PyNumber_Int(o) : \
                                (PyErr_Format(PyExc_TypeError, \
                                              "expected index value, got %.200s", Py_TYPE(o)->tp_name), \
                                 (PyObject*)0))
  #define __Pyx_PyIndex_Check(o) (PyNumber_Check(o) && !PyFloat_Check(o) && \
                                  !PyComplex_Check(o))
  #define PyIndex_Check __Pyx_PyIndex_Check
  #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message)
  #define __PYX_BUILD_PY_SSIZE_T "i"
#else
  #define __PYX_BUILD_PY_SSIZE_T "n"
  #define CYTHON_FORMAT_SSIZE_T "z"
  #define __Pyx_PyIndex_Check PyIndex_Check
#endif
#if PY_VERSION_HEX < 0x02060000
  #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt)
  #define Py_TYPE(ob)   (((PyObject*)(ob))->ob_type)
  #define Py_SIZE(ob)   (((PyVarObject*)(ob))->ob_size)
  #define PyVarObject_HEAD_INIT(type, size) \
          PyObject_HEAD_INIT(type) size,
  #define PyType_Modified(t)
  typedef struct {
     void *buf;
     PyObject *obj;
     Py_ssize_t len;
     Py_ssize_t itemsize;
     int readonly;
     int ndim;
     char *format;
     Py_ssize_t *shape;
     Py_ssize_t *strides;
     Py_ssize_t *suboffsets;
     void *internal;
  } Py_buffer;
  #define PyBUF_SIMPLE 0
  #define PyBUF_WRITABLE 0x0001
  #define PyBUF_FORMAT 0x0004
  #define PyBUF_ND 0x0008
  #define PyBUF_STRIDES (0x0010 | PyBUF_ND)
  #define PyBUF_C_CONTIGUOUS (0x0020 | PyBUF_STRIDES)
  #define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES)
  #define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES)
  #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES)
  #define PyBUF_RECORDS (PyBUF_STRIDES | PyBUF_FORMAT | PyBUF_WRITABLE)
  #define PyBUF_FULL (PyBUF_INDIRECT | PyBUF_FORMAT | PyBUF_WRITABLE)
  typedef int (*getbufferproc)(PyObject *, Py_buffer *, int);
  typedef void (*releasebufferproc)(PyObject *, Py_buffer *);
#endif
#if PY_MAJOR_VERSION < 3
  #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
  #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \
          PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
  #define __Pyx_DefaultClassType PyClass_Type
#else
  #define __Pyx_BUILTIN_MODULE_NAME "builtins"
  #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \
          PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
  #define __Pyx_DefaultClassType PyType_Type
#endif
#if PY_VERSION_HEX < 0x02060000
  #define PyUnicode_FromString(s) PyUnicode_Decode(s, strlen(s), "UTF-8", "strict")
#endif
#if PY_MAJOR_VERSION >= 3
  #define Py_TPFLAGS_CHECKTYPES 0
  #define Py_TPFLAGS_HAVE_INDEX 0
#endif
#if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3)
  #define Py_TPFLAGS_HAVE_NEWBUFFER 0
#endif
#if PY_VERSION_HEX < 0x02060000
  #define Py_TPFLAGS_HAVE_VERSION_TAG 0
#endif
#if PY_VERSION_HEX < 0x02060000 && !defined(Py_TPFLAGS_IS_ABSTRACT)
  #define Py_TPFLAGS_IS_ABSTRACT 0
#endif
#if PY_VERSION_HEX < 0x030400a1 && !defined(Py_TPFLAGS_HAVE_FINALIZE)
  #define Py_TPFLAGS_HAVE_FINALIZE 0
#endif
#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
  #define CYTHON_PEP393_ENABLED 1
  #define __Pyx_PyUnicode_READY(op)       (likely(PyUnicode_IS_READY(op)) ? \
                                              0 : _PyUnicode_Ready((PyObject *)(op)))
  #define __Pyx_PyUnicode_GET_LENGTH(u)   PyUnicode_GET_LENGTH(u)
  #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
  #define __Pyx_PyUnicode_KIND(u)         PyUnicode_KIND(u)
  #define __Pyx_PyUnicode_DATA(u)         PyUnicode_DATA(u)
  #define __Pyx_PyUnicode_READ(k, d, i)   PyUnicode_READ(k, d, i)
#else
  #define CYTHON_PEP393_ENABLED 0
  #define __Pyx_PyUnicode_READY(op)       (0)
  #define __Pyx_PyUnicode_GET_LENGTH(u)   PyUnicode_GET_SIZE(u)
  #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
  #define __Pyx_PyUnicode_KIND(u)         (sizeof(Py_UNICODE))
  #define __Pyx_PyUnicode_DATA(u)         ((void*)PyUnicode_AS_UNICODE(u))
  #define __Pyx_PyUnicode_READ(k, d, i)   ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
#endif
#if CYTHON_COMPILING_IN_PYPY
  #define __Pyx_PyUnicode_Concat(a, b)      PyNumber_Add(a, b)
  #define __Pyx_PyUnicode_ConcatSafe(a, b)  PyNumber_Add(a, b)
#else
  #define __Pyx_PyUnicode_Concat(a, b)      PyUnicode_Concat(a, b)
  #define __Pyx_PyUnicode_ConcatSafe(a, b)  ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ? \
      PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
#endif
#define __Pyx_PyString_FormatSafe(a, b)  ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b))
#define __Pyx_PyUnicode_FormatSafe(a, b)  ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
#if PY_MAJOR_VERSION >= 3
  #define __Pyx_PyString_Format(a, b)  PyUnicode_Format(a, b)
#else
  #define __Pyx_PyString_Format(a, b)  PyString_Format(a, b)
#endif
#if PY_MAJOR_VERSION >= 3
  #define PyBaseString_Type            PyUnicode_Type
  #define PyStringObject               PyUnicodeObject
  #define PyString_Type                PyUnicode_Type
  #define PyString_Check               PyUnicode_Check
  #define PyString_CheckExact          PyUnicode_CheckExact
#endif
#if PY_VERSION_HEX < 0x02060000
  #define PyBytesObject                PyStringObject
  #define PyBytes_Type                 PyString_Type
  #define PyBytes_Check                PyString_Check
  #define PyBytes_CheckExact           PyString_CheckExact
  #define PyBytes_FromString           PyString_FromString
  #define PyBytes_FromStringAndSize    PyString_FromStringAndSize
  #define PyBytes_FromFormat           PyString_FromFormat
  #define PyBytes_DecodeEscape         PyString_DecodeEscape
  #define PyBytes_AsString             PyString_AsString
  #define PyBytes_AsStringAndSize      PyString_AsStringAndSize
  #define PyBytes_Size                 PyString_Size
  #define PyBytes_AS_STRING            PyString_AS_STRING
  #define PyBytes_GET_SIZE             PyString_GET_SIZE
  #define PyBytes_Repr                 PyString_Repr
  #define PyBytes_Concat               PyString_Concat
  #define PyBytes_ConcatAndDel         PyString_ConcatAndDel
#endif
#if PY_MAJOR_VERSION >= 3
  #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
  #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
#else
  #define __Pyx_PyBaseString_Check(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj) || \
                                         PyString_Check(obj) || PyUnicode_Check(obj))
  #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
#endif
#if PY_VERSION_HEX < 0x02060000
  #define PySet_Check(obj)             PyObject_TypeCheck(obj, &PySet_Type)
  #define PyFrozenSet_Check(obj)       PyObject_TypeCheck(obj, &PyFrozenSet_Type)
#endif
#ifndef PySet_CheckExact
  #define PySet_CheckExact(obj)        (Py_TYPE(obj) == &PySet_Type)
#endif
#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
#if PY_MAJOR_VERSION >= 3
  #define PyIntObject                  PyLongObject
  #define PyInt_Type                   PyLong_Type
  #define PyInt_Check(op)              PyLong_Check(op)
  #define PyInt_CheckExact(op)         PyLong_CheckExact(op)
  #define PyInt_FromString             PyLong_FromString
  #define PyInt_FromUnicode            PyLong_FromUnicode
  #define PyInt_FromLong               PyLong_FromLong
  #define PyInt_FromSize_t             PyLong_FromSize_t
  #define PyInt_FromSsize_t            PyLong_FromSsize_t
  #define PyInt_AsLong                 PyLong_AsLong
  #define PyInt_AS_LONG                PyLong_AS_LONG
  #define PyInt_AsSsize_t              PyLong_AsSsize_t
  #define PyInt_AsUnsignedLongMask     PyLong_AsUnsignedLongMask
  #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
  #define PyNumber_Int                 PyNumber_Long
#endif
#if PY_MAJOR_VERSION >= 3
  #define PyBoolObject                 PyLongObject
#endif
#if PY_VERSION_HEX < 0x030200A4
  typedef long Py_hash_t;
  #define __Pyx_PyInt_FromHash_t PyInt_FromLong
  #define __Pyx_PyInt_AsHash_t   PyInt_AsLong
#else
  #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
  #define __Pyx_PyInt_AsHash_t   PyInt_AsSsize_t
#endif
#if (PY_MAJOR_VERSION < 3) || (PY_VERSION_HEX >= 0x03010300)
  #define __Pyx_PySequence_GetSlice(obj, a, b) PySequence_GetSlice(obj, a, b)
  #define __Pyx_PySequence_SetSlice(obj, a, b, value) PySequence_SetSlice(obj, a, b, value)
  #define __Pyx_PySequence_DelSlice(obj, a, b) PySequence_DelSlice(obj, a, b)
#else
  #define __Pyx_PySequence_GetSlice(obj, a, b) (unlikely(!(obj)) ? \
        (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), (PyObject*)0) : \
        (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_GetSlice(obj, a, b)) : \
            (PyErr_Format(PyExc_TypeError, "'%.200s' object is unsliceable", (obj)->ob_type->tp_name), (PyObject*)0)))
  #define __Pyx_PySequence_SetSlice(obj, a, b, value) (unlikely(!(obj)) ? \
        (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \
        (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_SetSlice(obj, a, b, value)) : \
            (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice assignment", (obj)->ob_type->tp_name), -1)))
  #define __Pyx_PySequence_DelSlice(obj, a, b) (unlikely(!(obj)) ? \
        (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \
        (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_DelSlice(obj, a, b)) : \
            (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice deletion", (obj)->ob_type->tp_name), -1)))
#endif
#if PY_MAJOR_VERSION >= 3
  #define PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func))
#endif
#if PY_VERSION_HEX < 0x02050000
  #define __Pyx_GetAttrString(o,n)   PyObject_GetAttrString((o),((char *)(n)))
  #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a))
  #define __Pyx_DelAttrString(o,n)   PyObject_DelAttrString((o),((char *)(n)))
#else
  #define __Pyx_GetAttrString(o,n)   PyObject_GetAttrString((o),(n))
  #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a))
  #define __Pyx_DelAttrString(o,n)   PyObject_DelAttrString((o),(n))
#endif
#if PY_VERSION_HEX < 0x02050000
  #define __Pyx_NAMESTR(n) ((char *)(n))
  #define __Pyx_DOCSTR(n)  ((char *)(n))
#else
  #define __Pyx_NAMESTR(n) (n)
  #define __Pyx_DOCSTR(n)  (n)
#endif
#ifndef CYTHON_INLINE
  #if defined(__GNUC__)
    #define CYTHON_INLINE __inline__
  #elif defined(_MSC_VER)
    #define CYTHON_INLINE __inline
  #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
    #define CYTHON_INLINE inline
  #else
    #define CYTHON_INLINE
  #endif
#endif
#ifndef CYTHON_RESTRICT
  #if defined(__GNUC__)
    #define CYTHON_RESTRICT __restrict__
  #elif defined(_MSC_VER) && _MSC_VER >= 1400
    #define CYTHON_RESTRICT __restrict
  #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
    #define CYTHON_RESTRICT restrict
  #else
    #define CYTHON_RESTRICT
  #endif
#endif
#ifdef NAN
#define __PYX_NAN() ((float) NAN)
#else
static CYTHON_INLINE float __PYX_NAN() {
  /* Initialize NaN. The sign is irrelevant, an exponent with all bits 1 and
   a nonzero mantissa means NaN. If the first bit in the mantissa is 1, it is
   a quiet NaN. */
  float value;
  memset(&value, 0xFF, sizeof(value));
  return value;
}
#endif
#ifdef __cplusplus
template<typename T>
void __Pyx_call_destructor(T* x) {
    x->~T();
}
#endif


#if PY_MAJOR_VERSION >= 3
  #define __Pyx_PyNumber_Divide(x,y)         PyNumber_TrueDivide(x,y)
  #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceTrueDivide(x,y)
#else
  #define __Pyx_PyNumber_Divide(x,y)         PyNumber_Divide(x,y)
  #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceDivide(x,y)
#endif

#ifndef __PYX_EXTERN_C
  #ifdef __cplusplus
    #define __PYX_EXTERN_C extern "C"
  #else
    #define __PYX_EXTERN_C extern
  #endif
#endif

#if defined(WIN32) || defined(MS_WINDOWS)
#define _USE_MATH_DEFINES
#endif
#include <math.h>
#define __PYX_HAVE__epr
#define __PYX_HAVE_API__epr
#include "string.h"
#include "stdio.h"
#include "epr_api.h"
#include "errno.h"
#include "stdlib.h"
#include "numpy/arrayobject.h"
#include "numpy/ufuncobject.h"
#ifdef _OPENMP
#include <omp.h>
#endif /* _OPENMP */

#ifdef PYREX_WITHOUT_ASSERTIONS
#define CYTHON_WITHOUT_ASSERTIONS
#endif

#ifndef CYTHON_UNUSED
# if defined(__GNUC__)
#   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
#     define CYTHON_UNUSED __attribute__ ((__unused__))
#   else
#     define CYTHON_UNUSED
#   endif
# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
#   define CYTHON_UNUSED __attribute__ ((__unused__))
# else
#   define CYTHON_UNUSED
# endif
#endif
typedef struct {PyObject **p; char *s; const Py_ssize_t n; const char* encoding;
                const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/

#define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
#define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT 0
#define __PYX_DEFAULT_STRING_ENCODING ""
#define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
#define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
#define __Pyx_fits_Py_ssize_t(v, type, is_signed)  (    \
    (sizeof(type) < sizeof(Py_ssize_t))  ||             \
    (sizeof(type) > sizeof(Py_ssize_t) &&               \
          likely(v < (type)PY_SSIZE_T_MAX ||            \
                 v == (type)PY_SSIZE_T_MAX)  &&         \
          (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||       \
                                v == (type)PY_SSIZE_T_MIN)))  ||  \
    (sizeof(type) == sizeof(Py_ssize_t) &&              \
          (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||        \
                               v == (type)PY_SSIZE_T_MAX)))  )
static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject*);
static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
#define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s))
#define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
#define __Pyx_PyBytes_FromString        PyBytes_FromString
#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*);
#if PY_MAJOR_VERSION < 3
    #define __Pyx_PyStr_FromString        __Pyx_PyBytes_FromString
    #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
#else
    #define __Pyx_PyStr_FromString        __Pyx_PyUnicode_FromString
    #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
#endif
#define __Pyx_PyObject_AsSString(s)    ((signed char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_AsUString(s)    ((unsigned char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_FromUString(s)  __Pyx_PyObject_FromString((const char*)s)
#define __Pyx_PyBytes_FromUString(s)   __Pyx_PyBytes_FromString((const char*)s)
#define __Pyx_PyByteArray_FromUString(s)   __Pyx_PyByteArray_FromString((const char*)s)
#define __Pyx_PyStr_FromUString(s)     __Pyx_PyStr_FromString((const char*)s)
#define __Pyx_PyUnicode_FromUString(s) __Pyx_PyUnicode_FromString((const char*)s)
#if PY_MAJOR_VERSION < 3
static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u)
{
    const Py_UNICODE *u_end = u;
    while (*u_end++) ;
    return (size_t)(u_end - u - 1);
}
#else
#define __Pyx_Py_UNICODE_strlen Py_UNICODE_strlen
#endif
#define __Pyx_PyUnicode_FromUnicode(u)       PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
#define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
#define __Pyx_PyUnicode_AsUnicode            PyUnicode_AsUnicode
#define __Pyx_Owned_Py_None(b) (Py_INCREF(Py_None), Py_None)
#define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False))
static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x);
static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
#if CYTHON_COMPILING_IN_CPYTHON
#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
#else
#define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
#endif
#define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
static int __Pyx_sys_getdefaultencoding_not_ascii;
static int __Pyx_init_sys_getdefaultencoding_params(void) {
    PyObject* sys;
    PyObject* default_encoding = NULL;
    PyObject* ascii_chars_u = NULL;
    PyObject* ascii_chars_b = NULL;
    const char* default_encoding_c;
    sys = PyImport_ImportModule("sys");
    if (!sys) goto bad;
    default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
    Py_DECREF(sys);
    if (!default_encoding) goto bad;
    default_encoding_c = PyBytes_AsString(default_encoding);
    if (!default_encoding_c) goto bad;
    if (strcmp(default_encoding_c, "ascii") == 0) {
        __Pyx_sys_getdefaultencoding_not_ascii = 0;
    } else {
        char ascii_chars[128];
        int c;
        for (c = 0; c < 128; c++) {
            ascii_chars[c] = c;
        }
        __Pyx_sys_getdefaultencoding_not_ascii = 1;
        ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
        if (!ascii_chars_u) goto bad;
        ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
        if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
            PyErr_Format(
                PyExc_ValueError,
                "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
                default_encoding_c);
            goto bad;
        }
        Py_DECREF(ascii_chars_u);
        Py_DECREF(ascii_chars_b);
    }
    Py_DECREF(default_encoding);
    return 0;
bad:
    Py_XDECREF(default_encoding);
    Py_XDECREF(ascii_chars_u);
    Py_XDECREF(ascii_chars_b);
    return -1;
}
#endif
#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
#else
#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
static char* __PYX_DEFAULT_STRING_ENCODING;
static int __Pyx_init_sys_getdefaultencoding_params(void) {
    PyObject* sys;
    PyObject* default_encoding = NULL;
    char* default_encoding_c;
    sys = PyImport_ImportModule("sys");
    if (!sys) goto bad;
    default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
    Py_DECREF(sys);
    if (!default_encoding) goto bad;
    default_encoding_c = PyBytes_AsString(default_encoding);
    if (!default_encoding_c) goto bad;
    __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c));
    if (!__PYX_DEFAULT_STRING_ENCODING) goto bad;
    strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
    Py_DECREF(default_encoding);
    return 0;
bad:
    Py_XDECREF(default_encoding);
    return -1;
}
#endif
#endif


/* Test for GCC > 2.95 */
#if defined(__GNUC__)     && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
  #define likely(x)   __builtin_expect(!!(x), 1)
  #define unlikely(x) __builtin_expect(!!(x), 0)
#else /* !__GNUC__ or GCC < 2.95 */
  #define likely(x)   (x)
  #define unlikely(x) (x)
#endif /* __GNUC__ */

static PyObject *__pyx_m;
static PyObject *__pyx_d;
static PyObject *__pyx_b;
static PyObject *__pyx_empty_tuple;
static PyObject *__pyx_empty_bytes;
static int __pyx_lineno;
static int __pyx_clineno = 0;
static const char * __pyx_cfilenm= __FILE__;
static const char *__pyx_filename;

#if !defined(CYTHON_CCOMPLEX)
  #if defined(__cplusplus)
    #define CYTHON_CCOMPLEX 1
  #elif defined(_Complex_I)
    #define CYTHON_CCOMPLEX 1
  #else
    #define CYTHON_CCOMPLEX 0
  #endif
#endif
#if CYTHON_CCOMPLEX
  #ifdef __cplusplus
    #include <complex>
  #else
    #include <complex.h>
  #endif
#endif
#if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__)
  #undef _Complex_I
  #define _Complex_I 1.0fj
#endif


static const char *__pyx_f[] = {
  "epr.pyx",
  "__init__.pxd",
  "type.pxd",
};

/* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":723
 * # in Cython to enable them only on the right systems.
 * 
 * ctypedef npy_int8       int8_t             # <<<<<<<<<<<<<<
 * ctypedef npy_int16      int16_t
 * ctypedef npy_int32      int32_t
 */
typedef npy_int8 __pyx_t_5numpy_int8_t;

/* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":724
 * 
 * ctypedef npy_int8       int8_t
 * ctypedef npy_int16      int16_t             # <<<<<<<<<<<<<<
 * ctypedef npy_int32      int32_t
 * ctypedef npy_int64      int64_t
 */
typedef npy_int16 __pyx_t_5numpy_int16_t;

/* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":725
 * ctypedef npy_int8       int8_t
 * ctypedef npy_int16      int16_t
 * ctypedef npy_int32      int32_t             # <<<<<<<<<<<<<<
 * ctypedef npy_int64      int64_t
 * #ctypedef npy_int96      int96_t
 */
typedef npy_int32 __pyx_t_5numpy_int32_t;

/* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":726
 * ctypedef npy_int16      int16_t
 * ctypedef npy_int32      int32_t
 * ctypedef npy_int64      int64_t             # <<<<<<<<<<<<<<
 * #ctypedef npy_int96      int96_t
 * #ctypedef npy_int128     int128_t
 */
typedef npy_int64 __pyx_t_5numpy_int64_t;

/* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":730
 * #ctypedef npy_int128     int128_t
 * 
 * ctypedef npy_uint8      uint8_t             # <<<<<<<<<<<<<<
 * ctypedef npy_uint16     uint16_t
 * ctypedef npy_uint32     uint32_t
 */
typedef npy_uint8 __pyx_t_5numpy_uint8_t;

/* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":731
 * 
 * ctypedef npy_uint8      uint8_t
 * ctypedef npy_uint16     uint16_t             # <<<<<<<<<<<<<<
 * ctypedef npy_uint32     uint32_t
 * ctypedef npy_uint64     uint64_t
 */
typedef npy_uint16 __pyx_t_5numpy_uint16_t;

/* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":732
 * ctypedef npy_uint8      uint8_t
 * ctypedef npy_uint16     uint16_t
 * ctypedef npy_uint32     uint32_t             # <<<<<<<<<<<<<<
 * ctypedef npy_uint64     uint64_t
 * #ctypedef npy_uint96     uint96_t
 */
typedef npy_uint32 __pyx_t_5numpy_uint32_t;

/* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":733
 * ctypedef npy_uint16     uint16_t
 * ctypedef npy_uint32     uint32_t
 * ctypedef npy_uint64     uint64_t             # <<<<<<<<<<<<<<
 * #ctypedef npy_uint96     uint96_t
 * #ctypedef npy_uint128    uint128_t
 */
typedef npy_uint64 __pyx_t_5numpy_uint64_t;

/* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":737
 * #ctypedef npy_uint128    uint128_t
 * 
 * ctypedef npy_float32    float32_t             # <<<<<<<<<<<<<<
 * ctypedef npy_float64    float64_t
 * #ctypedef npy_float80    float80_t
 */
typedef npy_float32 __pyx_t_5numpy_float32_t;

/* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":738
 * 
 * ctypedef npy_float32    float32_t
 * ctypedef npy_float64    float64_t             # <<<<<<<<<<<<<<
 * #ctypedef npy_float80    float80_t
 * #ctypedef npy_float128   float128_t
 */
typedef npy_float64 __pyx_t_5numpy_float64_t;

/* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":747
 * # The int types are mapped a bit surprising --
 * # numpy.int corresponds to 'l' and numpy.long to 'q'
 * ctypedef npy_long       int_t             # <<<<<<<<<<<<<<
 * ctypedef npy_longlong   long_t
 * ctypedef npy_longlong   longlong_t
 */
typedef npy_long __pyx_t_5numpy_int_t;

/* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":748
 * # numpy.int corresponds to 'l' and numpy.long to 'q'
 * ctypedef npy_long       int_t
 * ctypedef npy_longlong   long_t             # <<<<<<<<<<<<<<
 * ctypedef npy_longlong   longlong_t
 * 
 */
typedef npy_longlong __pyx_t_5numpy_long_t;

/* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":749
 * ctypedef npy_long       int_t
 * ctypedef npy_longlong   long_t
 * ctypedef npy_longlong   longlong_t             # <<<<<<<<<<<<<<
 * 
 * ctypedef npy_ulong      uint_t
 */
typedef npy_longlong __pyx_t_5numpy_longlong_t;

/* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":751
 * ctypedef npy_longlong   longlong_t
 * 
 * ctypedef npy_ulong      uint_t             # <<<<<<<<<<<<<<
 * ctypedef npy_ulonglong  ulong_t
 * ctypedef npy_ulonglong  ulonglong_t
 */
typedef npy_ulong __pyx_t_5numpy_uint_t;

/* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":752
 * 
 * ctypedef npy_ulong      uint_t
 * ctypedef npy_ulonglong  ulong_t             # <<<<<<<<<<<<<<
 * ctypedef npy_ulonglong  ulonglong_t
 * 
 */
typedef npy_ulonglong __pyx_t_5numpy_ulong_t;

/* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":753
 * ctypedef npy_ulong      uint_t
 * ctypedef npy_ulonglong  ulong_t
 * ctypedef npy_ulonglong  ulonglong_t             # <<<<<<<<<<<<<<
 * 
 * ctypedef npy_intp       intp_t
 */
typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t;

/* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":755
 * ctypedef npy_ulonglong  ulonglong_t
 * 
 * ctypedef npy_intp       intp_t             # <<<<<<<<<<<<<<
 * ctypedef npy_uintp      uintp_t
 * 
 */
typedef npy_intp __pyx_t_5numpy_intp_t;

/* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":756
 * 
 * ctypedef npy_intp       intp_t
 * ctypedef npy_uintp      uintp_t             # <<<<<<<<<<<<<<
 * 
 * ctypedef npy_double     float_t
 */
typedef npy_uintp __pyx_t_5numpy_uintp_t;

/* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":758
 * ctypedef npy_uintp      uintp_t
 * 
 * ctypedef npy_double     float_t             # <<<<<<<<<<<<<<
 * ctypedef npy_double     double_t
 * ctypedef npy_longdouble longdouble_t
 */
typedef npy_double __pyx_t_5numpy_float_t;

/* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":759
 * 
 * ctypedef npy_double     float_t
 * ctypedef npy_double     double_t             # <<<<<<<<<<<<<<
 * ctypedef npy_longdouble longdouble_t
 * 
 */
typedef npy_double __pyx_t_5numpy_double_t;

/* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":760
 * ctypedef npy_double     float_t
 * ctypedef npy_double     double_t
 * ctypedef npy_longdouble longdouble_t             # <<<<<<<<<<<<<<
 * 
 * ctypedef npy_cfloat      cfloat_t
 */
typedef npy_longdouble __pyx_t_5numpy_longdouble_t;
#if CYTHON_CCOMPLEX
  #ifdef __cplusplus
    typedef ::std::complex< float > __pyx_t_float_complex;
  #else
    typedef float _Complex __pyx_t_float_complex;
  #endif
#else
    typedef struct { float real, imag; } __pyx_t_float_complex;
#endif

#if CYTHON_CCOMPLEX
  #ifdef __cplusplus
    typedef ::std::complex< double > __pyx_t_double_complex;
  #else
    typedef double _Complex __pyx_t_double_complex;
  #endif
#else
    typedef struct { double real, imag; } __pyx_t_double_complex;
#endif


/*--- Type declarations ---*/
struct __pyx_obj_3epr__CLib;
struct __pyx_obj_3epr_EprObject;
struct __pyx_obj_3epr_DSD;
struct __pyx_obj_3epr_Field;
struct __pyx_obj_3epr_Record;
struct __pyx_obj_3epr_Raster;
struct __pyx_obj_3epr_Band;
struct __pyx_obj_3epr_Dataset;
struct __pyx_obj_3epr_Product;
struct __pyx_obj_3epr___pyx_scope_struct____iter__;
struct __pyx_obj_3epr___pyx_scope_struct_1_genexpr;
struct __pyx_obj_3epr___pyx_scope_struct_2___iter__;
struct __pyx_obj_3epr___pyx_scope_struct_3_genexpr;

/* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":762
 * ctypedef npy_longdouble longdouble_t
 * 
 * ctypedef npy_cfloat      cfloat_t             # <<<<<<<<<<<<<<
 * ctypedef npy_cdouble     cdouble_t
 * ctypedef npy_clongdouble clongdouble_t
 */
typedef npy_cfloat __pyx_t_5numpy_cfloat_t;

/* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":763
 * 
 * ctypedef npy_cfloat      cfloat_t
 * ctypedef npy_cdouble     cdouble_t             # <<<<<<<<<<<<<<
 * ctypedef npy_clongdouble clongdouble_t
 * 
 */
typedef npy_cdouble __pyx_t_5numpy_cdouble_t;

/* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":764
 * ctypedef npy_cfloat      cfloat_t
 * ctypedef npy_cdouble     cdouble_t
 * ctypedef npy_clongdouble clongdouble_t             # <<<<<<<<<<<<<<
 * 
 * ctypedef npy_cdouble     complex_t
 */
typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t;

/* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":766
 * ctypedef npy_clongdouble clongdouble_t
 * 
 * ctypedef npy_cdouble     complex_t             # <<<<<<<<<<<<<<
 * 
 * cdef inline object PyArray_MultiIterNew1(a):
 */
typedef npy_cdouble __pyx_t_5numpy_complex_t;
struct __pyx_t_3epr_EPR_FieldInfo;
typedef struct __pyx_t_3epr_EPR_FieldInfo __pyx_t_3epr_EPR_FieldInfo;
struct __pyx_t_3epr_EPR_RecordInfo;
typedef struct __pyx_t_3epr_EPR_RecordInfo __pyx_t_3epr_EPR_RecordInfo;
struct __pyx_opt_args_3epr__to_bytes;
struct __pyx_opt_args_3epr__to_str;
struct __pyx_opt_args_3epr_pyepr_null_ptr_error;
struct __pyx_opt_args_3epr_new_dsd;
struct __pyx_opt_args_3epr_5Field__get_offset;
struct __pyx_opt_args_3epr_5Field__set_elems;
struct __pyx_opt_args_3epr_new_field;
struct __pyx_opt_args_3epr_6Record__get_offset;
struct __pyx_opt_args_3epr_new_record;
struct __pyx_opt_args_3epr_new_raster;
struct __pyx_opt_args_3epr_4Band_read_raster;
struct __pyx_opt_args_3epr_new_band;
struct __pyx_opt_args_3epr_new_dataset;

/* "epr.pxd":357
 * 
 * # epr_field.h
 * ctypedef struct EPR_FieldInfo:             # <<<<<<<<<<<<<<
 *     char* name
 *     EPR_EDataTypeId data_type_id
 */
struct __pyx_t_3epr_EPR_FieldInfo {
  char *name;
  EPR_EDataTypeId data_type_id;
  uint num_elems;
  char *unit;
  char *description;
  uint tot_size;
};

/* "epr.pxd":367
 * 
 * # epr_record.h
 * ctypedef struct EPR_RecordInfo:             # <<<<<<<<<<<<<<
 *     char* dataset_name
 *     EPR_SPtrArray* field_infos
 */
struct __pyx_t_3epr_EPR_RecordInfo {
  char *dataset_name;
  EPR_SPtrArray *field_infos;
  uint tot_size;
};

/* "epr.pyx":83
 * 
 * 
 * cdef inline bytes _to_bytes(s, encoding='UTF-8'):             # <<<<<<<<<<<<<<
 *     if hasattr(s, 'encode'):
 *         return s.encode(encoding)
 */
struct __pyx_opt_args_3epr__to_bytes {
  int __pyx_n;
  PyObject *encoding;
};

/* "epr.pyx":90
 * 
 * 
 * cdef inline str _to_str(b, encoding='UTF-8'):             # <<<<<<<<<<<<<<
 *     if PY3:
 *         return b.decode(encoding)
 */
struct __pyx_opt_args_3epr__to_str {
  int __pyx_n;
  PyObject *encoding;
};

/* "epr.pyx":232
 * 
 * 
 * cdef pyepr_null_ptr_error(msg='null pointer'):             # <<<<<<<<<<<<<<
 *     cdef int code
 *     cdef str eprmsg = _to_str(<char*>epr_get_last_err_message(), 'ascii')
 */
struct __pyx_opt_args_3epr_pyepr_null_ptr_error {
  int __pyx_n;
  PyObject *msg;
};

/* "epr.pyx":505
 * 
 * 
 * cdef new_dsd(EPR_SDSD* ptr, object parent=None):             # <<<<<<<<<<<<<<
 *     if ptr is NULL:
 *         pyepr_null_ptr_error()
 */
struct __pyx_opt_args_3epr_new_dsd {
  int __pyx_n;
  PyObject *parent;
};

/* "epr.pyx":536
 *         self._parent._check_write_mode()
 * 
 *     cdef long _get_offset(self, bint absolute=0):             # <<<<<<<<<<<<<<
 *         cdef bint found = 0
 *         cdef int i = 0
 */
struct __pyx_opt_args_3epr_5Field__get_offset {
  int __pyx_n;
  int absolute;
};

/* "epr.pyx":829
 *         return out
 * 
 *     cdef _set_elems(self, np.ndarray elems, uint index=0):             # <<<<<<<<<<<<<<
 *         cdef Record record
 *         cdef Dataset dataset
 */
struct __pyx_opt_args_3epr_5Field__set_elems {
  int __pyx_n;
  uint index;
};

/* "epr.pyx":1094
 * 
 * 
 * cdef new_field(EPR_SField* ptr, Record parent=None):             # <<<<<<<<<<<<<<
 *     if ptr is NULL:
 *         pyepr_null_ptr_error()
 */
struct __pyx_opt_args_3epr_new_field {
  int __pyx_n;
  struct __pyx_obj_3epr_Record *parent;
};

/* "epr.pyx":1142
 *             (<Product>self._parent)._check_write_mode()
 * 
 *     cdef inline uint _get_offset(self, bint absolure=0):             # <<<<<<<<<<<<<<
 *         cdef EPR_RecordInfo* info = <EPR_RecordInfo*>self._ptr.info
 *         cdef uint offset = self._index * info.tot_size
 */
struct __pyx_opt_args_3epr_6Record__get_offset {
  int __pyx_n;
  int absolure;
};

/* "epr.pyx":1387
 * 
 * 
 * cdef new_record(EPR_SRecord* ptr, object parent=None, bint dealloc=False):             # <<<<<<<<<<<<<<
 *     if ptr is NULL:
 *         pyepr_null_ptr_error()
 */
struct __pyx_opt_args_3epr_new_record {
  int __pyx_n;
  PyObject *parent;
  int dealloc;
};

/* "epr.pyx":1575
 * 
 * 
 * cdef new_raster(EPR_SRaster* ptr, Band parent=None):             # <<<<<<<<<<<<<<
 *     if ptr is NULL:
 *         pyepr_null_ptr_error()
 */
struct __pyx_opt_args_3epr_new_raster {
  int __pyx_n;
  struct __pyx_obj_3epr_Band *parent;
};

/* "epr.pyx":1975
 *         return new_raster(raster_ptr, self)
 * 
 *     cpdef read_raster(self, int xoffset=0, int yoffset=0, Raster raster=None):             # <<<<<<<<<<<<<<
 *         '''read_raster(self, xoffset=0, yoffset=0, Raster raster=None)
 * 
 */
struct __pyx_opt_args_3epr_4Band_read_raster {
  int __pyx_n;
  int xoffset;
  int yoffset;
  struct __pyx_obj_3epr_Raster *raster;
};

/* "epr.pyx":2143
 * 
 * 
 * cdef new_band(EPR_SBandId* ptr, Product parent=None):             # <<<<<<<<<<<<<<
 *     if ptr is NULL:
 *         pyepr_null_ptr_error()
 */
struct __pyx_opt_args_3epr_new_band {
  int __pyx_n;
  struct __pyx_obj_3epr_Product *parent;
};

/* "epr.pyx":2355
 * 
 * 
 * cdef new_dataset(EPR_SDatasetId* ptr, Product parent=None):             # <<<<<<<<<<<<<<
 *     if ptr is NULL:
 *         pyepr_null_ptr_error()
 */
struct __pyx_opt_args_3epr_new_dataset {
  int __pyx_n;
  struct __pyx_obj_3epr_Product *parent;
};

/* "epr.pyx":269
 * 
 * 
 * cdef class _CLib:             # <<<<<<<<<<<<<<
 *     '''Library object to handle C API initialization/finalization
 * 
 */
struct __pyx_obj_3epr__CLib {
  PyObject_HEAD
};


/* "epr.pyx":303
 * 
 * 
 * cdef class EprObject:             # <<<<<<<<<<<<<<
 *     cdef object epr_c_lib
 * 
 */
struct __pyx_obj_3epr_EprObject {
  PyObject_HEAD
  PyObject *epr_c_lib;
};


/* "epr.pyx":378
 * 
 * 
 * cdef class DSD(EprObject):             # <<<<<<<<<<<<<<
 *     '''Dataset descriptor
 * 
 */
struct __pyx_obj_3epr_DSD {
  struct __pyx_obj_3epr_EprObject __pyx_base;
  struct __pyx_vtabstruct_3epr_DSD *__pyx_vtab;
  EPR_SDSD *_ptr;
  PyObject *_parent;
};


/* "epr.pyx":517
 * 
 * 
 * cdef class Field(EprObject):             # <<<<<<<<<<<<<<
 *     '''Represents a field within a record
 * 
 */
struct __pyx_obj_3epr_Field {
  struct __pyx_obj_3epr_EprObject __pyx_base;
  struct __pyx_vtabstruct_3epr_Field *__pyx_vtab;
  EPR_SField *_ptr;
  struct __pyx_obj_3epr_Record *_parent;
};


/* "epr.pyx":1106
 * 
 * 
 * cdef class Record(EprObject):             # <<<<<<<<<<<<<<
 *     '''Represents a record read from an ENVISAT dataset
 * 
 */
struct __pyx_obj_3epr_Record {
  struct __pyx_obj_3epr_EprObject __pyx_base;
  struct __pyx_vtabstruct_3epr_Record *__pyx_vtab;
  EPR_SRecord *_ptr;
  PyObject *_parent;
  int _dealloc;
  int _index;
};


/* "epr.pyx":1401
 * 
 * 
 * cdef class Raster(EprObject):             # <<<<<<<<<<<<<<
 *     '''Represents a raster in which data will be stored
 * 
 */
struct __pyx_obj_3epr_Raster {
  struct __pyx_obj_3epr_EprObject __pyx_base;
  struct __pyx_vtabstruct_3epr_Raster *__pyx_vtab;
  EPR_SRaster *_ptr;
  struct __pyx_obj_3epr_Band *_parent;
  PyObject *_data;
};


/* "epr.pyx":1673
 * 
 * 
 * cdef class Band(EprObject):             # <<<<<<<<<<<<<<
 *     '''The band of an ENVISAT product
 * 
 */
struct __pyx_obj_3epr_Band {
  struct __pyx_obj_3epr_EprObject __pyx_base;
  struct __pyx_vtabstruct_3epr_Band *__pyx_vtab;
  EPR_SBandId *_ptr;
  struct __pyx_obj_3epr_Product *_parent;
};


/* "epr.pyx":2155
 * 
 * 
 * cdef class Dataset(EprObject):             # <<<<<<<<<<<<<<
 *     '''ENVISAT dataset
 * 
 */
struct __pyx_obj_3epr_Dataset {
  struct __pyx_obj_3epr_EprObject __pyx_base;
  struct __pyx_vtabstruct_3epr_Dataset *__pyx_vtab;
  EPR_SDatasetId *_ptr;
  struct __pyx_obj_3epr_Product *_parent;
};


/* "epr.pyx":2367
 * 
 * 
 * cdef class Product(EprObject):             # <<<<<<<<<<<<<<
 *     '''ENVISAT product
 * 
 */
struct __pyx_obj_3epr_Product {
  struct __pyx_obj_3epr_EprObject __pyx_base;
  struct __pyx_vtabstruct_3epr_Product *__pyx_vtab;
  EPR_SProductId *_ptr;
  PyObject *_mode;
};


/* "epr.pyx":1350
 *         return list(self)
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         cdef int idx
 *         cdef int num_fields
 */
struct __pyx_obj_3epr___pyx_scope_struct____iter__ {
  PyObject_HEAD
  int __pyx_v_num_fields;
  struct __pyx_obj_3epr_Record *__pyx_v_self;
};


/* "epr.pyx":1358
 *         num_fields = epr_get_num_fields(self._ptr)
 * 
 *         return (self.get_field_at(idx) for idx in range(num_fields))             # <<<<<<<<<<<<<<
 * 
 *     def __str__(self):
 */
struct __pyx_obj_3epr___pyx_scope_struct_1_genexpr {
  PyObject_HEAD
  struct __pyx_obj_3epr___pyx_scope_struct____iter__ *__pyx_outer_scope;
  int __pyx_v_idx;
  int __pyx_t_0;
  int __pyx_t_1;
};


/* "epr.pyx":2331
 *         return list(self)
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         cdef int idx
 *         self.check_closed_product()
 */
struct __pyx_obj_3epr___pyx_scope_struct_2___iter__ {
  PyObject_HEAD
  struct __pyx_obj_3epr_Dataset *__pyx_v_self;
};


/* "epr.pyx":2334
 *         cdef int idx
 *         self.check_closed_product()
 *         return (self.read_record(idx)             # <<<<<<<<<<<<<<
 *                             for idx in range(epr_get_num_records(self._ptr)))
 * 
 */
struct __pyx_obj_3epr___pyx_scope_struct_3_genexpr {
  PyObject_HEAD
  struct __pyx_obj_3epr___pyx_scope_struct_2___iter__ *__pyx_outer_scope;
  uint __pyx_v_idx;
  uint __pyx_t_0;
  uint __pyx_t_1;
};



/* "epr.pyx":378
 * 
 * 
 * cdef class DSD(EprObject):             # <<<<<<<<<<<<<<
 *     '''Dataset descriptor
 * 
 */

struct __pyx_vtabstruct_3epr_DSD {
  PyObject *(*check_closed_product)(struct __pyx_obj_3epr_DSD *);
};
static struct __pyx_vtabstruct_3epr_DSD *__pyx_vtabptr_3epr_DSD;
static CYTHON_INLINE PyObject *__pyx_f_3epr_3DSD_check_closed_product(struct __pyx_obj_3epr_DSD *);


/* "epr.pyx":517
 * 
 * 
 * cdef class Field(EprObject):             # <<<<<<<<<<<<<<
 *     '''Represents a field within a record
 * 
 */

struct __pyx_vtabstruct_3epr_Field {
  PyObject *(*check_closed_product)(struct __pyx_obj_3epr_Field *);
  PyObject *(*_check_write_mode)(struct __pyx_obj_3epr_Field *);
  long (*_get_offset)(struct __pyx_obj_3epr_Field *, struct __pyx_opt_args_3epr_5Field__get_offset *__pyx_optional_args);
  PyObject *(*_set_elems)(struct __pyx_obj_3epr_Field *, PyArrayObject *, struct __pyx_opt_args_3epr_5Field__set_elems *__pyx_optional_args);
};
static struct __pyx_vtabstruct_3epr_Field *__pyx_vtabptr_3epr_Field;
static CYTHON_INLINE PyObject *__pyx_f_3epr_5Field_check_closed_product(struct __pyx_obj_3epr_Field *);
static CYTHON_INLINE PyObject *__pyx_f_3epr_5Field__check_write_mode(struct __pyx_obj_3epr_Field *);


/* "epr.pyx":1106
 * 
 * 
 * cdef class Record(EprObject):             # <<<<<<<<<<<<<<
 *     '''Represents a record read from an ENVISAT dataset
 * 
 */

struct __pyx_vtabstruct_3epr_Record {
  PyObject *(*check_closed_product)(struct __pyx_obj_3epr_Record *);
  PyObject *(*_check_write_mode)(struct __pyx_obj_3epr_Record *);
  uint (*_get_offset)(struct __pyx_obj_3epr_Record *, struct __pyx_opt_args_3epr_6Record__get_offset *__pyx_optional_args);
};
static struct __pyx_vtabstruct_3epr_Record *__pyx_vtabptr_3epr_Record;
static CYTHON_INLINE PyObject *__pyx_f_3epr_6Record_check_closed_product(struct __pyx_obj_3epr_Record *);
static CYTHON_INLINE PyObject *__pyx_f_3epr_6Record__check_write_mode(struct __pyx_obj_3epr_Record *);
static CYTHON_INLINE uint __pyx_f_3epr_6Record__get_offset(struct __pyx_obj_3epr_Record *, struct __pyx_opt_args_3epr_6Record__get_offset *__pyx_optional_args);


/* "epr.pyx":1401
 * 
 * 
 * cdef class Raster(EprObject):             # <<<<<<<<<<<<<<
 *     '''Represents a raster in which data will be stored
 * 
 */

struct __pyx_vtabstruct_3epr_Raster {
  PyArrayObject *(*toarray)(struct __pyx_obj_3epr_Raster *);
};
static struct __pyx_vtabstruct_3epr_Raster *__pyx_vtabptr_3epr_Raster;


/* "epr.pyx":1673
 * 
 * 
 * cdef class Band(EprObject):             # <<<<<<<<<<<<<<
 *     '''The band of an ENVISAT product
 * 
 */

struct __pyx_vtabstruct_3epr_Band {
  PyObject *(*check_closed_product)(struct __pyx_obj_3epr_Band *);
  PyObject *(*read_raster)(struct __pyx_obj_3epr_Band *, int __pyx_skip_dispatch, struct __pyx_opt_args_3epr_4Band_read_raster *__pyx_optional_args);
};
static struct __pyx_vtabstruct_3epr_Band *__pyx_vtabptr_3epr_Band;
static CYTHON_INLINE PyObject *__pyx_f_3epr_4Band_check_closed_product(struct __pyx_obj_3epr_Band *);


/* "epr.pyx":2155
 * 
 * 
 * cdef class Dataset(EprObject):             # <<<<<<<<<<<<<<
 *     '''ENVISAT dataset
 * 
 */

struct __pyx_vtabstruct_3epr_Dataset {
  PyObject *(*check_closed_product)(struct __pyx_obj_3epr_Dataset *);
  PyObject *(*_check_write_mode)(struct __pyx_obj_3epr_Dataset *);
  uint (*_get_offset)(struct __pyx_obj_3epr_Dataset *);
};
static struct __pyx_vtabstruct_3epr_Dataset *__pyx_vtabptr_3epr_Dataset;
static CYTHON_INLINE PyObject *__pyx_f_3epr_7Dataset_check_closed_product(struct __pyx_obj_3epr_Dataset *);
static CYTHON_INLINE PyObject *__pyx_f_3epr_7Dataset__check_write_mode(struct __pyx_obj_3epr_Dataset *);
static CYTHON_INLINE uint __pyx_f_3epr_7Dataset__get_offset(struct __pyx_obj_3epr_Dataset *);


/* "epr.pyx":2367
 * 
 * 
 * cdef class Product(EprObject):             # <<<<<<<<<<<<<<
 *     '''ENVISAT product
 * 
 */

struct __pyx_vtabstruct_3epr_Product {
  PyObject *(*check_closed_product)(struct __pyx_obj_3epr_Product *);
  PyObject *(*_check_write_mode)(struct __pyx_obj_3epr_Product *);
};
static struct __pyx_vtabstruct_3epr_Product *__pyx_vtabptr_3epr_Product;
static CYTHON_INLINE PyObject *__pyx_f_3epr_7Product_check_closed_product(struct __pyx_obj_3epr_Product *);
static CYTHON_INLINE PyObject *__pyx_f_3epr_7Product__check_write_mode(struct __pyx_obj_3epr_Product *);
#ifndef CYTHON_REFNANNY
  #define CYTHON_REFNANNY 0
#endif
#if CYTHON_REFNANNY
  typedef struct {
    void (*INCREF)(void*, PyObject*, int);
    void (*DECREF)(void*, PyObject*, int);
    void (*GOTREF)(void*, PyObject*, int);
    void (*GIVEREF)(void*, PyObject*, int);
    void* (*SetupContext)(const char*, int, const char*);
    void (*FinishContext)(void**);
  } __Pyx_RefNannyAPIStruct;
  static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
  static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); /*proto*/
  #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
#ifdef WITH_THREAD
  #define __Pyx_RefNannySetupContext(name, acquire_gil) \
          if (acquire_gil) { \
              PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); \
              __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \
              PyGILState_Release(__pyx_gilstate_save); \
          } else { \
              __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \
          }
#else
  #define __Pyx_RefNannySetupContext(name, acquire_gil) \
          __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
#endif
  #define __Pyx_RefNannyFinishContext() \
          __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
  #define __Pyx_INCREF(r)  __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  #define __Pyx_DECREF(r)  __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  #define __Pyx_GOTREF(r)  __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  #define __Pyx_XINCREF(r)  do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
  #define __Pyx_XDECREF(r)  do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
  #define __Pyx_XGOTREF(r)  do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
  #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
#else
  #define __Pyx_RefNannyDeclarations
  #define __Pyx_RefNannySetupContext(name, acquire_gil)
  #define __Pyx_RefNannyFinishContext()
  #define __Pyx_INCREF(r) Py_INCREF(r)
  #define __Pyx_DECREF(r) Py_DECREF(r)
  #define __Pyx_GOTREF(r)
  #define __Pyx_GIVEREF(r)
  #define __Pyx_XINCREF(r) Py_XINCREF(r)
  #define __Pyx_XDECREF(r) Py_XDECREF(r)
  #define __Pyx_XGOTREF(r)
  #define __Pyx_XGIVEREF(r)
#endif /* CYTHON_REFNANNY */
#define __Pyx_XDECREF_SET(r, v) do {                            \
        PyObject *tmp = (PyObject *) r;                         \
        r = v; __Pyx_XDECREF(tmp);                              \
    } while (0)
#define __Pyx_DECREF_SET(r, v) do {                             \
        PyObject *tmp = (PyObject *) r;                         \
        r = v; __Pyx_DECREF(tmp);                               \
    } while (0)
#define __Pyx_CLEAR(r)    do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
#define __Pyx_XCLEAR(r)   do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)

#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
    PyTypeObject* tp = Py_TYPE(obj);
    if (likely(tp->tp_getattro))
        return tp->tp_getattro(obj, attr_name);
#if PY_MAJOR_VERSION < 3
    if (likely(tp->tp_getattr))
        return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
#endif
    return PyObject_GetAttr(obj, attr_name);
}
#else
#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
#endif

static PyObject *__Pyx_GetBuiltinName(PyObject *name); /*proto*/

#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw); /*proto*/
#else
#define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
#endif

static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); /*proto*/

static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], \
    PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, \
    const char* function_name); /*proto*/

static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
    Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/

static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name); /*proto*/

#if CYTHON_COMPILING_IN_CPYTHON
#define __Pyx_PyObject_DelAttrStr(o,n) __Pyx_PyObject_SetAttrStr(o,n,NULL)
static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value) {
    PyTypeObject* tp = Py_TYPE(obj);
    if (likely(tp->tp_setattro))
        return tp->tp_setattro(obj, attr_name, value);
#if PY_MAJOR_VERSION < 3
    if (likely(tp->tp_setattr))
        return tp->tp_setattr(obj, PyString_AS_STRING(attr_name), value);
#endif
    return PyObject_SetAttr(obj, attr_name, value);
}
#else
#define __Pyx_PyObject_DelAttrStr(o,n)   PyObject_DelAttr(o,n)
#define __Pyx_PyObject_SetAttrStr(o,n,v) PyObject_SetAttr(o,n,v)
#endif

static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/

static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); /*proto*/

static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb); /*proto*/
static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb); /*proto*/

static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb); /*proto*/

static CYTHON_INLINE int __Pyx_CheckKeywordStrings(PyObject *kwdict, const char* function_name, int kw_allowed); /*proto*/

static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/

static void __Pyx_WriteUnraisable(const char *name, int clineno,
                                  int lineno, const char *filename,
                                  int full_traceback); /*proto*/

#define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck) \
    (__Pyx_fits_Py_ssize_t(i, type, is_signed) ? \
    __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck) : \
    (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) : \
               __Pyx_GetItemInt_Generic(o, to_py_func(i))))
#define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck) \
    (__Pyx_fits_Py_ssize_t(i, type, is_signed) ? \
    __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) : \
    (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL))
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
                                                              int wraparound, int boundscheck);
#define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck) \
    (__Pyx_fits_Py_ssize_t(i, type, is_signed) ? \
    __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) : \
    (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL))
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
                                                              int wraparound, int boundscheck);
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j);
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
                                                     int is_list, int wraparound, int boundscheck);

static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);

static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);

static CYTHON_INLINE int __Pyx_IterFinish(void); /*proto*/

static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected); /*proto*/

#if PY_MAJOR_VERSION < 3
#define __Pyx_PyString_Join __Pyx_PyBytes_Join
#define __Pyx_PyBaseString_Join(s, v) (PyUnicode_CheckExact(s) ? PyUnicode_Join(s, v) : __Pyx_PyBytes_Join(s, v))
#else
#define __Pyx_PyString_Join PyUnicode_Join
#define __Pyx_PyBaseString_Join PyUnicode_Join
#endif
#if CYTHON_COMPILING_IN_CPYTHON
    #if PY_MAJOR_VERSION < 3
    #define __Pyx_PyBytes_Join _PyString_Join
    #else
    #define __Pyx_PyBytes_Join _PyBytes_Join
    #endif
#else
static CYTHON_INLINE PyObject* __Pyx_PyBytes_Join(PyObject* sep, PyObject* values); /*proto*/
#endif

#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE int __Pyx_ListComp_Append(PyObject* list, PyObject* x) {
    PyListObject* L = (PyListObject*) list;
    Py_ssize_t len = Py_SIZE(list);
    if (likely(L->allocated > len)) {
        Py_INCREF(x);
        PyList_SET_ITEM(list, len, x);
        Py_SIZE(list) = len+1;
        return 0;
    }
    return PyList_Append(list, x);
}
#else
#define __Pyx_ListComp_Append(L,x) PyList_Append(L,x)
#endif

#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) {
    PyListObject* L = (PyListObject*) list;
    Py_ssize_t len = Py_SIZE(list);
    if (likely(L->allocated > len) & likely(len > (L->allocated >> 1))) {
        Py_INCREF(x);
        PyList_SET_ITEM(list, len, x);
        Py_SIZE(list) = len+1;
        return 0;
    }
    return PyList_Append(list, x);
}
#else
#define __Pyx_PyList_Append(L,x) PyList_Append(L,x)
#endif

static CYTHON_INLINE void __Pyx_RaiseClosureNameError(const char *varname);

static CYTHON_INLINE int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed,
    const char *name, int exact); /*proto*/

static CYTHON_INLINE int __Pyx_PyList_Extend(PyObject* L, PyObject* v) {
#if CYTHON_COMPILING_IN_CPYTHON
    PyObject* none = _PyList_Extend((PyListObject*)L, v);
    if (unlikely(!none))
        return -1;
    Py_DECREF(none);
    return 0;
#else
    return PyList_SetSlice(L, PY_SSIZE_T_MAX, PY_SSIZE_T_MAX, v);
#endif
}

#include <string.h>

static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals); /*proto*/

static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals); /*proto*/

#if PY_MAJOR_VERSION >= 3
#define __Pyx_PyString_Equals __Pyx_PyUnicode_Equals
#else
#define __Pyx_PyString_Equals __Pyx_PyBytes_Equals
#endif

static CYTHON_INLINE int __Pyx_PySequence_Contains(PyObject* item, PyObject* seq, int eq) {
    int result = PySequence_Contains(seq, item);
    return unlikely(result < 0) ? result : (result == (eq == Py_EQ));
}

static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void);

static int __Pyx_SetVtable(PyObject *dict, void *vtable); /*proto*/

static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name); /*proto*/

static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases);

static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type);

#define __Pyx_CyFunction_USED 1
#include <structmember.h>
#define __Pyx_CYFUNCTION_STATICMETHOD  0x01
#define __Pyx_CYFUNCTION_CLASSMETHOD   0x02
#define __Pyx_CYFUNCTION_CCLASS        0x04
#define __Pyx_CyFunction_GetClosure(f) \
    (((__pyx_CyFunctionObject *) (f))->func_closure)
#define __Pyx_CyFunction_GetClassObj(f) \
    (((__pyx_CyFunctionObject *) (f))->func_classobj)
#define __Pyx_CyFunction_Defaults(type, f) \
    ((type *)(((__pyx_CyFunctionObject *) (f))->defaults))
#define __Pyx_CyFunction_SetDefaultsGetter(f, g) \
    ((__pyx_CyFunctionObject *) (f))->defaults_getter = (g)
typedef struct {
    PyCFunctionObject func;
    PyObject *func_dict;
    PyObject *func_weakreflist;
    PyObject *func_name;
    PyObject *func_qualname;
    PyObject *func_doc;
    PyObject *func_globals;
    PyObject *func_code;
    PyObject *func_closure;
    PyObject *func_classobj; /* No-args super() class cell */
    void *defaults;
    int defaults_pyobjects;
    int flags;
    PyObject *defaults_tuple;   /* Const defaults tuple */
    PyObject *defaults_kwdict;  /* Const kwonly defaults dict */
    PyObject *(*defaults_getter)(PyObject *);
    PyObject *func_annotations; /* function annotations dict */
} __pyx_CyFunctionObject;
static PyTypeObject *__pyx_CyFunctionType = 0;
#define __Pyx_CyFunction_NewEx(ml, flags, qualname, self, module, globals, code) \
    __Pyx_CyFunction_New(__pyx_CyFunctionType, ml, flags, qualname, self, module, globals, code)
static PyObject *__Pyx_CyFunction_New(PyTypeObject *, PyMethodDef *ml,
                                      int flags, PyObject* qualname,
                                      PyObject *self,
                                      PyObject *module, PyObject *globals,
                                      PyObject* code);
static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *m,
                                                         size_t size,
                                                         int pyobjects);
static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *m,
                                                            PyObject *tuple);
static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *m,
                                                             PyObject *dict);
static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *m,
                                                              PyObject *dict);
static int __Pyx_CyFunction_init(void);

static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name, PyObject *qualname,
                                           PyObject *mkw, PyObject *modname, PyObject *doc); /*proto*/
static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObject *bases, PyObject *dict,
                                      PyObject *mkw, int calculate_metaclass, int allow_py2_metaclass); /*proto*/

static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level); /*proto*/

static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value);

static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);

static CYTHON_INLINE uint __Pyx_PyInt_As_uint(PyObject *);

static CYTHON_INLINE PyObject* __Pyx_PyInt_From_uint(uint value);

static CYTHON_INLINE PyObject* __Pyx_PyInt_From_EPR_Magic(EPR_Magic value);

static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);

#ifndef __PYX_FORCE_INIT_THREADS
  #define __PYX_FORCE_INIT_THREADS 0
#endif

static CYTHON_INLINE PyObject* __Pyx_PyInt_From_uchar(uchar value);

static CYTHON_INLINE PyObject* __Pyx_PyInt_From_char(char value);

static CYTHON_INLINE PyObject* __Pyx_PyInt_From_ushort(ushort value);

static CYTHON_INLINE PyObject* __Pyx_PyInt_From_short(short value);

static CYTHON_INLINE PyObject* __Pyx_PyInt_From_Py_intptr_t(Py_intptr_t value);

static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);

static CYTHON_INLINE size_t __Pyx_PyInt_As_size_t(PyObject *);

#if CYTHON_CCOMPLEX
  #ifdef __cplusplus
    #define __Pyx_CREAL(z) ((z).real())
    #define __Pyx_CIMAG(z) ((z).imag())
  #else
    #define __Pyx_CREAL(z) (__real__(z))
    #define __Pyx_CIMAG(z) (__imag__(z))
  #endif
#else
    #define __Pyx_CREAL(z) ((z).real)
    #define __Pyx_CIMAG(z) ((z).imag)
#endif
#if (defined(_WIN32) || defined(__clang__)) && defined(__cplusplus) && CYTHON_CCOMPLEX
    #define __Pyx_SET_CREAL(z,x) ((z).real(x))
    #define __Pyx_SET_CIMAG(z,y) ((z).imag(y))
#else
    #define __Pyx_SET_CREAL(z,x) __Pyx_CREAL(z) = (x)
    #define __Pyx_SET_CIMAG(z,y) __Pyx_CIMAG(z) = (y)
#endif

static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float, float);

#if CYTHON_CCOMPLEX
    #define __Pyx_c_eqf(a, b)   ((a)==(b))
    #define __Pyx_c_sumf(a, b)  ((a)+(b))
    #define __Pyx_c_difff(a, b) ((a)-(b))
    #define __Pyx_c_prodf(a, b) ((a)*(b))
    #define __Pyx_c_quotf(a, b) ((a)/(b))
    #define __Pyx_c_negf(a)     (-(a))
  #ifdef __cplusplus
    #define __Pyx_c_is_zerof(z) ((z)==(float)0)
    #define __Pyx_c_conjf(z)    (::std::conj(z))
    #if 1
        #define __Pyx_c_absf(z)     (::std::abs(z))
        #define __Pyx_c_powf(a, b)  (::std::pow(a, b))
    #endif
  #else
    #define __Pyx_c_is_zerof(z) ((z)==0)
    #define __Pyx_c_conjf(z)    (conjf(z))
    #if 1
        #define __Pyx_c_absf(z)     (cabsf(z))
        #define __Pyx_c_powf(a, b)  (cpowf(a, b))
    #endif
 #endif
#else
    static CYTHON_INLINE int __Pyx_c_eqf(__pyx_t_float_complex, __pyx_t_float_complex);
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sumf(__pyx_t_float_complex, __pyx_t_float_complex);
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_difff(__pyx_t_float_complex, __pyx_t_float_complex);
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prodf(__pyx_t_float_complex, __pyx_t_float_complex);
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quotf(__pyx_t_float_complex, __pyx_t_float_complex);
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_negf(__pyx_t_float_complex);
    static CYTHON_INLINE int __Pyx_c_is_zerof(__pyx_t_float_complex);
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conjf(__pyx_t_float_complex);
    #if 1
        static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex);
        static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_powf(__pyx_t_float_complex, __pyx_t_float_complex);
    #endif
#endif

static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double);

#if CYTHON_CCOMPLEX
    #define __Pyx_c_eq(a, b)   ((a)==(b))
    #define __Pyx_c_sum(a, b)  ((a)+(b))
    #define __Pyx_c_diff(a, b) ((a)-(b))
    #define __Pyx_c_prod(a, b) ((a)*(b))
    #define __Pyx_c_quot(a, b) ((a)/(b))
    #define __Pyx_c_neg(a)     (-(a))
  #ifdef __cplusplus
    #define __Pyx_c_is_zero(z) ((z)==(double)0)
    #define __Pyx_c_conj(z)    (::std::conj(z))
    #if 1
        #define __Pyx_c_abs(z)     (::std::abs(z))
        #define __Pyx_c_pow(a, b)  (::std::pow(a, b))
    #endif
  #else
    #define __Pyx_c_is_zero(z) ((z)==0)
    #define __Pyx_c_conj(z)    (conj(z))
    #if 1
        #define __Pyx_c_abs(z)     (cabs(z))
        #define __Pyx_c_pow(a, b)  (cpow(a, b))
    #endif
 #endif
#else
    static CYTHON_INLINE int __Pyx_c_eq(__pyx_t_double_complex, __pyx_t_double_complex);
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum(__pyx_t_double_complex, __pyx_t_double_complex);
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff(__pyx_t_double_complex, __pyx_t_double_complex);
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod(__pyx_t_double_complex, __pyx_t_double_complex);
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot(__pyx_t_double_complex, __pyx_t_double_complex);
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg(__pyx_t_double_complex);
    static CYTHON_INLINE int __Pyx_c_is_zero(__pyx_t_double_complex);
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj(__pyx_t_double_complex);
    #if 1
        static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex);
        static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow(__pyx_t_double_complex, __pyx_t_double_complex);
    #endif
#endif

static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb); /*proto*/

static PyObject* __Pyx_PyObject_CallMethodTuple(PyObject* obj, PyObject* method_name, PyObject* args) {
    PyObject *method, *result = NULL;
    if (unlikely(!args)) return NULL;
    method = __Pyx_PyObject_GetAttrStr(obj, method_name);
    if (unlikely(!method)) goto bad;
    result = __Pyx_PyObject_Call(method, args, NULL);
    Py_DECREF(method);
bad:
    Py_DECREF(args);
    return result;
}
#define __Pyx_PyObject_CallMethod3(obj, name, arg1, arg2, arg3) \
    __Pyx_PyObject_CallMethodTuple(obj, name, PyTuple_Pack(3, arg1, arg2, arg3))
#define __Pyx_PyObject_CallMethod2(obj, name, arg1, arg2) \
    __Pyx_PyObject_CallMethodTuple(obj, name, PyTuple_Pack(2, arg1, arg2))
#define __Pyx_PyObject_CallMethod1(obj, name, arg1) \
    __Pyx_PyObject_CallMethodTuple(obj, name, PyTuple_Pack(1, arg1))
#define __Pyx_PyObject_CallMethod0(obj, name) \
    __Pyx_PyObject_CallMethodTuple(obj, name, (Py_INCREF(__pyx_empty_tuple), __pyx_empty_tuple))

#define __Pyx_Generator_USED
#include <structmember.h>
#include <frameobject.h>
typedef PyObject *(*__pyx_generator_body_t)(PyObject *, PyObject *);
typedef struct {
    PyObject_HEAD
    __pyx_generator_body_t body;
    PyObject *closure;
    PyObject *exc_type;
    PyObject *exc_value;
    PyObject *exc_traceback;
    PyObject *gi_weakreflist;
    PyObject *classobj;
    PyObject *yieldfrom;
    int resume_label;
    char is_running;
} __pyx_GeneratorObject;
static __pyx_GeneratorObject *__Pyx_Generator_New(__pyx_generator_body_t body,
                                                  PyObject *closure);
static int __pyx_Generator_init(void);
static int __Pyx_Generator_clear(PyObject* self);
#if 1 || PY_VERSION_HEX < 0x030300B0
static int __Pyx_PyGen_FetchStopIterationValue(PyObject **pvalue);
#else
#define __Pyx_PyGen_FetchStopIterationValue(pvalue) PyGen_FetchStopIterationValue(pvalue)
#endif

static int __Pyx_check_binary_version(void);

#if !defined(__Pyx_PyIdentifier_FromString)
#if PY_MAJOR_VERSION < 3
  #define __Pyx_PyIdentifier_FromString(s) PyString_FromString(s)
#else
  #define __Pyx_PyIdentifier_FromString(s) PyUnicode_FromString(s)
#endif
#endif

static PyObject *__Pyx_ImportModule(const char *name); /*proto*/

static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict);  /*proto*/

typedef struct {
    int code_line;
    PyCodeObject* code_object;
} __Pyx_CodeObjectCacheEntry;
struct __Pyx_CodeObjectCache {
    int count;
    int max_count;
    __Pyx_CodeObjectCacheEntry* entries;
};
static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
static PyCodeObject *__pyx_find_code_object(int code_line);
static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);

static void __Pyx_AddTraceback(const char *funcname, int c_line,
                               int py_line, const char *filename); /*proto*/

static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/


/* Module declarations from 'libc.string' */

/* Module declarations from 'libc.stdio' */

/* Module declarations from 'libc.stdlib' */

/* Module declarations from 'libc' */

/* Module declarations from 'libc.errno' */

/* Module declarations from 'cpython.version' */

/* Module declarations from 'cpython.ref' */

/* Module declarations from 'cpython.object' */

/* Module declarations from 'cpython.weakref' */

/* Module declarations from 'cpython.buffer' */

/* Module declarations from '__builtin__' */

/* Module declarations from 'cpython.type' */
static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0;

/* Module declarations from 'numpy' */

/* Module declarations from 'numpy' */
static PyTypeObject *__pyx_ptype_5numpy_dtype = 0;
static PyTypeObject *__pyx_ptype_5numpy_flatiter = 0;
static PyTypeObject *__pyx_ptype_5numpy_broadcast = 0;
static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0;
static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0;
static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *, char *, char *, int *); /*proto*/
static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *, PyObject *); /*proto*/

/* Module declarations from 'epr' */
static PyTypeObject *__pyx_ptype_3epr__CLib = 0;
static PyTypeObject *__pyx_ptype_3epr_EprObject = 0;
static PyTypeObject *__pyx_ptype_3epr_DSD = 0;
static PyTypeObject *__pyx_ptype_3epr_Field = 0;
static PyTypeObject *__pyx_ptype_3epr_Record = 0;
static PyTypeObject *__pyx_ptype_3epr_Raster = 0;
static PyTypeObject *__pyx_ptype_3epr_Band = 0;
static PyTypeObject *__pyx_ptype_3epr_Dataset = 0;
static PyTypeObject *__pyx_ptype_3epr_Product = 0;
static PyTypeObject *__pyx_ptype_3epr___pyx_scope_struct____iter__ = 0;
static PyTypeObject *__pyx_ptype_3epr___pyx_scope_struct_1_genexpr = 0;
static PyTypeObject *__pyx_ptype_3epr___pyx_scope_struct_2___iter__ = 0;
static PyTypeObject *__pyx_ptype_3epr___pyx_scope_struct_3_genexpr = 0;
static int __pyx_v_3epr_PY3;
static int __pyx_v_3epr_SWAP_BYTES;
static struct __pyx_obj_3epr__CLib *__pyx_v_3epr__EPR_C_LIB = 0;
static CYTHON_INLINE PyObject *__pyx_f_3epr__to_bytes(PyObject *, struct __pyx_opt_args_3epr__to_bytes *__pyx_optional_args); /*proto*/
static CYTHON_INLINE PyObject *__pyx_f_3epr__to_str(PyObject *, struct __pyx_opt_args_3epr__to_str *__pyx_optional_args); /*proto*/
static enum NPY_TYPES __pyx_f_3epr__epr_to_numpy_type_id(enum EPR_DataTypeId); /*proto*/
static PyObject *__pyx_f_3epr_pyepr_check_errors(void); /*proto*/
static PyObject *__pyx_f_3epr_pyepr_null_ptr_error(struct __pyx_opt_args_3epr_pyepr_null_ptr_error *__pyx_optional_args); /*proto*/
static FILE *__pyx_f_3epr_pyepr_get_file_stream(PyObject *); /*proto*/
static PyObject *__pyx_f_3epr_get_numpy_dtype(EPR_EDataTypeId, int __pyx_skip_dispatch); /*proto*/
static uint __pyx_f_3epr_get_data_type_size(EPR_EDataTypeId, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_3epr_data_type_id_to_str(EPR_EDataTypeId, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_3epr_get_scaling_method_name(enum EPR_ScalingMethod, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_3epr_get_sample_model_name(enum EPR_SampleModel, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_3epr_new_dsd(EPR_SDSD *, struct __pyx_opt_args_3epr_new_dsd *__pyx_optional_args); /*proto*/
static PyObject *__pyx_f_3epr_new_field(EPR_SField *, struct __pyx_opt_args_3epr_new_field *__pyx_optional_args); /*proto*/
static PyObject *__pyx_f_3epr_new_record(EPR_SRecord *, struct __pyx_opt_args_3epr_new_record *__pyx_optional_args); /*proto*/
static PyObject *__pyx_f_3epr_new_raster(EPR_SRaster *, struct __pyx_opt_args_3epr_new_raster *__pyx_optional_args); /*proto*/
static PyObject *__pyx_f_3epr_new_band(EPR_SBandId *, struct __pyx_opt_args_3epr_new_band *__pyx_optional_args); /*proto*/
static PyObject *__pyx_f_3epr_new_dataset(EPR_SDatasetId *, struct __pyx_opt_args_3epr_new_dataset *__pyx_optional_args); /*proto*/
#define __Pyx_MODULE_NAME "epr"
int __pyx_module_is_main_epr = 0;

/* Implementation of 'epr' */
static PyObject *__pyx_builtin_Exception;
static PyObject *__pyx_builtin_ValueError;
static PyObject *__pyx_builtin_super;
static PyObject *__pyx_builtin_AttributeError;
static PyObject *__pyx_builtin_TypeError;
static PyObject *__pyx_builtin_ImportError;
static PyObject *__pyx_builtin_KeyError;
static PyObject *__pyx_builtin_NotImplemented;
static PyObject *__pyx_builtin_range;
static PyObject *__pyx_builtin_IOError;
static PyObject *__pyx_builtin_NotImplementedError;
static PyObject *__pyx_builtin_map;
static PyObject *__pyx_builtin_RuntimeError;
static PyObject *__pyx_pf_3epr_8EPRError___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_message, PyObject *__pyx_v_code, PyObject *__pyx_v_args, PyObject *__pyx_v_kargs); /* proto */
static int __pyx_pf_3epr_5_CLib___cinit__(CYTHON_UNUSED struct __pyx_obj_3epr__CLib *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_args, CYTHON_UNUSED PyObject *__pyx_v_kwargs); /* proto */
static void __pyx_pf_3epr_5_CLib_2__dealloc__(CYTHON_UNUSED struct __pyx_obj_3epr__CLib *__pyx_v_self); /* proto */
static int __pyx_pf_3epr_5_CLib_4__init__(struct __pyx_obj_3epr__CLib *__pyx_v_self); /* proto */
static int __pyx_pf_3epr_9EprObject___cinit__(struct __pyx_obj_3epr_EprObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_ars, CYTHON_UNUSED PyObject *__pyx_v_kargs); /* proto */
static void __pyx_pf_3epr_9EprObject_2__dealloc__(struct __pyx_obj_3epr_EprObject *__pyx_v_self); /* proto */
static int __pyx_pf_3epr_9EprObject_4__init__(struct __pyx_obj_3epr_EprObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3epr_get_numpy_dtype(CYTHON_UNUSED PyObject *__pyx_self, EPR_EDataTypeId __pyx_v_type_id); /* proto */
static PyObject *__pyx_pf_3epr_2get_data_type_size(CYTHON_UNUSED PyObject *__pyx_self, EPR_EDataTypeId __pyx_v_type_id); /* proto */
static PyObject *__pyx_pf_3epr_4data_type_id_to_str(CYTHON_UNUSED PyObject *__pyx_self, EPR_EDataTypeId __pyx_v_type_id); /* proto */
static PyObject *__pyx_pf_3epr_6get_scaling_method_name(CYTHON_UNUSED PyObject *__pyx_self, enum EPR_ScalingMethod __pyx_v_method); /* proto */
static PyObject *__pyx_pf_3epr_8get_sample_model_name(CYTHON_UNUSED PyObject *__pyx_self, enum EPR_SampleModel __pyx_v_model); /* proto */
static PyObject *__pyx_pf_3epr_3DSD_5index___get__(struct __pyx_obj_3epr_DSD *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3epr_3DSD_7ds_name___get__(struct __pyx_obj_3epr_DSD *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3epr_3DSD_7ds_type___get__(struct __pyx_obj_3epr_DSD *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3epr_3DSD_8filename___get__(struct __pyx_obj_3epr_DSD *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3epr_3DSD_9ds_offset___get__(struct __pyx_obj_3epr_DSD *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3epr_3DSD_7ds_size___get__(struct __pyx_obj_3epr_DSD *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3epr_3DSD_7num_dsr___get__(struct __pyx_obj_3epr_DSD *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3epr_3DSD_8dsr_size___get__(struct __pyx_obj_3epr_DSD *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3epr_3DSD___repr__(struct __pyx_obj_3epr_DSD *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3epr_3DSD_2__richcmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, int __pyx_v_op); /* proto */
static PyObject *__pyx_pf_3epr_3DSD_6_magic___get__(struct __pyx_obj_3epr_DSD *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3epr_5Field_print_(struct __pyx_obj_3epr_Field *__pyx_v_self, PyObject *__pyx_v_ostream); /* proto */
static PyObject *__pyx_pf_3epr_5Field_2get_unit(struct __pyx_obj_3epr_Field *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3epr_5Field_4get_description(struct __pyx_obj_3epr_Field *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3epr_5Field_6get_num_elems(struct __pyx_obj_3epr_Field *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3epr_5Field_8get_name(struct __pyx_obj_3epr_Field *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3epr_5Field_10get_type(struct __pyx_obj_3epr_Field *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3epr_5Field_12get_elem(struct __pyx_obj_3epr_Field *__pyx_v_self, uint __pyx_v_index); /* proto */
static PyObject *__pyx_pf_3epr_5Field_14get_elems(struct __pyx_obj_3epr_Field *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3epr_5Field_16set_elem(struct __pyx_obj_3epr_Field *__pyx_v_self, PyObject *__pyx_v_elem, uint __pyx_v_index); /* proto */
static PyObject *__pyx_pf_3epr_5Field_18set_elems(struct __pyx_obj_3epr_Field *__pyx_v_self, PyObject *__pyx_v_elems); /* proto */
static PyObject *__pyx_pf_3epr_5Field_8tot_size___get__(struct __pyx_obj_3epr_Field *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3epr_5Field_20__repr__(struct __pyx_obj_3epr_Field *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3epr_5Field_22__str__(struct __pyx_obj_3epr_Field *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3epr_5Field_24__richcmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, int __pyx_v_op); /* proto */
static Py_ssize_t __pyx_pf_3epr_5Field_26__len__(struct __pyx_obj_3epr_Field *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3epr_5Field_6_magic___get__(struct __pyx_obj_3epr_Field *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3epr_5Field_28get_offset(struct __pyx_obj_3epr_Field *__pyx_v_self); /* proto */
static void __pyx_pf_3epr_6Record___dealloc__(struct __pyx_obj_3epr_Record *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3epr_6Record_2get_num_fields(struct __pyx_obj_3epr_Record *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3epr_6Record_4print_(struct __pyx_obj_3epr_Record *__pyx_v_self, PyObject *__pyx_v_ostream); /* proto */
static PyObject *__pyx_pf_3epr_6Record_6print_element(struct __pyx_obj_3epr_Record *__pyx_v_self, uint __pyx_v_field_index, uint __pyx_v_element_index, PyObject *__pyx_v_ostream); /* proto */
static PyObject *__pyx_pf_3epr_6Record_8get_field(struct __pyx_obj_3epr_Record *__pyx_v_self, PyObject *__pyx_v_name); /* proto */
static PyObject *__pyx_pf_3epr_6Record_10get_field_at(struct __pyx_obj_3epr_Record *__pyx_v_self, uint __pyx_v_index); /* proto */
static PyObject *__pyx_pf_3epr_6Record_12dataset_name___get__(struct __pyx_obj_3epr_Record *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3epr_6Record_8tot_size___get__(struct __pyx_obj_3epr_Record *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3epr_6Record_5index___get__(struct __pyx_obj_3epr_Record *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3epr_6Record_12get_field_names(struct __pyx_obj_3epr_Record *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3epr_6Record_14fields(struct __pyx_obj_3epr_Record *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3epr_6Record_8__iter___genexpr(PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_3epr_6Record_16__iter__(struct __pyx_obj_3epr_Record *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3epr_6Record_18__str__(struct __pyx_obj_3epr_Record *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3epr_6Record_20__repr__(struct __pyx_obj_3epr_Record *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3epr_6Record_6_magic___get__(struct __pyx_obj_3epr_Record *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3epr_6Record_22get_offset(struct __pyx_obj_3epr_Record *__pyx_v_self); /* proto */
static void __pyx_pf_3epr_6Raster___dealloc__(struct __pyx_obj_3epr_Raster *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3epr_6Raster_9data_type___get__(struct __pyx_obj_3epr_Raster *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3epr_6Raster_12source_width___get__(struct __pyx_obj_3epr_Raster *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3epr_6Raster_13source_height___get__(struct __pyx_obj_3epr_Raster *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3epr_6Raster_13source_step_x___get__(struct __pyx_obj_3epr_Raster *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3epr_6Raster_13source_step_y___get__(struct __pyx_obj_3epr_Raster *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3epr_6Raster_2get_width(struct __pyx_obj_3epr_Raster *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3epr_6Raster_4get_height(struct __pyx_obj_3epr_Raster *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3epr_6Raster_6get_elem_size(struct __pyx_obj_3epr_Raster *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3epr_6Raster_8get_pixel(struct __pyx_obj_3epr_Raster *__pyx_v_self, int __pyx_v_x, int __pyx_v_y); /* proto */
static PyObject *__pyx_pf_3epr_6Raster_4data___get__(struct __pyx_obj_3epr_Raster *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3epr_6Raster_10__repr__(struct __pyx_obj_3epr_Raster *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3epr_6Raster_6_magic___get__(struct __pyx_obj_3epr_Raster *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3epr_10create_raster(CYTHON_UNUSED PyObject *__pyx_self, EPR_EDataTypeId __pyx_v_data_type, uint __pyx_v_src_width, uint __pyx_v_src_height, uint __pyx_v_xstep, uint __pyx_v_ystep); /* proto */
static PyObject *__pyx_pf_3epr_12create_bitmask_raster(CYTHON_UNUSED PyObject *__pyx_self, uint __pyx_v_src_width, uint __pyx_v_src_height, uint __pyx_v_xstep, uint __pyx_v_ystep); /* proto */
static PyObject *__pyx_pf_3epr_4Band_7product___get__(struct __pyx_obj_3epr_Band *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3epr_4Band_17spectr_band_index___get__(struct __pyx_obj_3epr_Band *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3epr_4Band_12sample_model___get__(struct __pyx_obj_3epr_Band *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3epr_4Band_9data_type___get__(struct __pyx_obj_3epr_Band *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3epr_4Band_14scaling_method___get__(struct __pyx_obj_3epr_Band *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3epr_4Band_14scaling_offset___get__(struct __pyx_obj_3epr_Band *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3epr_4Band_14scaling_factor___get__(struct __pyx_obj_3epr_Band *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3epr_4Band_7bm_expr___get__(struct __pyx_obj_3epr_Band *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3epr_4Band_4unit___get__(struct __pyx_obj_3epr_Band *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3epr_4Band_11description___get__(struct __pyx_obj_3epr_Band *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3epr_4Band_14lines_mirrored___get__(struct __pyx_obj_3epr_Band *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3epr_4Band_7dataset___get__(struct __pyx_obj_3epr_Band *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3epr_4Band_get_name(struct __pyx_obj_3epr_Band *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3epr_4Band_2create_compatible_raster(struct __pyx_obj_3epr_Band *__pyx_v_self, uint __pyx_v_src_width, uint __pyx_v_src_height, uint __pyx_v_xstep, uint __pyx_v_ystep); /* proto */
static PyObject *__pyx_pf_3epr_4Band_4read_raster(struct __pyx_obj_3epr_Band *__pyx_v_self, int __pyx_v_xoffset, int __pyx_v_yoffset, struct __pyx_obj_3epr_Raster *__pyx_v_raster); /* proto */
static PyObject *__pyx_pf_3epr_4Band_6read_as_array(struct __pyx_obj_3epr_Band *__pyx_v_self, PyObject *__pyx_v_width, PyObject *__pyx_v_height, uint __pyx_v_xoffset, uint __pyx_v_yoffset, uint __pyx_v_xstep, uint __pyx_v_ystep); /* proto */
static PyObject *__pyx_pf_3epr_4Band_8__repr__(struct __pyx_obj_3epr_Band *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3epr_4Band_6_magic___get__(struct __pyx_obj_3epr_Band *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3epr_4Band_12_field_index___get__(struct __pyx_obj_3epr_Band *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3epr_4Band_11_elem_index___get__(struct __pyx_obj_3epr_Band *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3epr_7Dataset_7product___get__(struct __pyx_obj_3epr_Dataset *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3epr_7Dataset_11description___get__(struct __pyx_obj_3epr_Dataset *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3epr_7Dataset_get_name(struct __pyx_obj_3epr_Dataset *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3epr_7Dataset_2get_dsd_name(struct __pyx_obj_3epr_Dataset *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3epr_7Dataset_4get_num_records(struct __pyx_obj_3epr_Dataset *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3epr_7Dataset_6get_dsd(struct __pyx_obj_3epr_Dataset *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3epr_7Dataset_8create_record(struct __pyx_obj_3epr_Dataset *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3epr_7Dataset_10read_record(struct __pyx_obj_3epr_Dataset *__pyx_v_self, uint __pyx_v_index, struct __pyx_obj_3epr_Record *__pyx_v_record); /* proto */
static PyObject *__pyx_pf_3epr_7Dataset_12records(struct __pyx_obj_3epr_Dataset *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3epr_7Dataset_8__iter___genexpr(PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_3epr_7Dataset_14__iter__(struct __pyx_obj_3epr_Dataset *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3epr_7Dataset_16__str__(struct __pyx_obj_3epr_Dataset *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3epr_7Dataset_18__repr__(struct __pyx_obj_3epr_Dataset *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3epr_7Dataset_6_magic___get__(struct __pyx_obj_3epr_Dataset *__pyx_v_self); /* proto */
static int __pyx_pf_3epr_7Product___cinit__(struct __pyx_obj_3epr_Product *__pyx_v_self, PyObject *__pyx_v_filename, PyObject *__pyx_v_mode); /* proto */
static void __pyx_pf_3epr_7Product_2__dealloc__(struct __pyx_obj_3epr_Product *__pyx_v_self); /* proto */
static int __pyx_pf_3epr_7Product_4__init__(CYTHON_UNUSED struct __pyx_obj_3epr_Product *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_filename, CYTHON_UNUSED PyObject *__pyx_v_mode); /* proto */
static PyObject *__pyx_pf_3epr_7Product_6close(struct __pyx_obj_3epr_Product *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3epr_7Product_8flush(struct __pyx_obj_3epr_Product *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3epr_7Product_9file_path___get__(struct __pyx_obj_3epr_Product *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3epr_7Product_7_fileno___get__(struct __pyx_obj_3epr_Product *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3epr_7Product_4mode___get__(struct __pyx_obj_3epr_Product *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3epr_7Product_8tot_size___get__(struct __pyx_obj_3epr_Product *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3epr_7Product_9id_string___get__(struct __pyx_obj_3epr_Product *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3epr_7Product_18meris_iodd_version___get__(struct __pyx_obj_3epr_Product *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3epr_7Product_10get_scene_width(struct __pyx_obj_3epr_Product *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3epr_7Product_12get_scene_height(struct __pyx_obj_3epr_Product *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3epr_7Product_14get_num_datasets(struct __pyx_obj_3epr_Product *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3epr_7Product_16get_num_dsds(struct __pyx_obj_3epr_Product *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3epr_7Product_18get_num_bands(struct __pyx_obj_3epr_Product *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3epr_7Product_20get_dataset_at(struct __pyx_obj_3epr_Product *__pyx_v_self, uint __pyx_v_index); /* proto */
static PyObject *__pyx_pf_3epr_7Product_22get_dataset(struct __pyx_obj_3epr_Product *__pyx_v_self, PyObject *__pyx_v_name); /* proto */
static PyObject *__pyx_pf_3epr_7Product_24get_dsd_at(struct __pyx_obj_3epr_Product *__pyx_v_self, uint __pyx_v_index); /* proto */
static PyObject *__pyx_pf_3epr_7Product_26get_mph(struct __pyx_obj_3epr_Product *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3epr_7Product_28get_sph(struct __pyx_obj_3epr_Product *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3epr_7Product_30get_band(struct __pyx_obj_3epr_Product *__pyx_v_self, PyObject *__pyx_v_name); /* proto */
static PyObject *__pyx_pf_3epr_7Product_32get_band_at(struct __pyx_obj_3epr_Product *__pyx_v_self, uint __pyx_v_index); /* proto */
static PyObject *__pyx_pf_3epr_7Product_34read_bitmask_raster(struct __pyx_obj_3epr_Product *__pyx_v_self, PyObject *__pyx_v_bm_expr, int __pyx_v_xoffset, int __pyx_v_yoffset, struct __pyx_obj_3epr_Raster *__pyx_v_raster); /* proto */
static PyObject *__pyx_pf_3epr_7Product_6closed___get__(struct __pyx_obj_3epr_Product *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3epr_7Product_36get_dataset_names(struct __pyx_obj_3epr_Product *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3epr_7Product_38get_band_names(struct __pyx_obj_3epr_Product *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3epr_7Product_40datasets(struct __pyx_obj_3epr_Product *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3epr_7Product_42bands(struct __pyx_obj_3epr_Product *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3epr_7Product_44__repr__(struct __pyx_obj_3epr_Product *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3epr_7Product_46__str__(struct __pyx_obj_3epr_Product *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3epr_7Product_48__enter__(struct __pyx_obj_3epr_Product *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3epr_7Product_50__exit__(struct __pyx_obj_3epr_Product *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_exc_info); /* proto */
static PyObject *__pyx_pf_3epr_7Product_6_magic___get__(struct __pyx_obj_3epr_Product *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_3epr_14open(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_filename, PyObject *__pyx_v_mode); /* proto */
static PyObject *__pyx_pf_3epr_16_close_api(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */
static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info); /* proto */
static PyObject *__pyx_tp_new_3epr__CLib(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_3epr_EprObject(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_3epr_DSD(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_3epr_Field(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_3epr_Record(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_3epr_Raster(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_3epr_Band(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_3epr_Dataset(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_3epr_Product(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_3epr___pyx_scope_struct____iter__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_3epr___pyx_scope_struct_1_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_3epr___pyx_scope_struct_2___iter__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_3epr___pyx_scope_struct_3_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static char __pyx_k_[] = "";
static char __pyx_k_B[] = "B";
static char __pyx_k_H[] = "H";
static char __pyx_k_I[] = "I";
static char __pyx_k_L[] = "L";
static char __pyx_k_O[] = "O";
static char __pyx_k_Q[] = "Q";
static char __pyx_k_b[] = "b";
static char __pyx_k_d[] = "%d";
static char __pyx_k_f[] = "%f";
static char __pyx_k_g[] = "g";
static char __pyx_k_h[] = "h";
static char __pyx_k_i[] = "i";
static char __pyx_k_l[] = "l";
static char __pyx_k_q[] = "q";
static char __pyx_k_u[] = "%u";
static char __pyx_k_w[] = "w";
static char __pyx_k_x[] = "x";
static char __pyx_k_y[] = "y";
static char __pyx_k_Zd[] = "Zd";
static char __pyx_k_Zf[] = "Zf";
static char __pyx_k_Zg[] = "Zg";
static char __pyx_k__9[] = ", ";
static char __pyx_k_gc[] = "gc";
static char __pyx_k_np[] = "np";
static char __pyx_k_os[] = "os";
static char __pyx_k_rb[] = "rb";
static char __pyx_k_LIN[] = "LIN";
static char __pyx_k_LOG[] = "LOG";
static char __pyx_k_MJD[] = "MJD";
static char __pyx_k__11[] = "\n";
static char __pyx_k__17[] = "+";
static char __pyx_k_d_2[] = "d";
static char __pyx_k_doc[] = "__doc__";
static char __pyx_k_epr[] = "epr";
static char __pyx_k_f_2[] = "f";
static char __pyx_k_i_d[] = "i%d";
static char __pyx_k_map[] = "map";
static char __pyx_k_r_b[] = "r+b";
static char __pyx_k_s_s[] = "%s: %s";
static char __pyx_k_sys[] = "sys";
static char __pyx_k_u_d[] = "u%d";
static char __pyx_k_1OF1[] = "1OF1";
static char __pyx_k_1OF2[] = "1OF2";
static char __pyx_k_2OF2[] = "2OF2";
static char __pyx_k_2TOF[] = "2TOF";
static char __pyx_k_3TOI[] = "3TOI";
static char __pyx_k_NONE[] = "NONE";
static char __pyx_k_args[] = "args";
static char __pyx_k_code[] = "code";
static char __pyx_k_data[] = "data";
static char __pyx_k_days[] = "days";
static char __pyx_k_elem[] = "elem";
static char __pyx_k_init[] = "__init__";
static char __pyx_k_int8[] = "int8";
static char __pyx_k_join[] = "join";
static char __pyx_k_main[] = "__main__";
static char __pyx_k_mode[] = "mode";
static char __pyx_k_name[] = "__name__";
static char __pyx_k_ndim[] = "ndim";
static char __pyx_k_open[] = "open";
static char __pyx_k_rb_2[] = "rb+";
static char __pyx_k_repr[] = "__repr__";
static char __pyx_k_self[] = "self";
static char __pyx_k_send[] = "send";
static char __pyx_k_size[] = "size";
static char __pyx_k_test[] = "__test__";
static char __pyx_k_0_9_1[] = "0.9.1";
static char __pyx_k_UTF_8[] = "UTF-8";
static char __pyx_k_ascii[] = "ascii";
static char __pyx_k_bands[] = "bands";
static char __pyx_k_bytes[] = "bytes_";
static char __pyx_k_class[] = "__class__";
static char __pyx_k_close[] = "close";
static char __pyx_k_flush[] = "flush";
static char __pyx_k_index[] = "index";
static char __pyx_k_int16[] = "int16";
static char __pyx_k_int32[] = "int32";
static char __pyx_k_kargs[] = "kargs";
static char __pyx_k_numpy[] = "numpy";
static char __pyx_k_range[] = "range";
static char __pyx_k_s_s_2[] = "%s = \"%s\"";
static char __pyx_k_s_s_3[] = "%s = {%s}";
static char __pyx_k_s_s_4[] = "%s = %s";
static char __pyx_k_shape[] = "shape";
static char __pyx_k_super[] = "super";
static char __pyx_k_throw[] = "throw";
static char __pyx_k_uint8[] = "uint8";
static char __pyx_k_width[] = "width";
static char __pyx_k_xstep[] = "xstep";
static char __pyx_k_ystep[] = "ystep";
static char __pyx_k_astype[] = "astype";
static char __pyx_k_atexit[] = "atexit";
static char __pyx_k_decode[] = "decode";
static char __pyx_k_encode[] = "encode";
static char __pyx_k_height[] = "height";
static char __pyx_k_import[] = "__import__";
static char __pyx_k_little[] = "little";
static char __pyx_k_module[] = "__module__";
static char __pyx_k_raster[] = "raster";
static char __pyx_k_record[] = "record";
static char __pyx_k_repr_2[] = "repr";
static char __pyx_k_stdout[] = "stdout";
static char __pyx_k_uint16[] = "uint16";
static char __pyx_k_uint32[] = "uint32";
static char __pyx_k_EPRTime[] = "EPRTime";
static char __pyx_k_IOError[] = "IOError";
static char __pyx_k_asarray[] = "asarray";
static char __pyx_k_bm_expr[] = "bm_expr";
static char __pyx_k_collect[] = "collect";
static char __pyx_k_ds_name[] = "ds_name";
static char __pyx_k_float32[] = "float32";
static char __pyx_k_float64[] = "float64";
static char __pyx_k_message[] = "message";
static char __pyx_k_ostream[] = "ostream";
static char __pyx_k_prepare[] = "__prepare__";
static char __pyx_k_product[] = "product";
static char __pyx_k_seconds[] = "seconds";
static char __pyx_k_version[] = "__version__";
static char __pyx_k_xoffset[] = "xoffset";
static char __pyx_k_yoffset[] = "yoffset";
static char __pyx_k_EPRError[] = "EPRError";
static char __pyx_k_KeyError[] = "KeyError";
static char __pyx_k_byteswap[] = "byteswap";
static char __pyx_k_datasets[] = "datasets";
static char __pyx_k_filename[] = "filename";
static char __pyx_k_get_elem[] = "get_elem";
static char __pyx_k_get_name[] = "get_name";
static char __pyx_k_get_type[] = "get_type";
static char __pyx_k_qualname[] = "__qualname__";
static char __pyx_k_register[] = "register";
static char __pyx_k_DTYPE_MAP[] = "_DTYPE_MAP";
static char __pyx_k_E_TID_INT[] = "E_TID_INT";
static char __pyx_k_Exception[] = "Exception";
static char __pyx_k_MODEL_MAP[] = "_MODEL_MAP";
static char __pyx_k_TypeError[] = "TypeError";
static char __pyx_k_byteorder[] = "byteorder";
static char __pyx_k_close_api[] = "_close_api";
static char __pyx_k_data_type[] = "data_type";
static char __pyx_k_epr_DSD_s[] = "epr.DSD(\"%s\")";
static char __pyx_k_get_elems[] = "get_elems";
static char __pyx_k_get_width[] = "get_width";
static char __pyx_k_id_string[] = "id_string";
static char __pyx_k_metaclass[] = "__metaclass__";
static char __pyx_k_src_width[] = "src_width";
static char __pyx_k_E_SMID_LIN[] = "E_SMID_LIN";
static char __pyx_k_E_SMID_LOG[] = "E_SMID_LOG";
static char __pyx_k_E_SMID_NON[] = "E_SMID_NON";
static char __pyx_k_E_TID_CHAR[] = "E_TID_CHAR";
static char __pyx_k_E_TID_TIME[] = "E_TID_TIME";
static char __pyx_k_E_TID_UINT[] = "E_TID_UINT";
static char __pyx_k_METHOD_MAP[] = "_METHOD_MAP";
static char __pyx_k_ValueError[] = "ValueError";
static char __pyx_k_get_height[] = "get_height";
static char __pyx_k_namedtuple[] = "namedtuple";
static char __pyx_k_pyx_vtable[] = "__pyx_vtable__";
static char __pyx_k_raster_ptr[] = "raster_ptr";
static char __pyx_k_s_d_fields[] = "%s %d fields";
static char __pyx_k_src_height[] = "src_height";
static char __pyx_k_E_SMOD_1OF1[] = "E_SMOD_1OF1";
static char __pyx_k_E_SMOD_1OF2[] = "E_SMOD_1OF2";
static char __pyx_k_E_SMOD_2OF2[] = "E_SMOD_2OF2";
static char __pyx_k_E_SMOD_2TOF[] = "E_SMOD_2TOF";
static char __pyx_k_E_SMOD_3TOI[] = "E_SMOD_3TOI";
static char __pyx_k_E_TID_FLOAT[] = "E_TID_FLOAT";
static char __pyx_k_E_TID_SHORT[] = "E_TID_SHORT";
static char __pyx_k_E_TID_SPARE[] = "E_TID_SPARE";
static char __pyx_k_E_TID_UCHAR[] = "E_TID_UCHAR";
static char __pyx_k_ImportError[] = "ImportError";
static char __pyx_k_collections[] = "collections";
static char __pyx_k_field_index[] = "field_index";
static char __pyx_k_flush_error[] = "flush error";
static char __pyx_k_get_band_at[] = "get_band_at";
static char __pyx_k_get_dataset[] = "get_dataset";
static char __pyx_k_read_raster[] = "read_raster";
static char __pyx_k_read_record[] = "read_record";
static char __pyx_k_s_s_dL_x_dP[] = "%s %s (%dL x %dP)";
static char __pyx_k_E_TID_DOUBLE[] = "E_TID_DOUBLE";
static char __pyx_k_E_TID_STRING[] = "E_TID_STRING";
static char __pyx_k_E_TID_USHORT[] = "E_TID_USHORT";
static char __pyx_k_RuntimeError[] = "RuntimeError";
static char __pyx_k_get_field_at[] = "get_field_at";
static char __pyx_k_microseconds[] = "microseconds";
static char __pyx_k_null_pointer[] = "null pointer";
static char __pyx_k_EPRValueError[] = "EPRValueError";
static char __pyx_k_EPR_API_error[] = "EPR API error";
static char __pyx_k_E_TID_UNKNOWN[] = "E_TID_UNKNOWN";
static char __pyx_k_create_raster[] = "create_raster";
static char __pyx_k_element_index[] = "element_index";
static char __pyx_k_get_num_bands[] = "get_num_bands";
static char __pyx_k_get_num_elems[] = "get_num_elems";
static char __pyx_k_s_d_d_j_d_m_d[] = "%s = {d=%d, j=%d, m=%d}";
static char __pyx_k_AttributeError[] = "AttributeError";
static char __pyx_k_NotImplemented[] = "NotImplemented";
static char __pyx_k_get_dataset_at[] = "get_dataset_at";
static char __pyx_k_get_num_fields[] = "get_num_fields";
static char __pyx_k_EPRError___init[] = "EPRError.__init__";
static char __pyx_k_EPR_MAGIC_FIELD[] = "_EPR_MAGIC_FIELD";
static char __pyx_k_get_num_records[] = "get_num_records";
static char __pyx_k_invalid_index_d[] = "invalid index: %d";
static char __pyx_k_invalid_ostream[] = "invalid ostream";
static char __pyx_k_EPR_MAGIC_RASTER[] = "_EPR_MAGIC_RASTER";
static char __pyx_k_EPR_MAGIC_RECORD[] = "_EPR_MAGIC_RECORD";
static char __pyx_k_The_dataset_name[] = "The dataset name";
static char __pyx_k_get_num_datasets[] = "get_num_datasets";
static char __pyx_k_unable_to_open_s[] = "unable to open \"%s\"";
static char __pyx_k_EPR_C_API_VERSION[] = "EPR_C_API_VERSION";
static char __pyx_k_EPR_MAGIC_BAND_ID[] = "_EPR_MAGIC_BAND_ID";
static char __pyx_k_ascontiguousarray[] = "ascontiguousarray";
static char __pyx_k_bad_output_stream[] = "bad output stream";
static char __pyx_k_invalid_data_type[] = "invalid data type";
static char __pyx_k_unknown_data_type[] = "<<unknown data type>>";
static char __pyx_k_EPR_MAGIC_FLAG_DEF[] = "_EPR_MAGIC_FLAG_DEF";
static char __pyx_k_invalid_field_type[] = "invalid field type";
static char __pyx_k_DEFAULT_FS_ENCODING[] = "_DEFAULT_FS_ENCODING";
static char __pyx_k_NotImplementedError[] = "NotImplementedError";
static char __pyx_k_invalid_data_type_s[] = "invalid data type: \"%s\"";
static char __pyx_k_invalid_open_mode_s[] = "invalid open mode: \"%s\"";
static char __pyx_k_s_unknown_data_type[] = "%s = <<unknown data type>>";
static char __pyx_k_EPR_MAGIC_DATASET_ID[] = "_EPR_MAGIC_DATASET_ID";
static char __pyx_k_EPR_MAGIC_PRODUCT_ID[] = "_EPR_MAGIC_PRODUCT_ID";
static char __pyx_k_unable_to_get_band_s[] = "unable to get band \"%s\"";
static char __pyx_k_create_bitmask_raster[] = "create_bitmask_raster";
static char __pyx_k_getfilesystemencoding[] = "getfilesystemencoding";
static char __pyx_k_invalid_EPR_type_ID_d[] = "invalid EPR type ID: %d";
static char __pyx_k_unable_to_get_field_s[] = "unable to get field \"%s\"";
static char __pyx_k_invalid_sample_model_s[] = "invalid sample model: \"%s\"";
static char __pyx_k_The_width_of_the_source[] = "The width of the source";
static char __pyx_k_epr_Dataset_s_d_records[] = "epr.Dataset(%s) %d records";
static char __pyx_k_unable_to_get_dataset_s[] = "unable to get dataset \"%s\"";
static char __pyx_k_The_height_of_the_source[] = "The height of the source";
static char __pyx_k_create_compatible_raster[] = "create_compatible_raster";
static char __pyx_k_epr_Field_s_d_s_elements[] = "epr.Field(\"%s\") %d %s elements";
static char __pyx_k_invalid_scaling_method_s[] = "invalid scaling method: \"%s\"";
static char __pyx_k_unable_to_get_MPH_record[] = "unable to get MPH record";
static char __pyx_k_unable_to_get_SPH_record[] = "unable to get SPH record";
static char __pyx_k_index_out_of_range_x_d_y_d[] = "index out of range: x=%d, y=%d";
static char __pyx_k_The_dataset_type_descriptor[] = "The dataset type descriptor";
static char __pyx_k_epr_Band_s_of_epr_Product_s[] = "epr.Band(%s) of epr.Product(%s)";
static char __pyx_k_ndarray_is_not_C_contiguous[] = "ndarray is not C contiguous";
static char __pyx_k_I_O_operation_on_closed_file[] = "I/O operation on closed file";
static char __pyx_k_invalid_step_xspet_d_ystep_d[] = "invalid step: xspet=%d, ystep=%d";
static char __pyx_k_unable_to_get_DSD_at_index_d[] = "unable to get DSD at index \"%d\"";
static char __pyx_k_Filed_s_elems_pointer_is_null[] = "Filed(\"%s\") elems pointer is null";
static char __pyx_k_unable_to_create_a_new_raster[] = "unable to create a new raster";
static char __pyx_k_unable_to_get_band_at_index_d[] = "unable to get band at index \"%d\"";
static char __pyx_k_s_class_cannot_be_instantiated[] = "\"%s\" class cannot be instantiated from Python";
static char __pyx_k_unable_to_get_field_at_index_d[] = "unable to get field at index %d";
static char __pyx_k_A_short_description_of_the_band[] = "A short description of the band's contents";
static char __pyx_k_Index_or_the_element_within_the[] = "Index or the element (within the dataset field) containing\n        the raw data used to create the band's pixel values.\n\n        It is set to -1 if not used\n\n        ";
static char __pyx_k_The_magic_number_for_internal_C[] = "The magic number for internal C structure";
static char __pyx_k_The_size_of_dataset_information[] = "The size of dataset-information in dataset product file";
static char __pyx_k_The_sub_sampling_for_the_across[] = "The sub-sampling for the across-track direction in pixel";
static char __pyx_k_home_antonio_projects_pyepr_src[] = "/home/antonio/projects/pyepr/src/epr.pyx";
static char __pyx_k_requeted_raster_height_d_is_too[] = "requeted raster height (%d) is too large for the Band (scene_height=%d)";
static char __pyx_k_unable_to_open_file_s_in_s_mode[] = "unable to open file \"%s\" in \"%s\" mode";
static char __pyx_k_unexpected_number_of_elements_d[] = "unexpected number of elements: %d";
static char __pyx_k_unknown_dtype_code_in_numpy_pxd[] = "unknown dtype code in numpy.pxd (%d)";
static char __pyx_k_xoffset_os_larger_that_he_scene[] = "xoffset os larger that he scene width";
static char __pyx_k_yoffset_os_larger_that_he_scene[] = "yoffset os larger that he scene height";
static char __pyx_k_A_bit_mask_expression_used_to_fi[] = "A bit-mask expression used to filter valid pixels\n\n        All others are set to zero\n\n        ";
static char __pyx_k_DSD_only_implements_and_operator[] = "DSD only implements \"==\" and \"!=\" operators";
static char __pyx_k_Field_only_implements_and_operat[] = "Field only implements \"==\" and \"!=\" operators";
static char __pyx_k_For_MERIS_L1b_and_RR_and_FR_to_p[] = "For MERIS L1b and RR and FR to provide backward compatibility";
static char __pyx_k_Format_string_allocated_too_shor[] = "Format string allocated too short, see comment in numpy.pxd";
static char __pyx_k_Index_of_the_record_within_the_d[] = "Index of the record within the dataset\n\n        It is *None* for empty records (created with\n        :meth:`Dataset.create_record` but still not read) and for *MPH*\n        (see :meth:`epr.Product.get_mph`) and *SPH* (see\n        :meth:`epr.Product.get_sph`) records.\n\n        .. seealso:: :meth:`epr.Dataset.read_record`\n\n        ";
static char __pyx_k_Index_or_the_field_within_the_da[] = "Index or the field (within the dataset) containing the raw\n        data used to create the band's pixel values.\n\n        It is set to -1 if not used\n\n        ";
static char __pyx_k_Mirrored_lines_flag_If_true_1_li[] = "Mirrored lines flag\n\n        If true (=1) lines will be mirrored (flipped) after read into a\n        raster in order to ensure a pixel ordering in raster X\n        direction from WEST to EAST.\n\n        ";
static char __pyx_k_Non_native_byte_order_not_suppor[] = "Non-native byte order not supported";
static char __pyx_k_Python_bindings_for_ENVISAT_Prod[] = "Python bindings for ENVISAT Product Reader C API\n\nPyEPR_ provides Python_ bindings for the ENVISAT Product Reader C API\n(`EPR API`_) for reading satellite data from ENVISAT_ ESA_ (European\nSpace Agency) mission.\n\nPyEPR_ is fully object oriented and, as well as the `EPR API`_ for C,\nsupports ENVISAT_ MERIS, AATSR Level 1B and Level 2 and also ASAR data\nproducts. It provides access to the data either on a geophysical\n(decoded, ready-to-use pixel samples) or on a raw data layer.\nThe raw data access makes it possible to read any data field contained\nin a product file.\n\n.. _PyEPR: http://avalentino.github.com/pyepr\n.. _Python: http://www.python.org\n.. _`EPR API`: https://github.com/bcdev/epr-api\n.. _ENVISAT: http://envisat.esa.int\n.. _ESA: http://earth.esa.int\n\n";
static char __pyx_k_Raster_data_exposed_as_class_num[] = "Raster data exposed as :class:`numpy.ndarray` object\n\n        .. note:: this property shares the data buffer with the\n                  :class:`Raster` object so any change in its contents\n                  is also reflected to the :class:`Raster` object\n\n        ";
static char __pyx_k_Scaling_method_The_scaling_metho[] = "Scaling method\n\n        The scaling method which must be applied to the raw source data\n        in order to get the 'real' pixel values in geo-physical units.\n\n        Possible values are:\n\n        * ``*``            --> no scaling applied\n        * ``Linear_Scale`` --> linear scaling applied::\n\n            y = offset + scale * x\n\n        * ``Log_Scale``    --> logarithmic scaling applied::\n\n            y = log10(offset + scale * x)\n\n        ";
static char __pyx_k_The_class_Product_instance_to_wh[] = "The :class:`Product` instance to which this band belongs to";
static char __pyx_k_The_data_type_of_the_band_s_pixe[] = "The data type of the band's pixels\n\n        All ``E_TID_*`` types are possible\n\n        ";
static char __pyx_k_The_file_s_path_including_the_fi[] = "The file's path including the file name";
static char __pyx_k_The_filename_in_the_DDDB_with_th[] = "The filename in the DDDB with the description of this dataset";
static char __pyx_k_The_fileno_of_the_class_epr_Prod[] = "The fileno of the :class:`epr.Product` input stream\n\n        To be used with care.\n\n        ";
static char __pyx_k_The_geophysical_unit_for_the_ban[] = "The geophysical unit for the band's pixel values";
static char __pyx_k_The_index_of_this_DSD_zero_based[] = "The index of this DSD (zero-based)";
static char __pyx_k_The_name_of_the_dataset_to_which[] = "The name of the dataset to which this record belongs to";
static char __pyx_k_The_number_of_dataset_records_fo[] = "The number of dataset records for the given dataset name";
static char __pyx_k_The_offset_of_dataset_informatio[] = "The offset of dataset-information the product file";
static char __pyx_k_The_product_identifier_string_ob[] = "The product identifier string obtained from the MPH\n        parameter 'PRODUCT'\n\n        The first 10 characters of this string identify the product\n        type, e.g. \"MER_1P__FR\" for a MERIS Level 1b full resolution\n        product.\n        The rest of the string decodes product instance properties.\n\n        ";
static char __pyx_k_The_sample_model_operation_The_s[] = "The sample model operation\n\n        The sample model operation applied to the source dataset for\n        getting the correct samples from the MDS (for example MERIS\n        L2).\n\n        Possible values are:\n\n        * ``*``     --> no operation (direct copy)\n        * ``1OF2``  --> first byte of 2-byte interleaved MDS\n        * ``2OF2``  --> second byte of 2-byte interleaved MDS\n        * ``0123``  --> combine 3-bytes interleaved to 4-byte integer\n\n        ";
static char __pyx_k_The_scaling_factor_Possible_valu[] = "The scaling factor\n\n        Possible values are:\n\n        * ``*`` --> no factor provided (implies scaling_method=*)\n        * ``const`` --> a floating point constant\n        * ``GADS.field[.field2]`` --> value is provided in global\n          annotation dataset with name `GADS` in field `field``.\n          Optionally a second element index for multiple-element fields\n          can be given too\n\n        ";
static char __pyx_k_The_scaling_offset_Possible_valu[] = "The scaling offset\n\n        Possible values are:\n\n        * ``*`` --> no offset provided (implies scaling_method=*)\n        * ``const`` --> a floating point constant\n        * ``GADS.field[.field2]` --> value is provided in global\n          annotation dataset with name ``GADS`` in field ``field``.\n          Optionally a second element index for multiple-element fields\n          can be given too\n\n        ";
static char __pyx_k_The_size_of_dataset_record_for_t[] = "The size of dataset record for the given dataset name";
static char __pyx_k_The_source_dataset_The_source_da[] = "The source dataset\n\n        The source dataset containing the raw data used to create the\n        band's pixel values.\n\n        ";
static char __pyx_k_The_sub_sampling_for_the_along_t[] = "The sub-sampling for the along-track direction in pixel";
static char __pyx_k_The_total_size_in_bytes_of_all_d[] = "The total size in bytes of all data elements of a field.\n\n        *tot_size* is a derived variable, it is computed at runtime and\n        not stored in the DSD-DB.\n\n        ";
static char __pyx_k_The_total_size_in_bytes_of_the_p[] = "The total size in bytes of the product file";
static char __pyx_k_The_total_size_in_bytes_of_the_r[] = "The total size in bytes of the record\n\n        It includes all data elements of all fields of a record in a\n        product file.\n\n        *tot_size* is a derived variable, it is computed at runtime\n        and not stored in the DSD-DB.\n\n        ";
static char __pyx_k_The_zero_based_spectral_band_ind[] = "The (zero-based) spectral band index\n\n        -1 if this is not a spectral band\n\n        ";
static char __pyx_k_True_if_the_class_epr_Product_is[] = "True if the :class:`epr.Product` is closed.";
static char __pyx_k_at_lease_part_of_the_requested_a[] = "at lease part of the requested area is outside the scene";
static char __pyx_k_epr_Product_s_d_datasets_d_bands[] = "epr.Product(%s) %d datasets, %d bands";
static char __pyx_k_invalid_shape_s_s_value_expected[] = "invalid shape \"%s\", \"(%s,)\" value expected";
static char __pyx_k_invalid_shape_s_scalar_value_exp[] = "invalid shape \"%s\", scalar value expected";
static char __pyx_k_ndarray_is_not_Fortran_contiguou[] = "ndarray is not Fortran contiguous";
static char __pyx_k_requeted_raster_width_d_is_too_l[] = "requeted raster width (%d) is too large for the Band (scene_width=%d)";
static char __pyx_k_setting_elements_is_not_implemen[] = "setting elements is not implemented on MPH/SPH records";
static char __pyx_k_unable_to_create_compatible_rast[] = "unable to create compatible raster with width=%d, height=%d xstep=%d, ystep=%d";
static char __pyx_k_unable_to_get_dataset_at_index_d[] = "unable to get dataset at index %d";
static char __pyx_k_unable_to_inizialize_EPR_API_lib[] = "unable to inizialize EPR API library: %s";
static char __pyx_k_unable_to_read_record_at_index_d[] = "unable to read record at index %d";
static char __pyx_k_write_error_d_of_d_bytes_written[] = "write error: %d of %d bytes written";
static char __pyx_k_write_operation_on_read_only_fil[] = "write operation on read-only file";
static char __pyx_k_xstep_d_too_large_for_the_reques[] = "xstep (%d) too large for the requested width (%d)";
static char __pyx_k_ystep_d_too_large_for_the_reques[] = "ystep (%d) too large for the requested height (%d)";
static char __pyx_k_Format_string_allocated_too_shor_2[] = "Format string allocated too short.";
static char __pyx_k_The_class_Product_instance_to_wh_2[] = "The :class:`Product` instance to which this dataset belongs to";
static char __pyx_k_The_data_type_of_the_band_s_pixe_2[] = "The data type of the band's pixels\n\n        Possible values are:\n\n        * ``*``         --> the datatype remains unchanged.\n        * ``uint8_t``   --> 8-bit unsigned integer\n        * ``uint32_t``  --> 32-bit unsigned integer\n        * ``Float``     --> 32-bit IEEE floating point\n\n        ";
static PyObject *__pyx_kp_s_;
static PyObject *__pyx_kp_s_0_9_1;
static PyObject *__pyx_kp_s_1OF1;
static PyObject *__pyx_kp_s_1OF2;
static PyObject *__pyx_kp_s_2OF2;
static PyObject *__pyx_kp_s_2TOF;
static PyObject *__pyx_kp_s_3TOI;
static PyObject *__pyx_n_s_AttributeError;
static PyObject *__pyx_n_s_DEFAULT_FS_ENCODING;
static PyObject *__pyx_kp_s_DSD_only_implements_and_operator;
static PyObject *__pyx_n_s_DTYPE_MAP;
static PyObject *__pyx_n_s_EPRError;
static PyObject *__pyx_n_s_EPRError___init;
static PyObject *__pyx_n_s_EPRTime;
static PyObject *__pyx_n_s_EPRValueError;
static PyObject *__pyx_kp_s_EPR_API_error;
static PyObject *__pyx_n_s_EPR_C_API_VERSION;
static PyObject *__pyx_n_s_EPR_MAGIC_BAND_ID;
static PyObject *__pyx_n_s_EPR_MAGIC_DATASET_ID;
static PyObject *__pyx_n_s_EPR_MAGIC_FIELD;
static PyObject *__pyx_n_s_EPR_MAGIC_FLAG_DEF;
static PyObject *__pyx_n_s_EPR_MAGIC_PRODUCT_ID;
static PyObject *__pyx_n_s_EPR_MAGIC_RASTER;
static PyObject *__pyx_n_s_EPR_MAGIC_RECORD;
static PyObject *__pyx_n_s_E_SMID_LIN;
static PyObject *__pyx_n_s_E_SMID_LOG;
static PyObject *__pyx_n_s_E_SMID_NON;
static PyObject *__pyx_n_s_E_SMOD_1OF1;
static PyObject *__pyx_n_s_E_SMOD_1OF2;
static PyObject *__pyx_n_s_E_SMOD_2OF2;
static PyObject *__pyx_n_s_E_SMOD_2TOF;
static PyObject *__pyx_n_s_E_SMOD_3TOI;
static PyObject *__pyx_n_s_E_TID_CHAR;
static PyObject *__pyx_n_s_E_TID_DOUBLE;
static PyObject *__pyx_n_s_E_TID_FLOAT;
static PyObject *__pyx_n_s_E_TID_INT;
static PyObject *__pyx_n_s_E_TID_SHORT;
static PyObject *__pyx_n_s_E_TID_SPARE;
static PyObject *__pyx_n_s_E_TID_STRING;
static PyObject *__pyx_n_s_E_TID_TIME;
static PyObject *__pyx_n_s_E_TID_UCHAR;
static PyObject *__pyx_n_s_E_TID_UINT;
static PyObject *__pyx_n_s_E_TID_UNKNOWN;
static PyObject *__pyx_n_s_E_TID_USHORT;
static PyObject *__pyx_n_s_Exception;
static PyObject *__pyx_kp_s_Field_only_implements_and_operat;
static PyObject *__pyx_kp_s_Filed_s_elems_pointer_is_null;
static PyObject *__pyx_kp_u_Format_string_allocated_too_shor;
static PyObject *__pyx_kp_u_Format_string_allocated_too_shor_2;
static PyObject *__pyx_n_s_IOError;
static PyObject *__pyx_kp_s_I_O_operation_on_closed_file;
static PyObject *__pyx_n_s_ImportError;
static PyObject *__pyx_n_s_KeyError;
static PyObject *__pyx_n_s_LIN;
static PyObject *__pyx_n_s_LOG;
static PyObject *__pyx_n_s_METHOD_MAP;
static PyObject *__pyx_n_s_MJD;
static PyObject *__pyx_n_s_MODEL_MAP;
static PyObject *__pyx_n_s_NONE;
static PyObject *__pyx_kp_u_Non_native_byte_order_not_suppor;
static PyObject *__pyx_n_s_NotImplemented;
static PyObject *__pyx_n_s_NotImplementedError;
static PyObject *__pyx_n_s_RuntimeError;
static PyObject *__pyx_n_s_TypeError;
static PyObject *__pyx_kp_s_UTF_8;
static PyObject *__pyx_n_s_ValueError;
static PyObject *__pyx_kp_s__11;
static PyObject *__pyx_kp_s__17;
static PyObject *__pyx_kp_s__9;
static PyObject *__pyx_n_s_args;
static PyObject *__pyx_n_s_asarray;
static PyObject *__pyx_n_s_ascii;
static PyObject *__pyx_n_s_ascontiguousarray;
static PyObject *__pyx_n_s_astype;
static PyObject *__pyx_kp_s_at_lease_part_of_the_requested_a;
static PyObject *__pyx_n_s_atexit;
static PyObject *__pyx_kp_s_bad_output_stream;
static PyObject *__pyx_n_s_bands;
static PyObject *__pyx_n_s_bm_expr;
static PyObject *__pyx_n_s_byteorder;
static PyObject *__pyx_n_s_bytes;
static PyObject *__pyx_n_s_byteswap;
static PyObject *__pyx_n_s_class;
static PyObject *__pyx_n_s_close;
static PyObject *__pyx_n_s_close_api;
static PyObject *__pyx_n_s_code;
static PyObject *__pyx_n_s_collect;
static PyObject *__pyx_n_s_collections;
static PyObject *__pyx_n_s_create_bitmask_raster;
static PyObject *__pyx_n_s_create_compatible_raster;
static PyObject *__pyx_n_s_create_raster;
static PyObject *__pyx_kp_s_d;
static PyObject *__pyx_n_s_data;
static PyObject *__pyx_n_s_data_type;
static PyObject *__pyx_n_s_datasets;
static PyObject *__pyx_n_s_days;
static PyObject *__pyx_n_s_decode;
static PyObject *__pyx_n_s_doc;
static PyObject *__pyx_n_s_ds_name;
static PyObject *__pyx_n_s_elem;
static PyObject *__pyx_n_s_element_index;
static PyObject *__pyx_n_s_encode;
static PyObject *__pyx_n_s_epr;
static PyObject *__pyx_kp_s_epr_Band_s_of_epr_Product_s;
static PyObject *__pyx_kp_s_epr_DSD_s;
static PyObject *__pyx_kp_s_epr_Dataset_s_d_records;
static PyObject *__pyx_kp_s_epr_Field_s_d_s_elements;
static PyObject *__pyx_kp_s_epr_Product_s_d_datasets_d_bands;
static PyObject *__pyx_kp_s_f;
static PyObject *__pyx_n_s_field_index;
static PyObject *__pyx_n_s_filename;
static PyObject *__pyx_n_s_float32;
static PyObject *__pyx_n_s_float64;
static PyObject *__pyx_n_s_flush;
static PyObject *__pyx_kp_s_flush_error;
static PyObject *__pyx_n_s_gc;
static PyObject *__pyx_n_s_get_band_at;
static PyObject *__pyx_n_s_get_dataset;
static PyObject *__pyx_n_s_get_dataset_at;
static PyObject *__pyx_n_s_get_elem;
static PyObject *__pyx_n_s_get_elems;
static PyObject *__pyx_n_s_get_field_at;
static PyObject *__pyx_n_s_get_height;
static PyObject *__pyx_n_s_get_name;
static PyObject *__pyx_n_s_get_num_bands;
static PyObject *__pyx_n_s_get_num_datasets;
static PyObject *__pyx_n_s_get_num_elems;
static PyObject *__pyx_n_s_get_num_fields;
static PyObject *__pyx_n_s_get_num_records;
static PyObject *__pyx_n_s_get_type;
static PyObject *__pyx_n_s_get_width;
static PyObject *__pyx_n_s_getfilesystemencoding;
static PyObject *__pyx_n_s_height;
static PyObject *__pyx_kp_s_home_antonio_projects_pyepr_src;
static PyObject *__pyx_kp_s_i_d;
static PyObject *__pyx_n_s_id_string;
static PyObject *__pyx_n_s_import;
static PyObject *__pyx_n_s_index;
static PyObject *__pyx_kp_s_index_out_of_range_x_d_y_d;
static PyObject *__pyx_n_s_init;
static PyObject *__pyx_n_s_int16;
static PyObject *__pyx_n_s_int32;
static PyObject *__pyx_n_s_int8;
static PyObject *__pyx_kp_s_invalid_EPR_type_ID_d;
static PyObject *__pyx_kp_s_invalid_data_type;
static PyObject *__pyx_kp_s_invalid_data_type_s;
static PyObject *__pyx_kp_s_invalid_field_type;
static PyObject *__pyx_kp_s_invalid_index_d;
static PyObject *__pyx_kp_s_invalid_open_mode_s;
static PyObject *__pyx_kp_s_invalid_ostream;
static PyObject *__pyx_kp_s_invalid_sample_model_s;
static PyObject *__pyx_kp_s_invalid_scaling_method_s;
static PyObject *__pyx_kp_s_invalid_shape_s_s_value_expected;
static PyObject *__pyx_kp_s_invalid_shape_s_scalar_value_exp;
static PyObject *__pyx_kp_s_invalid_step_xspet_d_ystep_d;
static PyObject *__pyx_n_s_join;
static PyObject *__pyx_n_s_kargs;
static PyObject *__pyx_n_s_little;
static PyObject *__pyx_n_s_main;
static PyObject *__pyx_n_s_map;
static PyObject *__pyx_n_s_message;
static PyObject *__pyx_n_s_metaclass;
static PyObject *__pyx_n_s_microseconds;
static PyObject *__pyx_n_s_mode;
static PyObject *__pyx_n_s_module;
static PyObject *__pyx_n_s_name;
static PyObject *__pyx_n_s_namedtuple;
static PyObject *__pyx_kp_u_ndarray_is_not_C_contiguous;
static PyObject *__pyx_kp_u_ndarray_is_not_Fortran_contiguou;
static PyObject *__pyx_n_s_ndim;
static PyObject *__pyx_n_s_np;
static PyObject *__pyx_kp_s_null_pointer;
static PyObject *__pyx_n_s_numpy;
static PyObject *__pyx_n_s_open;
static PyObject *__pyx_n_s_os;
static PyObject *__pyx_n_s_ostream;
static PyObject *__pyx_n_s_prepare;
static PyObject *__pyx_n_s_product;
static PyObject *__pyx_n_s_pyx_vtable;
static PyObject *__pyx_n_s_qualname;
static PyObject *__pyx_kp_s_r_b;
static PyObject *__pyx_n_s_range;
static PyObject *__pyx_n_s_raster;
static PyObject *__pyx_n_s_raster_ptr;
static PyObject *__pyx_n_s_rb;
static PyObject *__pyx_kp_s_rb_2;
static PyObject *__pyx_n_s_read_raster;
static PyObject *__pyx_n_s_read_record;
static PyObject *__pyx_n_s_record;
static PyObject *__pyx_n_s_register;
static PyObject *__pyx_n_s_repr;
static PyObject *__pyx_n_s_repr_2;
static PyObject *__pyx_kp_s_requeted_raster_height_d_is_too;
static PyObject *__pyx_kp_s_requeted_raster_width_d_is_too_l;
static PyObject *__pyx_kp_s_s_class_cannot_be_instantiated;
static PyObject *__pyx_kp_s_s_d_d_j_d_m_d;
static PyObject *__pyx_kp_s_s_d_fields;
static PyObject *__pyx_kp_s_s_s;
static PyObject *__pyx_kp_s_s_s_2;
static PyObject *__pyx_kp_s_s_s_3;
static PyObject *__pyx_kp_s_s_s_4;
static PyObject *__pyx_kp_s_s_s_dL_x_dP;
static PyObject *__pyx_kp_s_s_unknown_data_type;
static PyObject *__pyx_n_s_seconds;
static PyObject *__pyx_n_s_self;
static PyObject *__pyx_n_s_send;
static PyObject *__pyx_kp_s_setting_elements_is_not_implemen;
static PyObject *__pyx_n_s_shape;
static PyObject *__pyx_n_s_size;
static PyObject *__pyx_n_s_src_height;
static PyObject *__pyx_n_s_src_width;
static PyObject *__pyx_n_s_stdout;
static PyObject *__pyx_n_s_super;
static PyObject *__pyx_n_s_sys;
static PyObject *__pyx_n_s_test;
static PyObject *__pyx_n_s_throw;
static PyObject *__pyx_kp_s_u;
static PyObject *__pyx_kp_s_u_d;
static PyObject *__pyx_n_s_uint16;
static PyObject *__pyx_n_s_uint32;
static PyObject *__pyx_n_s_uint8;
static PyObject *__pyx_kp_s_unable_to_create_a_new_raster;
static PyObject *__pyx_kp_s_unable_to_create_compatible_rast;
static PyObject *__pyx_kp_s_unable_to_get_DSD_at_index_d;
static PyObject *__pyx_kp_s_unable_to_get_MPH_record;
static PyObject *__pyx_kp_s_unable_to_get_SPH_record;
static PyObject *__pyx_kp_s_unable_to_get_band_at_index_d;
static PyObject *__pyx_kp_s_unable_to_get_band_s;
static PyObject *__pyx_kp_s_unable_to_get_dataset_at_index_d;
static PyObject *__pyx_kp_s_unable_to_get_dataset_s;
static PyObject *__pyx_kp_s_unable_to_get_field_at_index_d;
static PyObject *__pyx_kp_s_unable_to_get_field_s;
static PyObject *__pyx_kp_s_unable_to_inizialize_EPR_API_lib;
static PyObject *__pyx_kp_s_unable_to_open_file_s_in_s_mode;
static PyObject *__pyx_kp_s_unable_to_open_s;
static PyObject *__pyx_kp_s_unable_to_read_record_at_index_d;
static PyObject *__pyx_kp_s_unexpected_number_of_elements_d;
static PyObject *__pyx_kp_s_unknown_data_type;
static PyObject *__pyx_kp_u_unknown_dtype_code_in_numpy_pxd;
static PyObject *__pyx_n_s_version;
static PyObject *__pyx_n_s_width;
static PyObject *__pyx_kp_s_write_error_d_of_d_bytes_written;
static PyObject *__pyx_kp_s_write_operation_on_read_only_fil;
static PyObject *__pyx_n_s_x;
static PyObject *__pyx_n_s_xoffset;
static PyObject *__pyx_kp_s_xoffset_os_larger_that_he_scene;
static PyObject *__pyx_n_s_xstep;
static PyObject *__pyx_kp_s_xstep_d_too_large_for_the_reques;
static PyObject *__pyx_n_s_y;
static PyObject *__pyx_n_s_yoffset;
static PyObject *__pyx_kp_s_yoffset_os_larger_that_he_scene;
static PyObject *__pyx_n_s_ystep;
static PyObject *__pyx_kp_s_ystep_d_too_large_for_the_reques;
static PyObject *__pyx_int_0;
static PyObject *__pyx_int_1;
static PyObject *__pyx_tuple__2;
static PyObject *__pyx_tuple__3;
static PyObject *__pyx_tuple__4;
static PyObject *__pyx_tuple__5;
static PyObject *__pyx_tuple__6;
static PyObject *__pyx_tuple__7;
static PyObject *__pyx_tuple__8;
static PyObject *__pyx_tuple__10;
static PyObject *__pyx_tuple__12;
static PyObject *__pyx_tuple__13;
static PyObject *__pyx_tuple__14;
static PyObject *__pyx_tuple__15;
static PyObject *__pyx_tuple__16;
static PyObject *__pyx_tuple__18;
static PyObject *__pyx_tuple__19;
static PyObject *__pyx_tuple__20;
static PyObject *__pyx_tuple__21;
static PyObject *__pyx_tuple__22;
static PyObject *__pyx_tuple__23;
static PyObject *__pyx_tuple__24;
static PyObject *__pyx_tuple__25;
static PyObject *__pyx_tuple__26;
static PyObject *__pyx_tuple__27;
static PyObject *__pyx_tuple__28;
static PyObject *__pyx_tuple__29;
static PyObject *__pyx_tuple__31;
static PyObject *__pyx_tuple__32;
static PyObject *__pyx_tuple__34;
static PyObject *__pyx_tuple__36;
static PyObject *__pyx_tuple__38;
static PyObject *__pyx_codeobj__30;
static PyObject *__pyx_codeobj__33;
static PyObject *__pyx_codeobj__35;
static PyObject *__pyx_codeobj__37;
static PyObject *__pyx_codeobj__39;

/* "epr.pyx":83
 * 
 * 
 * cdef inline bytes _to_bytes(s, encoding='UTF-8'):             # <<<<<<<<<<<<<<
 *     if hasattr(s, 'encode'):
 *         return s.encode(encoding)
 */

static CYTHON_INLINE PyObject *__pyx_f_3epr__to_bytes(PyObject *__pyx_v_s, struct __pyx_opt_args_3epr__to_bytes *__pyx_optional_args) {
  PyObject *__pyx_v_encoding = ((PyObject *)__pyx_kp_s_UTF_8);
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_to_bytes", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_encoding = __pyx_optional_args->encoding;
    }
  }

  /* "epr.pyx":84
 * 
 * cdef inline bytes _to_bytes(s, encoding='UTF-8'):
 *     if hasattr(s, 'encode'):             # <<<<<<<<<<<<<<
 *         return s.encode(encoding)
 *     else:
 */
  __pyx_t_1 = PyObject_HasAttr(__pyx_v_s, __pyx_n_s_encode); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "epr.pyx":85
 * cdef inline bytes _to_bytes(s, encoding='UTF-8'):
 *     if hasattr(s, 'encode'):
 *         return s.encode(encoding)             # <<<<<<<<<<<<<<
 *     else:
 *         return s
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_s, __pyx_n_s_encode); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_v_encoding);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_encoding);
    __Pyx_GIVEREF(__pyx_v_encoding);
    __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (!(likely(PyBytes_CheckExact(__pyx_t_5))||((__pyx_t_5) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_5)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_r = ((PyObject*)__pyx_t_5);
    __pyx_t_5 = 0;
    goto __pyx_L0;
  }
  /*else*/ {

    /* "epr.pyx":87
 *         return s.encode(encoding)
 *     else:
 *         return s             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    if (!(likely(PyBytes_CheckExact(__pyx_v_s))||((__pyx_v_s) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_v_s)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_INCREF(__pyx_v_s);
    __pyx_r = ((PyObject*)__pyx_v_s);
    goto __pyx_L0;
  }

  /* "epr.pyx":83
 * 
 * 
 * cdef inline bytes _to_bytes(s, encoding='UTF-8'):             # <<<<<<<<<<<<<<
 *     if hasattr(s, 'encode'):
 *         return s.encode(encoding)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("epr._to_bytes", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":90
 * 
 * 
 * cdef inline str _to_str(b, encoding='UTF-8'):             # <<<<<<<<<<<<<<
 *     if PY3:
 *         return b.decode(encoding)
 */

static CYTHON_INLINE PyObject *__pyx_f_3epr__to_str(PyObject *__pyx_v_b, struct __pyx_opt_args_3epr__to_str *__pyx_optional_args) {
  PyObject *__pyx_v_encoding = ((PyObject *)__pyx_kp_s_UTF_8);
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_to_str", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_encoding = __pyx_optional_args->encoding;
    }
  }

  /* "epr.pyx":91
 * 
 * cdef inline str _to_str(b, encoding='UTF-8'):
 *     if PY3:             # <<<<<<<<<<<<<<
 *         return b.decode(encoding)
 *     else:
 */
  __pyx_t_1 = (__pyx_v_3epr_PY3 != 0);
  if (__pyx_t_1) {

    /* "epr.pyx":92
 * cdef inline str _to_str(b, encoding='UTF-8'):
 *     if PY3:
 *         return b.decode(encoding)             # <<<<<<<<<<<<<<
 *     else:
 *         return b
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_b, __pyx_n_s_decode); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v_encoding);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_encoding);
    __Pyx_GIVEREF(__pyx_v_encoding);
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (!(likely(PyString_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "str", Py_TYPE(__pyx_t_4)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_r = ((PyObject*)__pyx_t_4);
    __pyx_t_4 = 0;
    goto __pyx_L0;
  }
  /*else*/ {

    /* "epr.pyx":94
 *         return b.decode(encoding)
 *     else:
 *         return b             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    if (!(likely(PyString_CheckExact(__pyx_v_b))||((__pyx_v_b) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "str", Py_TYPE(__pyx_v_b)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_INCREF(__pyx_v_b);
    __pyx_r = ((PyObject*)__pyx_v_b);
    goto __pyx_L0;
  }

  /* "epr.pyx":90
 * 
 * 
 * cdef inline str _to_str(b, encoding='UTF-8'):             # <<<<<<<<<<<<<<
 *     if PY3:
 *         return b.decode(encoding)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("epr._to_str", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":143
 * 
 * 
 * cdef np.NPY_TYPES _epr_to_numpy_type_id(EPR_DataTypeId epr_type):             # <<<<<<<<<<<<<<
 *     if epr_type == e_tid_uchar:
 *         return np.NPY_UBYTE
 */

static enum NPY_TYPES __pyx_f_3epr__epr_to_numpy_type_id(enum EPR_DataTypeId __pyx_v_epr_type) {
  enum NPY_TYPES __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("_epr_to_numpy_type_id", 0);

  /* "epr.pyx":144
 * 
 * cdef np.NPY_TYPES _epr_to_numpy_type_id(EPR_DataTypeId epr_type):
 *     if epr_type == e_tid_uchar:             # <<<<<<<<<<<<<<
 *         return np.NPY_UBYTE
 *     if epr_type == e_tid_char:
 */
  __pyx_t_1 = ((__pyx_v_epr_type == e_tid_uchar) != 0);
  if (__pyx_t_1) {

    /* "epr.pyx":145
 * cdef np.NPY_TYPES _epr_to_numpy_type_id(EPR_DataTypeId epr_type):
 *     if epr_type == e_tid_uchar:
 *         return np.NPY_UBYTE             # <<<<<<<<<<<<<<
 *     if epr_type == e_tid_char:
 *         return np.NPY_BYTE
 */
    __pyx_r = NPY_UBYTE;
    goto __pyx_L0;
  }

  /* "epr.pyx":146
 *     if epr_type == e_tid_uchar:
 *         return np.NPY_UBYTE
 *     if epr_type == e_tid_char:             # <<<<<<<<<<<<<<
 *         return np.NPY_BYTE
 *     if epr_type == e_tid_ushort:
 */
  __pyx_t_1 = ((__pyx_v_epr_type == e_tid_char) != 0);
  if (__pyx_t_1) {

    /* "epr.pyx":147
 *         return np.NPY_UBYTE
 *     if epr_type == e_tid_char:
 *         return np.NPY_BYTE             # <<<<<<<<<<<<<<
 *     if epr_type == e_tid_ushort:
 *         return np.NPY_USHORT
 */
    __pyx_r = NPY_BYTE;
    goto __pyx_L0;
  }

  /* "epr.pyx":148
 *     if epr_type == e_tid_char:
 *         return np.NPY_BYTE
 *     if epr_type == e_tid_ushort:             # <<<<<<<<<<<<<<
 *         return np.NPY_USHORT
 *     if epr_type == e_tid_short:
 */
  __pyx_t_1 = ((__pyx_v_epr_type == e_tid_ushort) != 0);
  if (__pyx_t_1) {

    /* "epr.pyx":149
 *         return np.NPY_BYTE
 *     if epr_type == e_tid_ushort:
 *         return np.NPY_USHORT             # <<<<<<<<<<<<<<
 *     if epr_type == e_tid_short:
 *         return np.NPY_SHORT
 */
    __pyx_r = NPY_USHORT;
    goto __pyx_L0;
  }

  /* "epr.pyx":150
 *     if epr_type == e_tid_ushort:
 *         return np.NPY_USHORT
 *     if epr_type == e_tid_short:             # <<<<<<<<<<<<<<
 *         return np.NPY_SHORT
 *     if epr_type == e_tid_uint:
 */
  __pyx_t_1 = ((__pyx_v_epr_type == e_tid_short) != 0);
  if (__pyx_t_1) {

    /* "epr.pyx":151
 *         return np.NPY_USHORT
 *     if epr_type == e_tid_short:
 *         return np.NPY_SHORT             # <<<<<<<<<<<<<<
 *     if epr_type == e_tid_uint:
 *         return np.NPY_UINT
 */
    __pyx_r = NPY_SHORT;
    goto __pyx_L0;
  }

  /* "epr.pyx":152
 *     if epr_type == e_tid_short:
 *         return np.NPY_SHORT
 *     if epr_type == e_tid_uint:             # <<<<<<<<<<<<<<
 *         return np.NPY_UINT
 *     if epr_type == e_tid_int:
 */
  __pyx_t_1 = ((__pyx_v_epr_type == e_tid_uint) != 0);
  if (__pyx_t_1) {

    /* "epr.pyx":153
 *         return np.NPY_SHORT
 *     if epr_type == e_tid_uint:
 *         return np.NPY_UINT             # <<<<<<<<<<<<<<
 *     if epr_type == e_tid_int:
 *         return np.NPY_INT
 */
    __pyx_r = NPY_UINT;
    goto __pyx_L0;
  }

  /* "epr.pyx":154
 *     if epr_type == e_tid_uint:
 *         return np.NPY_UINT
 *     if epr_type == e_tid_int:             # <<<<<<<<<<<<<<
 *         return np.NPY_INT
 *     if epr_type == e_tid_float:
 */
  __pyx_t_1 = ((__pyx_v_epr_type == e_tid_int) != 0);
  if (__pyx_t_1) {

    /* "epr.pyx":155
 *         return np.NPY_UINT
 *     if epr_type == e_tid_int:
 *         return np.NPY_INT             # <<<<<<<<<<<<<<
 *     if epr_type == e_tid_float:
 *         return np.NPY_FLOAT
 */
    __pyx_r = NPY_INT;
    goto __pyx_L0;
  }

  /* "epr.pyx":156
 *     if epr_type == e_tid_int:
 *         return np.NPY_INT
 *     if epr_type == e_tid_float:             # <<<<<<<<<<<<<<
 *         return np.NPY_FLOAT
 *     if epr_type == e_tid_double:
 */
  __pyx_t_1 = ((__pyx_v_epr_type == e_tid_float) != 0);
  if (__pyx_t_1) {

    /* "epr.pyx":157
 *         return np.NPY_INT
 *     if epr_type == e_tid_float:
 *         return np.NPY_FLOAT             # <<<<<<<<<<<<<<
 *     if epr_type == e_tid_double:
 *         return np.NPY_DOUBLE
 */
    __pyx_r = NPY_FLOAT;
    goto __pyx_L0;
  }

  /* "epr.pyx":158
 *     if epr_type == e_tid_float:
 *         return np.NPY_FLOAT
 *     if epr_type == e_tid_double:             # <<<<<<<<<<<<<<
 *         return np.NPY_DOUBLE
 *     if epr_type == e_tid_string:
 */
  __pyx_t_1 = ((__pyx_v_epr_type == e_tid_double) != 0);
  if (__pyx_t_1) {

    /* "epr.pyx":159
 *         return np.NPY_FLOAT
 *     if epr_type == e_tid_double:
 *         return np.NPY_DOUBLE             # <<<<<<<<<<<<<<
 *     if epr_type == e_tid_string:
 *         return np.NPY_STRING
 */
    __pyx_r = NPY_DOUBLE;
    goto __pyx_L0;
  }

  /* "epr.pyx":160
 *     if epr_type == e_tid_double:
 *         return np.NPY_DOUBLE
 *     if epr_type == e_tid_string:             # <<<<<<<<<<<<<<
 *         return np.NPY_STRING
 * 
 */
  __pyx_t_1 = ((__pyx_v_epr_type == e_tid_string) != 0);
  if (__pyx_t_1) {

    /* "epr.pyx":161
 *         return np.NPY_DOUBLE
 *     if epr_type == e_tid_string:
 *         return np.NPY_STRING             # <<<<<<<<<<<<<<
 * 
 *     return np.NPY_NOTYPE
 */
    __pyx_r = NPY_STRING;
    goto __pyx_L0;
  }

  /* "epr.pyx":163
 *         return np.NPY_STRING
 * 
 *     return np.NPY_NOTYPE             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = NPY_NOTYPE;
  goto __pyx_L0;

  /* "epr.pyx":143
 * 
 * 
 * cdef np.NPY_TYPES _epr_to_numpy_type_id(EPR_DataTypeId epr_type):             # <<<<<<<<<<<<<<
 *     if epr_type == e_tid_uchar:
 *         return np.NPY_UBYTE
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":201
 *     '''EPR API error'''
 * 
 *     def __init__(self, message='', code=None, *args, **kargs):             # <<<<<<<<<<<<<<
 *         '''__init__(self, message='', code=None, *args, **kargs)'''
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_3epr_8EPRError_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_3epr_8EPRError___init__[] = "__init__(self, message='', code=None, *args, **kargs)";
static PyMethodDef __pyx_mdef_3epr_8EPRError_1__init__ = {__Pyx_NAMESTR("__init__"), (PyCFunction)__pyx_pw_3epr_8EPRError_1__init__, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_3epr_8EPRError___init__)};
static PyObject *__pyx_pw_3epr_8EPRError_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_message = 0;
  PyObject *__pyx_v_code = 0;
  PyObject *__pyx_v_args = 0;
  PyObject *__pyx_v_kargs = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  __pyx_v_kargs = PyDict_New(); if (unlikely(!__pyx_v_kargs)) return NULL;
  __Pyx_GOTREF(__pyx_v_kargs);
  if (PyTuple_GET_SIZE(__pyx_args) > 3) {
    __pyx_v_args = PyTuple_GetSlice(__pyx_args, 3, PyTuple_GET_SIZE(__pyx_args));
    if (unlikely(!__pyx_v_args)) {
      __Pyx_DECREF(__pyx_v_kargs); __pyx_v_kargs = 0;
      __Pyx_RefNannyFinishContext();
      return NULL;
    }
    __Pyx_GOTREF(__pyx_v_args);
  } else {
    __pyx_v_args = __pyx_empty_tuple; __Pyx_INCREF(__pyx_empty_tuple);
  }
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_message,&__pyx_n_s_code,0};
    PyObject* values[3] = {0,0,0};
    values[1] = ((PyObject *)((PyObject*)__pyx_kp_s_));
    values[2] = ((PyObject *)((PyObject *)Py_None));
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        default:
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_message);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_code);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t used_pos_args = (pos_args < 3) ? pos_args : 3;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kargs, values, used_pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        default:
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        case  0:
        goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_self = values[0];
    __pyx_v_message = values[1];
    __pyx_v_code = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v_args); __pyx_v_args = 0;
  __Pyx_DECREF(__pyx_v_kargs); __pyx_v_kargs = 0;
  __Pyx_AddTraceback("epr.EPRError.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_3epr_8EPRError___init__(__pyx_self, __pyx_v_self, __pyx_v_message, __pyx_v_code, __pyx_v_args, __pyx_v_kargs);

  /* function exit code */
  __Pyx_XDECREF(__pyx_v_args);
  __Pyx_XDECREF(__pyx_v_kargs);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_3epr_8EPRError___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_message, PyObject *__pyx_v_code, PyObject *__pyx_v_args, PyObject *__pyx_v_kargs) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "epr.pyx":204
 *         '''__init__(self, message='', code=None, *args, **kargs)'''
 * 
 *         super(EPRError, self).__init__(message, code, *args, **kargs)             # <<<<<<<<<<<<<<
 * 
 *         #: EPR API error code
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_EPRError); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_self);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_self);
  __Pyx_GIVEREF(__pyx_v_self);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_super, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_init); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_message);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_message);
  __Pyx_GIVEREF(__pyx_v_message);
  __Pyx_INCREF(__pyx_v_code);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_code);
  __Pyx_GIVEREF(__pyx_v_code);
  __pyx_t_3 = PySequence_Tuple(__pyx_v_args); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyNumber_Add(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __pyx_v_kargs;
  __Pyx_INCREF(__pyx_t_3);
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "epr.pyx":207
 * 
 *         #: EPR API error code
 *         self.code = code             # <<<<<<<<<<<<<<
 * 
 * 
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_code, __pyx_v_code) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "epr.pyx":201
 *     '''EPR API error'''
 * 
 *     def __init__(self, message='', code=None, *args, **kargs):             # <<<<<<<<<<<<<<
 *         '''__init__(self, message='', code=None, *args, **kargs)'''
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("epr.EPRError.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":214
 * 
 * 
 * cdef pyepr_check_errors():             # <<<<<<<<<<<<<<
 *     cdef int code
 *     cdef str msg
 */

static PyObject *__pyx_f_3epr_pyepr_check_errors(void) {
  int __pyx_v_code;
  PyObject *__pyx_v_msg = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  struct __pyx_opt_args_3epr__to_str __pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("pyepr_check_errors", 0);

  /* "epr.pyx":217
 *     cdef int code
 *     cdef str msg
 *     code = epr_get_last_err_code()             # <<<<<<<<<<<<<<
 *     if code != e_err_none:
 *         msg = _to_str(<char*>epr_get_last_err_message(), 'ascii')
 */
  __pyx_v_code = epr_get_last_err_code();

  /* "epr.pyx":218
 *     cdef str msg
 *     code = epr_get_last_err_code()
 *     if code != e_err_none:             # <<<<<<<<<<<<<<
 *         msg = _to_str(<char*>epr_get_last_err_message(), 'ascii')
 *         epr_clear_err()
 */
  __pyx_t_1 = ((__pyx_v_code != e_err_none) != 0);
  if (__pyx_t_1) {

    /* "epr.pyx":219
 *     code = epr_get_last_err_code()
 *     if code != e_err_none:
 *         msg = _to_str(<char*>epr_get_last_err_message(), 'ascii')             # <<<<<<<<<<<<<<
 *         epr_clear_err()
 * 
 */
    __pyx_t_2 = __Pyx_PyBytes_FromString(((char *)epr_get_last_err_message())); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4.__pyx_n = 1;
    __pyx_t_4.encoding = __pyx_n_s_ascii;
    __pyx_t_3 = __pyx_f_3epr__to_str(__pyx_t_2, &__pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_msg = ((PyObject*)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "epr.pyx":220
 *     if code != e_err_none:
 *         msg = _to_str(<char*>epr_get_last_err_message(), 'ascii')
 *         epr_clear_err()             # <<<<<<<<<<<<<<
 * 
 *         # @TODO: if not msg: msg = EPR_ERR_MSG[code]
 */
    epr_clear_err();

    /* "epr.pyx":223
 * 
 *         # @TODO: if not msg: msg = EPR_ERR_MSG[code]
 *         if (e_err_invalid_product_id <= code <= e_err_invalid_keyword_name or             # <<<<<<<<<<<<<<
 *             code in (e_err_null_pointer,
 *                      e_err_illegal_arg,
 */
    __pyx_t_1 = (e_err_invalid_product_id <= ((enum EPR_ErrCode)__pyx_v_code));
    if (__pyx_t_1) {
      __pyx_t_1 = (__pyx_v_code <= e_err_invalid_keyword_name);
    }
    if (!(__pyx_t_1 != 0)) {

      /* "epr.pyx":224
 *         # @TODO: if not msg: msg = EPR_ERR_MSG[code]
 *         if (e_err_invalid_product_id <= code <= e_err_invalid_keyword_name or
 *             code in (e_err_null_pointer,             # <<<<<<<<<<<<<<
 *                      e_err_illegal_arg,
 *                      e_err_index_out_of_range)):
 */
      switch (__pyx_v_code) {
        case e_err_null_pointer:

        /* "epr.pyx":225
 *         if (e_err_invalid_product_id <= code <= e_err_invalid_keyword_name or
 *             code in (e_err_null_pointer,
 *                      e_err_illegal_arg,             # <<<<<<<<<<<<<<
 *                      e_err_index_out_of_range)):
 *             raise EPRValueError(msg, code)
 */
        case e_err_illegal_arg:

        /* "epr.pyx":226
 *             code in (e_err_null_pointer,
 *                      e_err_illegal_arg,
 *                      e_err_index_out_of_range)):             # <<<<<<<<<<<<<<
 *             raise EPRValueError(msg, code)
 *         else:
 */
        case e_err_index_out_of_range:

        /* "epr.pyx":224
 *         # @TODO: if not msg: msg = EPR_ERR_MSG[code]
 *         if (e_err_invalid_product_id <= code <= e_err_invalid_keyword_name or
 *             code in (e_err_null_pointer,             # <<<<<<<<<<<<<<
 *                      e_err_illegal_arg,
 *                      e_err_index_out_of_range)):
 */
        __pyx_t_5 = 1;
        break;
        default:
        __pyx_t_5 = 0;
        break;
      }
      __pyx_t_6 = (__pyx_t_5 != 0);
      __pyx_t_5 = __pyx_t_6;
    } else {
      __pyx_t_5 = (__pyx_t_1 != 0);
    }
    if (__pyx_t_5) {

      /* "epr.pyx":227
 *                      e_err_illegal_arg,
 *                      e_err_index_out_of_range)):
 *             raise EPRValueError(msg, code)             # <<<<<<<<<<<<<<
 *         else:
 *             raise EPRError(msg, code)
 */
      __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_EPRValueError); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_code); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_INCREF(__pyx_v_msg);
      PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_msg);
      __Pyx_GIVEREF(__pyx_v_msg);
      PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_2);
      __pyx_t_2 = 0;
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_7, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_Raise(__pyx_t_2, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    /*else*/ {

      /* "epr.pyx":229
 *             raise EPRValueError(msg, code)
 *         else:
 *             raise EPRError(msg, code)             # <<<<<<<<<<<<<<
 * 
 * 
 */
      __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_EPRError); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_code); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_v_msg);
      PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_msg);
      __Pyx_GIVEREF(__pyx_v_msg);
      PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_7);
      __Pyx_GIVEREF(__pyx_t_7);
      __pyx_t_7 = 0;
      __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_Raise(__pyx_t_7, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
  }

  /* "epr.pyx":214
 * 
 * 
 * cdef pyepr_check_errors():             # <<<<<<<<<<<<<<
 *     cdef int code
 *     cdef str msg
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("epr.pyepr_check_errors", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_msg);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":232
 * 
 * 
 * cdef pyepr_null_ptr_error(msg='null pointer'):             # <<<<<<<<<<<<<<
 *     cdef int code
 *     cdef str eprmsg = _to_str(<char*>epr_get_last_err_message(), 'ascii')
 */

static PyObject *__pyx_f_3epr_pyepr_null_ptr_error(struct __pyx_opt_args_3epr_pyepr_null_ptr_error *__pyx_optional_args) {
  PyObject *__pyx_v_msg = ((PyObject *)__pyx_kp_s_null_pointer);
  int __pyx_v_code;
  PyObject *__pyx_v_eprmsg = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  struct __pyx_opt_args_3epr__to_str __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("pyepr_null_ptr_error", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_msg = __pyx_optional_args->msg;
    }
  }

  /* "epr.pyx":234
 * cdef pyepr_null_ptr_error(msg='null pointer'):
 *     cdef int code
 *     cdef str eprmsg = _to_str(<char*>epr_get_last_err_message(), 'ascii')             # <<<<<<<<<<<<<<
 * 
 *     code = epr_get_last_err_code()
 */
  __pyx_t_1 = __Pyx_PyBytes_FromString(((char *)epr_get_last_err_message())); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3.__pyx_n = 1;
  __pyx_t_3.encoding = __pyx_n_s_ascii;
  __pyx_t_2 = __pyx_f_3epr__to_str(__pyx_t_1, &__pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_eprmsg = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "epr.pyx":236
 *     cdef str eprmsg = _to_str(<char*>epr_get_last_err_message(), 'ascii')
 * 
 *     code = epr_get_last_err_code()             # <<<<<<<<<<<<<<
 *     if not code:
 *         code = None
 */
  __pyx_v_code = epr_get_last_err_code();

  /* "epr.pyx":237
 * 
 *     code = epr_get_last_err_code()
 *     if not code:             # <<<<<<<<<<<<<<
 *         code = None
 * 
 */
  __pyx_t_4 = ((!(__pyx_v_code != 0)) != 0);
  if (__pyx_t_4) {

    /* "epr.pyx":238
 *     code = epr_get_last_err_code()
 *     if not code:
 *         code = None             # <<<<<<<<<<<<<<
 * 
 *     epr_clear_err()
 */
    __pyx_t_5 = __Pyx_PyInt_As_int(Py_None); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_code = __pyx_t_5;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "epr.pyx":240
 *         code = None
 * 
 *     epr_clear_err()             # <<<<<<<<<<<<<<
 * 
 *     raise EPRValueError('%s: %s' % (msg, eprmsg), code=code)
 */
  epr_clear_err();

  /* "epr.pyx":242
 *     epr_clear_err()
 * 
 *     raise EPRValueError('%s: %s' % (msg, eprmsg), code=code)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_EPRValueError); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_msg);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_msg);
  __Pyx_GIVEREF(__pyx_v_msg);
  __Pyx_INCREF(__pyx_v_eprmsg);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_eprmsg);
  __Pyx_GIVEREF(__pyx_v_eprmsg);
  __pyx_t_6 = __Pyx_PyString_Format(__pyx_kp_s_s_s, __pyx_t_1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_6);
  __pyx_t_6 = 0;
  __pyx_t_6 = PyDict_New(); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_code); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_code, __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_1, __pyx_t_6); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_Raise(__pyx_t_7, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "epr.pyx":232
 * 
 * 
 * cdef pyepr_null_ptr_error(msg='null pointer'):             # <<<<<<<<<<<<<<
 *     cdef int code
 *     cdef str eprmsg = _to_str(<char*>epr_get_last_err_message(), 'ascii')
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("epr.pyepr_null_ptr_error", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __Pyx_XDECREF(__pyx_v_eprmsg);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":245
 * 
 * 
 * cdef FILE* pyepr_get_file_stream(object ostream) except NULL:             # <<<<<<<<<<<<<<
 *     cdef FILE* fstream = NULL
 *     cdef int fileno
 */

static FILE *__pyx_f_3epr_pyepr_get_file_stream(PyObject *__pyx_v_ostream) {
  FILE *__pyx_v_fstream;
  int __pyx_v_fileno;
  PyObject *__pyx_v_e = NULL;
  FILE *__pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("pyepr_get_file_stream", 0);
  __Pyx_INCREF(__pyx_v_ostream);

  /* "epr.pyx":246
 * 
 * cdef FILE* pyepr_get_file_stream(object ostream) except NULL:
 *     cdef FILE* fstream = NULL             # <<<<<<<<<<<<<<
 *     cdef int fileno
 * 
 */
  __pyx_v_fstream = NULL;

  /* "epr.pyx":249
 *     cdef int fileno
 * 
 *     if ostream is None:             # <<<<<<<<<<<<<<
 *         ostream = sys.stdout
 * 
 */
  __pyx_t_1 = (__pyx_v_ostream == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "epr.pyx":250
 * 
 *     if ostream is None:
 *         ostream = sys.stdout             # <<<<<<<<<<<<<<
 * 
 *     try:
 */
    __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_sys); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 250; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_stdout); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 250; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF_SET(__pyx_v_ostream, __pyx_t_4);
    __pyx_t_4 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "epr.pyx":252
 *         ostream = sys.stdout
 * 
 *     try:             # <<<<<<<<<<<<<<
 *         ostream.flush()
 *     except AttributeError, e:
 */
  {
    __Pyx_ExceptionSave(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7);
    __Pyx_XGOTREF(__pyx_t_5);
    __Pyx_XGOTREF(__pyx_t_6);
    __Pyx_XGOTREF(__pyx_t_7);
    /*try:*/ {

      /* "epr.pyx":253
 * 
 *     try:
 *         ostream.flush()             # <<<<<<<<<<<<<<
 *     except AttributeError, e:
 *         raise TypeError(str(e))
 */
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_ostream, __pyx_n_s_flush); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }
    /*else:*/ {

      /* "epr.pyx":257
 *         raise TypeError(str(e))
 *     else:
 *         fileno = PyObject_AsFileDescriptor(ostream)             # <<<<<<<<<<<<<<
 *         if fileno == -1:
 *             raise TypeError('bad output stream')
 */
      __pyx_t_8 = PyObject_AsFileDescriptor(__pyx_v_ostream); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
      __pyx_v_fileno = __pyx_t_8;

      /* "epr.pyx":258
 *     else:
 *         fileno = PyObject_AsFileDescriptor(ostream)
 *         if fileno == -1:             # <<<<<<<<<<<<<<
 *             raise TypeError('bad output stream')
 *         else:
 */
      __pyx_t_2 = ((__pyx_v_fileno == -1) != 0);
      if (__pyx_t_2) {

        /* "epr.pyx":259
 *         fileno = PyObject_AsFileDescriptor(ostream)
 *         if fileno == -1:
 *             raise TypeError('bad output stream')             # <<<<<<<<<<<<<<
 *         else:
 *             fstream = stdio.fdopen(fileno, 'w')
 */
        __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_Raise(__pyx_t_3, 0, 0, 0);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
      }
      /*else*/ {

        /* "epr.pyx":261
 *             raise TypeError('bad output stream')
 *         else:
 *             fstream = stdio.fdopen(fileno, 'w')             # <<<<<<<<<<<<<<
 *             if fstream is NULL:
 *                 errno.errno = 0
 */
        __pyx_v_fstream = fdopen(__pyx_v_fileno, __pyx_k_w);

        /* "epr.pyx":262
 *         else:
 *             fstream = stdio.fdopen(fileno, 'w')
 *             if fstream is NULL:             # <<<<<<<<<<<<<<
 *                 errno.errno = 0
 *                 raise TypeError('invalid ostream')
 */
        __pyx_t_2 = ((__pyx_v_fstream == NULL) != 0);
        if (__pyx_t_2) {

          /* "epr.pyx":263
 *             fstream = stdio.fdopen(fileno, 'w')
 *             if fstream is NULL:
 *                 errno.errno = 0             # <<<<<<<<<<<<<<
 *                 raise TypeError('invalid ostream')
 * 
 */
          errno = 0;

          /* "epr.pyx":264
 *             if fstream is NULL:
 *                 errno.errno = 0
 *                 raise TypeError('invalid ostream')             # <<<<<<<<<<<<<<
 * 
 *     return fstream
 */
          __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 264; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_Raise(__pyx_t_3, 0, 0, 0);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 264; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
        }
      }
    }
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    goto __pyx_L11_try_end;
    __pyx_L4_error:;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "epr.pyx":254
 *     try:
 *         ostream.flush()
 *     except AttributeError, e:             # <<<<<<<<<<<<<<
 *         raise TypeError(str(e))
 *     else:
 */
    __pyx_t_8 = PyErr_ExceptionMatches(__pyx_builtin_AttributeError);
    if (__pyx_t_8) {
      __Pyx_AddTraceback("epr.pyepr_get_file_stream", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_4, &__pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 254; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_INCREF(__pyx_t_4);
      __pyx_v_e = __pyx_t_4;

      /* "epr.pyx":255
 *         ostream.flush()
 *     except AttributeError, e:
 *         raise TypeError(str(e))             # <<<<<<<<<<<<<<
 *     else:
 *         fileno = PyObject_AsFileDescriptor(ostream)
 */
      __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_INCREF(__pyx_v_e);
      PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_v_e);
      __Pyx_GIVEREF(__pyx_v_e);
      __pyx_t_11 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), __pyx_t_10, NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
      __Pyx_GOTREF(__pyx_t_10);
      PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_11);
      __Pyx_GIVEREF(__pyx_t_11);
      __pyx_t_11 = 0;
      __pyx_t_11 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_t_10, NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_Raise(__pyx_t_11, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      goto __pyx_L5_exception_handled;
    }
    goto __pyx_L6_except_error;
    __pyx_L6_except_error:;
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_XGIVEREF(__pyx_t_6);
    __Pyx_XGIVEREF(__pyx_t_7);
    __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7);
    goto __pyx_L1_error;
    __pyx_L5_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_XGIVEREF(__pyx_t_6);
    __Pyx_XGIVEREF(__pyx_t_7);
    __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7);
    __pyx_L11_try_end:;
  }

  /* "epr.pyx":266
 *                 raise TypeError('invalid ostream')
 * 
 *     return fstream             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = __pyx_v_fstream;
  goto __pyx_L0;

  /* "epr.pyx":245
 * 
 * 
 * cdef FILE* pyepr_get_file_stream(object ostream) except NULL:             # <<<<<<<<<<<<<<
 *     cdef FILE* fstream = NULL
 *     cdef int fileno
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_AddTraceback("epr.pyepr_get_file_stream", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_e);
  __Pyx_XDECREF(__pyx_v_ostream);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":276
 *     '''
 * 
 *     def __cinit__(self, *args, **kwargs):             # <<<<<<<<<<<<<<
 *         cdef bytes msg
 * 
 */

/* Python wrapper */
static int __pyx_pw_3epr_5_CLib_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_3epr_5_CLib_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED PyObject *__pyx_v_args = 0;
  CYTHON_UNUSED PyObject *__pyx_v_kwargs = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  if (unlikely(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 1))) return -1;
  __pyx_v_kwargs = (__pyx_kwds) ? PyDict_Copy(__pyx_kwds) : PyDict_New();
  if (unlikely(!__pyx_v_kwargs)) return -1;
  __Pyx_GOTREF(__pyx_v_kwargs);
  __Pyx_INCREF(__pyx_args);
  __pyx_v_args = __pyx_args;
  __pyx_r = __pyx_pf_3epr_5_CLib___cinit__(((struct __pyx_obj_3epr__CLib *)__pyx_v_self), __pyx_v_args, __pyx_v_kwargs);

  /* function exit code */
  __Pyx_XDECREF(__pyx_v_args);
  __Pyx_XDECREF(__pyx_v_kwargs);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_3epr_5_CLib___cinit__(CYTHON_UNUSED struct __pyx_obj_3epr__CLib *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_args, CYTHON_UNUSED PyObject *__pyx_v_kwargs) {
  PyObject *__pyx_v_msg = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  struct __pyx_opt_args_3epr__to_str __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "epr.pyx":285
 * 
 *         #if epr_init_api(e_log_warning, epr_log_message, NULL):
 *         if epr_init_api(e_log_warning, NULL, NULL):             # <<<<<<<<<<<<<<
 *             msg = <char*>epr_get_last_err_message()
 *             epr_clear_err()
 */
  __pyx_t_1 = (epr_init_api(e_log_warning, NULL, NULL) != 0);
  if (__pyx_t_1) {

    /* "epr.pyx":286
 *         #if epr_init_api(e_log_warning, epr_log_message, NULL):
 *         if epr_init_api(e_log_warning, NULL, NULL):
 *             msg = <char*>epr_get_last_err_message()             # <<<<<<<<<<<<<<
 *             epr_clear_err()
 *             raise ImportError('unable to inizialize EPR API library: '
 */
    __pyx_t_2 = __Pyx_PyBytes_FromString(((char *)epr_get_last_err_message())); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_v_msg = ((PyObject*)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "epr.pyx":287
 *         if epr_init_api(e_log_warning, NULL, NULL):
 *             msg = <char*>epr_get_last_err_message()
 *             epr_clear_err()             # <<<<<<<<<<<<<<
 *             raise ImportError('unable to inizialize EPR API library: '
 *                               '%s' % _to_str(msg, 'ascii'))
 */
    epr_clear_err();

    /* "epr.pyx":289
 *             epr_clear_err()
 *             raise ImportError('unable to inizialize EPR API library: '
 *                               '%s' % _to_str(msg, 'ascii'))             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(self):
 */
    __pyx_t_3.__pyx_n = 1;
    __pyx_t_3.encoding = __pyx_n_s_ascii;
    __pyx_t_2 = __pyx_f_3epr__to_str(__pyx_v_msg, &__pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_unable_to_inizialize_EPR_API_lib, __pyx_t_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "epr.pyx":288
 *             msg = <char*>epr_get_last_err_message()
 *             epr_clear_err()
 *             raise ImportError('unable to inizialize EPR API library: '             # <<<<<<<<<<<<<<
 *                               '%s' % _to_str(msg, 'ascii'))
 * 
 */
    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_Raise(__pyx_t_4, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "epr.pyx":276
 *     '''
 * 
 *     def __cinit__(self, *args, **kwargs):             # <<<<<<<<<<<<<<
 *         cdef bytes msg
 * 
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("epr._CLib.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_msg);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":291
 *                               '%s' % _to_str(msg, 'ascii'))
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         epr_close_api()
 * 
 */

/* Python wrapper */
static void __pyx_pw_3epr_5_CLib_3__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_3epr_5_CLib_3__dealloc__(PyObject *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_pf_3epr_5_CLib_2__dealloc__(((struct __pyx_obj_3epr__CLib *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

static void __pyx_pf_3epr_5_CLib_2__dealloc__(CYTHON_UNUSED struct __pyx_obj_3epr__CLib *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__", 0);

  /* "epr.pyx":292
 * 
 *     def __dealloc__(self):
 *         epr_close_api()             # <<<<<<<<<<<<<<
 * 
 *     def __init__(self):
 */
  epr_close_api();

  /* "epr.pyx":291
 *                               '%s' % _to_str(msg, 'ascii'))
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         epr_close_api()
 * 
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

/* "epr.pyx":294
 *         epr_close_api()
 * 
 *     def __init__(self):             # <<<<<<<<<<<<<<
 *         raise TypeError('"%s" class cannot be instantiated from Python' %
 *                                                     self.__class__.__name__)
 */

/* Python wrapper */
static int __pyx_pw_3epr_5_CLib_5__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_3epr_5_CLib_5__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("__init__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 0))) return -1;
  __pyx_r = __pyx_pf_3epr_5_CLib_4__init__(((struct __pyx_obj_3epr__CLib *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_3epr_5_CLib_4__init__(struct __pyx_obj_3epr__CLib *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "epr.pyx":296
 *     def __init__(self):
 *         raise TypeError('"%s" class cannot be instantiated from Python' %
 *                                                     self.__class__.__name__)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_class); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 296; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_name); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 296; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "epr.pyx":295
 * 
 *     def __init__(self):
 *         raise TypeError('"%s" class cannot be instantiated from Python' %             # <<<<<<<<<<<<<<
 *                                                     self.__class__.__name__)
 * 
 */
  __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_s_class_cannot_be_instantiated, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 295; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 295; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 295; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 295; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "epr.pyx":294
 *         epr_close_api()
 * 
 *     def __init__(self):             # <<<<<<<<<<<<<<
 *         raise TypeError('"%s" class cannot be instantiated from Python' %
 *                                                     self.__class__.__name__)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("epr._CLib.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":306
 *     cdef object epr_c_lib
 * 
 *     def __cinit__(self, *ars, **kargs):             # <<<<<<<<<<<<<<
 *         self.epr_c_lib = _EPR_C_LIB
 * 
 */

/* Python wrapper */
static int __pyx_pw_3epr_9EprObject_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_3epr_9EprObject_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED PyObject *__pyx_v_ars = 0;
  CYTHON_UNUSED PyObject *__pyx_v_kargs = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  if (unlikely(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 1))) return -1;
  __pyx_v_kargs = (__pyx_kwds) ? PyDict_Copy(__pyx_kwds) : PyDict_New();
  if (unlikely(!__pyx_v_kargs)) return -1;
  __Pyx_GOTREF(__pyx_v_kargs);
  __Pyx_INCREF(__pyx_args);
  __pyx_v_ars = __pyx_args;
  __pyx_r = __pyx_pf_3epr_9EprObject___cinit__(((struct __pyx_obj_3epr_EprObject *)__pyx_v_self), __pyx_v_ars, __pyx_v_kargs);

  /* function exit code */
  __Pyx_XDECREF(__pyx_v_ars);
  __Pyx_XDECREF(__pyx_v_kargs);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_3epr_9EprObject___cinit__(struct __pyx_obj_3epr_EprObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_ars, CYTHON_UNUSED PyObject *__pyx_v_kargs) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "epr.pyx":307
 * 
 *     def __cinit__(self, *ars, **kargs):
 *         self.epr_c_lib = _EPR_C_LIB             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(self):
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_3epr__EPR_C_LIB));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_3epr__EPR_C_LIB));
  __Pyx_GOTREF(__pyx_v_self->epr_c_lib);
  __Pyx_DECREF(__pyx_v_self->epr_c_lib);
  __pyx_v_self->epr_c_lib = ((PyObject *)__pyx_v_3epr__EPR_C_LIB);

  /* "epr.pyx":306
 *     cdef object epr_c_lib
 * 
 *     def __cinit__(self, *ars, **kargs):             # <<<<<<<<<<<<<<
 *         self.epr_c_lib = _EPR_C_LIB
 * 
 */

  /* function exit code */
  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":309
 *         self.epr_c_lib = _EPR_C_LIB
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         self.epr_c_lib = None
 * 
 */

/* Python wrapper */
static void __pyx_pw_3epr_9EprObject_3__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_3epr_9EprObject_3__dealloc__(PyObject *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_pf_3epr_9EprObject_2__dealloc__(((struct __pyx_obj_3epr_EprObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

static void __pyx_pf_3epr_9EprObject_2__dealloc__(struct __pyx_obj_3epr_EprObject *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__", 0);

  /* "epr.pyx":310
 * 
 *     def __dealloc__(self):
 *         self.epr_c_lib = None             # <<<<<<<<<<<<<<
 * 
 *     def __init__(self):
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->epr_c_lib);
  __Pyx_DECREF(__pyx_v_self->epr_c_lib);
  __pyx_v_self->epr_c_lib = Py_None;

  /* "epr.pyx":309
 *         self.epr_c_lib = _EPR_C_LIB
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         self.epr_c_lib = None
 * 
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

/* "epr.pyx":312
 *         self.epr_c_lib = None
 * 
 *     def __init__(self):             # <<<<<<<<<<<<<<
 *         raise TypeError('"%s" class cannot be instantiated from Python' %
 *                                                     self.__class__.__name__)
 */

/* Python wrapper */
static int __pyx_pw_3epr_9EprObject_5__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_3epr_9EprObject_5__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("__init__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 0))) return -1;
  __pyx_r = __pyx_pf_3epr_9EprObject_4__init__(((struct __pyx_obj_3epr_EprObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_3epr_9EprObject_4__init__(struct __pyx_obj_3epr_EprObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "epr.pyx":314
 *     def __init__(self):
 *         raise TypeError('"%s" class cannot be instantiated from Python' %
 *                                                     self.__class__.__name__)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_class); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_name); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "epr.pyx":313
 * 
 *     def __init__(self):
 *         raise TypeError('"%s" class cannot be instantiated from Python' %             # <<<<<<<<<<<<<<
 *                                                     self.__class__.__name__)
 * 
 */
  __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_s_class_cannot_be_instantiated, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "epr.pyx":312
 *         self.epr_c_lib = None
 * 
 *     def __init__(self):             # <<<<<<<<<<<<<<
 *         raise TypeError('"%s" class cannot be instantiated from Python' %
 *                                                     self.__class__.__name__)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("epr.EprObject.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":317
 * 
 * 
 * cpdef get_numpy_dtype(EPR_EDataTypeId type_id):             # <<<<<<<<<<<<<<
 *     '''get_numpy_dtype(epr_type)
 * 
 */

static PyObject *__pyx_pw_3epr_1get_numpy_dtype(PyObject *__pyx_self, PyObject *__pyx_arg_type_id); /*proto*/
static PyObject *__pyx_f_3epr_get_numpy_dtype(EPR_EDataTypeId __pyx_v_type_id, CYTHON_UNUSED int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_numpy_dtype", 0);

  /* "epr.pyx":324
 *     '''
 * 
 *     try:             # <<<<<<<<<<<<<<
 *         return _DTYPE_MAP[type_id]
 *     except KeyError:
 */
  {
    __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_1);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_3);
    /*try:*/ {

      /* "epr.pyx":325
 * 
 *     try:
 *         return _DTYPE_MAP[type_id]             # <<<<<<<<<<<<<<
 *     except KeyError:
 *         raise ValueError('invalid EPR type ID: %d' % type_id)
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_DTYPE_MAP); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 325; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = PyInt_FromLong(__pyx_v_type_id); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 325; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = PyObject_GetItem(__pyx_t_4, __pyx_t_5); if (unlikely(__pyx_t_6 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 325; __pyx_clineno = __LINE__; goto __pyx_L3_error;};
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_r = __pyx_t_6;
      __pyx_t_6 = 0;
      goto __pyx_L7_try_return;
    }
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L10_try_end;
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "epr.pyx":326
 *     try:
 *         return _DTYPE_MAP[type_id]
 *     except KeyError:             # <<<<<<<<<<<<<<
 *         raise ValueError('invalid EPR type ID: %d' % type_id)
 * 
 */
    __pyx_t_7 = PyErr_ExceptionMatches(__pyx_builtin_KeyError);
    if (__pyx_t_7) {
      __Pyx_AddTraceback("epr.get_numpy_dtype", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_5, &__pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GOTREF(__pyx_t_4);

      /* "epr.pyx":327
 *         return _DTYPE_MAP[type_id]
 *     except KeyError:
 *         raise ValueError('invalid EPR type ID: %d' % type_id)             # <<<<<<<<<<<<<<
 * 
 * 
 */
      __pyx_t_8 = PyInt_FromLong(__pyx_v_type_id); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_9 = __Pyx_PyString_Format(__pyx_kp_s_invalid_EPR_type_ID_d, __pyx_t_8); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_8);
      PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_9);
      __Pyx_GIVEREF(__pyx_t_9);
      __pyx_t_9 = 0;
      __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_t_8, NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_Raise(__pyx_t_9, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      goto __pyx_L4_exception_handled;
    }
    goto __pyx_L5_except_error;
    __pyx_L5_except_error:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L1_error;
    __pyx_L7_try_return:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L0;
    __pyx_L4_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    __pyx_L10_try_end:;
  }

  /* "epr.pyx":317
 * 
 * 
 * cpdef get_numpy_dtype(EPR_EDataTypeId type_id):             # <<<<<<<<<<<<<<
 *     '''get_numpy_dtype(epr_type)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("epr.get_numpy_dtype", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_3epr_1get_numpy_dtype(PyObject *__pyx_self, PyObject *__pyx_arg_type_id); /*proto*/
static char __pyx_doc_3epr_get_numpy_dtype[] = "get_numpy_dtype(epr_type)\n\n    Return the numpy datatype specified EPR type ID\n\n    ";
static PyObject *__pyx_pw_3epr_1get_numpy_dtype(PyObject *__pyx_self, PyObject *__pyx_arg_type_id) {
  EPR_EDataTypeId __pyx_v_type_id;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_numpy_dtype (wrapper)", 0);
  assert(__pyx_arg_type_id); {
    __pyx_v_type_id = ((EPR_EDataTypeId)PyInt_AsLong(__pyx_arg_type_id)); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("epr.get_numpy_dtype", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_3epr_get_numpy_dtype(__pyx_self, ((EPR_EDataTypeId)__pyx_v_type_id));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_3epr_get_numpy_dtype(CYTHON_UNUSED PyObject *__pyx_self, EPR_EDataTypeId __pyx_v_type_id) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_numpy_dtype", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_3epr_get_numpy_dtype(__pyx_v_type_id, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("epr.get_numpy_dtype", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":330
 * 
 * 
 * cpdef uint get_data_type_size(EPR_EDataTypeId type_id):             # <<<<<<<<<<<<<<
 *     '''get_data_type_size(type_id)
 * 
 */

static PyObject *__pyx_pw_3epr_3get_data_type_size(PyObject *__pyx_self, PyObject *__pyx_arg_type_id); /*proto*/
static uint __pyx_f_3epr_get_data_type_size(EPR_EDataTypeId __pyx_v_type_id, CYTHON_UNUSED int __pyx_skip_dispatch) {
  uint __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_data_type_size", 0);

  /* "epr.pyx":337
 *     '''
 * 
 *     return epr_get_data_type_size(type_id)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = epr_get_data_type_size(__pyx_v_type_id);
  goto __pyx_L0;

  /* "epr.pyx":330
 * 
 * 
 * cpdef uint get_data_type_size(EPR_EDataTypeId type_id):             # <<<<<<<<<<<<<<
 *     '''get_data_type_size(type_id)
 * 
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_3epr_3get_data_type_size(PyObject *__pyx_self, PyObject *__pyx_arg_type_id); /*proto*/
static char __pyx_doc_3epr_2get_data_type_size[] = "get_data_type_size(type_id)\n\n    Gets the size in bytes for an element of the given data type\n\n    ";
static PyObject *__pyx_pw_3epr_3get_data_type_size(PyObject *__pyx_self, PyObject *__pyx_arg_type_id) {
  EPR_EDataTypeId __pyx_v_type_id;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_data_type_size (wrapper)", 0);
  assert(__pyx_arg_type_id); {
    __pyx_v_type_id = ((EPR_EDataTypeId)PyInt_AsLong(__pyx_arg_type_id)); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 330; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("epr.get_data_type_size", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_3epr_2get_data_type_size(__pyx_self, ((EPR_EDataTypeId)__pyx_v_type_id));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_3epr_2get_data_type_size(CYTHON_UNUSED PyObject *__pyx_self, EPR_EDataTypeId __pyx_v_type_id) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_data_type_size", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_uint(__pyx_f_3epr_get_data_type_size(__pyx_v_type_id, 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 330; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("epr.get_data_type_size", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":340
 * 
 * 
 * cpdef str data_type_id_to_str(EPR_EDataTypeId type_id):             # <<<<<<<<<<<<<<
 *     '''data_type_id_to_str(type_id)
 * 
 */

static PyObject *__pyx_pw_3epr_5data_type_id_to_str(PyObject *__pyx_self, PyObject *__pyx_arg_type_id); /*proto*/
static PyObject *__pyx_f_3epr_data_type_id_to_str(EPR_EDataTypeId __pyx_v_type_id, CYTHON_UNUSED int __pyx_skip_dispatch) {
  char *__pyx_v_type_id_str;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  struct __pyx_opt_args_3epr__to_str __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("data_type_id_to_str", 0);

  /* "epr.pyx":347
 *     '''
 * 
 *     cdef char* type_id_str = <char*>epr_data_type_id_to_str(type_id)             # <<<<<<<<<<<<<<
 * 
 *     return _to_str(type_id_str, 'ascii')
 */
  __pyx_v_type_id_str = ((char *)epr_data_type_id_to_str(__pyx_v_type_id));

  /* "epr.pyx":349
 *     cdef char* type_id_str = <char*>epr_data_type_id_to_str(type_id)
 * 
 *     return _to_str(type_id_str, 'ascii')             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_type_id_str); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3.__pyx_n = 1;
  __pyx_t_3.encoding = __pyx_n_s_ascii;
  __pyx_t_2 = __pyx_f_3epr__to_str(__pyx_t_1, &__pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "epr.pyx":340
 * 
 * 
 * cpdef str data_type_id_to_str(EPR_EDataTypeId type_id):             # <<<<<<<<<<<<<<
 *     '''data_type_id_to_str(type_id)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("epr.data_type_id_to_str", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_3epr_5data_type_id_to_str(PyObject *__pyx_self, PyObject *__pyx_arg_type_id); /*proto*/
static char __pyx_doc_3epr_4data_type_id_to_str[] = "data_type_id_to_str(type_id)\n\n    Gets the 'C' data type string for the given data type\n\n    ";
static PyObject *__pyx_pw_3epr_5data_type_id_to_str(PyObject *__pyx_self, PyObject *__pyx_arg_type_id) {
  EPR_EDataTypeId __pyx_v_type_id;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("data_type_id_to_str (wrapper)", 0);
  assert(__pyx_arg_type_id); {
    __pyx_v_type_id = ((EPR_EDataTypeId)PyInt_AsLong(__pyx_arg_type_id)); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 340; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("epr.data_type_id_to_str", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_3epr_4data_type_id_to_str(__pyx_self, ((EPR_EDataTypeId)__pyx_v_type_id));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_3epr_4data_type_id_to_str(CYTHON_UNUSED PyObject *__pyx_self, EPR_EDataTypeId __pyx_v_type_id) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("data_type_id_to_str", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_3epr_data_type_id_to_str(__pyx_v_type_id, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 340; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("epr.data_type_id_to_str", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":352
 * 
 * 
 * cpdef str get_scaling_method_name(EPR_ScalingMethod method):             # <<<<<<<<<<<<<<
 *     '''get_scaling_method_name(method)
 * 
 */

static PyObject *__pyx_pw_3epr_7get_scaling_method_name(PyObject *__pyx_self, PyObject *__pyx_arg_method); /*proto*/
static PyObject *__pyx_f_3epr_get_scaling_method_name(enum EPR_ScalingMethod __pyx_v_method, CYTHON_UNUSED int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_scaling_method_name", 0);

  /* "epr.pyx":359
 *     '''
 * 
 *     try:             # <<<<<<<<<<<<<<
 *         return _METHOD_MAP[method]
 *     except KeyError:
 */
  {
    __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_1);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_3);
    /*try:*/ {

      /* "epr.pyx":360
 * 
 *     try:
 *         return _METHOD_MAP[method]             # <<<<<<<<<<<<<<
 *     except KeyError:
 *         raise ValueError('invalid scaling method: "%s"' % method)
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_METHOD_MAP); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = PyInt_FromLong(__pyx_v_method); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = PyObject_GetItem(__pyx_t_4, __pyx_t_5); if (unlikely(__pyx_t_6 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L3_error;};
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (!(likely(PyString_CheckExact(__pyx_t_6))||((__pyx_t_6) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "str", Py_TYPE(__pyx_t_6)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __pyx_r = ((PyObject*)__pyx_t_6);
      __pyx_t_6 = 0;
      goto __pyx_L7_try_return;
    }
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L10_try_end;
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "epr.pyx":361
 *     try:
 *         return _METHOD_MAP[method]
 *     except KeyError:             # <<<<<<<<<<<<<<
 *         raise ValueError('invalid scaling method: "%s"' % method)
 * 
 */
    __pyx_t_7 = PyErr_ExceptionMatches(__pyx_builtin_KeyError);
    if (__pyx_t_7) {
      __Pyx_AddTraceback("epr.get_scaling_method_name", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_5, &__pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 361; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GOTREF(__pyx_t_4);

      /* "epr.pyx":362
 *         return _METHOD_MAP[method]
 *     except KeyError:
 *         raise ValueError('invalid scaling method: "%s"' % method)             # <<<<<<<<<<<<<<
 * 
 * 
 */
      __pyx_t_8 = PyInt_FromLong(__pyx_v_method); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 362; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_9 = __Pyx_PyString_Format(__pyx_kp_s_invalid_scaling_method_s, __pyx_t_8); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 362; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 362; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_8);
      PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_9);
      __Pyx_GIVEREF(__pyx_t_9);
      __pyx_t_9 = 0;
      __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_t_8, NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 362; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_Raise(__pyx_t_9, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 362; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      goto __pyx_L4_exception_handled;
    }
    goto __pyx_L5_except_error;
    __pyx_L5_except_error:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L1_error;
    __pyx_L7_try_return:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L0;
    __pyx_L4_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    __pyx_L10_try_end:;
  }

  /* "epr.pyx":352
 * 
 * 
 * cpdef str get_scaling_method_name(EPR_ScalingMethod method):             # <<<<<<<<<<<<<<
 *     '''get_scaling_method_name(method)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("epr.get_scaling_method_name", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_3epr_7get_scaling_method_name(PyObject *__pyx_self, PyObject *__pyx_arg_method); /*proto*/
static char __pyx_doc_3epr_6get_scaling_method_name[] = "get_scaling_method_name(method)\n\n    Return the name of the specified scaling method\n\n    ";
static PyObject *__pyx_pw_3epr_7get_scaling_method_name(PyObject *__pyx_self, PyObject *__pyx_arg_method) {
  enum EPR_ScalingMethod __pyx_v_method;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_scaling_method_name (wrapper)", 0);
  assert(__pyx_arg_method); {
    __pyx_v_method = ((enum EPR_ScalingMethod)PyInt_AsLong(__pyx_arg_method)); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 352; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("epr.get_scaling_method_name", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_3epr_6get_scaling_method_name(__pyx_self, ((enum EPR_ScalingMethod)__pyx_v_method));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_3epr_6get_scaling_method_name(CYTHON_UNUSED PyObject *__pyx_self, enum EPR_ScalingMethod __pyx_v_method) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_scaling_method_name", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_3epr_get_scaling_method_name(__pyx_v_method, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 352; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("epr.get_scaling_method_name", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":365
 * 
 * 
 * cpdef str get_sample_model_name(EPR_SampleModel model):             # <<<<<<<<<<<<<<
 *     '''get_sample_model_name(model)
 * 
 */

static PyObject *__pyx_pw_3epr_9get_sample_model_name(PyObject *__pyx_self, PyObject *__pyx_arg_model); /*proto*/
static PyObject *__pyx_f_3epr_get_sample_model_name(enum EPR_SampleModel __pyx_v_model, CYTHON_UNUSED int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_sample_model_name", 0);

  /* "epr.pyx":372
 *     '''
 * 
 *     try:             # <<<<<<<<<<<<<<
 *         return _MODEL_MAP[model]
 *     except KeyError:
 */
  {
    __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_1);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_3);
    /*try:*/ {

      /* "epr.pyx":373
 * 
 *     try:
 *         return _MODEL_MAP[model]             # <<<<<<<<<<<<<<
 *     except KeyError:
 *         raise ValueError('invalid sample model: "%s"' % model)
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_MODEL_MAP); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 373; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = PyInt_FromLong(__pyx_v_model); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 373; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = PyObject_GetItem(__pyx_t_4, __pyx_t_5); if (unlikely(__pyx_t_6 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 373; __pyx_clineno = __LINE__; goto __pyx_L3_error;};
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (!(likely(PyString_CheckExact(__pyx_t_6))||((__pyx_t_6) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "str", Py_TYPE(__pyx_t_6)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 373; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __pyx_r = ((PyObject*)__pyx_t_6);
      __pyx_t_6 = 0;
      goto __pyx_L7_try_return;
    }
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L10_try_end;
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "epr.pyx":374
 *     try:
 *         return _MODEL_MAP[model]
 *     except KeyError:             # <<<<<<<<<<<<<<
 *         raise ValueError('invalid sample model: "%s"' % model)
 * 
 */
    __pyx_t_7 = PyErr_ExceptionMatches(__pyx_builtin_KeyError);
    if (__pyx_t_7) {
      __Pyx_AddTraceback("epr.get_sample_model_name", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_5, &__pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GOTREF(__pyx_t_4);

      /* "epr.pyx":375
 *         return _MODEL_MAP[model]
 *     except KeyError:
 *         raise ValueError('invalid sample model: "%s"' % model)             # <<<<<<<<<<<<<<
 * 
 * 
 */
      __pyx_t_8 = PyInt_FromLong(__pyx_v_model); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 375; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_9 = __Pyx_PyString_Format(__pyx_kp_s_invalid_sample_model_s, __pyx_t_8); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 375; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 375; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_8);
      PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_9);
      __Pyx_GIVEREF(__pyx_t_9);
      __pyx_t_9 = 0;
      __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_t_8, NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 375; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_Raise(__pyx_t_9, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 375; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      goto __pyx_L4_exception_handled;
    }
    goto __pyx_L5_except_error;
    __pyx_L5_except_error:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L1_error;
    __pyx_L7_try_return:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L0;
    __pyx_L4_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    __pyx_L10_try_end:;
  }

  /* "epr.pyx":365
 * 
 * 
 * cpdef str get_sample_model_name(EPR_SampleModel model):             # <<<<<<<<<<<<<<
 *     '''get_sample_model_name(model)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("epr.get_sample_model_name", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_3epr_9get_sample_model_name(PyObject *__pyx_self, PyObject *__pyx_arg_model); /*proto*/
static char __pyx_doc_3epr_8get_sample_model_name[] = "get_sample_model_name(model)\n\n    Return the name of the specified sample model\n\n    ";
static PyObject *__pyx_pw_3epr_9get_sample_model_name(PyObject *__pyx_self, PyObject *__pyx_arg_model) {
  enum EPR_SampleModel __pyx_v_model;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_sample_model_name (wrapper)", 0);
  assert(__pyx_arg_model); {
    __pyx_v_model = ((enum EPR_SampleModel)PyInt_AsLong(__pyx_arg_model)); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 365; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("epr.get_sample_model_name", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_3epr_8get_sample_model_name(__pyx_self, ((enum EPR_SampleModel)__pyx_v_model));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_3epr_8get_sample_model_name(CYTHON_UNUSED PyObject *__pyx_self, enum EPR_SampleModel __pyx_v_model) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_sample_model_name", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_3epr_get_sample_model_name(__pyx_v_model, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 365; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("epr.get_sample_model_name", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":389
 *     cdef object _parent     # Dataset or Product
 * 
 *     cdef inline check_closed_product(self):             # <<<<<<<<<<<<<<
 *         if isinstance(self, Dataset):
 *             (<Dataset>self._parent).check_closed_product()
 */

static CYTHON_INLINE PyObject *__pyx_f_3epr_3DSD_check_closed_product(struct __pyx_obj_3epr_DSD *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("check_closed_product", 0);

  /* "epr.pyx":390
 * 
 *     cdef inline check_closed_product(self):
 *         if isinstance(self, Dataset):             # <<<<<<<<<<<<<<
 *             (<Dataset>self._parent).check_closed_product()
 *         else:
 */
  __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_self), ((PyObject*)__pyx_ptype_3epr_Dataset)); 
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "epr.pyx":391
 *     cdef inline check_closed_product(self):
 *         if isinstance(self, Dataset):
 *             (<Dataset>self._parent).check_closed_product()             # <<<<<<<<<<<<<<
 *         else:
 *             #elif isinstance(self, Product):
 */
    __pyx_t_3 = __pyx_f_3epr_7Dataset_check_closed_product(((struct __pyx_obj_3epr_Dataset *)__pyx_v_self->_parent)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 391; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "epr.pyx":394
 *         else:
 *             #elif isinstance(self, Product):
 *             (<Product>self._parent).check_closed_product()             # <<<<<<<<<<<<<<
 * 
 *     property index:
 */
    __pyx_t_3 = __pyx_f_3epr_7Product_check_closed_product(((struct __pyx_obj_3epr_Product *)__pyx_v_self->_parent)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 394; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __pyx_L3:;

  /* "epr.pyx":389
 *     cdef object _parent     # Dataset or Product
 * 
 *     cdef inline check_closed_product(self):             # <<<<<<<<<<<<<<
 *         if isinstance(self, Dataset):
 *             (<Dataset>self._parent).check_closed_product()
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("epr.DSD.check_closed_product", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":399
 *         '''The index of this DSD (zero-based)'''
 * 
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             self.check_closed_product()
 *             return self._ptr.index
 */

/* Python wrapper */
static PyObject *__pyx_pw_3epr_3DSD_5index_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_3epr_3DSD_5index_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_3epr_3DSD_5index___get__(((struct __pyx_obj_3epr_DSD *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_3epr_3DSD_5index___get__(struct __pyx_obj_3epr_DSD *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "epr.pyx":400
 * 
 *         def __get__(self):
 *             self.check_closed_product()             # <<<<<<<<<<<<<<
 *             return self._ptr.index
 * 
 */
  __pyx_t_1 = __pyx_f_3epr_3DSD_check_closed_product(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 400; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "epr.pyx":401
 *         def __get__(self):
 *             self.check_closed_product()
 *             return self._ptr.index             # <<<<<<<<<<<<<<
 * 
 *     property ds_name:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->_ptr->index); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "epr.pyx":399
 *         '''The index of this DSD (zero-based)'''
 * 
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             self.check_closed_product()
 *             return self._ptr.index
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("epr.DSD.index.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":406
 *         '''The dataset name'''
 * 
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             self.check_closed_product()
 *             return _to_str(self._ptr.ds_name, 'ascii')
 */

/* Python wrapper */
static PyObject *__pyx_pw_3epr_3DSD_7ds_name_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_3epr_3DSD_7ds_name_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_3epr_3DSD_7ds_name___get__(((struct __pyx_obj_3epr_DSD *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_3epr_3DSD_7ds_name___get__(struct __pyx_obj_3epr_DSD *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  struct __pyx_opt_args_3epr__to_str __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "epr.pyx":407
 * 
 *         def __get__(self):
 *             self.check_closed_product()             # <<<<<<<<<<<<<<
 *             return _to_str(self._ptr.ds_name, 'ascii')
 * 
 */
  __pyx_t_1 = __pyx_f_3epr_3DSD_check_closed_product(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 407; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "epr.pyx":408
 *         def __get__(self):
 *             self.check_closed_product()
 *             return _to_str(self._ptr.ds_name, 'ascii')             # <<<<<<<<<<<<<<
 * 
 *     property ds_type:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_self->_ptr->ds_name); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 408; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3.__pyx_n = 1;
  __pyx_t_3.encoding = __pyx_n_s_ascii;
  __pyx_t_2 = __pyx_f_3epr__to_str(__pyx_t_1, &__pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 408; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "epr.pyx":406
 *         '''The dataset name'''
 * 
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             self.check_closed_product()
 *             return _to_str(self._ptr.ds_name, 'ascii')
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("epr.DSD.ds_name.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":413
 *         '''The dataset type descriptor'''
 * 
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             self.check_closed_product()
 *             return _to_str(self._ptr.ds_type, 'ascii')
 */

/* Python wrapper */
static PyObject *__pyx_pw_3epr_3DSD_7ds_type_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_3epr_3DSD_7ds_type_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_3epr_3DSD_7ds_type___get__(((struct __pyx_obj_3epr_DSD *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_3epr_3DSD_7ds_type___get__(struct __pyx_obj_3epr_DSD *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  struct __pyx_opt_args_3epr__to_str __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "epr.pyx":414
 * 
 *         def __get__(self):
 *             self.check_closed_product()             # <<<<<<<<<<<<<<
 *             return _to_str(self._ptr.ds_type, 'ascii')
 * 
 */
  __pyx_t_1 = __pyx_f_3epr_3DSD_check_closed_product(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 414; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "epr.pyx":415
 *         def __get__(self):
 *             self.check_closed_product()
 *             return _to_str(self._ptr.ds_type, 'ascii')             # <<<<<<<<<<<<<<
 * 
 *     property filename:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_self->_ptr->ds_type); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3.__pyx_n = 1;
  __pyx_t_3.encoding = __pyx_n_s_ascii;
  __pyx_t_2 = __pyx_f_3epr__to_str(__pyx_t_1, &__pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "epr.pyx":413
 *         '''The dataset type descriptor'''
 * 
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             self.check_closed_product()
 *             return _to_str(self._ptr.ds_type, 'ascii')
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("epr.DSD.ds_type.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":420
 *         '''The filename in the DDDB with the description of this dataset'''
 * 
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             self.check_closed_product()
 *             return _to_str(self._ptr.filename, 'ascii')
 */

/* Python wrapper */
static PyObject *__pyx_pw_3epr_3DSD_8filename_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_3epr_3DSD_8filename_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_3epr_3DSD_8filename___get__(((struct __pyx_obj_3epr_DSD *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_3epr_3DSD_8filename___get__(struct __pyx_obj_3epr_DSD *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  struct __pyx_opt_args_3epr__to_str __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "epr.pyx":421
 * 
 *         def __get__(self):
 *             self.check_closed_product()             # <<<<<<<<<<<<<<
 *             return _to_str(self._ptr.filename, 'ascii')
 * 
 */
  __pyx_t_1 = __pyx_f_3epr_3DSD_check_closed_product(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 421; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "epr.pyx":422
 *         def __get__(self):
 *             self.check_closed_product()
 *             return _to_str(self._ptr.filename, 'ascii')             # <<<<<<<<<<<<<<
 * 
 *     property ds_offset:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_self->_ptr->filename); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 422; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3.__pyx_n = 1;
  __pyx_t_3.encoding = __pyx_n_s_ascii;
  __pyx_t_2 = __pyx_f_3epr__to_str(__pyx_t_1, &__pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 422; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "epr.pyx":420
 *         '''The filename in the DDDB with the description of this dataset'''
 * 
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             self.check_closed_product()
 *             return _to_str(self._ptr.filename, 'ascii')
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("epr.DSD.filename.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":427
 *         '''The offset of dataset-information the product file'''
 * 
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             self.check_closed_product()
 *             return self._ptr.ds_offset
 */

/* Python wrapper */
static PyObject *__pyx_pw_3epr_3DSD_9ds_offset_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_3epr_3DSD_9ds_offset_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_3epr_3DSD_9ds_offset___get__(((struct __pyx_obj_3epr_DSD *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_3epr_3DSD_9ds_offset___get__(struct __pyx_obj_3epr_DSD *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "epr.pyx":428
 * 
 *         def __get__(self):
 *             self.check_closed_product()             # <<<<<<<<<<<<<<
 *             return self._ptr.ds_offset
 * 
 */
  __pyx_t_1 = __pyx_f_3epr_3DSD_check_closed_product(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 428; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "epr.pyx":429
 *         def __get__(self):
 *             self.check_closed_product()
 *             return self._ptr.ds_offset             # <<<<<<<<<<<<<<
 * 
 *     property ds_size:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_uint(__pyx_v_self->_ptr->ds_offset); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 429; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "epr.pyx":427
 *         '''The offset of dataset-information the product file'''
 * 
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             self.check_closed_product()
 *             return self._ptr.ds_offset
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("epr.DSD.ds_offset.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":434
 *         '''The size of dataset-information in dataset product file'''
 * 
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             self.check_closed_product()
 *             return self._ptr.ds_size
 */

/* Python wrapper */
static PyObject *__pyx_pw_3epr_3DSD_7ds_size_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_3epr_3DSD_7ds_size_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_3epr_3DSD_7ds_size___get__(((struct __pyx_obj_3epr_DSD *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_3epr_3DSD_7ds_size___get__(struct __pyx_obj_3epr_DSD *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "epr.pyx":435
 * 
 *         def __get__(self):
 *             self.check_closed_product()             # <<<<<<<<<<<<<<
 *             return self._ptr.ds_size
 * 
 */
  __pyx_t_1 = __pyx_f_3epr_3DSD_check_closed_product(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "epr.pyx":436
 *         def __get__(self):
 *             self.check_closed_product()
 *             return self._ptr.ds_size             # <<<<<<<<<<<<<<
 * 
 *     property num_dsr:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_uint(__pyx_v_self->_ptr->ds_size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 436; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "epr.pyx":434
 *         '''The size of dataset-information in dataset product file'''
 * 
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             self.check_closed_product()
 *             return self._ptr.ds_size
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("epr.DSD.ds_size.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":441
 *         '''The number of dataset records for the given dataset name'''
 * 
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             self.check_closed_product()
 *             return self._ptr.num_dsr
 */

/* Python wrapper */
static PyObject *__pyx_pw_3epr_3DSD_7num_dsr_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_3epr_3DSD_7num_dsr_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_3epr_3DSD_7num_dsr___get__(((struct __pyx_obj_3epr_DSD *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_3epr_3DSD_7num_dsr___get__(struct __pyx_obj_3epr_DSD *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "epr.pyx":442
 * 
 *         def __get__(self):
 *             self.check_closed_product()             # <<<<<<<<<<<<<<
 *             return self._ptr.num_dsr
 * 
 */
  __pyx_t_1 = __pyx_f_3epr_3DSD_check_closed_product(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 442; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "epr.pyx":443
 *         def __get__(self):
 *             self.check_closed_product()
 *             return self._ptr.num_dsr             # <<<<<<<<<<<<<<
 * 
 *     property dsr_size:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_uint(__pyx_v_self->_ptr->num_dsr); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 443; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "epr.pyx":441
 *         '''The number of dataset records for the given dataset name'''
 * 
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             self.check_closed_product()
 *             return self._ptr.num_dsr
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("epr.DSD.num_dsr.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":448
 *         '''The size of dataset record for the given dataset name'''
 * 
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             self.check_closed_product()
 *             return self._ptr.dsr_size
 */

/* Python wrapper */
static PyObject *__pyx_pw_3epr_3DSD_8dsr_size_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_3epr_3DSD_8dsr_size_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_3epr_3DSD_8dsr_size___get__(((struct __pyx_obj_3epr_DSD *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_3epr_3DSD_8dsr_size___get__(struct __pyx_obj_3epr_DSD *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "epr.pyx":449
 * 
 *         def __get__(self):
 *             self.check_closed_product()             # <<<<<<<<<<<<<<
 *             return self._ptr.dsr_size
 * 
 */
  __pyx_t_1 = __pyx_f_3epr_3DSD_check_closed_product(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 449; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "epr.pyx":450
 *         def __get__(self):
 *             self.check_closed_product()
 *             return self._ptr.dsr_size             # <<<<<<<<<<<<<<
 * 
 *     # --- high level interface ------------------------------------------------
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_uint(__pyx_v_self->_ptr->dsr_size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "epr.pyx":448
 *         '''The size of dataset record for the given dataset name'''
 * 
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             self.check_closed_product()
 *             return self._ptr.dsr_size
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("epr.DSD.dsr_size.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":453
 * 
 *     # --- high level interface ------------------------------------------------
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return 'epr.DSD("%s")' % self.ds_name
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_3epr_3DSD_1__repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_3epr_3DSD_1__repr__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
  __pyx_r = __pyx_pf_3epr_3DSD___repr__(((struct __pyx_obj_3epr_DSD *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_3epr_3DSD___repr__(struct __pyx_obj_3epr_DSD *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__repr__", 0);

  /* "epr.pyx":454
 *     # --- high level interface ------------------------------------------------
 *     def __repr__(self):
 *         return 'epr.DSD("%s")' % self.ds_name             # <<<<<<<<<<<<<<
 * 
 *     def __richcmp__(self, other, int op):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_ds_name); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_epr_DSD_s, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "epr.pyx":453
 * 
 *     # --- high level interface ------------------------------------------------
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return 'epr.DSD("%s")' % self.ds_name
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("epr.DSD.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":456
 *         return 'epr.DSD("%s")' % self.ds_name
 * 
 *     def __richcmp__(self, other, int op):             # <<<<<<<<<<<<<<
 *         cdef EPR_SDSD* p1 = (<DSD>self)._ptr
 *         cdef EPR_SDSD* p2 = (<DSD>other)._ptr
 */

/* Python wrapper */
static PyObject *__pyx_pw_3epr_3DSD_3__richcmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, int __pyx_v_op); /*proto*/
static PyObject *__pyx_pw_3epr_3DSD_3__richcmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, int __pyx_v_op) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__richcmp__ (wrapper)", 0);
  __pyx_r = __pyx_pf_3epr_3DSD_2__richcmp__(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_v_other), ((int)__pyx_v_op));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_3epr_3DSD_2__richcmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, int __pyx_v_op) {
  EPR_SDSD *__pyx_v_p1;
  EPR_SDSD *__pyx_v_p2;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  EPR_SDSD *__pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  int __pyx_t_7;
  int __pyx_t_8;
  int __pyx_t_9;
  int __pyx_t_10;
  int __pyx_t_11;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__richcmp__", 0);

  /* "epr.pyx":457
 * 
 *     def __richcmp__(self, other, int op):
 *         cdef EPR_SDSD* p1 = (<DSD>self)._ptr             # <<<<<<<<<<<<<<
 *         cdef EPR_SDSD* p2 = (<DSD>other)._ptr
 * 
 */
  __pyx_t_1 = ((struct __pyx_obj_3epr_DSD *)__pyx_v_self)->_ptr;
  __pyx_v_p1 = __pyx_t_1;

  /* "epr.pyx":458
 *     def __richcmp__(self, other, int op):
 *         cdef EPR_SDSD* p1 = (<DSD>self)._ptr
 *         cdef EPR_SDSD* p2 = (<DSD>other)._ptr             # <<<<<<<<<<<<<<
 * 
 *         if isinstance(self, DSD) and isinstance(other, DSD):
 */
  __pyx_t_1 = ((struct __pyx_obj_3epr_DSD *)__pyx_v_other)->_ptr;
  __pyx_v_p2 = __pyx_t_1;

  /* "epr.pyx":460
 *         cdef EPR_SDSD* p2 = (<DSD>other)._ptr
 * 
 *         if isinstance(self, DSD) and isinstance(other, DSD):             # <<<<<<<<<<<<<<
 *             if op == 2:         # eq
 *                 if p1 == p2:
 */
  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_self, ((PyObject*)__pyx_ptype_3epr_DSD)); 
  if ((__pyx_t_2 != 0)) {
    __pyx_t_3 = __Pyx_TypeCheck(__pyx_v_other, ((PyObject*)__pyx_ptype_3epr_DSD)); 
    __pyx_t_4 = (__pyx_t_3 != 0);
  } else {
    __pyx_t_4 = (__pyx_t_2 != 0);
  }
  if (__pyx_t_4) {

    /* "epr.pyx":476
 *                         (cstring.strcmp(p1.filename, p2.filename) == 0))
 * 
 *             elif op == 3:       # ne             # <<<<<<<<<<<<<<
 *                 if p1 == p2:
 *                     return False
 */
    switch (__pyx_v_op) {

      /* "epr.pyx":461
 * 
 *         if isinstance(self, DSD) and isinstance(other, DSD):
 *             if op == 2:         # eq             # <<<<<<<<<<<<<<
 *                 if p1 == p2:
 *                     return True
 */
      case 2:

      /* "epr.pyx":462
 *         if isinstance(self, DSD) and isinstance(other, DSD):
 *             if op == 2:         # eq
 *                 if p1 == p2:             # <<<<<<<<<<<<<<
 *                     return True
 * 
 */
      __pyx_t_4 = ((__pyx_v_p1 == __pyx_v_p2) != 0);
      if (__pyx_t_4) {

        /* "epr.pyx":463
 *             if op == 2:         # eq
 *                 if p1 == p2:
 *                     return True             # <<<<<<<<<<<<<<
 * 
 *                 (<DSD>self).check_closed_product()
 */
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(Py_True);
        __pyx_r = Py_True;
        goto __pyx_L0;
      }

      /* "epr.pyx":465
 *                     return True
 * 
 *                 (<DSD>self).check_closed_product()             # <<<<<<<<<<<<<<
 * 
 *                 return ((p1.index == p2.index) and
 */
      __pyx_t_5 = __pyx_f_3epr_3DSD_check_closed_product(((struct __pyx_obj_3epr_DSD *)__pyx_v_self)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

      /* "epr.pyx":467
 *                 (<DSD>self).check_closed_product()
 * 
 *                 return ((p1.index == p2.index) and             # <<<<<<<<<<<<<<
 *                         (p1.ds_offset == p2.ds_offset) and
 *                         (p1.ds_size == p2.ds_size) and
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_4 = (__pyx_v_p1->index == __pyx_v_p2->index);
      if (__pyx_t_4) {

        /* "epr.pyx":468
 * 
 *                 return ((p1.index == p2.index) and
 *                         (p1.ds_offset == p2.ds_offset) and             # <<<<<<<<<<<<<<
 *                         (p1.ds_size == p2.ds_size) and
 *                         (p1.num_dsr == p2.num_dsr) and
 */
        __pyx_t_2 = (__pyx_v_p1->ds_offset == __pyx_v_p2->ds_offset);
        if (__pyx_t_2) {

          /* "epr.pyx":469
 *                 return ((p1.index == p2.index) and
 *                         (p1.ds_offset == p2.ds_offset) and
 *                         (p1.ds_size == p2.ds_size) and             # <<<<<<<<<<<<<<
 *                         (p1.num_dsr == p2.num_dsr) and
 *                         (p1.dsr_size == p2.dsr_size)and
 */
          __pyx_t_3 = (__pyx_v_p1->ds_size == __pyx_v_p2->ds_size);
          if (__pyx_t_3) {

            /* "epr.pyx":470
 *                         (p1.ds_offset == p2.ds_offset) and
 *                         (p1.ds_size == p2.ds_size) and
 *                         (p1.num_dsr == p2.num_dsr) and             # <<<<<<<<<<<<<<
 *                         (p1.dsr_size == p2.dsr_size)and
 *                         (cstring.strcmp(p1.ds_name, p2.ds_name) == 0) and
 */
            __pyx_t_6 = (__pyx_v_p1->num_dsr == __pyx_v_p2->num_dsr);
            if (__pyx_t_6) {

              /* "epr.pyx":471
 *                         (p1.ds_size == p2.ds_size) and
 *                         (p1.num_dsr == p2.num_dsr) and
 *                         (p1.dsr_size == p2.dsr_size)and             # <<<<<<<<<<<<<<
 *                         (cstring.strcmp(p1.ds_name, p2.ds_name) == 0) and
 *                         (cstring.strcmp(p1.ds_type, p2.ds_type) == 0) and
 */
              __pyx_t_7 = (__pyx_v_p1->dsr_size == __pyx_v_p2->dsr_size);
              if (__pyx_t_7) {

                /* "epr.pyx":472
 *                         (p1.num_dsr == p2.num_dsr) and
 *                         (p1.dsr_size == p2.dsr_size)and
 *                         (cstring.strcmp(p1.ds_name, p2.ds_name) == 0) and             # <<<<<<<<<<<<<<
 *                         (cstring.strcmp(p1.ds_type, p2.ds_type) == 0) and
 *                         (cstring.strcmp(p1.filename, p2.filename) == 0))
 */
                __pyx_t_8 = (strcmp(__pyx_v_p1->ds_name, __pyx_v_p2->ds_name) == 0);
                if (__pyx_t_8) {

                  /* "epr.pyx":473
 *                         (p1.dsr_size == p2.dsr_size)and
 *                         (cstring.strcmp(p1.ds_name, p2.ds_name) == 0) and
 *                         (cstring.strcmp(p1.ds_type, p2.ds_type) == 0) and             # <<<<<<<<<<<<<<
 *                         (cstring.strcmp(p1.filename, p2.filename) == 0))
 * 
 */
                  __pyx_t_9 = (strcmp(__pyx_v_p1->ds_type, __pyx_v_p2->ds_type) == 0);
                  if (__pyx_t_9) {

                    /* "epr.pyx":474
 *                         (cstring.strcmp(p1.ds_name, p2.ds_name) == 0) and
 *                         (cstring.strcmp(p1.ds_type, p2.ds_type) == 0) and
 *                         (cstring.strcmp(p1.filename, p2.filename) == 0))             # <<<<<<<<<<<<<<
 * 
 *             elif op == 3:       # ne
 */
                    __pyx_t_10 = (strcmp(__pyx_v_p1->filename, __pyx_v_p2->filename) == 0);
                    __pyx_t_11 = __pyx_t_10;
                  } else {
                    __pyx_t_11 = __pyx_t_9;
                  }
                  __pyx_t_9 = __pyx_t_11;
                } else {
                  __pyx_t_9 = __pyx_t_8;
                }
                __pyx_t_8 = __pyx_t_9;
              } else {
                __pyx_t_8 = __pyx_t_7;
              }
              __pyx_t_7 = __pyx_t_8;
            } else {
              __pyx_t_7 = __pyx_t_6;
            }
            __pyx_t_6 = __pyx_t_7;
          } else {
            __pyx_t_6 = __pyx_t_3;
          }
          __pyx_t_3 = __pyx_t_6;
        } else {
          __pyx_t_3 = __pyx_t_2;
        }
        __pyx_t_2 = __pyx_t_3;
      } else {
        __pyx_t_2 = __pyx_t_4;
      }

      /* "epr.pyx":467
 *                 (<DSD>self).check_closed_product()
 * 
 *                 return ((p1.index == p2.index) and             # <<<<<<<<<<<<<<
 *                         (p1.ds_offset == p2.ds_offset) and
 *                         (p1.ds_size == p2.ds_size) and
 */
      __pyx_t_5 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_r = __pyx_t_5;
      __pyx_t_5 = 0;
      goto __pyx_L0;
      break;

      /* "epr.pyx":476
 *                         (cstring.strcmp(p1.filename, p2.filename) == 0))
 * 
 *             elif op == 3:       # ne             # <<<<<<<<<<<<<<
 *                 if p1 == p2:
 *                     return False
 */
      case 3:

      /* "epr.pyx":477
 * 
 *             elif op == 3:       # ne
 *                 if p1 == p2:             # <<<<<<<<<<<<<<
 *                     return False
 * 
 */
      __pyx_t_2 = ((__pyx_v_p1 == __pyx_v_p2) != 0);
      if (__pyx_t_2) {

        /* "epr.pyx":478
 *             elif op == 3:       # ne
 *                 if p1 == p2:
 *                     return False             # <<<<<<<<<<<<<<
 * 
 *                 (<DSD>self).check_closed_product()
 */
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(Py_False);
        __pyx_r = Py_False;
        goto __pyx_L0;
      }

      /* "epr.pyx":480
 *                     return False
 * 
 *                 (<DSD>self).check_closed_product()             # <<<<<<<<<<<<<<
 * 
 *                 return ((p1.index != p2.index) or
 */
      __pyx_t_5 = __pyx_f_3epr_3DSD_check_closed_product(((struct __pyx_obj_3epr_DSD *)__pyx_v_self)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 480; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

      /* "epr.pyx":482
 *                 (<DSD>self).check_closed_product()
 * 
 *                 return ((p1.index != p2.index) or             # <<<<<<<<<<<<<<
 *                         (p1.ds_offset != p2.ds_offset) or
 *                         (p1.ds_size != p2.ds_size) or
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_2 = (__pyx_v_p1->index != __pyx_v_p2->index);
      if (!__pyx_t_2) {

        /* "epr.pyx":483
 * 
 *                 return ((p1.index != p2.index) or
 *                         (p1.ds_offset != p2.ds_offset) or             # <<<<<<<<<<<<<<
 *                         (p1.ds_size != p2.ds_size) or
 *                         (p1.num_dsr != p2.num_dsr) or
 */
        __pyx_t_4 = (__pyx_v_p1->ds_offset != __pyx_v_p2->ds_offset);
        if (!__pyx_t_4) {

          /* "epr.pyx":484
 *                 return ((p1.index != p2.index) or
 *                         (p1.ds_offset != p2.ds_offset) or
 *                         (p1.ds_size != p2.ds_size) or             # <<<<<<<<<<<<<<
 *                         (p1.num_dsr != p2.num_dsr) or
 *                         (p1.dsr_size != p2.dsr_size) or
 */
          __pyx_t_3 = (__pyx_v_p1->ds_size != __pyx_v_p2->ds_size);
          if (!__pyx_t_3) {

            /* "epr.pyx":485
 *                         (p1.ds_offset != p2.ds_offset) or
 *                         (p1.ds_size != p2.ds_size) or
 *                         (p1.num_dsr != p2.num_dsr) or             # <<<<<<<<<<<<<<
 *                         (p1.dsr_size != p2.dsr_size) or
 *                         (cstring.strcmp(p1.ds_name, p2.ds_name) != 0) or
 */
            __pyx_t_6 = (__pyx_v_p1->num_dsr != __pyx_v_p2->num_dsr);
            if (!__pyx_t_6) {

              /* "epr.pyx":486
 *                         (p1.ds_size != p2.ds_size) or
 *                         (p1.num_dsr != p2.num_dsr) or
 *                         (p1.dsr_size != p2.dsr_size) or             # <<<<<<<<<<<<<<
 *                         (cstring.strcmp(p1.ds_name, p2.ds_name) != 0) or
 *                         (cstring.strcmp(p1.ds_type, p2.ds_type) != 0) or
 */
              __pyx_t_7 = (__pyx_v_p1->dsr_size != __pyx_v_p2->dsr_size);
              if (!__pyx_t_7) {

                /* "epr.pyx":487
 *                         (p1.num_dsr != p2.num_dsr) or
 *                         (p1.dsr_size != p2.dsr_size) or
 *                         (cstring.strcmp(p1.ds_name, p2.ds_name) != 0) or             # <<<<<<<<<<<<<<
 *                         (cstring.strcmp(p1.ds_type, p2.ds_type) != 0) or
 *                         (cstring.strcmp(p1.filename, p2.filename) != 0))
 */
                __pyx_t_8 = (strcmp(__pyx_v_p1->ds_name, __pyx_v_p2->ds_name) != 0);
                if (!__pyx_t_8) {

                  /* "epr.pyx":488
 *                         (p1.dsr_size != p2.dsr_size) or
 *                         (cstring.strcmp(p1.ds_name, p2.ds_name) != 0) or
 *                         (cstring.strcmp(p1.ds_type, p2.ds_type) != 0) or             # <<<<<<<<<<<<<<
 *                         (cstring.strcmp(p1.filename, p2.filename) != 0))
 * 
 */
                  __pyx_t_9 = (strcmp(__pyx_v_p1->ds_type, __pyx_v_p2->ds_type) != 0);
                  if (!__pyx_t_9) {

                    /* "epr.pyx":489
 *                         (cstring.strcmp(p1.ds_name, p2.ds_name) != 0) or
 *                         (cstring.strcmp(p1.ds_type, p2.ds_type) != 0) or
 *                         (cstring.strcmp(p1.filename, p2.filename) != 0))             # <<<<<<<<<<<<<<
 * 
 *             else:
 */
                    __pyx_t_11 = (strcmp(__pyx_v_p1->filename, __pyx_v_p2->filename) != 0);
                    __pyx_t_10 = __pyx_t_11;
                  } else {
                    __pyx_t_10 = __pyx_t_9;
                  }
                  __pyx_t_9 = __pyx_t_10;
                } else {
                  __pyx_t_9 = __pyx_t_8;
                }
                __pyx_t_8 = __pyx_t_9;
              } else {
                __pyx_t_8 = __pyx_t_7;
              }
              __pyx_t_7 = __pyx_t_8;
            } else {
              __pyx_t_7 = __pyx_t_6;
            }
            __pyx_t_6 = __pyx_t_7;
          } else {
            __pyx_t_6 = __pyx_t_3;
          }
          __pyx_t_3 = __pyx_t_6;
        } else {
          __pyx_t_3 = __pyx_t_4;
        }
        __pyx_t_4 = __pyx_t_3;
      } else {
        __pyx_t_4 = __pyx_t_2;
      }

      /* "epr.pyx":482
 *                 (<DSD>self).check_closed_product()
 * 
 *                 return ((p1.index != p2.index) or             # <<<<<<<<<<<<<<
 *                         (p1.ds_offset != p2.ds_offset) or
 *                         (p1.ds_size != p2.ds_size) or
 */
      __pyx_t_5 = __Pyx_PyBool_FromLong(__pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 482; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_r = __pyx_t_5;
      __pyx_t_5 = 0;
      goto __pyx_L0;
      break;
      default:

      /* "epr.pyx":492
 * 
 *             else:
 *                 raise TypeError('DSD only implements "==" and "!=" operators')             # <<<<<<<<<<<<<<
 *         else:
 *             return NotImplemented
 */
      __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 492; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_Raise(__pyx_t_5, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 492; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      break;
    }
  }
  /*else*/ {

    /* "epr.pyx":494
 *                 raise TypeError('DSD only implements "==" and "!=" operators')
 *         else:
 *             return NotImplemented             # <<<<<<<<<<<<<<
 * 
 *     # --- low level interface -------------------------------------------------
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_builtin_NotImplemented);
    __pyx_r = __pyx_builtin_NotImplemented;
    goto __pyx_L0;
  }

  /* "epr.pyx":456
 *         return 'epr.DSD("%s")' % self.ds_name
 * 
 *     def __richcmp__(self, other, int op):             # <<<<<<<<<<<<<<
 *         cdef EPR_SDSD* p1 = (<DSD>self)._ptr
 *         cdef EPR_SDSD* p2 = (<DSD>other)._ptr
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("epr.DSD.__richcmp__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":500
 *         '''The magic number for internal C structure'''
 * 
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             self.check_closed_product()
 *             return self._ptr.magic
 */

/* Python wrapper */
static PyObject *__pyx_pw_3epr_3DSD_6_magic_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_3epr_3DSD_6_magic_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_3epr_3DSD_6_magic___get__(((struct __pyx_obj_3epr_DSD *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_3epr_3DSD_6_magic___get__(struct __pyx_obj_3epr_DSD *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "epr.pyx":501
 * 
 *         def __get__(self):
 *             self.check_closed_product()             # <<<<<<<<<<<<<<
 *             return self._ptr.magic
 * 
 */
  __pyx_t_1 = __pyx_f_3epr_3DSD_check_closed_product(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 501; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "epr.pyx":502
 *         def __get__(self):
 *             self.check_closed_product()
 *             return self._ptr.magic             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_EPR_Magic(__pyx_v_self->_ptr->magic); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 502; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "epr.pyx":500
 *         '''The magic number for internal C structure'''
 * 
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             self.check_closed_product()
 *             return self._ptr.magic
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("epr.DSD._magic.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":505
 * 
 * 
 * cdef new_dsd(EPR_SDSD* ptr, object parent=None):             # <<<<<<<<<<<<<<
 *     if ptr is NULL:
 *         pyepr_null_ptr_error()
 */

static PyObject *__pyx_f_3epr_new_dsd(EPR_SDSD *__pyx_v_ptr, struct __pyx_opt_args_3epr_new_dsd *__pyx_optional_args) {
  PyObject *__pyx_v_parent = ((PyObject *)Py_None);
  struct __pyx_obj_3epr_DSD *__pyx_v_instance = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("new_dsd", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_parent = __pyx_optional_args->parent;
    }
  }

  /* "epr.pyx":506
 * 
 * cdef new_dsd(EPR_SDSD* ptr, object parent=None):
 *     if ptr is NULL:             # <<<<<<<<<<<<<<
 *         pyepr_null_ptr_error()
 * 
 */
  __pyx_t_1 = ((__pyx_v_ptr == NULL) != 0);
  if (__pyx_t_1) {

    /* "epr.pyx":507
 * cdef new_dsd(EPR_SDSD* ptr, object parent=None):
 *     if ptr is NULL:
 *         pyepr_null_ptr_error()             # <<<<<<<<<<<<<<
 * 
 *     cdef DSD instance = DSD.__new__(DSD)
 */
    __pyx_t_2 = __pyx_f_3epr_pyepr_null_ptr_error(NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "epr.pyx":509
 *         pyepr_null_ptr_error()
 * 
 *     cdef DSD instance = DSD.__new__(DSD)             # <<<<<<<<<<<<<<
 * 
 *     instance._ptr = ptr
 */
  __pyx_t_2 = __pyx_tp_new_3epr_DSD(((PyTypeObject *)((PyObject*)__pyx_ptype_3epr_DSD)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (!(likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_3epr_DSD)))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_instance = ((struct __pyx_obj_3epr_DSD *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "epr.pyx":511
 *     cdef DSD instance = DSD.__new__(DSD)
 * 
 *     instance._ptr = ptr             # <<<<<<<<<<<<<<
 *     instance._parent = parent   # Dataset or Product
 * 
 */
  __pyx_v_instance->_ptr = __pyx_v_ptr;

  /* "epr.pyx":512
 * 
 *     instance._ptr = ptr
 *     instance._parent = parent   # Dataset or Product             # <<<<<<<<<<<<<<
 * 
 *     return instance
 */
  __Pyx_INCREF(__pyx_v_parent);
  __Pyx_GIVEREF(__pyx_v_parent);
  __Pyx_GOTREF(__pyx_v_instance->_parent);
  __Pyx_DECREF(__pyx_v_instance->_parent);
  __pyx_v_instance->_parent = __pyx_v_parent;

  /* "epr.pyx":514
 *     instance._parent = parent   # Dataset or Product
 * 
 *     return instance             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_instance));
  __pyx_r = ((PyObject *)__pyx_v_instance);
  goto __pyx_L0;

  /* "epr.pyx":505
 * 
 * 
 * cdef new_dsd(EPR_SDSD* ptr, object parent=None):             # <<<<<<<<<<<<<<
 *     if ptr is NULL:
 *         pyepr_null_ptr_error()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("epr.new_dsd", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_instance);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":530
 *     cdef Record _parent
 * 
 *     cdef inline check_closed_product(self):             # <<<<<<<<<<<<<<
 *         self._parent.check_closed_product()
 * 
 */

static CYTHON_INLINE PyObject *__pyx_f_3epr_5Field_check_closed_product(struct __pyx_obj_3epr_Field *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("check_closed_product", 0);

  /* "epr.pyx":531
 * 
 *     cdef inline check_closed_product(self):
 *         self._parent.check_closed_product()             # <<<<<<<<<<<<<<
 * 
 *     cdef inline _check_write_mode(self):
 */
  __pyx_t_1 = __pyx_f_3epr_6Record_check_closed_product(__pyx_v_self->_parent); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 531; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "epr.pyx":530
 *     cdef Record _parent
 * 
 *     cdef inline check_closed_product(self):             # <<<<<<<<<<<<<<
 *         self._parent.check_closed_product()
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("epr.Field.check_closed_product", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":533
 *         self._parent.check_closed_product()
 * 
 *     cdef inline _check_write_mode(self):             # <<<<<<<<<<<<<<
 *         self._parent._check_write_mode()
 * 
 */

static CYTHON_INLINE PyObject *__pyx_f_3epr_5Field__check_write_mode(struct __pyx_obj_3epr_Field *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_check_write_mode", 0);

  /* "epr.pyx":534
 * 
 *     cdef inline _check_write_mode(self):
 *         self._parent._check_write_mode()             # <<<<<<<<<<<<<<
 * 
 *     cdef long _get_offset(self, bint absolute=0):
 */
  __pyx_t_1 = __pyx_f_3epr_6Record__check_write_mode(__pyx_v_self->_parent); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 534; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "epr.pyx":533
 *         self._parent.check_closed_product()
 * 
 *     cdef inline _check_write_mode(self):             # <<<<<<<<<<<<<<
 *         self._parent._check_write_mode()
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("epr.Field._check_write_mode", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":536
 *         self._parent._check_write_mode()
 * 
 *     cdef long _get_offset(self, bint absolute=0):             # <<<<<<<<<<<<<<
 *         cdef bint found = 0
 *         cdef int i = 0
 */

static long __pyx_f_3epr_5Field__get_offset(struct __pyx_obj_3epr_Field *__pyx_v_self, struct __pyx_opt_args_3epr_5Field__get_offset *__pyx_optional_args) {
  int __pyx_v_absolute = ((int)0);
  int __pyx_v_found;
  int __pyx_v_i;
  int __pyx_v_num_fields_in_record;
  long __pyx_v_offset;
  char const *__pyx_v_name;
  struct EPR_Field const *__pyx_v_field;
  __pyx_t_3epr_EPR_FieldInfo const *__pyx_v_info;
  struct EPR_Record const *__pyx_v_record;
  long __pyx_r;
  __Pyx_RefNannyDeclarations
  char *__pyx_t_1;
  EPR_SRecord *__pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  long __pyx_t_6;
  uint __pyx_t_7;
  struct __pyx_opt_args_3epr_6Record__get_offset __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_get_offset", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_absolute = __pyx_optional_args->absolute;
    }
  }

  /* "epr.pyx":537
 * 
 *     cdef long _get_offset(self, bint absolute=0):
 *         cdef bint found = 0             # <<<<<<<<<<<<<<
 *         cdef int i = 0
 *         cdef int num_fields_in_record = 0
 */
  __pyx_v_found = 0;

  /* "epr.pyx":538
 *     cdef long _get_offset(self, bint absolute=0):
 *         cdef bint found = 0
 *         cdef int i = 0             # <<<<<<<<<<<<<<
 *         cdef int num_fields_in_record = 0
 *         cdef long offset = 0
 */
  __pyx_v_i = 0;

  /* "epr.pyx":539
 *         cdef bint found = 0
 *         cdef int i = 0
 *         cdef int num_fields_in_record = 0             # <<<<<<<<<<<<<<
 *         cdef long offset = 0
 *         cdef const char* name = NULL
 */
  __pyx_v_num_fields_in_record = 0;

  /* "epr.pyx":540
 *         cdef int i = 0
 *         cdef int num_fields_in_record = 0
 *         cdef long offset = 0             # <<<<<<<<<<<<<<
 *         cdef const char* name = NULL
 *         cdef const EPR_Field* field = NULL
 */
  __pyx_v_offset = 0;

  /* "epr.pyx":541
 *         cdef int num_fields_in_record = 0
 *         cdef long offset = 0
 *         cdef const char* name = NULL             # <<<<<<<<<<<<<<
 *         cdef const EPR_Field* field = NULL
 *         cdef const EPR_FieldInfo* info = NULL
 */
  __pyx_v_name = NULL;

  /* "epr.pyx":542
 *         cdef long offset = 0
 *         cdef const char* name = NULL
 *         cdef const EPR_Field* field = NULL             # <<<<<<<<<<<<<<
 *         cdef const EPR_FieldInfo* info = NULL
 *         cdef const EPR_Record* record = NULL
 */
  __pyx_v_field = NULL;

  /* "epr.pyx":543
 *         cdef const char* name = NULL
 *         cdef const EPR_Field* field = NULL
 *         cdef const EPR_FieldInfo* info = NULL             # <<<<<<<<<<<<<<
 *         cdef const EPR_Record* record = NULL
 * 
 */
  __pyx_v_info = NULL;

  /* "epr.pyx":544
 *         cdef const EPR_Field* field = NULL
 *         cdef const EPR_FieldInfo* info = NULL
 *         cdef const EPR_Record* record = NULL             # <<<<<<<<<<<<<<
 * 
 *         info = <EPR_FieldInfo*>self._ptr.info
 */
  __pyx_v_record = NULL;

  /* "epr.pyx":546
 *         cdef const EPR_Record* record = NULL
 * 
 *         info = <EPR_FieldInfo*>self._ptr.info             # <<<<<<<<<<<<<<
 *         name = info.name
 *         record = self._parent._ptr
 */
  __pyx_v_info = ((__pyx_t_3epr_EPR_FieldInfo *)__pyx_v_self->_ptr->info);

  /* "epr.pyx":547
 * 
 *         info = <EPR_FieldInfo*>self._ptr.info
 *         name = info.name             # <<<<<<<<<<<<<<
 *         record = self._parent._ptr
 *         num_fields_in_record = epr_get_num_fields(record)
 */
  __pyx_t_1 = __pyx_v_info->name;
  __pyx_v_name = __pyx_t_1;

  /* "epr.pyx":548
 *         info = <EPR_FieldInfo*>self._ptr.info
 *         name = info.name
 *         record = self._parent._ptr             # <<<<<<<<<<<<<<
 *         num_fields_in_record = epr_get_num_fields(record)
 *         for i in range(num_fields_in_record):
 */
  __pyx_t_2 = __pyx_v_self->_parent->_ptr;
  __pyx_v_record = __pyx_t_2;

  /* "epr.pyx":549
 *         name = info.name
 *         record = self._parent._ptr
 *         num_fields_in_record = epr_get_num_fields(record)             # <<<<<<<<<<<<<<
 *         for i in range(num_fields_in_record):
 *             field = epr_get_field_at(record, i)
 */
  __pyx_v_num_fields_in_record = epr_get_num_fields(__pyx_v_record);

  /* "epr.pyx":550
 *         record = self._parent._ptr
 *         num_fields_in_record = epr_get_num_fields(record)
 *         for i in range(num_fields_in_record):             # <<<<<<<<<<<<<<
 *             field = epr_get_field_at(record, i)
 *             info = <EPR_FieldInfo*>field.info
 */
  __pyx_t_3 = __pyx_v_num_fields_in_record;
  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
    __pyx_v_i = __pyx_t_4;

    /* "epr.pyx":551
 *         num_fields_in_record = epr_get_num_fields(record)
 *         for i in range(num_fields_in_record):
 *             field = epr_get_field_at(record, i)             # <<<<<<<<<<<<<<
 *             info = <EPR_FieldInfo*>field.info
 *             if info.name == name:
 */
    __pyx_v_field = epr_get_field_at(__pyx_v_record, __pyx_v_i);

    /* "epr.pyx":552
 *         for i in range(num_fields_in_record):
 *             field = epr_get_field_at(record, i)
 *             info = <EPR_FieldInfo*>field.info             # <<<<<<<<<<<<<<
 *             if info.name == name:
 *                 found = 1
 */
    __pyx_v_info = ((__pyx_t_3epr_EPR_FieldInfo *)__pyx_v_field->info);

    /* "epr.pyx":553
 *             field = epr_get_field_at(record, i)
 *             info = <EPR_FieldInfo*>field.info
 *             if info.name == name:             # <<<<<<<<<<<<<<
 *                 found = 1
 *                 break
 */
    __pyx_t_5 = ((__pyx_v_info->name == __pyx_v_name) != 0);
    if (__pyx_t_5) {

      /* "epr.pyx":554
 *             info = <EPR_FieldInfo*>field.info
 *             if info.name == name:
 *                 found = 1             # <<<<<<<<<<<<<<
 *                 break
 *             offset += info.tot_size
 */
      __pyx_v_found = 1;

      /* "epr.pyx":555
 *             if info.name == name:
 *                 found = 1
 *                 break             # <<<<<<<<<<<<<<
 *             offset += info.tot_size
 * 
 */
      goto __pyx_L4_break;
    }

    /* "epr.pyx":556
 *                 found = 1
 *                 break
 *             offset += info.tot_size             # <<<<<<<<<<<<<<
 * 
 *         if not found:
 */
    __pyx_v_offset = (__pyx_v_offset + __pyx_v_info->tot_size);
  }
  __pyx_L4_break:;

  /* "epr.pyx":558
 *             offset += info.tot_size
 * 
 *         if not found:             # <<<<<<<<<<<<<<
 *             offset = None
 *         elif absolute:
 */
  __pyx_t_5 = ((!(__pyx_v_found != 0)) != 0);
  if (__pyx_t_5) {

    /* "epr.pyx":559
 * 
 *         if not found:
 *             offset = None             # <<<<<<<<<<<<<<
 *         elif absolute:
 *             offset += self._parent._get_offset(absolute)
 */
    __pyx_t_6 = __Pyx_PyInt_As_long(Py_None); if (unlikely((__pyx_t_6 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_offset = __pyx_t_6;
    goto __pyx_L6;
  }

  /* "epr.pyx":560
 *         if not found:
 *             offset = None
 *         elif absolute:             # <<<<<<<<<<<<<<
 *             offset += self._parent._get_offset(absolute)
 * 
 */
  __pyx_t_5 = (__pyx_v_absolute != 0);
  if (__pyx_t_5) {

    /* "epr.pyx":561
 *             offset = None
 *         elif absolute:
 *             offset += self._parent._get_offset(absolute)             # <<<<<<<<<<<<<<
 * 
 *         return offset
 */
    __pyx_t_8.__pyx_n = 1;
    __pyx_t_8.absolure = __pyx_v_absolute;
    __pyx_t_7 = __pyx_f_3epr_6Record__get_offset(__pyx_v_self->_parent, &__pyx_t_8); 
    __pyx_v_offset = (__pyx_v_offset + __pyx_t_7);
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "epr.pyx":563
 *             offset += self._parent._get_offset(absolute)
 * 
 *         return offset             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = __pyx_v_offset;
  goto __pyx_L0;

  /* "epr.pyx":536
 *         self._parent._check_write_mode()
 * 
 *     cdef long _get_offset(self, bint absolute=0):             # <<<<<<<<<<<<<<
 *         cdef bint found = 0
 *         cdef int i = 0
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_WriteUnraisable("epr.Field._get_offset", __pyx_clineno, __pyx_lineno, __pyx_filename, 0);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":566
 * 
 * 
 *     def print_(self, ostream=None):             # <<<<<<<<<<<<<<
 *         '''print_(self, ostream=None)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_3epr_5Field_1print_(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_3epr_5Field_print_[] = "print_(self, ostream=None)\n\n        Write the field to specified file (default: :data:`sys.stdout`)\n\n        This method writes formatted contents of the field to\n        specified *ostream* text file or (default) the ASCII output\n        is be printed to standard output (:data:`sys.stdout`)\n\n        :param ostream:\n            the (opened) output file object\n\n        .. note:: the *ostream* parameter have to be a *real* file not\n                  a generic stream object like\n                  :class:`StringIO.StringIO` instances\n\n        ";
static PyObject *__pyx_pw_3epr_5Field_1print_(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_ostream = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("print_ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_ostream,0};
    PyObject* values[1] = {0};
    values[0] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_ostream);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "print_") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 566; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_ostream = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("print_", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 566; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("epr.Field.print_", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_3epr_5Field_print_(((struct __pyx_obj_3epr_Field *)__pyx_v_self), __pyx_v_ostream);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_3epr_5Field_print_(struct __pyx_obj_3epr_Field *__pyx_v_self, PyObject *__pyx_v_ostream) {
  FILE *__pyx_v_fstream;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  FILE *__pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("print_", 0);

  /* "epr.pyx":584
 *         '''
 * 
 *         cdef FILE* fstream = pyepr_get_file_stream(ostream)             # <<<<<<<<<<<<<<
 * 
 *         self.check_closed_product()
 */
  __pyx_t_1 = __pyx_f_3epr_pyepr_get_file_stream(__pyx_v_ostream); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 584; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_fstream = __pyx_t_1;

  /* "epr.pyx":586
 *         cdef FILE* fstream = pyepr_get_file_stream(ostream)
 * 
 *         self.check_closed_product()             # <<<<<<<<<<<<<<
 * 
 *         with nogil:
 */
  __pyx_t_2 = __pyx_f_3epr_5Field_check_closed_product(__pyx_v_self); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 586; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "epr.pyx":588
 *         self.check_closed_product()
 * 
 *         with nogil:             # <<<<<<<<<<<<<<
 *             epr_print_field(self._ptr, fstream)
 *             stdio.fflush(fstream)
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      #endif
      /*try:*/ {

        /* "epr.pyx":589
 * 
 *         with nogil:
 *             epr_print_field(self._ptr, fstream)             # <<<<<<<<<<<<<<
 *             stdio.fflush(fstream)
 * 
 */
        epr_print_field(__pyx_v_self->_ptr, __pyx_v_fstream);

        /* "epr.pyx":590
 *         with nogil:
 *             epr_print_field(self._ptr, fstream)
 *             stdio.fflush(fstream)             # <<<<<<<<<<<<<<
 * 
 *         pyepr_check_errors()
 */
        fflush(__pyx_v_fstream);
      }

      /* "epr.pyx":588
 *         self.check_closed_product()
 * 
 *         with nogil:             # <<<<<<<<<<<<<<
 *             epr_print_field(self._ptr, fstream)
 *             stdio.fflush(fstream)
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L5;
        }
        __pyx_L5:;
      }
  }

  /* "epr.pyx":592
 *             stdio.fflush(fstream)
 * 
 *         pyepr_check_errors()             # <<<<<<<<<<<<<<
 * 
 *     #def dump_field(self):
 */
  __pyx_t_2 = __pyx_f_3epr_pyepr_check_errors(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "epr.pyx":566
 * 
 * 
 *     def print_(self, ostream=None):             # <<<<<<<<<<<<<<
 *         '''print_(self, ostream=None)
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("epr.Field.print_", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":598
 *     #    pyepr_check_errors()
 * 
 *     def get_unit(self):             # <<<<<<<<<<<<<<
 *         '''get_unit(self)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_3epr_5Field_3get_unit(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_3epr_5Field_2get_unit[] = "get_unit(self)\n\n        Gets the unit of the field\n\n        ";
static PyObject *__pyx_pw_3epr_5Field_3get_unit(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_unit (wrapper)", 0);
  __pyx_r = __pyx_pf_3epr_5Field_2get_unit(((struct __pyx_obj_3epr_Field *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_3epr_5Field_2get_unit(struct __pyx_obj_3epr_Field *__pyx_v_self) {
  char const *__pyx_v_unit;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  struct __pyx_opt_args_3epr__to_str __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_unit", 0);

  /* "epr.pyx":605
 *         '''
 * 
 *         cdef const char* unit = NULL             # <<<<<<<<<<<<<<
 * 
 *         self.check_closed_product()
 */
  __pyx_v_unit = NULL;

  /* "epr.pyx":607
 *         cdef const char* unit = NULL
 * 
 *         self.check_closed_product()             # <<<<<<<<<<<<<<
 * 
 *         unit = epr_get_field_unit(self._ptr)
 */
  __pyx_t_1 = __pyx_f_3epr_5Field_check_closed_product(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 607; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "epr.pyx":609
 *         self.check_closed_product()
 * 
 *         unit = epr_get_field_unit(self._ptr)             # <<<<<<<<<<<<<<
 * 
 *         if unit is NULL:
 */
  __pyx_v_unit = epr_get_field_unit(__pyx_v_self->_ptr);

  /* "epr.pyx":611
 *         unit = epr_get_field_unit(self._ptr)
 * 
 *         if unit is NULL:             # <<<<<<<<<<<<<<
 *             return ''
 *         else:
 */
  __pyx_t_2 = ((__pyx_v_unit == NULL) != 0);
  if (__pyx_t_2) {

    /* "epr.pyx":612
 * 
 *         if unit is NULL:
 *             return ''             # <<<<<<<<<<<<<<
 *         else:
 *             return _to_str(<char*>unit, 'ascii')
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_kp_s_);
    __pyx_r = __pyx_kp_s_;
    goto __pyx_L0;
  }
  /*else*/ {

    /* "epr.pyx":614
 *             return ''
 *         else:
 *             return _to_str(<char*>unit, 'ascii')             # <<<<<<<<<<<<<<
 * 
 *     def get_description(self):
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __Pyx_PyBytes_FromString(((char *)__pyx_v_unit)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 614; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4.__pyx_n = 1;
    __pyx_t_4.encoding = __pyx_n_s_ascii;
    __pyx_t_3 = __pyx_f_3epr__to_str(__pyx_t_1, &__pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 614; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
  }

  /* "epr.pyx":598
 *     #    pyepr_check_errors()
 * 
 *     def get_unit(self):             # <<<<<<<<<<<<<<
 *         '''get_unit(self)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("epr.Field.get_unit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":616
 *             return _to_str(<char*>unit, 'ascii')
 * 
 *     def get_description(self):             # <<<<<<<<<<<<<<
 *         '''get_description(self)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_3epr_5Field_5get_description(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_3epr_5Field_4get_description[] = "get_description(self)\n\n        Gets the description of the field\n\n        ";
static PyObject *__pyx_pw_3epr_5Field_5get_description(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_description (wrapper)", 0);
  __pyx_r = __pyx_pf_3epr_5Field_4get_description(((struct __pyx_obj_3epr_Field *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_3epr_5Field_4get_description(struct __pyx_obj_3epr_Field *__pyx_v_self) {
  char *__pyx_v_description;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  struct __pyx_opt_args_3epr__to_str __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_description", 0);

  /* "epr.pyx":623
 *         '''
 * 
 *         cdef char* description = NULL             # <<<<<<<<<<<<<<
 * 
 *         self.check_closed_product()
 */
  __pyx_v_description = NULL;

  /* "epr.pyx":625
 *         cdef char* description = NULL
 * 
 *         self.check_closed_product()             # <<<<<<<<<<<<<<
 * 
 *         description = <char*>epr_get_field_description(self._ptr)
 */
  __pyx_t_1 = __pyx_f_3epr_5Field_check_closed_product(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 625; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "epr.pyx":627
 *         self.check_closed_product()
 * 
 *         description = <char*>epr_get_field_description(self._ptr)             # <<<<<<<<<<<<<<
 * 
 *         return _to_str(description, 'ascii')
 */
  __pyx_v_description = ((char *)epr_get_field_description(__pyx_v_self->_ptr));

  /* "epr.pyx":629
 *         description = <char*>epr_get_field_description(self._ptr)
 * 
 *         return _to_str(description, 'ascii')             # <<<<<<<<<<<<<<
 * 
 *     def get_num_elems(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_description); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 629; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3.__pyx_n = 1;
  __pyx_t_3.encoding = __pyx_n_s_ascii;
  __pyx_t_2 = __pyx_f_3epr__to_str(__pyx_t_1, &__pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 629; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "epr.pyx":616
 *             return _to_str(<char*>unit, 'ascii')
 * 
 *     def get_description(self):             # <<<<<<<<<<<<<<
 *         '''get_description(self)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("epr.Field.get_description", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":631
 *         return _to_str(description, 'ascii')
 * 
 *     def get_num_elems(self):             # <<<<<<<<<<<<<<
 *         '''get_num_elems(self)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_3epr_5Field_7get_num_elems(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_3epr_5Field_6get_num_elems[] = "get_num_elems(self)\n\n        Gets the number of elements of the field\n\n        ";
static PyObject *__pyx_pw_3epr_5Field_7get_num_elems(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_num_elems (wrapper)", 0);
  __pyx_r = __pyx_pf_3epr_5Field_6get_num_elems(((struct __pyx_obj_3epr_Field *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_3epr_5Field_6get_num_elems(struct __pyx_obj_3epr_Field *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_num_elems", 0);

  /* "epr.pyx":638
 *         '''
 * 
 *         self.check_closed_product()             # <<<<<<<<<<<<<<
 * 
 *         return epr_get_field_num_elems(self._ptr)
 */
  __pyx_t_1 = __pyx_f_3epr_5Field_check_closed_product(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 638; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "epr.pyx":640
 *         self.check_closed_product()
 * 
 *         return epr_get_field_num_elems(self._ptr)             # <<<<<<<<<<<<<<
 * 
 *     def get_name(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_uint(epr_get_field_num_elems(__pyx_v_self->_ptr)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 640; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "epr.pyx":631
 *         return _to_str(description, 'ascii')
 * 
 *     def get_num_elems(self):             # <<<<<<<<<<<<<<
 *         '''get_num_elems(self)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("epr.Field.get_num_elems", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":642
 *         return epr_get_field_num_elems(self._ptr)
 * 
 *     def get_name(self):             # <<<<<<<<<<<<<<
 *         '''get_name(self)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_3epr_5Field_9get_name(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_3epr_5Field_8get_name[] = "get_name(self)\n\n        Gets the name of the field\n\n        ";
static PyObject *__pyx_pw_3epr_5Field_9get_name(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_name (wrapper)", 0);
  __pyx_r = __pyx_pf_3epr_5Field_8get_name(((struct __pyx_obj_3epr_Field *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_3epr_5Field_8get_name(struct __pyx_obj_3epr_Field *__pyx_v_self) {
  char *__pyx_v_name;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  struct __pyx_opt_args_3epr__to_str __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_name", 0);

  /* "epr.pyx":649
 *         '''
 * 
 *         cdef char* name = NULL             # <<<<<<<<<<<<<<
 * 
 *         self.check_closed_product()
 */
  __pyx_v_name = NULL;

  /* "epr.pyx":651
 *         cdef char* name = NULL
 * 
 *         self.check_closed_product()             # <<<<<<<<<<<<<<
 * 
 *         name = <char*>epr_get_field_name(self._ptr)
 */
  __pyx_t_1 = __pyx_f_3epr_5Field_check_closed_product(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 651; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "epr.pyx":653
 *         self.check_closed_product()
 * 
 *         name = <char*>epr_get_field_name(self._ptr)             # <<<<<<<<<<<<<<
 * 
 *         return _to_str(name, 'ascii')
 */
  __pyx_v_name = ((char *)epr_get_field_name(__pyx_v_self->_ptr));

  /* "epr.pyx":655
 *         name = <char*>epr_get_field_name(self._ptr)
 * 
 *         return _to_str(name, 'ascii')             # <<<<<<<<<<<<<<
 * 
 *     def get_type(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_name); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 655; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3.__pyx_n = 1;
  __pyx_t_3.encoding = __pyx_n_s_ascii;
  __pyx_t_2 = __pyx_f_3epr__to_str(__pyx_t_1, &__pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 655; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "epr.pyx":642
 *         return epr_get_field_num_elems(self._ptr)
 * 
 *     def get_name(self):             # <<<<<<<<<<<<<<
 *         '''get_name(self)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("epr.Field.get_name", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":657
 *         return _to_str(name, 'ascii')
 * 
 *     def get_type(self):             # <<<<<<<<<<<<<<
 *         '''get_type(self)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_3epr_5Field_11get_type(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_3epr_5Field_10get_type[] = "get_type(self)\n\n        Gets the type of the field\n\n        ";
static PyObject *__pyx_pw_3epr_5Field_11get_type(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_type (wrapper)", 0);
  __pyx_r = __pyx_pf_3epr_5Field_10get_type(((struct __pyx_obj_3epr_Field *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_3epr_5Field_10get_type(struct __pyx_obj_3epr_Field *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_type", 0);

  /* "epr.pyx":664
 *         '''
 * 
 *         self.check_closed_product()             # <<<<<<<<<<<<<<
 * 
 *         return epr_get_field_type(self._ptr)
 */
  __pyx_t_1 = __pyx_f_3epr_5Field_check_closed_product(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 664; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "epr.pyx":666
 *         self.check_closed_product()
 * 
 *         return epr_get_field_type(self._ptr)             # <<<<<<<<<<<<<<
 * 
 *     def get_elem(self, uint index=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyInt_FromLong(epr_get_field_type(__pyx_v_self->_ptr)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 666; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "epr.pyx":657
 *         return _to_str(name, 'ascii')
 * 
 *     def get_type(self):             # <<<<<<<<<<<<<<
 *         '''get_type(self)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("epr.Field.get_type", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":668
 *         return epr_get_field_type(self._ptr)
 * 
 *     def get_elem(self, uint index=0):             # <<<<<<<<<<<<<<
 *         '''get_elem(self, index=0)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_3epr_5Field_13get_elem(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_3epr_5Field_12get_elem[] = "get_elem(self, index=0)\n\n        Field single element access\n\n        This function is for getting the elements of a field.\n\n        :param index:\n            the zero-based index of element to be returned, must not be\n            negative\n        :returns:\n            the typed value from given field\n\n        ";
static PyObject *__pyx_pw_3epr_5Field_13get_elem(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  uint __pyx_v_index;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_elem (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_index,0};
    PyObject* values[1] = {0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_index);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "get_elem") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 668; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_index = __Pyx_PyInt_As_uint(values[0]); if (unlikely((__pyx_v_index == (uint)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 668; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_index = ((uint)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("get_elem", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 668; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("epr.Field.get_elem", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_3epr_5Field_12get_elem(((struct __pyx_obj_3epr_Field *)__pyx_v_self), __pyx_v_index);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_3epr_5Field_12get_elem(struct __pyx_obj_3epr_Field *__pyx_v_self, uint __pyx_v_index) {
  EPR_STime *__pyx_v_eprtime;
  EPR_EDataTypeId __pyx_v_etype;
  PyObject *__pyx_v_val = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_elem", 0);

  /* "epr.pyx":685
 *         cdef EPR_STime* eprtime
 * 
 *         self.check_closed_product()             # <<<<<<<<<<<<<<
 * 
 *         etype = epr_get_field_type(self._ptr)
 */
  __pyx_t_1 = __pyx_f_3epr_5Field_check_closed_product(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 685; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "epr.pyx":687
 *         self.check_closed_product()
 * 
 *         etype = epr_get_field_type(self._ptr)             # <<<<<<<<<<<<<<
 * 
 *         if etype == e_tid_uchar:
 */
  __pyx_v_etype = epr_get_field_type(__pyx_v_self->_ptr);

  /* "epr.pyx":711
 *         #elif etype == e_tid_spare:
 *         #    val = epr_get_field_elem_as_str(self._ptr)
 *         elif etype == e_tid_time:             # <<<<<<<<<<<<<<
 *             if index != 0:
 *                 raise ValueError('invalid index: %d' % index)
 */
  switch (__pyx_v_etype) {

    /* "epr.pyx":689
 *         etype = epr_get_field_type(self._ptr)
 * 
 *         if etype == e_tid_uchar:             # <<<<<<<<<<<<<<
 *             val = epr_get_field_elem_as_uchar(self._ptr, index)
 *         elif etype == e_tid_char:
 */
    case e_tid_uchar:

    /* "epr.pyx":690
 * 
 *         if etype == e_tid_uchar:
 *             val = epr_get_field_elem_as_uchar(self._ptr, index)             # <<<<<<<<<<<<<<
 *         elif etype == e_tid_char:
 *             val = epr_get_field_elem_as_char(self._ptr, index)
 */
    __pyx_t_1 = __Pyx_PyInt_From_uchar(epr_get_field_elem_as_uchar(__pyx_v_self->_ptr, __pyx_v_index)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 690; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_val = __pyx_t_1;
    __pyx_t_1 = 0;
    break;

    /* "epr.pyx":691
 *         if etype == e_tid_uchar:
 *             val = epr_get_field_elem_as_uchar(self._ptr, index)
 *         elif etype == e_tid_char:             # <<<<<<<<<<<<<<
 *             val = epr_get_field_elem_as_char(self._ptr, index)
 *         elif etype == e_tid_ushort:
 */
    case e_tid_char:

    /* "epr.pyx":692
 *             val = epr_get_field_elem_as_uchar(self._ptr, index)
 *         elif etype == e_tid_char:
 *             val = epr_get_field_elem_as_char(self._ptr, index)             # <<<<<<<<<<<<<<
 *         elif etype == e_tid_ushort:
 *             val = epr_get_field_elem_as_ushort(self._ptr, index)
 */
    __pyx_t_1 = __Pyx_PyInt_From_char(epr_get_field_elem_as_char(__pyx_v_self->_ptr, __pyx_v_index)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 692; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_val = __pyx_t_1;
    __pyx_t_1 = 0;
    break;

    /* "epr.pyx":693
 *         elif etype == e_tid_char:
 *             val = epr_get_field_elem_as_char(self._ptr, index)
 *         elif etype == e_tid_ushort:             # <<<<<<<<<<<<<<
 *             val = epr_get_field_elem_as_ushort(self._ptr, index)
 *         elif etype == e_tid_short:
 */
    case e_tid_ushort:

    /* "epr.pyx":694
 *             val = epr_get_field_elem_as_char(self._ptr, index)
 *         elif etype == e_tid_ushort:
 *             val = epr_get_field_elem_as_ushort(self._ptr, index)             # <<<<<<<<<<<<<<
 *         elif etype == e_tid_short:
 *             val = epr_get_field_elem_as_short(self._ptr, index)
 */
    __pyx_t_1 = __Pyx_PyInt_From_ushort(epr_get_field_elem_as_ushort(__pyx_v_self->_ptr, __pyx_v_index)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 694; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_val = __pyx_t_1;
    __pyx_t_1 = 0;
    break;

    /* "epr.pyx":695
 *         elif etype == e_tid_ushort:
 *             val = epr_get_field_elem_as_ushort(self._ptr, index)
 *         elif etype == e_tid_short:             # <<<<<<<<<<<<<<
 *             val = epr_get_field_elem_as_short(self._ptr, index)
 *         elif etype == e_tid_uint:
 */
    case e_tid_short:

    /* "epr.pyx":696
 *             val = epr_get_field_elem_as_ushort(self._ptr, index)
 *         elif etype == e_tid_short:
 *             val = epr_get_field_elem_as_short(self._ptr, index)             # <<<<<<<<<<<<<<
 *         elif etype == e_tid_uint:
 *             val = epr_get_field_elem_as_uint(self._ptr, index)
 */
    __pyx_t_1 = __Pyx_PyInt_From_short(epr_get_field_elem_as_short(__pyx_v_self->_ptr, __pyx_v_index)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 696; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_val = __pyx_t_1;
    __pyx_t_1 = 0;
    break;

    /* "epr.pyx":697
 *         elif etype == e_tid_short:
 *             val = epr_get_field_elem_as_short(self._ptr, index)
 *         elif etype == e_tid_uint:             # <<<<<<<<<<<<<<
 *             val = epr_get_field_elem_as_uint(self._ptr, index)
 *         elif etype == e_tid_int:
 */
    case e_tid_uint:

    /* "epr.pyx":698
 *             val = epr_get_field_elem_as_short(self._ptr, index)
 *         elif etype == e_tid_uint:
 *             val = epr_get_field_elem_as_uint(self._ptr, index)             # <<<<<<<<<<<<<<
 *         elif etype == e_tid_int:
 *             val = epr_get_field_elem_as_int(self._ptr, index)
 */
    __pyx_t_1 = __Pyx_PyInt_From_uint(epr_get_field_elem_as_uint(__pyx_v_self->_ptr, __pyx_v_index)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 698; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_val = __pyx_t_1;
    __pyx_t_1 = 0;
    break;

    /* "epr.pyx":699
 *         elif etype == e_tid_uint:
 *             val = epr_get_field_elem_as_uint(self._ptr, index)
 *         elif etype == e_tid_int:             # <<<<<<<<<<<<<<
 *             val = epr_get_field_elem_as_int(self._ptr, index)
 *         elif etype == e_tid_float:
 */
    case e_tid_int:

    /* "epr.pyx":700
 *             val = epr_get_field_elem_as_uint(self._ptr, index)
 *         elif etype == e_tid_int:
 *             val = epr_get_field_elem_as_int(self._ptr, index)             # <<<<<<<<<<<<<<
 *         elif etype == e_tid_float:
 *             val = epr_get_field_elem_as_float(self._ptr, index)
 */
    __pyx_t_1 = __Pyx_PyInt_From_int(epr_get_field_elem_as_int(__pyx_v_self->_ptr, __pyx_v_index)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 700; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_val = __pyx_t_1;
    __pyx_t_1 = 0;
    break;

    /* "epr.pyx":701
 *         elif etype == e_tid_int:
 *             val = epr_get_field_elem_as_int(self._ptr, index)
 *         elif etype == e_tid_float:             # <<<<<<<<<<<<<<
 *             val = epr_get_field_elem_as_float(self._ptr, index)
 *         elif etype == e_tid_double:
 */
    case e_tid_float:

    /* "epr.pyx":702
 *             val = epr_get_field_elem_as_int(self._ptr, index)
 *         elif etype == e_tid_float:
 *             val = epr_get_field_elem_as_float(self._ptr, index)             # <<<<<<<<<<<<<<
 *         elif etype == e_tid_double:
 *             val = epr_get_field_elem_as_double(self._ptr, index)
 */
    __pyx_t_1 = PyFloat_FromDouble(epr_get_field_elem_as_float(__pyx_v_self->_ptr, __pyx_v_index)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 702; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_val = __pyx_t_1;
    __pyx_t_1 = 0;
    break;

    /* "epr.pyx":703
 *         elif etype == e_tid_float:
 *             val = epr_get_field_elem_as_float(self._ptr, index)
 *         elif etype == e_tid_double:             # <<<<<<<<<<<<<<
 *             val = epr_get_field_elem_as_double(self._ptr, index)
 *         elif etype == e_tid_string:
 */
    case e_tid_double:

    /* "epr.pyx":704
 *             val = epr_get_field_elem_as_float(self._ptr, index)
 *         elif etype == e_tid_double:
 *             val = epr_get_field_elem_as_double(self._ptr, index)             # <<<<<<<<<<<<<<
 *         elif etype == e_tid_string:
 *             if index != 0:
 */
    __pyx_t_1 = PyFloat_FromDouble(epr_get_field_elem_as_double(__pyx_v_self->_ptr, __pyx_v_index)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 704; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_val = __pyx_t_1;
    __pyx_t_1 = 0;
    break;

    /* "epr.pyx":705
 *         elif etype == e_tid_double:
 *             val = epr_get_field_elem_as_double(self._ptr, index)
 *         elif etype == e_tid_string:             # <<<<<<<<<<<<<<
 *             if index != 0:
 *                 raise ValueError('invalid index: %d' % index)
 */
    case e_tid_string:

    /* "epr.pyx":706
 *             val = epr_get_field_elem_as_double(self._ptr, index)
 *         elif etype == e_tid_string:
 *             if index != 0:             # <<<<<<<<<<<<<<
 *                 raise ValueError('invalid index: %d' % index)
 *             val = <char*>epr_get_field_elem_as_str(self._ptr)
 */
    __pyx_t_2 = ((__pyx_v_index != 0) != 0);
    if (__pyx_t_2) {

      /* "epr.pyx":707
 *         elif etype == e_tid_string:
 *             if index != 0:
 *                 raise ValueError('invalid index: %d' % index)             # <<<<<<<<<<<<<<
 *             val = <char*>epr_get_field_elem_as_str(self._ptr)
 *         #elif etype == e_tid_spare:
 */
      __pyx_t_1 = __Pyx_PyInt_From_uint(__pyx_v_index); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 707; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_invalid_index_d, __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 707; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 707; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_3);
      __pyx_t_3 = 0;
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 707; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_Raise(__pyx_t_3, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 707; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }

    /* "epr.pyx":708
 *             if index != 0:
 *                 raise ValueError('invalid index: %d' % index)
 *             val = <char*>epr_get_field_elem_as_str(self._ptr)             # <<<<<<<<<<<<<<
 *         #elif etype == e_tid_spare:
 *         #    val = epr_get_field_elem_as_str(self._ptr)
 */
    __pyx_t_3 = __Pyx_PyBytes_FromString(((char *)epr_get_field_elem_as_str(__pyx_v_self->_ptr))); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_v_val = __pyx_t_3;
    __pyx_t_3 = 0;
    break;

    /* "epr.pyx":711
 *         #elif etype == e_tid_spare:
 *         #    val = epr_get_field_elem_as_str(self._ptr)
 *         elif etype == e_tid_time:             # <<<<<<<<<<<<<<
 *             if index != 0:
 *                 raise ValueError('invalid index: %d' % index)
 */
    case e_tid_time:

    /* "epr.pyx":712
 *         #    val = epr_get_field_elem_as_str(self._ptr)
 *         elif etype == e_tid_time:
 *             if index != 0:             # <<<<<<<<<<<<<<
 *                 raise ValueError('invalid index: %d' % index)
 * 
 */
    __pyx_t_2 = ((__pyx_v_index != 0) != 0);
    if (__pyx_t_2) {

      /* "epr.pyx":713
 *         elif etype == e_tid_time:
 *             if index != 0:
 *                 raise ValueError('invalid index: %d' % index)             # <<<<<<<<<<<<<<
 * 
 *             # use casting to silence warnings
 */
      __pyx_t_3 = __Pyx_PyInt_From_uint(__pyx_v_index); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_invalid_index_d, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
      __Pyx_GIVEREF(__pyx_t_1);
      __pyx_t_1 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_Raise(__pyx_t_1, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }

    /* "epr.pyx":716
 * 
 *             # use casting to silence warnings
 *             eprtime = <EPR_STime*>epr_get_field_elem_as_mjd(self._ptr)             # <<<<<<<<<<<<<<
 *             val = EPRTime(eprtime.days, eprtime.seconds, eprtime.microseconds)
 *         else:
 */
    __pyx_v_eprtime = ((EPR_STime *)epr_get_field_elem_as_mjd(__pyx_v_self->_ptr));

    /* "epr.pyx":717
 *             # use casting to silence warnings
 *             eprtime = <EPR_STime*>epr_get_field_elem_as_mjd(self._ptr)
 *             val = EPRTime(eprtime.days, eprtime.seconds, eprtime.microseconds)             # <<<<<<<<<<<<<<
 *         else:
 *             raise ValueError('invalid field type')
 */
    __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_EPRTime); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 717; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_eprtime->days); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 717; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyInt_From_uint(__pyx_v_eprtime->seconds); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 717; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = __Pyx_PyInt_From_uint(__pyx_v_eprtime->microseconds); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 717; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 717; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_5);
    __pyx_t_3 = 0;
    __pyx_t_4 = 0;
    __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_6, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 717; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_v_val = __pyx_t_5;
    __pyx_t_5 = 0;
    break;
    default:

    /* "epr.pyx":719
 *             val = EPRTime(eprtime.days, eprtime.seconds, eprtime.microseconds)
 *         else:
 *             raise ValueError('invalid field type')             # <<<<<<<<<<<<<<
 * 
 *         pyepr_check_errors()
 */
    __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 719; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_Raise(__pyx_t_5, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 719; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    break;
  }

  /* "epr.pyx":721
 *             raise ValueError('invalid field type')
 * 
 *         pyepr_check_errors()             # <<<<<<<<<<<<<<
 *         return val
 * 
 */
  __pyx_t_5 = __pyx_f_3epr_pyepr_check_errors(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 721; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "epr.pyx":722
 * 
 *         pyepr_check_errors()
 *         return val             # <<<<<<<<<<<<<<
 * 
 *     def get_elems(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_val);
  __pyx_r = __pyx_v_val;
  goto __pyx_L0;

  /* "epr.pyx":668
 *         return epr_get_field_type(self._ptr)
 * 
 *     def get_elem(self, uint index=0):             # <<<<<<<<<<<<<<
 *         '''get_elem(self, index=0)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("epr.Field.get_elem", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_val);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":724
 *         return val
 * 
 *     def get_elems(self):             # <<<<<<<<<<<<<<
 *         '''get_elems(self)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_3epr_5Field_15get_elems(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_3epr_5Field_14get_elems[] = "get_elems(self)\n\n        Field array element access\n\n        This function is for getting an array of field elements of the\n        field.\n\n        :returns:\n            the data array (:class:`numpy.ndarray`) having the type of\n            the field\n\n        ";
static PyObject *__pyx_pw_3epr_5Field_15get_elems(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_elems (wrapper)", 0);
  __pyx_r = __pyx_pf_3epr_5Field_14get_elems(((struct __pyx_obj_3epr_Field *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_3epr_5Field_14get_elems(struct __pyx_obj_3epr_Field *__pyx_v_self) {
  void *__pyx_v_buf;
  int __pyx_v_nd;
  npy_intp __pyx_v_shape[1];
  PyArrayObject *__pyx_v_out = 0;
  struct EPR_Time *__pyx_v_t;
  enum NPY_TYPES __pyx_v_dtype;
  EPR_EDataTypeId __pyx_v_etype;
  PyObject *__pyx_v_msg = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  struct __pyx_opt_args_3epr_pyepr_null_ptr_error __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_elems", 0);

  /* "epr.pyx":738
 *         '''
 * 
 *         cdef void* buf = NULL             # <<<<<<<<<<<<<<
 *         cdef int nd = 1
 *         cdef np.npy_intp shape[1]
 */
  __pyx_v_buf = NULL;

  /* "epr.pyx":739
 * 
 *         cdef void* buf = NULL
 *         cdef int nd = 1             # <<<<<<<<<<<<<<
 *         cdef np.npy_intp shape[1]
 *         cdef np.ndarray out
 */
  __pyx_v_nd = 1;

  /* "epr.pyx":742
 *         cdef np.npy_intp shape[1]
 *         cdef np.ndarray out
 *         cdef EPR_Time* t = NULL             # <<<<<<<<<<<<<<
 *         cdef np.NPY_TYPES dtype
 * 
 */
  __pyx_v_t = NULL;

  /* "epr.pyx":745
 *         cdef np.NPY_TYPES dtype
 * 
 *         self.check_closed_product()             # <<<<<<<<<<<<<<
 * 
 *         shape[0] = epr_get_field_num_elems(self._ptr)
 */
  __pyx_t_1 = __pyx_f_3epr_5Field_check_closed_product(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 745; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "epr.pyx":747
 *         self.check_closed_product()
 * 
 *         shape[0] = epr_get_field_num_elems(self._ptr)             # <<<<<<<<<<<<<<
 *         etype = epr_get_field_type(self._ptr)
 *         msg = 'Filed("%s") elems pointer is null' % self.get_name()
 */
  (__pyx_v_shape[0]) = epr_get_field_num_elems(__pyx_v_self->_ptr);

  /* "epr.pyx":748
 * 
 *         shape[0] = epr_get_field_num_elems(self._ptr)
 *         etype = epr_get_field_type(self._ptr)             # <<<<<<<<<<<<<<
 *         msg = 'Filed("%s") elems pointer is null' % self.get_name()
 * 
 */
  __pyx_v_etype = epr_get_field_type(__pyx_v_self->_ptr);

  /* "epr.pyx":749
 *         shape[0] = epr_get_field_num_elems(self._ptr)
 *         etype = epr_get_field_type(self._ptr)
 *         msg = 'Filed("%s") elems pointer is null' % self.get_name()             # <<<<<<<<<<<<<<
 * 
 *         if etype == e_tid_time:
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_get_name); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 749; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 749; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_Filed_s_elems_pointer_is_null, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 749; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_msg = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "epr.pyx":751
 *         msg = 'Filed("%s") elems pointer is null' % self.get_name()
 * 
 *         if etype == e_tid_time:             # <<<<<<<<<<<<<<
 *             if shape[0] != 1:
 *                 raise ValueError(
 */
  __pyx_t_3 = ((__pyx_v_etype == e_tid_time) != 0);
  if (__pyx_t_3) {

    /* "epr.pyx":752
 * 
 *         if etype == e_tid_time:
 *             if shape[0] != 1:             # <<<<<<<<<<<<<<
 *                 raise ValueError(
 *                     'unexpected number of elements: %d' % shape[0])
 */
    __pyx_t_3 = (((__pyx_v_shape[0]) != 1) != 0);
    if (__pyx_t_3) {

      /* "epr.pyx":754
 *             if shape[0] != 1:
 *                 raise ValueError(
 *                     'unexpected number of elements: %d' % shape[0])             # <<<<<<<<<<<<<<
 *             t = <EPR_Time*>epr_get_field_elem_as_mjd(self._ptr)
 *             if t is NULL:
 */
      __pyx_t_1 = __Pyx_PyInt_From_Py_intptr_t((__pyx_v_shape[0])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 754; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_unexpected_number_of_elements_d, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 754; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "epr.pyx":753
 *         if etype == e_tid_time:
 *             if shape[0] != 1:
 *                 raise ValueError(             # <<<<<<<<<<<<<<
 *                     'unexpected number of elements: %d' % shape[0])
 *             t = <EPR_Time*>epr_get_field_elem_as_mjd(self._ptr)
 */
      __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 753; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_2);
      __pyx_t_2 = 0;
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 753; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_Raise(__pyx_t_2, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 753; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }

    /* "epr.pyx":755
 *                 raise ValueError(
 *                     'unexpected number of elements: %d' % shape[0])
 *             t = <EPR_Time*>epr_get_field_elem_as_mjd(self._ptr)             # <<<<<<<<<<<<<<
 *             if t is NULL:
 *                 pyepr_null_ptr_error(msg)
 */
    __pyx_v_t = ((struct EPR_Time *)epr_get_field_elem_as_mjd(__pyx_v_self->_ptr));

    /* "epr.pyx":756
 *                     'unexpected number of elements: %d' % shape[0])
 *             t = <EPR_Time*>epr_get_field_elem_as_mjd(self._ptr)
 *             if t is NULL:             # <<<<<<<<<<<<<<
 *                 pyepr_null_ptr_error(msg)
 * 
 */
    __pyx_t_3 = ((__pyx_v_t == NULL) != 0);
    if (__pyx_t_3) {

      /* "epr.pyx":757
 *             t = <EPR_Time*>epr_get_field_elem_as_mjd(self._ptr)
 *             if t is NULL:
 *                 pyepr_null_ptr_error(msg)             # <<<<<<<<<<<<<<
 * 
 *             out = np.ndarray(1, MJD)
 */
      __pyx_t_4.__pyx_n = 1;
      __pyx_t_4.msg = __pyx_v_msg;
      __pyx_t_2 = __pyx_f_3epr_pyepr_null_ptr_error(&__pyx_t_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 757; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      goto __pyx_L5;
    }
    __pyx_L5:;

    /* "epr.pyx":759
 *                 pyepr_null_ptr_error(msg)
 * 
 *             out = np.ndarray(1, MJD)             # <<<<<<<<<<<<<<
 *             out[0]['days'] = t.days
 *             out[0]['seconds'] = t.seconds
 */
    __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_MJD); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 759; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 759; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_int_1);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_int_1);
    __Pyx_GIVEREF(__pyx_int_1);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_2);
    __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5numpy_ndarray)), __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 759; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_v_out = ((PyArrayObject *)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "epr.pyx":760
 * 
 *             out = np.ndarray(1, MJD)
 *             out[0]['days'] = t.days             # <<<<<<<<<<<<<<
 *             out[0]['seconds'] = t.seconds
 *             out[0]['microseconds'] = t.microseconds
 */
    __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_t->days); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 760; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = __Pyx_GetItemInt(((PyObject *)__pyx_v_out), 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 760; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_1);
    if (unlikely(PyObject_SetItem(__pyx_t_1, __pyx_n_s_days, __pyx_t_2) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 760; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "epr.pyx":761
 *             out = np.ndarray(1, MJD)
 *             out[0]['days'] = t.days
 *             out[0]['seconds'] = t.seconds             # <<<<<<<<<<<<<<
 *             out[0]['microseconds'] = t.microseconds
 * 
 */
    __pyx_t_2 = __Pyx_PyInt_From_uint(__pyx_v_t->seconds); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 761; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = __Pyx_GetItemInt(((PyObject *)__pyx_v_out), 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 761; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_1);
    if (unlikely(PyObject_SetItem(__pyx_t_1, __pyx_n_s_seconds, __pyx_t_2) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 761; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "epr.pyx":762
 *             out[0]['days'] = t.days
 *             out[0]['seconds'] = t.seconds
 *             out[0]['microseconds'] = t.microseconds             # <<<<<<<<<<<<<<
 * 
 *             return out
 */
    __pyx_t_2 = __Pyx_PyInt_From_uint(__pyx_v_t->microseconds); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 762; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = __Pyx_GetItemInt(((PyObject *)__pyx_v_out), 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 762; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_1);
    if (unlikely(PyObject_SetItem(__pyx_t_1, __pyx_n_s_microseconds, __pyx_t_2) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 762; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "epr.pyx":764
 *             out[0]['microseconds'] = t.microseconds
 * 
 *             return out             # <<<<<<<<<<<<<<
 * 
 *         if etype == e_tid_uchar:
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)__pyx_v_out));
    __pyx_r = ((PyObject *)__pyx_v_out);
    goto __pyx_L0;
  }

  /* "epr.pyx":806
 *             if buf is NULL:
 *                 pyepr_null_ptr_error(msg)
 *         elif etype == e_tid_string:             # <<<<<<<<<<<<<<
 *             if shape[0] != 1:
 *                 raise ValueError(
 */
  switch (__pyx_v_etype) {

    /* "epr.pyx":766
 *             return out
 * 
 *         if etype == e_tid_uchar:             # <<<<<<<<<<<<<<
 *             dtype = np.NPY_UBYTE
 *             buf = <uchar*>epr_get_field_elems_uchar(self._ptr)
 */
    case e_tid_uchar:

    /* "epr.pyx":767
 * 
 *         if etype == e_tid_uchar:
 *             dtype = np.NPY_UBYTE             # <<<<<<<<<<<<<<
 *             buf = <uchar*>epr_get_field_elems_uchar(self._ptr)
 *             if buf is NULL:
 */
    __pyx_v_dtype = NPY_UBYTE;

    /* "epr.pyx":768
 *         if etype == e_tid_uchar:
 *             dtype = np.NPY_UBYTE
 *             buf = <uchar*>epr_get_field_elems_uchar(self._ptr)             # <<<<<<<<<<<<<<
 *             if buf is NULL:
 *                 pyepr_null_ptr_error(msg)
 */
    __pyx_v_buf = ((uchar *)epr_get_field_elems_uchar(__pyx_v_self->_ptr));

    /* "epr.pyx":769
 *             dtype = np.NPY_UBYTE
 *             buf = <uchar*>epr_get_field_elems_uchar(self._ptr)
 *             if buf is NULL:             # <<<<<<<<<<<<<<
 *                 pyepr_null_ptr_error(msg)
 *         elif etype == e_tid_char:
 */
    __pyx_t_3 = ((__pyx_v_buf == NULL) != 0);
    if (__pyx_t_3) {

      /* "epr.pyx":770
 *             buf = <uchar*>epr_get_field_elems_uchar(self._ptr)
 *             if buf is NULL:
 *                 pyepr_null_ptr_error(msg)             # <<<<<<<<<<<<<<
 *         elif etype == e_tid_char:
 *             dtype = np.NPY_BYTE
 */
      __pyx_t_4.__pyx_n = 1;
      __pyx_t_4.msg = __pyx_v_msg;
      __pyx_t_2 = __pyx_f_3epr_pyepr_null_ptr_error(&__pyx_t_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 770; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      goto __pyx_L6;
    }
    __pyx_L6:;
    break;

    /* "epr.pyx":771
 *             if buf is NULL:
 *                 pyepr_null_ptr_error(msg)
 *         elif etype == e_tid_char:             # <<<<<<<<<<<<<<
 *             dtype = np.NPY_BYTE
 *             buf = <char*>epr_get_field_elems_char(self._ptr)
 */
    case e_tid_char:

    /* "epr.pyx":772
 *                 pyepr_null_ptr_error(msg)
 *         elif etype == e_tid_char:
 *             dtype = np.NPY_BYTE             # <<<<<<<<<<<<<<
 *             buf = <char*>epr_get_field_elems_char(self._ptr)
 *             if buf is NULL:
 */
    __pyx_v_dtype = NPY_BYTE;

    /* "epr.pyx":773
 *         elif etype == e_tid_char:
 *             dtype = np.NPY_BYTE
 *             buf = <char*>epr_get_field_elems_char(self._ptr)             # <<<<<<<<<<<<<<
 *             if buf is NULL:
 *                 pyepr_null_ptr_error(msg)
 */
    __pyx_v_buf = ((char *)epr_get_field_elems_char(__pyx_v_self->_ptr));

    /* "epr.pyx":774
 *             dtype = np.NPY_BYTE
 *             buf = <char*>epr_get_field_elems_char(self._ptr)
 *             if buf is NULL:             # <<<<<<<<<<<<<<
 *                 pyepr_null_ptr_error(msg)
 *         elif etype == e_tid_ushort:
 */
    __pyx_t_3 = ((__pyx_v_buf == NULL) != 0);
    if (__pyx_t_3) {

      /* "epr.pyx":775
 *             buf = <char*>epr_get_field_elems_char(self._ptr)
 *             if buf is NULL:
 *                 pyepr_null_ptr_error(msg)             # <<<<<<<<<<<<<<
 *         elif etype == e_tid_ushort:
 *             dtype = np.NPY_USHORT
 */
      __pyx_t_4.__pyx_n = 1;
      __pyx_t_4.msg = __pyx_v_msg;
      __pyx_t_2 = __pyx_f_3epr_pyepr_null_ptr_error(&__pyx_t_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 775; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      goto __pyx_L7;
    }
    __pyx_L7:;
    break;

    /* "epr.pyx":776
 *             if buf is NULL:
 *                 pyepr_null_ptr_error(msg)
 *         elif etype == e_tid_ushort:             # <<<<<<<<<<<<<<
 *             dtype = np.NPY_USHORT
 *             buf = <ushort*>epr_get_field_elems_ushort(self._ptr)
 */
    case e_tid_ushort:

    /* "epr.pyx":777
 *                 pyepr_null_ptr_error(msg)
 *         elif etype == e_tid_ushort:
 *             dtype = np.NPY_USHORT             # <<<<<<<<<<<<<<
 *             buf = <ushort*>epr_get_field_elems_ushort(self._ptr)
 *             if buf is NULL:
 */
    __pyx_v_dtype = NPY_USHORT;

    /* "epr.pyx":778
 *         elif etype == e_tid_ushort:
 *             dtype = np.NPY_USHORT
 *             buf = <ushort*>epr_get_field_elems_ushort(self._ptr)             # <<<<<<<<<<<<<<
 *             if buf is NULL:
 *                 pyepr_null_ptr_error(msg)
 */
    __pyx_v_buf = ((ushort *)epr_get_field_elems_ushort(__pyx_v_self->_ptr));

    /* "epr.pyx":779
 *             dtype = np.NPY_USHORT
 *             buf = <ushort*>epr_get_field_elems_ushort(self._ptr)
 *             if buf is NULL:             # <<<<<<<<<<<<<<
 *                 pyepr_null_ptr_error(msg)
 *         elif etype == e_tid_short:
 */
    __pyx_t_3 = ((__pyx_v_buf == NULL) != 0);
    if (__pyx_t_3) {

      /* "epr.pyx":780
 *             buf = <ushort*>epr_get_field_elems_ushort(self._ptr)
 *             if buf is NULL:
 *                 pyepr_null_ptr_error(msg)             # <<<<<<<<<<<<<<
 *         elif etype == e_tid_short:
 *             dtype = np.NPY_SHORT
 */
      __pyx_t_4.__pyx_n = 1;
      __pyx_t_4.msg = __pyx_v_msg;
      __pyx_t_2 = __pyx_f_3epr_pyepr_null_ptr_error(&__pyx_t_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 780; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      goto __pyx_L8;
    }
    __pyx_L8:;
    break;

    /* "epr.pyx":781
 *             if buf is NULL:
 *                 pyepr_null_ptr_error(msg)
 *         elif etype == e_tid_short:             # <<<<<<<<<<<<<<
 *             dtype = np.NPY_SHORT
 *             buf = <short*>epr_get_field_elems_short(self._ptr)
 */
    case e_tid_short:

    /* "epr.pyx":782
 *                 pyepr_null_ptr_error(msg)
 *         elif etype == e_tid_short:
 *             dtype = np.NPY_SHORT             # <<<<<<<<<<<<<<
 *             buf = <short*>epr_get_field_elems_short(self._ptr)
 *             if buf is NULL:
 */
    __pyx_v_dtype = NPY_SHORT;

    /* "epr.pyx":783
 *         elif etype == e_tid_short:
 *             dtype = np.NPY_SHORT
 *             buf = <short*>epr_get_field_elems_short(self._ptr)             # <<<<<<<<<<<<<<
 *             if buf is NULL:
 *                 pyepr_null_ptr_error(msg)
 */
    __pyx_v_buf = ((short *)epr_get_field_elems_short(__pyx_v_self->_ptr));

    /* "epr.pyx":784
 *             dtype = np.NPY_SHORT
 *             buf = <short*>epr_get_field_elems_short(self._ptr)
 *             if buf is NULL:             # <<<<<<<<<<<<<<
 *                 pyepr_null_ptr_error(msg)
 *         elif etype == e_tid_uint:
 */
    __pyx_t_3 = ((__pyx_v_buf == NULL) != 0);
    if (__pyx_t_3) {

      /* "epr.pyx":785
 *             buf = <short*>epr_get_field_elems_short(self._ptr)
 *             if buf is NULL:
 *                 pyepr_null_ptr_error(msg)             # <<<<<<<<<<<<<<
 *         elif etype == e_tid_uint:
 *             dtype = np.NPY_UINT
 */
      __pyx_t_4.__pyx_n = 1;
      __pyx_t_4.msg = __pyx_v_msg;
      __pyx_t_2 = __pyx_f_3epr_pyepr_null_ptr_error(&__pyx_t_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      goto __pyx_L9;
    }
    __pyx_L9:;
    break;

    /* "epr.pyx":786
 *             if buf is NULL:
 *                 pyepr_null_ptr_error(msg)
 *         elif etype == e_tid_uint:             # <<<<<<<<<<<<<<
 *             dtype = np.NPY_UINT
 *             buf = <uint*>epr_get_field_elems_uint(self._ptr)
 */
    case e_tid_uint:

    /* "epr.pyx":787
 *                 pyepr_null_ptr_error(msg)
 *         elif etype == e_tid_uint:
 *             dtype = np.NPY_UINT             # <<<<<<<<<<<<<<
 *             buf = <uint*>epr_get_field_elems_uint(self._ptr)
 *             if buf is NULL:
 */
    __pyx_v_dtype = NPY_UINT;

    /* "epr.pyx":788
 *         elif etype == e_tid_uint:
 *             dtype = np.NPY_UINT
 *             buf = <uint*>epr_get_field_elems_uint(self._ptr)             # <<<<<<<<<<<<<<
 *             if buf is NULL:
 *                 pyepr_null_ptr_error(msg)
 */
    __pyx_v_buf = ((uint *)epr_get_field_elems_uint(__pyx_v_self->_ptr));

    /* "epr.pyx":789
 *             dtype = np.NPY_UINT
 *             buf = <uint*>epr_get_field_elems_uint(self._ptr)
 *             if buf is NULL:             # <<<<<<<<<<<<<<
 *                 pyepr_null_ptr_error(msg)
 *         elif etype == e_tid_int:
 */
    __pyx_t_3 = ((__pyx_v_buf == NULL) != 0);
    if (__pyx_t_3) {

      /* "epr.pyx":790
 *             buf = <uint*>epr_get_field_elems_uint(self._ptr)
 *             if buf is NULL:
 *                 pyepr_null_ptr_error(msg)             # <<<<<<<<<<<<<<
 *         elif etype == e_tid_int:
 *             dtype = np.NPY_INT
 */
      __pyx_t_4.__pyx_n = 1;
      __pyx_t_4.msg = __pyx_v_msg;
      __pyx_t_2 = __pyx_f_3epr_pyepr_null_ptr_error(&__pyx_t_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      goto __pyx_L10;
    }
    __pyx_L10:;
    break;

    /* "epr.pyx":791
 *             if buf is NULL:
 *                 pyepr_null_ptr_error(msg)
 *         elif etype == e_tid_int:             # <<<<<<<<<<<<<<
 *             dtype = np.NPY_INT
 *             buf = <int*>epr_get_field_elems_int(self._ptr)
 */
    case e_tid_int:

    /* "epr.pyx":792
 *                 pyepr_null_ptr_error(msg)
 *         elif etype == e_tid_int:
 *             dtype = np.NPY_INT             # <<<<<<<<<<<<<<
 *             buf = <int*>epr_get_field_elems_int(self._ptr)
 *             if buf is NULL:
 */
    __pyx_v_dtype = NPY_INT;

    /* "epr.pyx":793
 *         elif etype == e_tid_int:
 *             dtype = np.NPY_INT
 *             buf = <int*>epr_get_field_elems_int(self._ptr)             # <<<<<<<<<<<<<<
 *             if buf is NULL:
 *                 pyepr_null_ptr_error(msg)
 */
    __pyx_v_buf = ((int *)epr_get_field_elems_int(__pyx_v_self->_ptr));

    /* "epr.pyx":794
 *             dtype = np.NPY_INT
 *             buf = <int*>epr_get_field_elems_int(self._ptr)
 *             if buf is NULL:             # <<<<<<<<<<<<<<
 *                 pyepr_null_ptr_error(msg)
 *         elif etype == e_tid_float:
 */
    __pyx_t_3 = ((__pyx_v_buf == NULL) != 0);
    if (__pyx_t_3) {

      /* "epr.pyx":795
 *             buf = <int*>epr_get_field_elems_int(self._ptr)
 *             if buf is NULL:
 *                 pyepr_null_ptr_error(msg)             # <<<<<<<<<<<<<<
 *         elif etype == e_tid_float:
 *             dtype = np.NPY_FLOAT
 */
      __pyx_t_4.__pyx_n = 1;
      __pyx_t_4.msg = __pyx_v_msg;
      __pyx_t_2 = __pyx_f_3epr_pyepr_null_ptr_error(&__pyx_t_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      goto __pyx_L11;
    }
    __pyx_L11:;
    break;

    /* "epr.pyx":796
 *             if buf is NULL:
 *                 pyepr_null_ptr_error(msg)
 *         elif etype == e_tid_float:             # <<<<<<<<<<<<<<
 *             dtype = np.NPY_FLOAT
 *             buf = <float*>epr_get_field_elems_float(self._ptr)
 */
    case e_tid_float:

    /* "epr.pyx":797
 *                 pyepr_null_ptr_error(msg)
 *         elif etype == e_tid_float:
 *             dtype = np.NPY_FLOAT             # <<<<<<<<<<<<<<
 *             buf = <float*>epr_get_field_elems_float(self._ptr)
 *             if buf is NULL:
 */
    __pyx_v_dtype = NPY_FLOAT;

    /* "epr.pyx":798
 *         elif etype == e_tid_float:
 *             dtype = np.NPY_FLOAT
 *             buf = <float*>epr_get_field_elems_float(self._ptr)             # <<<<<<<<<<<<<<
 *             if buf is NULL:
 *                 pyepr_null_ptr_error(msg)
 */
    __pyx_v_buf = ((float *)epr_get_field_elems_float(__pyx_v_self->_ptr));

    /* "epr.pyx":799
 *             dtype = np.NPY_FLOAT
 *             buf = <float*>epr_get_field_elems_float(self._ptr)
 *             if buf is NULL:             # <<<<<<<<<<<<<<
 *                 pyepr_null_ptr_error(msg)
 *         elif etype == e_tid_double:
 */
    __pyx_t_3 = ((__pyx_v_buf == NULL) != 0);
    if (__pyx_t_3) {

      /* "epr.pyx":800
 *             buf = <float*>epr_get_field_elems_float(self._ptr)
 *             if buf is NULL:
 *                 pyepr_null_ptr_error(msg)             # <<<<<<<<<<<<<<
 *         elif etype == e_tid_double:
 *             dtype = np.NPY_DOUBLE
 */
      __pyx_t_4.__pyx_n = 1;
      __pyx_t_4.msg = __pyx_v_msg;
      __pyx_t_2 = __pyx_f_3epr_pyepr_null_ptr_error(&__pyx_t_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 800; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      goto __pyx_L12;
    }
    __pyx_L12:;
    break;

    /* "epr.pyx":801
 *             if buf is NULL:
 *                 pyepr_null_ptr_error(msg)
 *         elif etype == e_tid_double:             # <<<<<<<<<<<<<<
 *             dtype = np.NPY_DOUBLE
 *             buf = <double*>epr_get_field_elems_double(self._ptr)
 */
    case e_tid_double:

    /* "epr.pyx":802
 *                 pyepr_null_ptr_error(msg)
 *         elif etype == e_tid_double:
 *             dtype = np.NPY_DOUBLE             # <<<<<<<<<<<<<<
 *             buf = <double*>epr_get_field_elems_double(self._ptr)
 *             if buf is NULL:
 */
    __pyx_v_dtype = NPY_DOUBLE;

    /* "epr.pyx":803
 *         elif etype == e_tid_double:
 *             dtype = np.NPY_DOUBLE
 *             buf = <double*>epr_get_field_elems_double(self._ptr)             # <<<<<<<<<<<<<<
 *             if buf is NULL:
 *                 pyepr_null_ptr_error(msg)
 */
    __pyx_v_buf = ((double *)epr_get_field_elems_double(__pyx_v_self->_ptr));

    /* "epr.pyx":804
 *             dtype = np.NPY_DOUBLE
 *             buf = <double*>epr_get_field_elems_double(self._ptr)
 *             if buf is NULL:             # <<<<<<<<<<<<<<
 *                 pyepr_null_ptr_error(msg)
 *         elif etype == e_tid_string:
 */
    __pyx_t_3 = ((__pyx_v_buf == NULL) != 0);
    if (__pyx_t_3) {

      /* "epr.pyx":805
 *             buf = <double*>epr_get_field_elems_double(self._ptr)
 *             if buf is NULL:
 *                 pyepr_null_ptr_error(msg)             # <<<<<<<<<<<<<<
 *         elif etype == e_tid_string:
 *             if shape[0] != 1:
 */
      __pyx_t_4.__pyx_n = 1;
      __pyx_t_4.msg = __pyx_v_msg;
      __pyx_t_2 = __pyx_f_3epr_pyepr_null_ptr_error(&__pyx_t_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 805; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      goto __pyx_L13;
    }
    __pyx_L13:;
    break;

    /* "epr.pyx":806
 *             if buf is NULL:
 *                 pyepr_null_ptr_error(msg)
 *         elif etype == e_tid_string:             # <<<<<<<<<<<<<<
 *             if shape[0] != 1:
 *                 raise ValueError(
 */
    case e_tid_string:

    /* "epr.pyx":807
 *                 pyepr_null_ptr_error(msg)
 *         elif etype == e_tid_string:
 *             if shape[0] != 1:             # <<<<<<<<<<<<<<
 *                 raise ValueError(
 *                     'unexpected number of elements: %d' % shape[0])
 */
    __pyx_t_3 = (((__pyx_v_shape[0]) != 1) != 0);
    if (__pyx_t_3) {

      /* "epr.pyx":809
 *             if shape[0] != 1:
 *                 raise ValueError(
 *                     'unexpected number of elements: %d' % shape[0])             # <<<<<<<<<<<<<<
 *             nd = 0
 *             dtype = np.NPY_STRING
 */
      __pyx_t_2 = __Pyx_PyInt_From_Py_intptr_t((__pyx_v_shape[0])); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 809; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_unexpected_number_of_elements_d, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 809; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "epr.pyx":808
 *         elif etype == e_tid_string:
 *             if shape[0] != 1:
 *                 raise ValueError(             # <<<<<<<<<<<<<<
 *                     'unexpected number of elements: %d' % shape[0])
 *             nd = 0
 */
      __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 808; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
      __Pyx_GIVEREF(__pyx_t_1);
      __pyx_t_1 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 808; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_Raise(__pyx_t_1, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 808; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }

    /* "epr.pyx":810
 *                 raise ValueError(
 *                     'unexpected number of elements: %d' % shape[0])
 *             nd = 0             # <<<<<<<<<<<<<<
 *             dtype = np.NPY_STRING
 *             buf = <char*>epr_get_field_elem_as_str(self._ptr)
 */
    __pyx_v_nd = 0;

    /* "epr.pyx":811
 *                     'unexpected number of elements: %d' % shape[0])
 *             nd = 0
 *             dtype = np.NPY_STRING             # <<<<<<<<<<<<<<
 *             buf = <char*>epr_get_field_elem_as_str(self._ptr)
 *             if buf is NULL:
 */
    __pyx_v_dtype = NPY_STRING;

    /* "epr.pyx":812
 *             nd = 0
 *             dtype = np.NPY_STRING
 *             buf = <char*>epr_get_field_elem_as_str(self._ptr)             # <<<<<<<<<<<<<<
 *             if buf is NULL:
 *                 pyepr_null_ptr_error(msg)
 */
    __pyx_v_buf = ((char *)epr_get_field_elem_as_str(__pyx_v_self->_ptr));

    /* "epr.pyx":813
 *             dtype = np.NPY_STRING
 *             buf = <char*>epr_get_field_elem_as_str(self._ptr)
 *             if buf is NULL:             # <<<<<<<<<<<<<<
 *                 pyepr_null_ptr_error(msg)
 *         #elif etype == e_tid_unknown:
 */
    __pyx_t_3 = ((__pyx_v_buf == NULL) != 0);
    if (__pyx_t_3) {

      /* "epr.pyx":814
 *             buf = <char*>epr_get_field_elem_as_str(self._ptr)
 *             if buf is NULL:
 *                 pyepr_null_ptr_error(msg)             # <<<<<<<<<<<<<<
 *         #elif etype == e_tid_unknown:
 *         #    pass
 */
      __pyx_t_4.__pyx_n = 1;
      __pyx_t_4.msg = __pyx_v_msg;
      __pyx_t_1 = __pyx_f_3epr_pyepr_null_ptr_error(&__pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L15;
    }
    __pyx_L15:;
    break;
    default:

    /* "epr.pyx":820
 *         #    pass
 *         else:
 *             raise ValueError('invalid field type')             # <<<<<<<<<<<<<<
 * 
 *         out = np.PyArray_SimpleNewFromData(nd, shape, dtype, <void*>buf)
 */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    break;
  }

  /* "epr.pyx":822
 *             raise ValueError('invalid field type')
 * 
 *         out = np.PyArray_SimpleNewFromData(nd, shape, dtype, <void*>buf)             # <<<<<<<<<<<<<<
 *         #np.PyArray_CLEARFLAG(out, NPY_ARRAY_WRITEABLE)  # new in numpy 1.7
 *         # Make the ndarray keep a reference to this object
 */
  __pyx_t_1 = PyArray_SimpleNewFromData(__pyx_v_nd, __pyx_v_shape, __pyx_v_dtype, ((void *)__pyx_v_buf)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_out = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "epr.pyx":825
 *         #np.PyArray_CLEARFLAG(out, NPY_ARRAY_WRITEABLE)  # new in numpy 1.7
 *         # Make the ndarray keep a reference to this object
 *         np.set_array_base(out, self)             # <<<<<<<<<<<<<<
 * 
 *         return out
 */
  __pyx_f_5numpy_set_array_base(__pyx_v_out, ((PyObject *)__pyx_v_self));

  /* "epr.pyx":827
 *         np.set_array_base(out, self)
 * 
 *         return out             # <<<<<<<<<<<<<<
 * 
 *     cdef _set_elems(self, np.ndarray elems, uint index=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_out));
  __pyx_r = ((PyObject *)__pyx_v_out);
  goto __pyx_L0;

  /* "epr.pyx":724
 *         return val
 * 
 *     def get_elems(self):             # <<<<<<<<<<<<<<
 *         '''get_elems(self)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("epr.Field.get_elems", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_out);
  __Pyx_XDECREF(__pyx_v_msg);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":829
 *         return out
 * 
 *     cdef _set_elems(self, np.ndarray elems, uint index=0):             # <<<<<<<<<<<<<<
 *         cdef Record record
 *         cdef Dataset dataset
 */

static PyObject *__pyx_f_3epr_5Field__set_elems(struct __pyx_obj_3epr_Field *__pyx_v_self, PyArrayObject *__pyx_v_elems, struct __pyx_opt_args_3epr_5Field__set_elems *__pyx_optional_args) {
  uint __pyx_v_index = ((uint)0);
  struct __pyx_obj_3epr_Record *__pyx_v_record = 0;
  struct __pyx_obj_3epr_Dataset *__pyx_v_dataset = 0;
  struct __pyx_obj_3epr_Product *__pyx_v_product = 0;
  FILE *__pyx_v_istream;
  size_t __pyx_v_ret;
  size_t __pyx_v_nelems;
  size_t __pyx_v_elemsize;
  size_t __pyx_v_datasize;
  long __pyx_v_file_offset;
  long __pyx_v_field_offset;
  char *__pyx_v_buf;
  enum EPR_DataTypeId __pyx_v_etype;
  PyObject *__pyx_v_dtype = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  FILE *__pyx_t_4;
  size_t __pyx_t_5;
  long __pyx_t_6;
  struct __pyx_opt_args_3epr_5Field__get_offset __pyx_t_7;
  int __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_set_elems", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_index = __pyx_optional_args->index;
    }
  }
  __Pyx_INCREF((PyObject *)__pyx_v_elems);

  /* "epr.pyx":841
 *         cdef long field_offset
 *         cdef char* buf
 *         cdef EPR_DataTypeId etype = epr_get_field_type(self._ptr)             # <<<<<<<<<<<<<<
 * 
 *         dtype = _DTYPE_MAP[etype]
 */
  __pyx_v_etype = epr_get_field_type(__pyx_v_self->_ptr);

  /* "epr.pyx":843
 *         cdef EPR_DataTypeId etype = epr_get_field_type(self._ptr)
 * 
 *         dtype = _DTYPE_MAP[etype]             # <<<<<<<<<<<<<<
 * 
 *         elems = elems.astype(dtype)
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_DTYPE_MAP); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 843; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyInt_FromLong(__pyx_v_etype); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 843; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyObject_GetItem(__pyx_t_1, __pyx_t_2); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 843; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_dtype = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "epr.pyx":845
 *         dtype = _DTYPE_MAP[etype]
 * 
 *         elems = elems.astype(dtype)             # <<<<<<<<<<<<<<
 * 
 *         record = self._parent
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_elems), __pyx_n_s_astype); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 845; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 845; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_dtype);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_dtype);
  __Pyx_GIVEREF(__pyx_v_dtype);
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 845; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 845; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF_SET(__pyx_v_elems, ((PyArrayObject *)__pyx_t_1));
  __pyx_t_1 = 0;

  /* "epr.pyx":847
 *         elems = elems.astype(dtype)
 * 
 *         record = self._parent             # <<<<<<<<<<<<<<
 *         dataset = record._parent
 *         product = dataset._parent
 */
  __pyx_t_1 = ((PyObject *)__pyx_v_self->_parent);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_record = ((struct __pyx_obj_3epr_Record *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "epr.pyx":848
 * 
 *         record = self._parent
 *         dataset = record._parent             # <<<<<<<<<<<<<<
 *         product = dataset._parent
 *         istream = product._ptr.istream
 */
  if (!(likely(((__pyx_v_record->_parent) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_record->_parent, __pyx_ptype_3epr_Dataset))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 848; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_1 = __pyx_v_record->_parent;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_dataset = ((struct __pyx_obj_3epr_Dataset *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "epr.pyx":849
 *         record = self._parent
 *         dataset = record._parent
 *         product = dataset._parent             # <<<<<<<<<<<<<<
 *         istream = product._ptr.istream
 * 
 */
  __pyx_t_1 = ((PyObject *)__pyx_v_dataset->_parent);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_product = ((struct __pyx_obj_3epr_Product *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "epr.pyx":850
 *         dataset = record._parent
 *         product = dataset._parent
 *         istream = product._ptr.istream             # <<<<<<<<<<<<<<
 * 
 *         nelems = elems.size
 */
  __pyx_t_4 = __pyx_v_product->_ptr->istream;
  __pyx_v_istream = __pyx_t_4;

  /* "epr.pyx":852
 *         istream = product._ptr.istream
 * 
 *         nelems = elems.size             # <<<<<<<<<<<<<<
 *         elemsize = epr_get_data_type_size(etype)
 *         datasize = elemsize * nelems
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_elems), __pyx_n_s_size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 852; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = __Pyx_PyInt_As_size_t(__pyx_t_1); if (unlikely((__pyx_t_5 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 852; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_nelems = __pyx_t_5;

  /* "epr.pyx":853
 * 
 *         nelems = elems.size
 *         elemsize = epr_get_data_type_size(etype)             # <<<<<<<<<<<<<<
 *         datasize = elemsize * nelems
 *         field_offset = index * elemsize
 */
  __pyx_v_elemsize = epr_get_data_type_size(__pyx_v_etype);

  /* "epr.pyx":854
 *         nelems = elems.size
 *         elemsize = epr_get_data_type_size(etype)
 *         datasize = elemsize * nelems             # <<<<<<<<<<<<<<
 *         field_offset = index * elemsize
 *         file_offset = self._get_offset(absolute=1)
 */
  __pyx_v_datasize = (__pyx_v_elemsize * __pyx_v_nelems);

  /* "epr.pyx":855
 *         elemsize = epr_get_data_type_size(etype)
 *         datasize = elemsize * nelems
 *         field_offset = index * elemsize             # <<<<<<<<<<<<<<
 *         file_offset = self._get_offset(absolute=1)
 *         buf = <char*>self._ptr.elems + field_offset
 */
  __pyx_v_field_offset = (__pyx_v_index * __pyx_v_elemsize);

  /* "epr.pyx":856
 *         datasize = elemsize * nelems
 *         field_offset = index * elemsize
 *         file_offset = self._get_offset(absolute=1)             # <<<<<<<<<<<<<<
 *         buf = <char*>self._ptr.elems + field_offset
 * 
 */
  __pyx_t_7.__pyx_n = 1;
  __pyx_t_7.absolute = 1;
  __pyx_t_6 = ((struct __pyx_vtabstruct_3epr_Field *)__pyx_v_self->__pyx_vtab)->_get_offset(__pyx_v_self, &__pyx_t_7); 
  __pyx_v_file_offset = __pyx_t_6;

  /* "epr.pyx":857
 *         field_offset = index * elemsize
 *         file_offset = self._get_offset(absolute=1)
 *         buf = <char*>self._ptr.elems + field_offset             # <<<<<<<<<<<<<<
 * 
 *         cstring.memcpy(<void*>buf, <const void*>elems.data, datasize)
 */
  __pyx_v_buf = (((char *)__pyx_v_self->_ptr->elems) + __pyx_v_field_offset);

  /* "epr.pyx":859
 *         buf = <char*>self._ptr.elems + field_offset
 * 
 *         cstring.memcpy(<void*>buf, <const void*>elems.data, datasize)             # <<<<<<<<<<<<<<
 * 
 *         if SWAP_BYTES:
 */
  memcpy(((void *)__pyx_v_buf), ((void const *)__pyx_v_elems->data), __pyx_v_datasize);

  /* "epr.pyx":861
 *         cstring.memcpy(<void*>buf, <const void*>elems.data, datasize)
 * 
 *         if SWAP_BYTES:             # <<<<<<<<<<<<<<
 *             elems = elems.byteswap()
 * 
 */
  __pyx_t_8 = (__pyx_v_3epr_SWAP_BYTES != 0);
  if (__pyx_t_8) {

    /* "epr.pyx":862
 * 
 *         if SWAP_BYTES:
 *             elems = elems.byteswap()             # <<<<<<<<<<<<<<
 * 
 *         with nogil:
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_elems), __pyx_n_s_byteswap); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 862; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 862; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 862; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF_SET(__pyx_v_elems, ((PyArrayObject *)__pyx_t_2));
    __pyx_t_2 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "epr.pyx":864
 *             elems = elems.byteswap()
 * 
 *         with nogil:             # <<<<<<<<<<<<<<
 *             stdio.fseek(istream, file_offset + field_offset, stdio.SEEK_SET)
 *             ret = stdio.fwrite(elems.data, elemsize, nelems,
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      #endif
      /*try:*/ {

        /* "epr.pyx":865
 * 
 *         with nogil:
 *             stdio.fseek(istream, file_offset + field_offset, stdio.SEEK_SET)             # <<<<<<<<<<<<<<
 *             ret = stdio.fwrite(elems.data, elemsize, nelems,
 *                                product._ptr.istream)
 */
        fseek(__pyx_v_istream, (__pyx_v_file_offset + __pyx_v_field_offset), SEEK_SET);

        /* "epr.pyx":866
 *         with nogil:
 *             stdio.fseek(istream, file_offset + field_offset, stdio.SEEK_SET)
 *             ret = stdio.fwrite(elems.data, elemsize, nelems,             # <<<<<<<<<<<<<<
 *                                product._ptr.istream)
 *         if ret != nelems:
 */
        __pyx_v_ret = fwrite(__pyx_v_elems->data, __pyx_v_elemsize, __pyx_v_nelems, __pyx_v_product->_ptr->istream);
      }

      /* "epr.pyx":864
 *             elems = elems.byteswap()
 * 
 *         with nogil:             # <<<<<<<<<<<<<<
 *             stdio.fseek(istream, file_offset + field_offset, stdio.SEEK_SET)
 *             ret = stdio.fwrite(elems.data, elemsize, nelems,
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L6;
        }
        __pyx_L6:;
      }
  }

  /* "epr.pyx":868
 *             ret = stdio.fwrite(elems.data, elemsize, nelems,
 *                                product._ptr.istream)
 *         if ret != nelems:             # <<<<<<<<<<<<<<
 *             raise IOError(
 *                 'write error: %d of %d bytes written' % (ret, datasize))
 */
  __pyx_t_8 = ((__pyx_v_ret != __pyx_v_nelems) != 0);
  if (__pyx_t_8) {

    /* "epr.pyx":870
 *         if ret != nelems:
 *             raise IOError(
 *                 'write error: %d of %d bytes written' % (ret, datasize))             # <<<<<<<<<<<<<<
 * 
 *     def set_elem(self, elem, uint index=0):
 */
    __pyx_t_2 = __Pyx_PyInt_FromSize_t(__pyx_v_ret); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 870; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = __Pyx_PyInt_FromSize_t(__pyx_v_datasize); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 870; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 870; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    __pyx_t_2 = 0;
    __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_write_error_d_of_d_bytes_written, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 870; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "epr.pyx":869
 *                                product._ptr.istream)
 *         if ret != nelems:
 *             raise IOError(             # <<<<<<<<<<<<<<
 *                 'write error: %d of %d bytes written' % (ret, datasize))
 * 
 */
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 869; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_IOError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 869; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 869; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "epr.pyx":829
 *         return out
 * 
 *     cdef _set_elems(self, np.ndarray elems, uint index=0):             # <<<<<<<<<<<<<<
 *         cdef Record record
 *         cdef Dataset dataset
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("epr.Field._set_elems", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_record);
  __Pyx_XDECREF((PyObject *)__pyx_v_dataset);
  __Pyx_XDECREF((PyObject *)__pyx_v_product);
  __Pyx_XDECREF(__pyx_v_dtype);
  __Pyx_XDECREF((PyObject *)__pyx_v_elems);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":872
 *                 'write error: %d of %d bytes written' % (ret, datasize))
 * 
 *     def set_elem(self, elem, uint index=0):             # <<<<<<<<<<<<<<
 *         '''set_elem(self, elem, index=0)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_3epr_5Field_17set_elem(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_3epr_5Field_16set_elem[] = "set_elem(self, elem, index=0)\n\n        Set Field array element\n\n        This function is for setting an array of field element of the\n        field.\n\n        :param elem:\n            value of the element to set\n        :param index:\n            the zero-based index of element to be set, must not be\n            negative. Default: 0.\n\n        ";
static PyObject *__pyx_pw_3epr_5Field_17set_elem(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_elem = 0;
  uint __pyx_v_index;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_elem (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_elem,&__pyx_n_s_index,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_elem)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_index);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "set_elem") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 872; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_elem = values[0];
    if (values[1]) {
      __pyx_v_index = __Pyx_PyInt_As_uint(values[1]); if (unlikely((__pyx_v_index == (uint)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 872; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_index = ((uint)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("set_elem", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 872; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("epr.Field.set_elem", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_3epr_5Field_16set_elem(((struct __pyx_obj_3epr_Field *)__pyx_v_self), __pyx_v_elem, __pyx_v_index);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_3epr_5Field_16set_elem(struct __pyx_obj_3epr_Field *__pyx_v_self, PyObject *__pyx_v_elem, uint __pyx_v_index) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  struct __pyx_opt_args_3epr_5Field__set_elems __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("set_elem", 0);
  __Pyx_INCREF(__pyx_v_elem);

  /* "epr.pyx":888
 *         '''
 * 
 *         self.check_closed_product()             # <<<<<<<<<<<<<<
 *         self._check_write_mode()
 * 
 */
  __pyx_t_1 = __pyx_f_3epr_5Field_check_closed_product(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 888; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "epr.pyx":889
 * 
 *         self.check_closed_product()
 *         self._check_write_mode()             # <<<<<<<<<<<<<<
 * 
 *         if self._parent.index is None:
 */
  __pyx_t_1 = __pyx_f_3epr_5Field__check_write_mode(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 889; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "epr.pyx":891
 *         self._check_write_mode()
 * 
 *         if self._parent.index is None:             # <<<<<<<<<<<<<<
 *             raise NotImplementedError(
 *                 'setting elements is not implemented on MPH/SPH records')
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->_parent), __pyx_n_s_index); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 891; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = (__pyx_t_1 == Py_None);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "epr.pyx":892
 * 
 *         if self._parent.index is None:
 *             raise NotImplementedError(             # <<<<<<<<<<<<<<
 *                 'setting elements is not implemented on MPH/SPH records')
 * 
 */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_NotImplementedError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 892; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 892; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "epr.pyx":895
 *                 'setting elements is not implemented on MPH/SPH records')
 * 
 *         elem = np.asarray(elem)             # <<<<<<<<<<<<<<
 *         if elem.size != 1:
 *             raise ValueError(
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 895; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_asarray); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 895; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 895; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_elem);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_elem);
  __Pyx_GIVEREF(__pyx_v_elem);
  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_1, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 895; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF_SET(__pyx_v_elem, __pyx_t_5);
  __pyx_t_5 = 0;

  /* "epr.pyx":896
 * 
 *         elem = np.asarray(elem)
 *         if elem.size != 1:             # <<<<<<<<<<<<<<
 *             raise ValueError(
 *                 'invalid shape "%s", scalar value expected' % elem.shape)
 */
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_elem, __pyx_n_s_size); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 896; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_1 = PyObject_RichCompare(__pyx_t_5, __pyx_int_1, Py_NE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 896; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 896; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_3) {

    /* "epr.pyx":898
 *         if elem.size != 1:
 *             raise ValueError(
 *                 'invalid shape "%s", scalar value expected' % elem.shape)             # <<<<<<<<<<<<<<
 * 
 *         self._set_elems(elem, index)
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_elem, __pyx_n_s_shape); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 898; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = __Pyx_PyString_Format(__pyx_kp_s_invalid_shape_s_scalar_value_exp, __pyx_t_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 898; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "epr.pyx":897
 *         elem = np.asarray(elem)
 *         if elem.size != 1:
 *             raise ValueError(             # <<<<<<<<<<<<<<
 *                 'invalid shape "%s", scalar value expected' % elem.shape)
 * 
 */
    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 897; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_5);
    __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_t_1, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 897; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_Raise(__pyx_t_5, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 897; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "epr.pyx":900
 *                 'invalid shape "%s", scalar value expected' % elem.shape)
 * 
 *         self._set_elems(elem, index)             # <<<<<<<<<<<<<<
 * 
 *     def set_elems(self, elems):
 */
  if (!(likely(((__pyx_v_elem) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_elem, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 900; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_6.__pyx_n = 1;
  __pyx_t_6.index = __pyx_v_index;
  __pyx_t_5 = ((struct __pyx_vtabstruct_3epr_Field *)__pyx_v_self->__pyx_vtab)->_set_elems(__pyx_v_self, ((PyArrayObject *)__pyx_v_elem), &__pyx_t_6); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 900; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "epr.pyx":872
 *                 'write error: %d of %d bytes written' % (ret, datasize))
 * 
 *     def set_elem(self, elem, uint index=0):             # <<<<<<<<<<<<<<
 *         '''set_elem(self, elem, index=0)
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("epr.Field.set_elem", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_elem);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":902
 *         self._set_elems(elem, index)
 * 
 *     def set_elems(self, elems):             # <<<<<<<<<<<<<<
 *         '''set_elems(self, elems)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_3epr_5Field_19set_elems(PyObject *__pyx_v_self, PyObject *__pyx_v_elems); /*proto*/
static char __pyx_doc_3epr_5Field_18set_elems[] = "set_elems(self, elems)\n\n        Set Field array elements\n\n        This function is for setting an array of field elements of the\n        field.\n\n        :param elems:\n            np.ndarray of elements to set\n\n        ";
static PyObject *__pyx_pw_3epr_5Field_19set_elems(PyObject *__pyx_v_self, PyObject *__pyx_v_elems) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_elems (wrapper)", 0);
  __pyx_r = __pyx_pf_3epr_5Field_18set_elems(((struct __pyx_obj_3epr_Field *)__pyx_v_self), ((PyObject *)__pyx_v_elems));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_3epr_5Field_18set_elems(struct __pyx_obj_3epr_Field *__pyx_v_self, PyObject *__pyx_v_elems) {
  uint __pyx_v_nelems;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("set_elems", 0);
  __Pyx_INCREF(__pyx_v_elems);

  /* "epr.pyx":917
 *         cdef uint nelems
 * 
 *         self.check_closed_product()             # <<<<<<<<<<<<<<
 *         self._check_write_mode()
 * 
 */
  __pyx_t_1 = __pyx_f_3epr_5Field_check_closed_product(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 917; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "epr.pyx":918
 * 
 *         self.check_closed_product()
 *         self._check_write_mode()             # <<<<<<<<<<<<<<
 * 
 *         if self._parent._index is None:
 */
  __pyx_t_1 = __pyx_f_3epr_5Field__check_write_mode(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 918; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "epr.pyx":920
 *         self._check_write_mode()
 * 
 *         if self._parent._index is None:             # <<<<<<<<<<<<<<
 *             raise NotImplementedError(
 *                 'setting elements is not implemented on MPH/SPH records')
 */
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->_parent->_index); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 920; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = (__pyx_t_1 == Py_None);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "epr.pyx":921
 * 
 *         if self._parent._index is None:
 *             raise NotImplementedError(             # <<<<<<<<<<<<<<
 *                 'setting elements is not implemented on MPH/SPH records')
 * 
 */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_NotImplementedError, __pyx_tuple__8, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 921; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 921; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "epr.pyx":924
 *                 'setting elements is not implemented on MPH/SPH records')
 * 
 *         elems = np.ascontiguousarray(elems)             # <<<<<<<<<<<<<<
 *         nelems = epr_get_field_num_elems(self._ptr)
 *         if elems.ndim > 1 or elems.size != nelems:
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 924; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_ascontiguousarray); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 924; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 924; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_elems);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_elems);
  __Pyx_GIVEREF(__pyx_v_elems);
  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_1, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 924; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF_SET(__pyx_v_elems, __pyx_t_5);
  __pyx_t_5 = 0;

  /* "epr.pyx":925
 * 
 *         elems = np.ascontiguousarray(elems)
 *         nelems = epr_get_field_num_elems(self._ptr)             # <<<<<<<<<<<<<<
 *         if elems.ndim > 1 or elems.size != nelems:
 *             raise ValueError('invalid shape "%s", "(%s,)" value expected' % (
 */
  __pyx_v_nelems = epr_get_field_num_elems(__pyx_v_self->_ptr);

  /* "epr.pyx":926
 *         elems = np.ascontiguousarray(elems)
 *         nelems = epr_get_field_num_elems(self._ptr)
 *         if elems.ndim > 1 or elems.size != nelems:             # <<<<<<<<<<<<<<
 *             raise ValueError('invalid shape "%s", "(%s,)" value expected' % (
 *                 elems.shape, nelems))
 */
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_elems, __pyx_n_s_ndim); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 926; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_1 = PyObject_RichCompare(__pyx_t_5, __pyx_int_1, Py_GT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 926; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 926; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (!__pyx_t_3) {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_elems, __pyx_n_s_size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 926; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = __Pyx_PyInt_From_uint(__pyx_v_nelems); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 926; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_4 = PyObject_RichCompare(__pyx_t_1, __pyx_t_5, Py_NE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 926; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 926; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_6 = __pyx_t_2;
  } else {
    __pyx_t_6 = __pyx_t_3;
  }
  if (__pyx_t_6) {

    /* "epr.pyx":928
 *         if elems.ndim > 1 or elems.size != nelems:
 *             raise ValueError('invalid shape "%s", "(%s,)" value expected' % (
 *                 elems.shape, nelems))             # <<<<<<<<<<<<<<
 * 
 *         self._set_elems(elems)
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_elems, __pyx_n_s_shape); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 928; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = __Pyx_PyInt_From_uint(__pyx_v_nelems); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 928; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 928; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_5);
    __pyx_t_4 = 0;
    __pyx_t_5 = 0;

    /* "epr.pyx":927
 *         nelems = epr_get_field_num_elems(self._ptr)
 *         if elems.ndim > 1 or elems.size != nelems:
 *             raise ValueError('invalid shape "%s", "(%s,)" value expected' % (             # <<<<<<<<<<<<<<
 *                 elems.shape, nelems))
 * 
 */
    __pyx_t_5 = __Pyx_PyString_Format(__pyx_kp_s_invalid_shape_s_s_value_expected, __pyx_t_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 927; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 927; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_5);
    __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_t_1, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 927; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_Raise(__pyx_t_5, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 927; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "epr.pyx":930
 *                 elems.shape, nelems))
 * 
 *         self._set_elems(elems)             # <<<<<<<<<<<<<<
 * 
 *     property tot_size:
 */
  if (!(likely(((__pyx_v_elems) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_elems, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 930; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_5 = ((struct __pyx_vtabstruct_3epr_Field *)__pyx_v_self->__pyx_vtab)->_set_elems(__pyx_v_self, ((PyArrayObject *)__pyx_v_elems), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 930; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "epr.pyx":902
 *         self._set_elems(elem, index)
 * 
 *     def set_elems(self, elems):             # <<<<<<<<<<<<<<
 *         '''set_elems(self, elems)
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("epr.Field.set_elems", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_elems);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":940
 *         '''
 * 
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             cdef EPR_FieldInfo* info = <EPR_FieldInfo*>self._ptr.info
 *             return info.tot_size
 */

/* Python wrapper */
static PyObject *__pyx_pw_3epr_5Field_8tot_size_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_3epr_5Field_8tot_size_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_3epr_5Field_8tot_size___get__(((struct __pyx_obj_3epr_Field *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_3epr_5Field_8tot_size___get__(struct __pyx_obj_3epr_Field *__pyx_v_self) {
  __pyx_t_3epr_EPR_FieldInfo *__pyx_v_info;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "epr.pyx":941
 * 
 *         def __get__(self):
 *             cdef EPR_FieldInfo* info = <EPR_FieldInfo*>self._ptr.info             # <<<<<<<<<<<<<<
 *             return info.tot_size
 * 
 */
  __pyx_v_info = ((__pyx_t_3epr_EPR_FieldInfo *)__pyx_v_self->_ptr->info);

  /* "epr.pyx":942
 *         def __get__(self):
 *             cdef EPR_FieldInfo* info = <EPR_FieldInfo*>self._ptr.info
 *             return info.tot_size             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_uint(__pyx_v_info->tot_size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 942; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "epr.pyx":940
 *         '''
 * 
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             cdef EPR_FieldInfo* info = <EPR_FieldInfo*>self._ptr.info
 *             return info.tot_size
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("epr.Field.tot_size.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":946
 * 
 *     # --- high level interface ------------------------------------------------
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return 'epr.Field("%s") %d %s elements' % (self.get_name(),
 *                     self.get_num_elems(), data_type_id_to_str(self.get_type()))
 */

/* Python wrapper */
static PyObject *__pyx_pw_3epr_5Field_21__repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_3epr_5Field_21__repr__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
  __pyx_r = __pyx_pf_3epr_5Field_20__repr__(((struct __pyx_obj_3epr_Field *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_3epr_5Field_20__repr__(struct __pyx_obj_3epr_Field *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  EPR_EDataTypeId __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__repr__", 0);

  /* "epr.pyx":947
 *     # --- high level interface ------------------------------------------------
 *     def __repr__(self):
 *         return 'epr.Field("%s") %d %s elements' % (self.get_name(),             # <<<<<<<<<<<<<<
 *                     self.get_num_elems(), data_type_id_to_str(self.get_type()))
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_get_name); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 947; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 947; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "epr.pyx":948
 *     def __repr__(self):
 *         return 'epr.Field("%s") %d %s elements' % (self.get_name(),
 *                     self.get_num_elems(), data_type_id_to_str(self.get_type()))             # <<<<<<<<<<<<<<
 * 
 *     def __str__(self):
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_get_num_elems); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 948; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 948; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_get_type); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 948; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 948; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_5 = ((EPR_EDataTypeId)PyInt_AsLong(__pyx_t_4)); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 948; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __pyx_f_3epr_data_type_id_to_str(__pyx_t_5, 0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 948; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);

  /* "epr.pyx":947
 *     # --- high level interface ------------------------------------------------
 *     def __repr__(self):
 *         return 'epr.Field("%s") %d %s elements' % (self.get_name(),             # <<<<<<<<<<<<<<
 *                     self.get_num_elems(), data_type_id_to_str(self.get_type()))
 * 
 */
  __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 947; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_epr_Field_s_d_s_elements, __pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 947; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "epr.pyx":946
 * 
 *     # --- high level interface ------------------------------------------------
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return 'epr.Field("%s") %d %s elements' % (self.get_name(),
 *                     self.get_num_elems(), data_type_id_to_str(self.get_type()))
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("epr.Field.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":950
 *                     self.get_num_elems(), data_type_id_to_str(self.get_type()))
 * 
 *     def __str__(self):             # <<<<<<<<<<<<<<
 *         cdef object name = self.get_name()
 *         cdef EPR_DataTypeId type_ = self.get_type()
 */

/* Python wrapper */
static PyObject *__pyx_pw_3epr_5Field_23__str__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_3epr_5Field_23__str__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__str__ (wrapper)", 0);
  __pyx_r = __pyx_pf_3epr_5Field_22__str__(((struct __pyx_obj_3epr_Field *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_3epr_5Field_22__str__(struct __pyx_obj_3epr_Field *__pyx_v_self) {
  PyObject *__pyx_v_name = 0;
  enum EPR_DataTypeId __pyx_v_type_;
  int __pyx_v_num_elems;
  PyObject *__pyx_v_days = NULL;
  PyObject *__pyx_v_seconds = NULL;
  PyObject *__pyx_v_microseconds = NULL;
  PyObject *__pyx_v_fmt = NULL;
  PyObject *__pyx_v_data = NULL;
  PyObject *__pyx_v_item = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  enum EPR_DataTypeId __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *(*__pyx_t_7)(PyObject *);
  int __pyx_t_8;
  Py_ssize_t __pyx_t_9;
  PyObject *(*__pyx_t_10)(PyObject *);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__str__", 0);

  /* "epr.pyx":951
 * 
 *     def __str__(self):
 *         cdef object name = self.get_name()             # <<<<<<<<<<<<<<
 *         cdef EPR_DataTypeId type_ = self.get_type()
 *         cdef int num_elems = 0
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_get_name); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 951; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 951; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_name = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "epr.pyx":952
 *     def __str__(self):
 *         cdef object name = self.get_name()
 *         cdef EPR_DataTypeId type_ = self.get_type()             # <<<<<<<<<<<<<<
 *         cdef int num_elems = 0
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_get_type); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 952; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 952; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_3 = ((enum EPR_DataTypeId)PyInt_AsLong(__pyx_t_1)); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 952; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_type_ = __pyx_t_3;

  /* "epr.pyx":953
 *         cdef object name = self.get_name()
 *         cdef EPR_DataTypeId type_ = self.get_type()
 *         cdef int num_elems = 0             # <<<<<<<<<<<<<<
 * 
 *         if type_ == e_tid_string:
 */
  __pyx_v_num_elems = 0;

  /* "epr.pyx":957
 *         if type_ == e_tid_string:
 *             return '%s = "%s"' % (name, self.get_elem())
 *         elif type_ == e_tid_time:             # <<<<<<<<<<<<<<
 *             days, seconds, microseconds = self.get_elem()
 *             return '%s = {d=%d, j=%d, m=%d}' % (name,
 */
  switch (__pyx_v_type_) {

    /* "epr.pyx":955
 *         cdef int num_elems = 0
 * 
 *         if type_ == e_tid_string:             # <<<<<<<<<<<<<<
 *             return '%s = "%s"' % (name, self.get_elem())
 *         elif type_ == e_tid_time:
 */
    case e_tid_string:

    /* "epr.pyx":956
 * 
 *         if type_ == e_tid_string:
 *             return '%s = "%s"' % (name, self.get_elem())             # <<<<<<<<<<<<<<
 *         elif type_ == e_tid_time:
 *             days, seconds, microseconds = self.get_elem()
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_get_elem); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 956; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 956; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 956; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_v_name);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_name);
    __Pyx_GIVEREF(__pyx_v_name);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_2);
    __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_s_s_2, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 956; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;
    break;

    /* "epr.pyx":957
 *         if type_ == e_tid_string:
 *             return '%s = "%s"' % (name, self.get_elem())
 *         elif type_ == e_tid_time:             # <<<<<<<<<<<<<<
 *             days, seconds, microseconds = self.get_elem()
 *             return '%s = {d=%d, j=%d, m=%d}' % (name,
 */
    case e_tid_time:

    /* "epr.pyx":958
 *             return '%s = "%s"' % (name, self.get_elem())
 *         elif type_ == e_tid_time:
 *             days, seconds, microseconds = self.get_elem()             # <<<<<<<<<<<<<<
 *             return '%s = {d=%d, j=%d, m=%d}' % (name,
 *                                                 days, seconds, microseconds)
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_get_elem); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 958; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 958; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
      PyObject* sequence = __pyx_t_1;
      #if CYTHON_COMPILING_IN_CPYTHON
      Py_ssize_t size = Py_SIZE(sequence);
      #else
      Py_ssize_t size = PySequence_Size(sequence);
      #endif
      if (unlikely(size != 3)) {
        if (size > 3) __Pyx_RaiseTooManyValuesError(3);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 958; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      #if CYTHON_COMPILING_IN_CPYTHON
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); 
        __pyx_t_5 = PyTuple_GET_ITEM(sequence, 2); 
      } else {
        __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_4 = PyList_GET_ITEM(sequence, 1); 
        __pyx_t_5 = PyList_GET_ITEM(sequence, 2); 
      }
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_5);
      #else
      __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 958; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 958; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 958; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_6 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 958; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_7 = Py_TYPE(__pyx_t_6)->tp_iternext;
      index = 0; __pyx_t_2 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_2);
      index = 1; __pyx_t_4 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_4)) goto __pyx_L3_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_4);
      index = 2; __pyx_t_5 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_5)) goto __pyx_L3_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_5);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_6), 3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 958; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_7 = NULL;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      goto __pyx_L4_unpacking_done;
      __pyx_L3_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_7 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 958; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_L4_unpacking_done:;
    }
    __pyx_v_days = __pyx_t_2;
    __pyx_t_2 = 0;
    __pyx_v_seconds = __pyx_t_4;
    __pyx_t_4 = 0;
    __pyx_v_microseconds = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "epr.pyx":959
 *         elif type_ == e_tid_time:
 *             days, seconds, microseconds = self.get_elem()
 *             return '%s = {d=%d, j=%d, m=%d}' % (name,             # <<<<<<<<<<<<<<
 *                                                 days, seconds, microseconds)
 *         else:
 */
    __Pyx_XDECREF(__pyx_r);

    /* "epr.pyx":960
 *             days, seconds, microseconds = self.get_elem()
 *             return '%s = {d=%d, j=%d, m=%d}' % (name,
 *                                                 days, seconds, microseconds)             # <<<<<<<<<<<<<<
 *         else:
 *             num_elems = epr_get_field_num_elems(self._ptr)
 */
    __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 959; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_v_name);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_name);
    __Pyx_GIVEREF(__pyx_v_name);
    __Pyx_INCREF(__pyx_v_days);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_days);
    __Pyx_GIVEREF(__pyx_v_days);
    __Pyx_INCREF(__pyx_v_seconds);
    PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_seconds);
    __Pyx_GIVEREF(__pyx_v_seconds);
    __Pyx_INCREF(__pyx_v_microseconds);
    PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_v_microseconds);
    __Pyx_GIVEREF(__pyx_v_microseconds);

    /* "epr.pyx":959
 *         elif type_ == e_tid_time:
 *             days, seconds, microseconds = self.get_elem()
 *             return '%s = {d=%d, j=%d, m=%d}' % (name,             # <<<<<<<<<<<<<<
 *                                                 days, seconds, microseconds)
 *         else:
 */
    __pyx_t_5 = __Pyx_PyString_Format(__pyx_kp_s_s_d_d_j_d_m_d, __pyx_t_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 959; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_r = __pyx_t_5;
    __pyx_t_5 = 0;
    goto __pyx_L0;
    break;
    default:

    /* "epr.pyx":962
 *                                                 days, seconds, microseconds)
 *         else:
 *             num_elems = epr_get_field_num_elems(self._ptr)             # <<<<<<<<<<<<<<
 * 
 *             if type_ == e_tid_uchar:
 */
    __pyx_v_num_elems = epr_get_field_num_elems(__pyx_v_self->_ptr);

    /* "epr.pyx":964
 *             num_elems = epr_get_field_num_elems(self._ptr)
 * 
 *             if type_ == e_tid_uchar:             # <<<<<<<<<<<<<<
 *                 fmt = '%u'
 *             elif type_ == e_tid_char:
 */
    __pyx_t_8 = ((__pyx_v_type_ == e_tid_uchar) != 0);
    if (__pyx_t_8) {

      /* "epr.pyx":965
 * 
 *             if type_ == e_tid_uchar:
 *                 fmt = '%u'             # <<<<<<<<<<<<<<
 *             elif type_ == e_tid_char:
 *                 fmt = '%d'
 */
      __Pyx_INCREF(__pyx_kp_s_u);
      __pyx_v_fmt = __pyx_kp_s_u;
      goto __pyx_L5;
    }

    /* "epr.pyx":966
 *             if type_ == e_tid_uchar:
 *                 fmt = '%u'
 *             elif type_ == e_tid_char:             # <<<<<<<<<<<<<<
 *                 fmt = '%d'
 *             elif type_ == e_tid_ushort:
 */
    __pyx_t_8 = ((__pyx_v_type_ == e_tid_char) != 0);
    if (__pyx_t_8) {

      /* "epr.pyx":967
 *                 fmt = '%u'
 *             elif type_ == e_tid_char:
 *                 fmt = '%d'             # <<<<<<<<<<<<<<
 *             elif type_ == e_tid_ushort:
 *                 fmt = '%u'
 */
      __Pyx_INCREF(__pyx_kp_s_d);
      __pyx_v_fmt = __pyx_kp_s_d;
      goto __pyx_L5;
    }

    /* "epr.pyx":968
 *             elif type_ == e_tid_char:
 *                 fmt = '%d'
 *             elif type_ == e_tid_ushort:             # <<<<<<<<<<<<<<
 *                 fmt = '%u'
 *             elif type_ == e_tid_short:
 */
    __pyx_t_8 = ((__pyx_v_type_ == e_tid_ushort) != 0);
    if (__pyx_t_8) {

      /* "epr.pyx":969
 *                 fmt = '%d'
 *             elif type_ == e_tid_ushort:
 *                 fmt = '%u'             # <<<<<<<<<<<<<<
 *             elif type_ == e_tid_short:
 *                 fmt = '%d'
 */
      __Pyx_INCREF(__pyx_kp_s_u);
      __pyx_v_fmt = __pyx_kp_s_u;
      goto __pyx_L5;
    }

    /* "epr.pyx":970
 *             elif type_ == e_tid_ushort:
 *                 fmt = '%u'
 *             elif type_ == e_tid_short:             # <<<<<<<<<<<<<<
 *                 fmt = '%d'
 *             elif type_ == e_tid_uint:
 */
    __pyx_t_8 = ((__pyx_v_type_ == e_tid_short) != 0);
    if (__pyx_t_8) {

      /* "epr.pyx":971
 *                 fmt = '%u'
 *             elif type_ == e_tid_short:
 *                 fmt = '%d'             # <<<<<<<<<<<<<<
 *             elif type_ == e_tid_uint:
 *                 fmt = '%u'
 */
      __Pyx_INCREF(__pyx_kp_s_d);
      __pyx_v_fmt = __pyx_kp_s_d;
      goto __pyx_L5;
    }

    /* "epr.pyx":972
 *             elif type_ == e_tid_short:
 *                 fmt = '%d'
 *             elif type_ == e_tid_uint:             # <<<<<<<<<<<<<<
 *                 fmt = '%u'
 *             elif type_ == e_tid_int:
 */
    __pyx_t_8 = ((__pyx_v_type_ == e_tid_uint) != 0);
    if (__pyx_t_8) {

      /* "epr.pyx":973
 *                 fmt = '%d'
 *             elif type_ == e_tid_uint:
 *                 fmt = '%u'             # <<<<<<<<<<<<<<
 *             elif type_ == e_tid_int:
 *                 fmt = '%d'
 */
      __Pyx_INCREF(__pyx_kp_s_u);
      __pyx_v_fmt = __pyx_kp_s_u;
      goto __pyx_L5;
    }

    /* "epr.pyx":974
 *             elif type_ == e_tid_uint:
 *                 fmt = '%u'
 *             elif type_ == e_tid_int:             # <<<<<<<<<<<<<<
 *                 fmt = '%d'
 *             elif type_ == e_tid_float:
 */
    __pyx_t_8 = ((__pyx_v_type_ == e_tid_int) != 0);
    if (__pyx_t_8) {

      /* "epr.pyx":975
 *                 fmt = '%u'
 *             elif type_ == e_tid_int:
 *                 fmt = '%d'             # <<<<<<<<<<<<<<
 *             elif type_ == e_tid_float:
 *                 fmt = '%f'
 */
      __Pyx_INCREF(__pyx_kp_s_d);
      __pyx_v_fmt = __pyx_kp_s_d;
      goto __pyx_L5;
    }

    /* "epr.pyx":976
 *             elif type_ == e_tid_int:
 *                 fmt = '%d'
 *             elif type_ == e_tid_float:             # <<<<<<<<<<<<<<
 *                 fmt = '%f'
 *             elif type_ == e_tid_double:
 */
    __pyx_t_8 = ((__pyx_v_type_ == e_tid_float) != 0);
    if (__pyx_t_8) {

      /* "epr.pyx":977
 *                 fmt = '%d'
 *             elif type_ == e_tid_float:
 *                 fmt = '%f'             # <<<<<<<<<<<<<<
 *             elif type_ == e_tid_double:
 *                 fmt = '%f'
 */
      __Pyx_INCREF(__pyx_kp_s_f);
      __pyx_v_fmt = __pyx_kp_s_f;
      goto __pyx_L5;
    }

    /* "epr.pyx":978
 *             elif type_ == e_tid_float:
 *                 fmt = '%f'
 *             elif type_ == e_tid_double:             # <<<<<<<<<<<<<<
 *                 fmt = '%f'
 *             else:
 */
    __pyx_t_8 = ((__pyx_v_type_ == e_tid_double) != 0);
    if (__pyx_t_8) {

      /* "epr.pyx":979
 *                 fmt = '%f'
 *             elif type_ == e_tid_double:
 *                 fmt = '%f'             # <<<<<<<<<<<<<<
 *             else:
 *                 if num_elems > 1:
 */
      __Pyx_INCREF(__pyx_kp_s_f);
      __pyx_v_fmt = __pyx_kp_s_f;
      goto __pyx_L5;
    }
    /*else*/ {

      /* "epr.pyx":981
 *                 fmt = '%f'
 *             else:
 *                 if num_elems > 1:             # <<<<<<<<<<<<<<
 *                     data = ['<<unknown data type>>'] * num_elems
 *                     data = ', '.join(data)
 */
      __pyx_t_8 = ((__pyx_v_num_elems > 1) != 0);
      if (__pyx_t_8) {

        /* "epr.pyx":982
 *             else:
 *                 if num_elems > 1:
 *                     data = ['<<unknown data type>>'] * num_elems             # <<<<<<<<<<<<<<
 *                     data = ', '.join(data)
 *                     return '%s = {%s}' % (name, data)
 */
        __pyx_t_5 = PyList_New(1 * ((__pyx_v_num_elems<0) ? 0:__pyx_v_num_elems)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 982; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_5);
        { Py_ssize_t __pyx_temp;
          for (__pyx_temp=0; __pyx_temp < __pyx_v_num_elems; __pyx_temp++) {
            __Pyx_INCREF(__pyx_kp_s_unknown_data_type);
            PyList_SET_ITEM(__pyx_t_5, __pyx_temp, __pyx_kp_s_unknown_data_type);
            __Pyx_GIVEREF(__pyx_kp_s_unknown_data_type);
          }
        }
        __pyx_v_data = __pyx_t_5;
        __pyx_t_5 = 0;

        /* "epr.pyx":983
 *                 if num_elems > 1:
 *                     data = ['<<unknown data type>>'] * num_elems
 *                     data = ', '.join(data)             # <<<<<<<<<<<<<<
 *                     return '%s = {%s}' % (name, data)
 *                 else:
 */
        __pyx_t_5 = __Pyx_PyString_Join(__pyx_kp_s__9, __pyx_v_data); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 983; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF_SET(__pyx_v_data, __pyx_t_5);
        __pyx_t_5 = 0;

        /* "epr.pyx":984
 *                     data = ['<<unknown data type>>'] * num_elems
 *                     data = ', '.join(data)
 *                     return '%s = {%s}' % (name, data)             # <<<<<<<<<<<<<<
 *                 else:
 *                     return '%s = <<unknown data type>>' % name
 */
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 984; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_INCREF(__pyx_v_name);
        PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_name);
        __Pyx_GIVEREF(__pyx_v_name);
        __Pyx_INCREF(__pyx_v_data);
        PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_data);
        __Pyx_GIVEREF(__pyx_v_data);
        __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_s_s_3, __pyx_t_5); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 984; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_r = __pyx_t_1;
        __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      /*else*/ {

        /* "epr.pyx":986
 *                     return '%s = {%s}' % (name, data)
 *                 else:
 *                     return '%s = <<unknown data type>>' % name             # <<<<<<<<<<<<<<
 * 
 *             if num_elems > 1:
 */
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_s_unknown_data_type, __pyx_v_name); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 986; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_r = __pyx_t_1;
        __pyx_t_1 = 0;
        goto __pyx_L0;
      }
    }
    __pyx_L5:;

    /* "epr.pyx":988
 *                     return '%s = <<unknown data type>>' % name
 * 
 *             if num_elems > 1:             # <<<<<<<<<<<<<<
 *                 data = ', '.join([fmt % item for item in self.get_elems()])
 *                 return '%s = {%s}' % (name, data)
 */
    __pyx_t_8 = ((__pyx_v_num_elems > 1) != 0);
    if (__pyx_t_8) {

      /* "epr.pyx":989
 * 
 *             if num_elems > 1:
 *                 data = ', '.join([fmt % item for item in self.get_elems()])             # <<<<<<<<<<<<<<
 *                 return '%s = {%s}' % (name, data)
 *             else:
 */
      __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 989; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_get_elems); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 989; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 989; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (PyList_CheckExact(__pyx_t_4) || PyTuple_CheckExact(__pyx_t_4)) {
        __pyx_t_5 = __pyx_t_4; __Pyx_INCREF(__pyx_t_5); __pyx_t_9 = 0;
        __pyx_t_10 = NULL;
      } else {
        __pyx_t_9 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 989; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_10 = Py_TYPE(__pyx_t_5)->tp_iternext;
      }
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      for (;;) {
        if (!__pyx_t_10 && PyList_CheckExact(__pyx_t_5)) {
          if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_5)) break;
          #if CYTHON_COMPILING_IN_CPYTHON
          __pyx_t_4 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_9); __Pyx_INCREF(__pyx_t_4); __pyx_t_9++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 989; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          #else
          __pyx_t_4 = PySequence_ITEM(__pyx_t_5, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 989; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          #endif
        } else if (!__pyx_t_10 && PyTuple_CheckExact(__pyx_t_5)) {
          if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_5)) break;
          #if CYTHON_COMPILING_IN_CPYTHON
          __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_9); __Pyx_INCREF(__pyx_t_4); __pyx_t_9++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 989; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          #else
          __pyx_t_4 = PySequence_ITEM(__pyx_t_5, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 989; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          #endif
        } else {
          __pyx_t_4 = __pyx_t_10(__pyx_t_5);
          if (unlikely(!__pyx_t_4)) {
            PyObject* exc_type = PyErr_Occurred();
            if (exc_type) {
              if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
              else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 989; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            }
            break;
          }
          __Pyx_GOTREF(__pyx_t_4);
        }
        __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_4);
        __pyx_t_4 = 0;
        __pyx_t_4 = PyNumber_Remainder(__pyx_v_fmt, __pyx_v_item); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 989; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_4);
        if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_4))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 989; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      }
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = __Pyx_PyString_Join(__pyx_kp_s__9, __pyx_t_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 989; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_v_data = __pyx_t_5;
      __pyx_t_5 = 0;

      /* "epr.pyx":990
 *             if num_elems > 1:
 *                 data = ', '.join([fmt % item for item in self.get_elems()])
 *                 return '%s = {%s}' % (name, data)             # <<<<<<<<<<<<<<
 *             else:
 *                 return '%s = %s' % (name, fmt % self.get_elem())
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 990; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_INCREF(__pyx_v_name);
      PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_name);
      __Pyx_GIVEREF(__pyx_v_name);
      __Pyx_INCREF(__pyx_v_data);
      PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_data);
      __Pyx_GIVEREF(__pyx_v_data);
      __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_s_s_3, __pyx_t_5); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 990; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_r = __pyx_t_1;
      __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    /*else*/ {

      /* "epr.pyx":992
 *                 return '%s = {%s}' % (name, data)
 *             else:
 *                 return '%s = %s' % (name, fmt % self.get_elem())             # <<<<<<<<<<<<<<
 * 
 *     def __richcmp__(self, other, int op):
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_get_elem); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 992; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 992; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = PyNumber_Remainder(__pyx_v_fmt, __pyx_t_5); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 992; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 992; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_INCREF(__pyx_v_name);
      PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_name);
      __Pyx_GIVEREF(__pyx_v_name);
      PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1);
      __Pyx_GIVEREF(__pyx_t_1);
      __pyx_t_1 = 0;
      __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_s_s_4, __pyx_t_5); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 992; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_r = __pyx_t_1;
      __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    break;
  }

  /* "epr.pyx":950
 *                     self.get_num_elems(), data_type_id_to_str(self.get_type()))
 * 
 *     def __str__(self):             # <<<<<<<<<<<<<<
 *         cdef object name = self.get_name()
 *         cdef EPR_DataTypeId type_ = self.get_type()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("epr.Field.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_name);
  __Pyx_XDECREF(__pyx_v_days);
  __Pyx_XDECREF(__pyx_v_seconds);
  __Pyx_XDECREF(__pyx_v_microseconds);
  __Pyx_XDECREF(__pyx_v_fmt);
  __Pyx_XDECREF(__pyx_v_data);
  __Pyx_XDECREF(__pyx_v_item);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":994
 *                 return '%s = %s' % (name, fmt % self.get_elem())
 * 
 *     def __richcmp__(self, other, int op):             # <<<<<<<<<<<<<<
 *         cdef int ret
 *         cdef size_t n
 */

/* Python wrapper */
static PyObject *__pyx_pw_3epr_5Field_25__richcmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, int __pyx_v_op); /*proto*/
static PyObject *__pyx_pw_3epr_5Field_25__richcmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, int __pyx_v_op) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__richcmp__ (wrapper)", 0);
  __pyx_r = __pyx_pf_3epr_5Field_24__richcmp__(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_v_other), ((int)__pyx_v_op));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_3epr_5Field_24__richcmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, int __pyx_v_op) {
  size_t __pyx_v_n;
  EPR_SField *__pyx_v_p1;
  EPR_SField *__pyx_v_p2;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  EPR_SField *__pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  int __pyx_t_7;
  int __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__richcmp__", 0);

  /* "epr.pyx":997
 *         cdef int ret
 *         cdef size_t n
 *         cdef EPR_SField* p1 = (<Field>self)._ptr             # <<<<<<<<<<<<<<
 *         cdef EPR_SField* p2 = (<Field>other)._ptr
 * 
 */
  __pyx_t_1 = ((struct __pyx_obj_3epr_Field *)__pyx_v_self)->_ptr;
  __pyx_v_p1 = __pyx_t_1;

  /* "epr.pyx":998
 *         cdef size_t n
 *         cdef EPR_SField* p1 = (<Field>self)._ptr
 *         cdef EPR_SField* p2 = (<Field>other)._ptr             # <<<<<<<<<<<<<<
 * 
 *         if isinstance(self, Field) and isinstance(other, Field):
 */
  __pyx_t_1 = ((struct __pyx_obj_3epr_Field *)__pyx_v_other)->_ptr;
  __pyx_v_p2 = __pyx_t_1;

  /* "epr.pyx":1000
 *         cdef EPR_SField* p2 = (<Field>other)._ptr
 * 
 *         if isinstance(self, Field) and isinstance(other, Field):             # <<<<<<<<<<<<<<
 *             if op == 2:         # eq
 *                 if p1 == p2:
 */
  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_self, ((PyObject*)__pyx_ptype_3epr_Field)); 
  if ((__pyx_t_2 != 0)) {
    __pyx_t_3 = __Pyx_TypeCheck(__pyx_v_other, ((PyObject*)__pyx_ptype_3epr_Field)); 
    __pyx_t_4 = (__pyx_t_3 != 0);
  } else {
    __pyx_t_4 = (__pyx_t_2 != 0);
  }
  if (__pyx_t_4) {

    /* "epr.pyx":1033
 *                 return (cstring.memcmp(p1.elems, p2.elems, n) == 0)
 * 
 *             elif op == 3:       # ne             # <<<<<<<<<<<<<<
 *                 if p1 == p2:
 *                     return False
 */
    switch (__pyx_v_op) {

      /* "epr.pyx":1001
 * 
 *         if isinstance(self, Field) and isinstance(other, Field):
 *             if op == 2:         # eq             # <<<<<<<<<<<<<<
 *                 if p1 == p2:
 *                     return True
 */
      case 2:

      /* "epr.pyx":1002
 *         if isinstance(self, Field) and isinstance(other, Field):
 *             if op == 2:         # eq
 *                 if p1 == p2:             # <<<<<<<<<<<<<<
 *                     return True
 * 
 */
      __pyx_t_4 = ((__pyx_v_p1 == __pyx_v_p2) != 0);
      if (__pyx_t_4) {

        /* "epr.pyx":1003
 *             if op == 2:         # eq
 *                 if p1 == p2:
 *                     return True             # <<<<<<<<<<<<<<
 * 
 *                 (<Field>self).check_closed_product()
 */
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(Py_True);
        __pyx_r = Py_True;
        goto __pyx_L0;
      }

      /* "epr.pyx":1005
 *                     return True
 * 
 *                 (<Field>self).check_closed_product()             # <<<<<<<<<<<<<<
 * 
 *                 if ((epr_get_field_num_elems(p1) !=
 */
      __pyx_t_5 = __pyx_f_3epr_5Field_check_closed_product(((struct __pyx_obj_3epr_Field *)__pyx_v_self)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1005; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

      /* "epr.pyx":1007
 *                 (<Field>self).check_closed_product()
 * 
 *                 if ((epr_get_field_num_elems(p1) !=             # <<<<<<<<<<<<<<
 *                             epr_get_field_num_elems(p2)) or
 * 
 */
      __pyx_t_4 = ((epr_get_field_num_elems(__pyx_v_p1) != epr_get_field_num_elems(__pyx_v_p2)) != 0);
      if (!__pyx_t_4) {

        /* "epr.pyx":1010
 *                             epr_get_field_num_elems(p2)) or
 * 
 *                     (epr_get_field_type(p1) != epr_get_field_type(p2)) or             # <<<<<<<<<<<<<<
 * 
 *                     (cstring.strcmp(epr_get_field_unit(p1),
 */
        __pyx_t_2 = ((epr_get_field_type(__pyx_v_p1) != epr_get_field_type(__pyx_v_p2)) != 0);
        if (!__pyx_t_2) {

          /* "epr.pyx":1013
 * 
 *                     (cstring.strcmp(epr_get_field_unit(p1),
 *                                     epr_get_field_unit(p2)) != 0) or             # <<<<<<<<<<<<<<
 * 
 *                     (cstring.strcmp(epr_get_field_description(p1),
 */
          __pyx_t_3 = ((strcmp(epr_get_field_unit(__pyx_v_p1), epr_get_field_unit(__pyx_v_p2)) != 0) != 0);
          if (!__pyx_t_3) {

            /* "epr.pyx":1016
 * 
 *                     (cstring.strcmp(epr_get_field_description(p1),
 *                                     epr_get_field_description(p2)) != 0) or             # <<<<<<<<<<<<<<
 * 
 *                     (cstring.strcmp(epr_get_field_name(p1),
 */
            __pyx_t_6 = ((strcmp(epr_get_field_description(__pyx_v_p1), epr_get_field_description(__pyx_v_p2)) != 0) != 0);
            if (!__pyx_t_6) {

              /* "epr.pyx":1019
 * 
 *                     (cstring.strcmp(epr_get_field_name(p1),
 *                                     epr_get_field_name(p2)) != 0)):             # <<<<<<<<<<<<<<
 * 
 *                     return False
 */
              __pyx_t_7 = ((strcmp(epr_get_field_name(__pyx_v_p1), epr_get_field_name(__pyx_v_p2)) != 0) != 0);
              __pyx_t_8 = __pyx_t_7;
            } else {
              __pyx_t_8 = __pyx_t_6;
            }
            __pyx_t_6 = __pyx_t_8;
          } else {
            __pyx_t_6 = __pyx_t_3;
          }
          __pyx_t_3 = __pyx_t_6;
        } else {
          __pyx_t_3 = __pyx_t_2;
        }
        __pyx_t_2 = __pyx_t_3;
      } else {
        __pyx_t_2 = __pyx_t_4;
      }
      if (__pyx_t_2) {

        /* "epr.pyx":1021
 *                                     epr_get_field_name(p2)) != 0)):
 * 
 *                     return False             # <<<<<<<<<<<<<<
 * 
 *                 n = epr_get_data_type_size(epr_get_field_type(p1))
 */
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(Py_False);
        __pyx_r = Py_False;
        goto __pyx_L0;
      }

      /* "epr.pyx":1023
 *                     return False
 * 
 *                 n = epr_get_data_type_size(epr_get_field_type(p1))             # <<<<<<<<<<<<<<
 *                 if n != 0:
 *                     n *= epr_get_field_num_elems(p1)
 */
      __pyx_v_n = epr_get_data_type_size(epr_get_field_type(__pyx_v_p1));

      /* "epr.pyx":1024
 * 
 *                 n = epr_get_data_type_size(epr_get_field_type(p1))
 *                 if n != 0:             # <<<<<<<<<<<<<<
 *                     n *= epr_get_field_num_elems(p1)
 *                 #pyepr_check_errors()
 */
      __pyx_t_2 = ((__pyx_v_n != 0) != 0);
      if (__pyx_t_2) {

        /* "epr.pyx":1025
 *                 n = epr_get_data_type_size(epr_get_field_type(p1))
 *                 if n != 0:
 *                     n *= epr_get_field_num_elems(p1)             # <<<<<<<<<<<<<<
 *                 #pyepr_check_errors()
 *                 if n <= 0:
 */
        __pyx_v_n = (__pyx_v_n * epr_get_field_num_elems(__pyx_v_p1));
        goto __pyx_L6;
      }
      __pyx_L6:;

      /* "epr.pyx":1027
 *                     n *= epr_get_field_num_elems(p1)
 *                 #pyepr_check_errors()
 *                 if n <= 0:             # <<<<<<<<<<<<<<
 *                     # @TODO: check
 *                     return True
 */
      __pyx_t_2 = ((__pyx_v_n <= 0) != 0);
      if (__pyx_t_2) {

        /* "epr.pyx":1029
 *                 if n <= 0:
 *                     # @TODO: check
 *                     return True             # <<<<<<<<<<<<<<
 * 
 *                 return (cstring.memcmp(p1.elems, p2.elems, n) == 0)
 */
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(Py_True);
        __pyx_r = Py_True;
        goto __pyx_L0;
      }

      /* "epr.pyx":1031
 *                     return True
 * 
 *                 return (cstring.memcmp(p1.elems, p2.elems, n) == 0)             # <<<<<<<<<<<<<<
 * 
 *             elif op == 3:       # ne
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_5 = __Pyx_PyBool_FromLong((memcmp(__pyx_v_p1->elems, __pyx_v_p2->elems, __pyx_v_n) == 0)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1031; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_r = __pyx_t_5;
      __pyx_t_5 = 0;
      goto __pyx_L0;
      break;

      /* "epr.pyx":1033
 *                 return (cstring.memcmp(p1.elems, p2.elems, n) == 0)
 * 
 *             elif op == 3:       # ne             # <<<<<<<<<<<<<<
 *                 if p1 == p2:
 *                     return False
 */
      case 3:

      /* "epr.pyx":1034
 * 
 *             elif op == 3:       # ne
 *                 if p1 == p2:             # <<<<<<<<<<<<<<
 *                     return False
 * 
 */
      __pyx_t_2 = ((__pyx_v_p1 == __pyx_v_p2) != 0);
      if (__pyx_t_2) {

        /* "epr.pyx":1035
 *             elif op == 3:       # ne
 *                 if p1 == p2:
 *                     return False             # <<<<<<<<<<<<<<
 * 
 *                 (<Field>self).check_closed_product()
 */
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(Py_False);
        __pyx_r = Py_False;
        goto __pyx_L0;
      }

      /* "epr.pyx":1037
 *                     return False
 * 
 *                 (<Field>self).check_closed_product()             # <<<<<<<<<<<<<<
 * 
 *                 if ((epr_get_field_num_elems(p1) !=
 */
      __pyx_t_5 = __pyx_f_3epr_5Field_check_closed_product(((struct __pyx_obj_3epr_Field *)__pyx_v_self)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1037; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

      /* "epr.pyx":1039
 *                 (<Field>self).check_closed_product()
 * 
 *                 if ((epr_get_field_num_elems(p1) !=             # <<<<<<<<<<<<<<
 *                             epr_get_field_num_elems(p2)) or
 * 
 */
      __pyx_t_2 = ((epr_get_field_num_elems(__pyx_v_p1) != epr_get_field_num_elems(__pyx_v_p2)) != 0);
      if (!__pyx_t_2) {

        /* "epr.pyx":1042
 *                             epr_get_field_num_elems(p2)) or
 * 
 *                     (epr_get_field_type(p1) != epr_get_field_type(p2)) or             # <<<<<<<<<<<<<<
 * 
 *                     (cstring.strcmp(epr_get_field_unit(p1),
 */
        __pyx_t_4 = ((epr_get_field_type(__pyx_v_p1) != epr_get_field_type(__pyx_v_p2)) != 0);
        if (!__pyx_t_4) {

          /* "epr.pyx":1045
 * 
 *                     (cstring.strcmp(epr_get_field_unit(p1),
 *                                     epr_get_field_unit(p2)) != 0) or             # <<<<<<<<<<<<<<
 * 
 *                     (cstring.strcmp(epr_get_field_description(p1),
 */
          __pyx_t_3 = ((strcmp(epr_get_field_unit(__pyx_v_p1), epr_get_field_unit(__pyx_v_p2)) != 0) != 0);
          if (!__pyx_t_3) {

            /* "epr.pyx":1048
 * 
 *                     (cstring.strcmp(epr_get_field_description(p1),
 *                                     epr_get_field_description(p2)) != 0) or             # <<<<<<<<<<<<<<
 * 
 *                     (cstring.strcmp(epr_get_field_name(p1),
 */
            __pyx_t_6 = ((strcmp(epr_get_field_description(__pyx_v_p1), epr_get_field_description(__pyx_v_p2)) != 0) != 0);
            if (!__pyx_t_6) {

              /* "epr.pyx":1051
 * 
 *                     (cstring.strcmp(epr_get_field_name(p1),
 *                                     epr_get_field_name(p2)) != 0)):             # <<<<<<<<<<<<<<
 * 
 *                     return True
 */
              __pyx_t_8 = ((strcmp(epr_get_field_name(__pyx_v_p1), epr_get_field_name(__pyx_v_p2)) != 0) != 0);
              __pyx_t_7 = __pyx_t_8;
            } else {
              __pyx_t_7 = __pyx_t_6;
            }
            __pyx_t_6 = __pyx_t_7;
          } else {
            __pyx_t_6 = __pyx_t_3;
          }
          __pyx_t_3 = __pyx_t_6;
        } else {
          __pyx_t_3 = __pyx_t_4;
        }
        __pyx_t_4 = __pyx_t_3;
      } else {
        __pyx_t_4 = __pyx_t_2;
      }
      if (__pyx_t_4) {

        /* "epr.pyx":1053
 *                                     epr_get_field_name(p2)) != 0)):
 * 
 *                     return True             # <<<<<<<<<<<<<<
 * 
 *                 n = epr_get_data_type_size(epr_get_field_type(p1))
 */
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(Py_True);
        __pyx_r = Py_True;
        goto __pyx_L0;
      }

      /* "epr.pyx":1055
 *                     return True
 * 
 *                 n = epr_get_data_type_size(epr_get_field_type(p1))             # <<<<<<<<<<<<<<
 *                 if n != 0:
 *                     n *= epr_get_field_num_elems(p1)
 */
      __pyx_v_n = epr_get_data_type_size(epr_get_field_type(__pyx_v_p1));

      /* "epr.pyx":1056
 * 
 *                 n = epr_get_data_type_size(epr_get_field_type(p1))
 *                 if n != 0:             # <<<<<<<<<<<<<<
 *                     n *= epr_get_field_num_elems(p1)
 *                 #pyepr_check_errors()
 */
      __pyx_t_4 = ((__pyx_v_n != 0) != 0);
      if (__pyx_t_4) {

        /* "epr.pyx":1057
 *                 n = epr_get_data_type_size(epr_get_field_type(p1))
 *                 if n != 0:
 *                     n *= epr_get_field_num_elems(p1)             # <<<<<<<<<<<<<<
 *                 #pyepr_check_errors()
 *                 if n <= 0:
 */
        __pyx_v_n = (__pyx_v_n * epr_get_field_num_elems(__pyx_v_p1));
        goto __pyx_L10;
      }
      __pyx_L10:;

      /* "epr.pyx":1059
 *                     n *= epr_get_field_num_elems(p1)
 *                 #pyepr_check_errors()
 *                 if n <= 0:             # <<<<<<<<<<<<<<
 *                     # @TODO: check
 *                     return False
 */
      __pyx_t_4 = ((__pyx_v_n <= 0) != 0);
      if (__pyx_t_4) {

        /* "epr.pyx":1061
 *                 if n <= 0:
 *                     # @TODO: check
 *                     return False             # <<<<<<<<<<<<<<
 * 
 *                 return (cstring.memcmp(p1.elems, p2.elems, n) != 0)
 */
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(Py_False);
        __pyx_r = Py_False;
        goto __pyx_L0;
      }

      /* "epr.pyx":1063
 *                     return False
 * 
 *                 return (cstring.memcmp(p1.elems, p2.elems, n) != 0)             # <<<<<<<<<<<<<<
 * 
 *             else:
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_5 = __Pyx_PyBool_FromLong((memcmp(__pyx_v_p1->elems, __pyx_v_p2->elems, __pyx_v_n) != 0)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1063; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_r = __pyx_t_5;
      __pyx_t_5 = 0;
      goto __pyx_L0;
      break;
      default:

      /* "epr.pyx":1066
 * 
 *             else:
 *                 raise TypeError(             # <<<<<<<<<<<<<<
 *                     'Field only implements "==" and "!=" operators')
 *         else:
 */
      __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1066; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_Raise(__pyx_t_5, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1066; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      break;
    }
  }
  /*else*/ {

    /* "epr.pyx":1069
 *                     'Field only implements "==" and "!=" operators')
 *         else:
 *             return NotImplemented             # <<<<<<<<<<<<<<
 * 
 *     def __len__(self):
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_builtin_NotImplemented);
    __pyx_r = __pyx_builtin_NotImplemented;
    goto __pyx_L0;
  }

  /* "epr.pyx":994
 *                 return '%s = %s' % (name, fmt % self.get_elem())
 * 
 *     def __richcmp__(self, other, int op):             # <<<<<<<<<<<<<<
 *         cdef int ret
 *         cdef size_t n
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("epr.Field.__richcmp__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":1071
 *             return NotImplemented
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         self.check_closed_product()
 * 
 */

/* Python wrapper */
static Py_ssize_t __pyx_pw_3epr_5Field_27__len__(PyObject *__pyx_v_self); /*proto*/
static Py_ssize_t __pyx_pw_3epr_5Field_27__len__(PyObject *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
  __pyx_r = __pyx_pf_3epr_5Field_26__len__(((struct __pyx_obj_3epr_Field *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static Py_ssize_t __pyx_pf_3epr_5Field_26__len__(struct __pyx_obj_3epr_Field *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__len__", 0);

  /* "epr.pyx":1072
 * 
 *     def __len__(self):
 *         self.check_closed_product()             # <<<<<<<<<<<<<<
 * 
 *         if epr_get_field_type(self._ptr) == e_tid_string:
 */
  __pyx_t_1 = __pyx_f_3epr_5Field_check_closed_product(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1072; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "epr.pyx":1074
 *         self.check_closed_product()
 * 
 *         if epr_get_field_type(self._ptr) == e_tid_string:             # <<<<<<<<<<<<<<
 *             return cstring.strlen(epr_get_field_elem_as_str(self._ptr))
 *         else:
 */
  __pyx_t_2 = ((epr_get_field_type(__pyx_v_self->_ptr) == e_tid_string) != 0);
  if (__pyx_t_2) {

    /* "epr.pyx":1075
 * 
 *         if epr_get_field_type(self._ptr) == e_tid_string:
 *             return cstring.strlen(epr_get_field_elem_as_str(self._ptr))             # <<<<<<<<<<<<<<
 *         else:
 *             return epr_get_field_num_elems(self._ptr)
 */
    __pyx_r = strlen(epr_get_field_elem_as_str(__pyx_v_self->_ptr));
    goto __pyx_L0;
  }
  /*else*/ {

    /* "epr.pyx":1077
 *             return cstring.strlen(epr_get_field_elem_as_str(self._ptr))
 *         else:
 *             return epr_get_field_num_elems(self._ptr)             # <<<<<<<<<<<<<<
 * 
 *     # --- low level interface -------------------------------------------------
 */
    __pyx_r = epr_get_field_num_elems(__pyx_v_self->_ptr);
    goto __pyx_L0;
  }

  /* "epr.pyx":1071
 *             return NotImplemented
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         self.check_closed_product()
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("epr.Field.__len__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":1083
 *         '''The magic number for internal C structure'''
 * 
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             self.check_closed_product()
 *             return self._ptr.magic
 */

/* Python wrapper */
static PyObject *__pyx_pw_3epr_5Field_6_magic_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_3epr_5Field_6_magic_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_3epr_5Field_6_magic___get__(((struct __pyx_obj_3epr_Field *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_3epr_5Field_6_magic___get__(struct __pyx_obj_3epr_Field *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "epr.pyx":1084
 * 
 *         def __get__(self):
 *             self.check_closed_product()             # <<<<<<<<<<<<<<
 *             return self._ptr.magic
 * 
 */
  __pyx_t_1 = __pyx_f_3epr_5Field_check_closed_product(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1084; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "epr.pyx":1085
 *         def __get__(self):
 *             self.check_closed_product()
 *             return self._ptr.magic             # <<<<<<<<<<<<<<
 * 
 *     def get_offset(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_EPR_Magic(__pyx_v_self->_ptr->magic); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1085; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "epr.pyx":1083
 *         '''The magic number for internal C structure'''
 * 
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             self.check_closed_product()
 *             return self._ptr.magic
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("epr.Field._magic.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":1087
 *             return self._ptr.magic
 * 
 *     def get_offset(self):             # <<<<<<<<<<<<<<
 *         '''Field offset in bytes within the Record'''
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_3epr_5Field_29get_offset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_3epr_5Field_28get_offset[] = "Field offset in bytes within the Record";
static PyObject *__pyx_pw_3epr_5Field_29get_offset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_offset (wrapper)", 0);
  __pyx_r = __pyx_pf_3epr_5Field_28get_offset(((struct __pyx_obj_3epr_Field *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_3epr_5Field_28get_offset(struct __pyx_obj_3epr_Field *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_offset", 0);

  /* "epr.pyx":1090
 *         '''Field offset in bytes within the Record'''
 * 
 *         self.check_closed_product()             # <<<<<<<<<<<<<<
 *         return self._get_offset()
 * 
 */
  __pyx_t_1 = __pyx_f_3epr_5Field_check_closed_product(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1090; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "epr.pyx":1091
 * 
 *         self.check_closed_product()
 *         return self._get_offset()             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_long(((struct __pyx_vtabstruct_3epr_Field *)__pyx_v_self->__pyx_vtab)->_get_offset(__pyx_v_self, NULL)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1091; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "epr.pyx":1087
 *             return self._ptr.magic
 * 
 *     def get_offset(self):             # <<<<<<<<<<<<<<
 *         '''Field offset in bytes within the Record'''
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("epr.Field.get_offset", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":1094
 * 
 * 
 * cdef new_field(EPR_SField* ptr, Record parent=None):             # <<<<<<<<<<<<<<
 *     if ptr is NULL:
 *         pyepr_null_ptr_error()
 */

static PyObject *__pyx_f_3epr_new_field(EPR_SField *__pyx_v_ptr, struct __pyx_opt_args_3epr_new_field *__pyx_optional_args) {
  struct __pyx_obj_3epr_Record *__pyx_v_parent = ((struct __pyx_obj_3epr_Record *)Py_None);
  struct __pyx_obj_3epr_Field *__pyx_v_instance = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("new_field", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_parent = __pyx_optional_args->parent;
    }
  }

  /* "epr.pyx":1095
 * 
 * cdef new_field(EPR_SField* ptr, Record parent=None):
 *     if ptr is NULL:             # <<<<<<<<<<<<<<
 *         pyepr_null_ptr_error()
 * 
 */
  __pyx_t_1 = ((__pyx_v_ptr == NULL) != 0);
  if (__pyx_t_1) {

    /* "epr.pyx":1096
 * cdef new_field(EPR_SField* ptr, Record parent=None):
 *     if ptr is NULL:
 *         pyepr_null_ptr_error()             # <<<<<<<<<<<<<<
 * 
 *     cdef Field instance = Field.__new__(Field)
 */
    __pyx_t_2 = __pyx_f_3epr_pyepr_null_ptr_error(NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1096; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "epr.pyx":1098
 *         pyepr_null_ptr_error()
 * 
 *     cdef Field instance = Field.__new__(Field)             # <<<<<<<<<<<<<<
 * 
 *     instance._ptr = ptr
 */
  __pyx_t_2 = __pyx_tp_new_3epr_Field(((PyTypeObject *)((PyObject*)__pyx_ptype_3epr_Field)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1098; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (!(likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_3epr_Field)))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1098; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_instance = ((struct __pyx_obj_3epr_Field *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "epr.pyx":1100
 *     cdef Field instance = Field.__new__(Field)
 * 
 *     instance._ptr = ptr             # <<<<<<<<<<<<<<
 *     instance._parent = parent
 * 
 */
  __pyx_v_instance->_ptr = __pyx_v_ptr;

  /* "epr.pyx":1101
 * 
 *     instance._ptr = ptr
 *     instance._parent = parent             # <<<<<<<<<<<<<<
 * 
 *     return instance
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_parent));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_parent));
  __Pyx_GOTREF(__pyx_v_instance->_parent);
  __Pyx_DECREF(((PyObject *)__pyx_v_instance->_parent));
  __pyx_v_instance->_parent = __pyx_v_parent;

  /* "epr.pyx":1103
 *     instance._parent = parent
 * 
 *     return instance             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_instance));
  __pyx_r = ((PyObject *)__pyx_v_instance);
  goto __pyx_L0;

  /* "epr.pyx":1094
 * 
 * 
 * cdef new_field(EPR_SField* ptr, Record parent=None):             # <<<<<<<<<<<<<<
 *     if ptr is NULL:
 *         pyepr_null_ptr_error()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("epr.new_field", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_instance);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":1120
 *     cdef int _index
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         if not self._dealloc:
 *             return
 */

/* Python wrapper */
static void __pyx_pw_3epr_6Record_1__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_3epr_6Record_1__dealloc__(PyObject *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_pf_3epr_6Record___dealloc__(((struct __pyx_obj_3epr_Record *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

static void __pyx_pf_3epr_6Record___dealloc__(struct __pyx_obj_3epr_Record *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__dealloc__", 0);

  /* "epr.pyx":1121
 * 
 *     def __dealloc__(self):
 *         if not self._dealloc:             # <<<<<<<<<<<<<<
 *             return
 * 
 */
  __pyx_t_1 = ((!(__pyx_v_self->_dealloc != 0)) != 0);
  if (__pyx_t_1) {

    /* "epr.pyx":1122
 *     def __dealloc__(self):
 *         if not self._dealloc:
 *             return             # <<<<<<<<<<<<<<
 * 
 *         if self._ptr is not NULL:
 */
    goto __pyx_L0;
  }

  /* "epr.pyx":1124
 *             return
 * 
 *         if self._ptr is not NULL:             # <<<<<<<<<<<<<<
 *             epr_free_record(self._ptr)
 *             pyepr_check_errors()
 */
  __pyx_t_1 = ((__pyx_v_self->_ptr != NULL) != 0);
  if (__pyx_t_1) {

    /* "epr.pyx":1125
 * 
 *         if self._ptr is not NULL:
 *             epr_free_record(self._ptr)             # <<<<<<<<<<<<<<
 *             pyepr_check_errors()
 * 
 */
    epr_free_record(__pyx_v_self->_ptr);

    /* "epr.pyx":1126
 *         if self._ptr is not NULL:
 *             epr_free_record(self._ptr)
 *             pyepr_check_errors()             # <<<<<<<<<<<<<<
 * 
 *     cdef inline check_closed_product(self):
 */
    __pyx_t_2 = __pyx_f_3epr_pyepr_check_errors(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1126; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "epr.pyx":1120
 *     cdef int _index
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         if not self._dealloc:
 *             return
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_WriteUnraisable("epr.Record.__dealloc__", __pyx_clineno, __pyx_lineno, __pyx_filename, 0);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* "epr.pyx":1128
 *             pyepr_check_errors()
 * 
 *     cdef inline check_closed_product(self):             # <<<<<<<<<<<<<<
 *         if isinstance(self._parent, Dataset):
 *             (<Dataset>self._parent).check_closed_product()
 */

static CYTHON_INLINE PyObject *__pyx_f_3epr_6Record_check_closed_product(struct __pyx_obj_3epr_Record *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("check_closed_product", 0);

  /* "epr.pyx":1129
 * 
 *     cdef inline check_closed_product(self):
 *         if isinstance(self._parent, Dataset):             # <<<<<<<<<<<<<<
 *             (<Dataset>self._parent).check_closed_product()
 *         else:
 */
  __pyx_t_1 = __pyx_v_self->_parent;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_TypeCheck(__pyx_t_1, ((PyObject*)__pyx_ptype_3epr_Dataset)); 
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "epr.pyx":1130
 *     cdef inline check_closed_product(self):
 *         if isinstance(self._parent, Dataset):
 *             (<Dataset>self._parent).check_closed_product()             # <<<<<<<<<<<<<<
 *         else:
 *             #elif isinstance(self._parent, Product):
 */
    __pyx_t_1 = __pyx_f_3epr_7Dataset_check_closed_product(((struct __pyx_obj_3epr_Dataset *)__pyx_v_self->_parent)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "epr.pyx":1133
 *         else:
 *             #elif isinstance(self._parent, Product):
 *             (<Product>self._parent).check_closed_product()             # <<<<<<<<<<<<<<
 * 
 *     cdef inline _check_write_mode(self):
 */
    __pyx_t_1 = __pyx_f_3epr_7Product_check_closed_product(((struct __pyx_obj_3epr_Product *)__pyx_v_self->_parent)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }
  __pyx_L3:;

  /* "epr.pyx":1128
 *             pyepr_check_errors()
 * 
 *     cdef inline check_closed_product(self):             # <<<<<<<<<<<<<<
 *         if isinstance(self._parent, Dataset):
 *             (<Dataset>self._parent).check_closed_product()
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("epr.Record.check_closed_product", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":1135
 *             (<Product>self._parent).check_closed_product()
 * 
 *     cdef inline _check_write_mode(self):             # <<<<<<<<<<<<<<
 *         if isinstance(self._parent, Dataset):
 *             (<Dataset>self._parent)._check_write_mode()
 */

static CYTHON_INLINE PyObject *__pyx_f_3epr_6Record__check_write_mode(struct __pyx_obj_3epr_Record *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_check_write_mode", 0);

  /* "epr.pyx":1136
 * 
 *     cdef inline _check_write_mode(self):
 *         if isinstance(self._parent, Dataset):             # <<<<<<<<<<<<<<
 *             (<Dataset>self._parent)._check_write_mode()
 *         else:
 */
  __pyx_t_1 = __pyx_v_self->_parent;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_TypeCheck(__pyx_t_1, ((PyObject*)__pyx_ptype_3epr_Dataset)); 
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "epr.pyx":1137
 *     cdef inline _check_write_mode(self):
 *         if isinstance(self._parent, Dataset):
 *             (<Dataset>self._parent)._check_write_mode()             # <<<<<<<<<<<<<<
 *         else:
 *             #elif isinstance(self._parent, Product):
 */
    __pyx_t_1 = __pyx_f_3epr_7Dataset__check_write_mode(((struct __pyx_obj_3epr_Dataset *)__pyx_v_self->_parent)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "epr.pyx":1140
 *         else:
 *             #elif isinstance(self._parent, Product):
 *             (<Product>self._parent)._check_write_mode()             # <<<<<<<<<<<<<<
 * 
 *     cdef inline uint _get_offset(self, bint absolure=0):
 */
    __pyx_t_1 = __pyx_f_3epr_7Product__check_write_mode(((struct __pyx_obj_3epr_Product *)__pyx_v_self->_parent)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }
  __pyx_L3:;

  /* "epr.pyx":1135
 *             (<Product>self._parent).check_closed_product()
 * 
 *     cdef inline _check_write_mode(self):             # <<<<<<<<<<<<<<
 *         if isinstance(self._parent, Dataset):
 *             (<Dataset>self._parent)._check_write_mode()
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("epr.Record._check_write_mode", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":1142
 *             (<Product>self._parent)._check_write_mode()
 * 
 *     cdef inline uint _get_offset(self, bint absolure=0):             # <<<<<<<<<<<<<<
 *         cdef EPR_RecordInfo* info = <EPR_RecordInfo*>self._ptr.info
 *         cdef uint offset = self._index * info.tot_size
 */

static CYTHON_INLINE uint __pyx_f_3epr_6Record__get_offset(struct __pyx_obj_3epr_Record *__pyx_v_self, struct __pyx_opt_args_3epr_6Record__get_offset *__pyx_optional_args) {
  int __pyx_v_absolure = ((int)0);
  __pyx_t_3epr_EPR_RecordInfo *__pyx_v_info;
  uint __pyx_v_offset;
  uint __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("_get_offset", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_absolure = __pyx_optional_args->absolure;
    }
  }

  /* "epr.pyx":1143
 * 
 *     cdef inline uint _get_offset(self, bint absolure=0):
 *         cdef EPR_RecordInfo* info = <EPR_RecordInfo*>self._ptr.info             # <<<<<<<<<<<<<<
 *         cdef uint offset = self._index * info.tot_size
 * 
 */
  __pyx_v_info = ((__pyx_t_3epr_EPR_RecordInfo *)__pyx_v_self->_ptr->info);

  /* "epr.pyx":1144
 *     cdef inline uint _get_offset(self, bint absolure=0):
 *         cdef EPR_RecordInfo* info = <EPR_RecordInfo*>self._ptr.info
 *         cdef uint offset = self._index * info.tot_size             # <<<<<<<<<<<<<<
 * 
 *         # assert self._index is not None
 */
  __pyx_v_offset = (__pyx_v_self->_index * __pyx_v_info->tot_size);

  /* "epr.pyx":1148
 *         # assert self._index is not None
 * 
 *         if absolure:             # <<<<<<<<<<<<<<
 *             offset += (<Dataset>self._parent)._get_offset()
 * 
 */
  __pyx_t_1 = (__pyx_v_absolure != 0);
  if (__pyx_t_1) {

    /* "epr.pyx":1149
 * 
 *         if absolure:
 *             offset += (<Dataset>self._parent)._get_offset()             # <<<<<<<<<<<<<<
 * 
 *         return offset
 */
    __pyx_v_offset = (__pyx_v_offset + __pyx_f_3epr_7Dataset__get_offset(((struct __pyx_obj_3epr_Dataset *)__pyx_v_self->_parent)));
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "epr.pyx":1151
 *             offset += (<Dataset>self._parent)._get_offset()
 * 
 *         return offset             # <<<<<<<<<<<<<<
 * 
 *     def get_num_fields(self):
 */
  __pyx_r = __pyx_v_offset;
  goto __pyx_L0;

  /* "epr.pyx":1142
 *             (<Product>self._parent)._check_write_mode()
 * 
 *     cdef inline uint _get_offset(self, bint absolure=0):             # <<<<<<<<<<<<<<
 *         cdef EPR_RecordInfo* info = <EPR_RecordInfo*>self._ptr.info
 *         cdef uint offset = self._index * info.tot_size
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":1153
 *         return offset
 * 
 *     def get_num_fields(self):             # <<<<<<<<<<<<<<
 *         '''get_num_fields(self)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_3epr_6Record_3get_num_fields(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_3epr_6Record_2get_num_fields[] = "get_num_fields(self)\n\n        Gets the number of fields contained in the record\n\n        ";
static PyObject *__pyx_pw_3epr_6Record_3get_num_fields(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_num_fields (wrapper)", 0);
  __pyx_r = __pyx_pf_3epr_6Record_2get_num_fields(((struct __pyx_obj_3epr_Record *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_3epr_6Record_2get_num_fields(struct __pyx_obj_3epr_Record *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_num_fields", 0);

  /* "epr.pyx":1160
 *         '''
 * 
 *         return epr_get_num_fields(self._ptr)             # <<<<<<<<<<<<<<
 * 
 *     def print_(self, ostream=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_uint(epr_get_num_fields(__pyx_v_self->_ptr)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "epr.pyx":1153
 *         return offset
 * 
 *     def get_num_fields(self):             # <<<<<<<<<<<<<<
 *         '''get_num_fields(self)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("epr.Record.get_num_fields", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":1162
 *         return epr_get_num_fields(self._ptr)
 * 
 *     def print_(self, ostream=None):             # <<<<<<<<<<<<<<
 *         '''print_(self, ostream=None)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_3epr_6Record_5print_(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_3epr_6Record_4print_[] = "print_(self, ostream=None)\n\n        Write the record to specified file\n\n        This method writes formatted contents of the record to\n        specified *ostream* text file or (default) the ASCII output\n        is be printed to standard output (:data:`sys.stdout`)\n\n        :param ostream:\n            the (opened) output file object\n\n        .. note:: the *ostream* parameter have to be a *real* file not\n                  a generic stream object like\n                  :class:`StringIO.StringIO` instances\n\n        ";
static PyObject *__pyx_pw_3epr_6Record_5print_(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_ostream = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("print_ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_ostream,0};
    PyObject* values[1] = {0};
    values[0] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_ostream);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "print_") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1162; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_ostream = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("print_", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1162; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("epr.Record.print_", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_3epr_6Record_4print_(((struct __pyx_obj_3epr_Record *)__pyx_v_self), __pyx_v_ostream);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_3epr_6Record_4print_(struct __pyx_obj_3epr_Record *__pyx_v_self, PyObject *__pyx_v_ostream) {
  FILE *__pyx_v_fstream;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  FILE *__pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("print_", 0);

  /* "epr.pyx":1180
 *         '''
 * 
 *         cdef FILE* fstream = pyepr_get_file_stream(ostream)             # <<<<<<<<<<<<<<
 * 
 *         self.check_closed_product()
 */
  __pyx_t_1 = __pyx_f_3epr_pyepr_get_file_stream(__pyx_v_ostream); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_fstream = __pyx_t_1;

  /* "epr.pyx":1182
 *         cdef FILE* fstream = pyepr_get_file_stream(ostream)
 * 
 *         self.check_closed_product()             # <<<<<<<<<<<<<<
 * 
 *         with nogil:
 */
  __pyx_t_2 = __pyx_f_3epr_6Record_check_closed_product(__pyx_v_self); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1182; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "epr.pyx":1184
 *         self.check_closed_product()
 * 
 *         with nogil:             # <<<<<<<<<<<<<<
 *             epr_print_record(self._ptr, fstream)
 *             stdio.fflush(fstream)
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      #endif
      /*try:*/ {

        /* "epr.pyx":1185
 * 
 *         with nogil:
 *             epr_print_record(self._ptr, fstream)             # <<<<<<<<<<<<<<
 *             stdio.fflush(fstream)
 * 
 */
        epr_print_record(__pyx_v_self->_ptr, __pyx_v_fstream);

        /* "epr.pyx":1186
 *         with nogil:
 *             epr_print_record(self._ptr, fstream)
 *             stdio.fflush(fstream)             # <<<<<<<<<<<<<<
 * 
 *         pyepr_check_errors()
 */
        fflush(__pyx_v_fstream);
      }

      /* "epr.pyx":1184
 *         self.check_closed_product()
 * 
 *         with nogil:             # <<<<<<<<<<<<<<
 *             epr_print_record(self._ptr, fstream)
 *             stdio.fflush(fstream)
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L5;
        }
        __pyx_L5:;
      }
  }

  /* "epr.pyx":1188
 *             stdio.fflush(fstream)
 * 
 *         pyepr_check_errors()             # <<<<<<<<<<<<<<
 * 
 *     def print_element(self, uint field_index, uint element_index,
 */
  __pyx_t_2 = __pyx_f_3epr_pyepr_check_errors(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1188; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "epr.pyx":1162
 *         return epr_get_num_fields(self._ptr)
 * 
 *     def print_(self, ostream=None):             # <<<<<<<<<<<<<<
 *         '''print_(self, ostream=None)
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("epr.Record.print_", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":1190
 *         pyepr_check_errors()
 * 
 *     def print_element(self, uint field_index, uint element_index,             # <<<<<<<<<<<<<<
 *                       ostream=None):
 *         '''print_element(self, field_index, element_index, ostream=None)
 */

/* Python wrapper */
static PyObject *__pyx_pw_3epr_6Record_7print_element(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_3epr_6Record_6print_element[] = "print_element(self, field_index, element_index, ostream=None)\n\n        Write the specified field element to file\n\n        This method writes formatted contents of the specified field\n        element to the *ostream* text file or (default) the ASCII output\n        will be printed to standard output (:data:`sys.stdout`)\n\n        :param field_index:\n            the index of field in the record\n        :param element_index:\n            the index of element in the specified field\n        :param ostream:\n            the (opened) output file object\n\n        .. note:: the *ostream* parameter have to be a *real* file not\n                  a generic stream object like\n                  :class:`StringIO.StringIO` instances\n\n        ";
static PyObject *__pyx_pw_3epr_6Record_7print_element(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  uint __pyx_v_field_index;
  uint __pyx_v_element_index;
  PyObject *__pyx_v_ostream = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("print_element (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_field_index,&__pyx_n_s_element_index,&__pyx_n_s_ostream,0};
    PyObject* values[3] = {0,0,0};

    /* "epr.pyx":1191
 * 
 *     def print_element(self, uint field_index, uint element_index,
 *                       ostream=None):             # <<<<<<<<<<<<<<
 *         '''print_element(self, field_index, element_index, ostream=None)
 * 
 */
    values[2] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_field_index)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_element_index)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("print_element", 0, 2, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1190; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_ostream);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "print_element") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1190; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_field_index = __Pyx_PyInt_As_uint(values[0]); if (unlikely((__pyx_v_field_index == (uint)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1190; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_element_index = __Pyx_PyInt_As_uint(values[1]); if (unlikely((__pyx_v_element_index == (uint)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1190; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_ostream = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("print_element", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1190; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("epr.Record.print_element", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_3epr_6Record_6print_element(((struct __pyx_obj_3epr_Record *)__pyx_v_self), __pyx_v_field_index, __pyx_v_element_index, __pyx_v_ostream);

  /* "epr.pyx":1190
 *         pyepr_check_errors()
 * 
 *     def print_element(self, uint field_index, uint element_index,             # <<<<<<<<<<<<<<
 *                       ostream=None):
 *         '''print_element(self, field_index, element_index, ostream=None)
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_3epr_6Record_6print_element(struct __pyx_obj_3epr_Record *__pyx_v_self, uint __pyx_v_field_index, uint __pyx_v_element_index, PyObject *__pyx_v_ostream) {
  FILE *__pyx_v_fstream;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  FILE *__pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("print_element", 0);

  /* "epr.pyx":1213
 *         '''
 * 
 *         cdef FILE* fstream = pyepr_get_file_stream(ostream)             # <<<<<<<<<<<<<<
 * 
 *         self.check_closed_product()
 */
  __pyx_t_1 = __pyx_f_3epr_pyepr_get_file_stream(__pyx_v_ostream); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1213; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_fstream = __pyx_t_1;

  /* "epr.pyx":1215
 *         cdef FILE* fstream = pyepr_get_file_stream(ostream)
 * 
 *         self.check_closed_product()             # <<<<<<<<<<<<<<
 * 
 *         with nogil:
 */
  __pyx_t_2 = __pyx_f_3epr_6Record_check_closed_product(__pyx_v_self); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "epr.pyx":1217
 *         self.check_closed_product()
 * 
 *         with nogil:             # <<<<<<<<<<<<<<
 *             epr_print_element(self._ptr, field_index, element_index, fstream)
 *             stdio.fflush(fstream)
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      #endif
      /*try:*/ {

        /* "epr.pyx":1218
 * 
 *         with nogil:
 *             epr_print_element(self._ptr, field_index, element_index, fstream)             # <<<<<<<<<<<<<<
 *             stdio.fflush(fstream)
 * 
 */
        epr_print_element(__pyx_v_self->_ptr, __pyx_v_field_index, __pyx_v_element_index, __pyx_v_fstream);

        /* "epr.pyx":1219
 *         with nogil:
 *             epr_print_element(self._ptr, field_index, element_index, fstream)
 *             stdio.fflush(fstream)             # <<<<<<<<<<<<<<
 * 
 *         pyepr_check_errors()
 */
        fflush(__pyx_v_fstream);
      }

      /* "epr.pyx":1217
 *         self.check_closed_product()
 * 
 *         with nogil:             # <<<<<<<<<<<<<<
 *             epr_print_element(self._ptr, field_index, element_index, fstream)
 *             stdio.fflush(fstream)
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L5;
        }
        __pyx_L5:;
      }
  }

  /* "epr.pyx":1221
 *             stdio.fflush(fstream)
 * 
 *         pyepr_check_errors()             # <<<<<<<<<<<<<<
 * 
 *     def get_field(self, name):
 */
  __pyx_t_2 = __pyx_f_3epr_pyepr_check_errors(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1221; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "epr.pyx":1190
 *         pyepr_check_errors()
 * 
 *     def print_element(self, uint field_index, uint element_index,             # <<<<<<<<<<<<<<
 *                       ostream=None):
 *         '''print_element(self, field_index, element_index, ostream=None)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("epr.Record.print_element", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":1223
 *         pyepr_check_errors()
 * 
 *     def get_field(self, name):             # <<<<<<<<<<<<<<
 *         '''get_field(self, name)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_3epr_6Record_9get_field(PyObject *__pyx_v_self, PyObject *__pyx_v_name); /*proto*/
static char __pyx_doc_3epr_6Record_8get_field[] = "get_field(self, name)\n\n        Gets a field specified by name\n\n        The field is here identified through the given name.\n        It contains the field info and all corresponding values.\n\n        :param name:\n            the the name of required field\n        :returns:\n            the specified :class:`Field` or raises an exception\n            (:exc:`EPRValueError`) if an error occurred\n\n        ";
static PyObject *__pyx_pw_3epr_6Record_9get_field(PyObject *__pyx_v_self, PyObject *__pyx_v_name) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_field (wrapper)", 0);
  __pyx_r = __pyx_pf_3epr_6Record_8get_field(((struct __pyx_obj_3epr_Record *)__pyx_v_self), ((PyObject *)__pyx_v_name));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_3epr_6Record_8get_field(struct __pyx_obj_3epr_Record *__pyx_v_self, PyObject *__pyx_v_name) {
  EPR_SField *__pyx_v_field_ptr;
  PyObject *__pyx_v_cname = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  char *__pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  struct __pyx_opt_args_3epr_pyepr_null_ptr_error __pyx_t_5;
  struct __pyx_opt_args_3epr_new_field __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_field", 0);

  /* "epr.pyx":1240
 * 
 *         cdef EPR_SField* field_ptr
 *         cdef bytes cname = _to_bytes(name)             # <<<<<<<<<<<<<<
 * 
 *         self.check_closed_product()
 */
  __pyx_t_1 = __pyx_f_3epr__to_bytes(__pyx_v_name, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1240; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_cname = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "epr.pyx":1242
 *         cdef bytes cname = _to_bytes(name)
 * 
 *         self.check_closed_product()             # <<<<<<<<<<<<<<
 * 
 *         field_ptr = <EPR_SField*>epr_get_field(self._ptr, cname)
 */
  __pyx_t_1 = __pyx_f_3epr_6Record_check_closed_product(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "epr.pyx":1244
 *         self.check_closed_product()
 * 
 *         field_ptr = <EPR_SField*>epr_get_field(self._ptr, cname)             # <<<<<<<<<<<<<<
 *         if field_ptr is NULL:
 *             pyepr_null_ptr_error('unable to get field "%s"' % name)
 */
  __pyx_t_2 = __Pyx_PyObject_AsString(__pyx_v_cname); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1244; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_field_ptr = ((EPR_SField *)epr_get_field(__pyx_v_self->_ptr, __pyx_t_2));

  /* "epr.pyx":1245
 * 
 *         field_ptr = <EPR_SField*>epr_get_field(self._ptr, cname)
 *         if field_ptr is NULL:             # <<<<<<<<<<<<<<
 *             pyepr_null_ptr_error('unable to get field "%s"' % name)
 * 
 */
  __pyx_t_3 = ((__pyx_v_field_ptr == NULL) != 0);
  if (__pyx_t_3) {

    /* "epr.pyx":1246
 *         field_ptr = <EPR_SField*>epr_get_field(self._ptr, cname)
 *         if field_ptr is NULL:
 *             pyepr_null_ptr_error('unable to get field "%s"' % name)             # <<<<<<<<<<<<<<
 * 
 *         return new_field(field_ptr, self)
 */
    __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_unable_to_get_field_s, __pyx_v_name); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1246; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5.__pyx_n = 1;
    __pyx_t_5.msg = __pyx_t_1;
    __pyx_t_4 = __pyx_f_3epr_pyepr_null_ptr_error(&__pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1246; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "epr.pyx":1248
 *             pyepr_null_ptr_error('unable to get field "%s"' % name)
 * 
 *         return new_field(field_ptr, self)             # <<<<<<<<<<<<<<
 * 
 *     def get_field_at(self, uint index):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_6.__pyx_n = 1;
  __pyx_t_6.parent = __pyx_v_self;
  __pyx_t_4 = __pyx_f_3epr_new_field(__pyx_v_field_ptr, &__pyx_t_6); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1248; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "epr.pyx":1223
 *         pyepr_check_errors()
 * 
 *     def get_field(self, name):             # <<<<<<<<<<<<<<
 *         '''get_field(self, name)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("epr.Record.get_field", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_cname);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":1250
 *         return new_field(field_ptr, self)
 * 
 *     def get_field_at(self, uint index):             # <<<<<<<<<<<<<<
 *         '''get_field_at(self, index)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_3epr_6Record_11get_field_at(PyObject *__pyx_v_self, PyObject *__pyx_arg_index); /*proto*/
static char __pyx_doc_3epr_6Record_10get_field_at[] = "get_field_at(self, index)\n\n        Gets a field at the specified position within the record\n\n        :param index:\n            the zero-based index (position within record) of the field\n        :returns:\n            the field or raises and exception (:exc:`EPRValueError`)\n            if an error occurred\n\n        ";
static PyObject *__pyx_pw_3epr_6Record_11get_field_at(PyObject *__pyx_v_self, PyObject *__pyx_arg_index) {
  uint __pyx_v_index;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_field_at (wrapper)", 0);
  assert(__pyx_arg_index); {
    __pyx_v_index = __Pyx_PyInt_As_uint(__pyx_arg_index); if (unlikely((__pyx_v_index == (uint)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1250; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("epr.Record.get_field_at", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_3epr_6Record_10get_field_at(((struct __pyx_obj_3epr_Record *)__pyx_v_self), ((uint)__pyx_v_index));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_3epr_6Record_10get_field_at(struct __pyx_obj_3epr_Record *__pyx_v_self, uint __pyx_v_index) {
  EPR_SField *__pyx_v_field_ptr;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  struct __pyx_opt_args_3epr_pyepr_null_ptr_error __pyx_t_4;
  struct __pyx_opt_args_3epr_new_field __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_field_at", 0);

  /* "epr.pyx":1265
 *         cdef EPR_SField* field_ptr
 * 
 *         self.check_closed_product()             # <<<<<<<<<<<<<<
 * 
 *         field_ptr = <EPR_SField*>epr_get_field_at(self._ptr, index)
 */
  __pyx_t_1 = __pyx_f_3epr_6Record_check_closed_product(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1265; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "epr.pyx":1267
 *         self.check_closed_product()
 * 
 *         field_ptr = <EPR_SField*>epr_get_field_at(self._ptr, index)             # <<<<<<<<<<<<<<
 *         if field_ptr is NULL:
 *             pyepr_null_ptr_error('unable to get field at index %d' % index)
 */
  __pyx_v_field_ptr = ((EPR_SField *)epr_get_field_at(__pyx_v_self->_ptr, __pyx_v_index));

  /* "epr.pyx":1268
 * 
 *         field_ptr = <EPR_SField*>epr_get_field_at(self._ptr, index)
 *         if field_ptr is NULL:             # <<<<<<<<<<<<<<
 *             pyepr_null_ptr_error('unable to get field at index %d' % index)
 * 
 */
  __pyx_t_2 = ((__pyx_v_field_ptr == NULL) != 0);
  if (__pyx_t_2) {

    /* "epr.pyx":1269
 *         field_ptr = <EPR_SField*>epr_get_field_at(self._ptr, index)
 *         if field_ptr is NULL:
 *             pyepr_null_ptr_error('unable to get field at index %d' % index)             # <<<<<<<<<<<<<<
 * 
 *         return new_field(field_ptr, self)
 */
    __pyx_t_1 = __Pyx_PyInt_From_uint(__pyx_v_index); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1269; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_unable_to_get_field_at_index_d, __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1269; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_4.__pyx_n = 1;
    __pyx_t_4.msg = __pyx_t_3;
    __pyx_t_1 = __pyx_f_3epr_pyepr_null_ptr_error(&__pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1269; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "epr.pyx":1271
 *             pyepr_null_ptr_error('unable to get field at index %d' % index)
 * 
 *         return new_field(field_ptr, self)             # <<<<<<<<<<<<<<
 * 
 *     property dataset_name:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_5.__pyx_n = 1;
  __pyx_t_5.parent = __pyx_v_self;
  __pyx_t_1 = __pyx_f_3epr_new_field(__pyx_v_field_ptr, &__pyx_t_5); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1271; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "epr.pyx":1250
 *         return new_field(field_ptr, self)
 * 
 *     def get_field_at(self, uint index):             # <<<<<<<<<<<<<<
 *         '''get_field_at(self, index)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("epr.Record.get_field_at", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":1276
 *         '''The name of the dataset to which this record belongs to'''
 * 
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             self.check_closed_product()
 *             cdef EPR_RecordInfo* info = <EPR_RecordInfo*>self._ptr.info
 */

/* Python wrapper */
static PyObject *__pyx_pw_3epr_6Record_12dataset_name_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_3epr_6Record_12dataset_name_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_3epr_6Record_12dataset_name___get__(((struct __pyx_obj_3epr_Record *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_3epr_6Record_12dataset_name___get__(struct __pyx_obj_3epr_Record *__pyx_v_self) {
  __pyx_t_3epr_EPR_RecordInfo *__pyx_v_info;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "epr.pyx":1277
 * 
 *         def __get__(self):
 *             self.check_closed_product()             # <<<<<<<<<<<<<<
 *             cdef EPR_RecordInfo* info = <EPR_RecordInfo*>self._ptr.info
 *             if info.dataset_name == NULL:
 */
  __pyx_t_1 = __pyx_f_3epr_6Record_check_closed_product(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1277; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "epr.pyx":1278
 *         def __get__(self):
 *             self.check_closed_product()
 *             cdef EPR_RecordInfo* info = <EPR_RecordInfo*>self._ptr.info             # <<<<<<<<<<<<<<
 *             if info.dataset_name == NULL:
 *                 return ''
 */
  __pyx_v_info = ((__pyx_t_3epr_EPR_RecordInfo *)__pyx_v_self->_ptr->info);

  /* "epr.pyx":1279
 *             self.check_closed_product()
 *             cdef EPR_RecordInfo* info = <EPR_RecordInfo*>self._ptr.info
 *             if info.dataset_name == NULL:             # <<<<<<<<<<<<<<
 *                 return ''
 *             else:
 */
  __pyx_t_2 = ((__pyx_v_info->dataset_name == NULL) != 0);
  if (__pyx_t_2) {

    /* "epr.pyx":1280
 *             cdef EPR_RecordInfo* info = <EPR_RecordInfo*>self._ptr.info
 *             if info.dataset_name == NULL:
 *                 return ''             # <<<<<<<<<<<<<<
 *             else:
 *                 return _to_str(info.dataset_name)
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_kp_s_);
    __pyx_r = __pyx_kp_s_;
    goto __pyx_L0;
  }
  /*else*/ {

    /* "epr.pyx":1282
 *                 return ''
 *             else:
 *                 return _to_str(info.dataset_name)             # <<<<<<<<<<<<<<
 * 
 *     property tot_size:
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_info->dataset_name); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1282; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = __pyx_f_3epr__to_str(__pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1282; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
  }

  /* "epr.pyx":1276
 *         '''The name of the dataset to which this record belongs to'''
 * 
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             self.check_closed_product()
 *             cdef EPR_RecordInfo* info = <EPR_RecordInfo*>self._ptr.info
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("epr.Record.dataset_name.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":1295
 *         '''
 * 
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             self.check_closed_product()
 *             cdef EPR_RecordInfo* info = <EPR_RecordInfo*>self._ptr.info
 */

/* Python wrapper */
static PyObject *__pyx_pw_3epr_6Record_8tot_size_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_3epr_6Record_8tot_size_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_3epr_6Record_8tot_size___get__(((struct __pyx_obj_3epr_Record *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_3epr_6Record_8tot_size___get__(struct __pyx_obj_3epr_Record *__pyx_v_self) {
  __pyx_t_3epr_EPR_RecordInfo *__pyx_v_info;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "epr.pyx":1296
 * 
 *         def __get__(self):
 *             self.check_closed_product()             # <<<<<<<<<<<<<<
 *             cdef EPR_RecordInfo* info = <EPR_RecordInfo*>self._ptr.info
 *             return info.tot_size
 */
  __pyx_t_1 = __pyx_f_3epr_6Record_check_closed_product(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1296; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "epr.pyx":1297
 *         def __get__(self):
 *             self.check_closed_product()
 *             cdef EPR_RecordInfo* info = <EPR_RecordInfo*>self._ptr.info             # <<<<<<<<<<<<<<
 *             return info.tot_size
 * 
 */
  __pyx_v_info = ((__pyx_t_3epr_EPR_RecordInfo *)__pyx_v_self->_ptr->info);

  /* "epr.pyx":1298
 *             self.check_closed_product()
 *             cdef EPR_RecordInfo* info = <EPR_RecordInfo*>self._ptr.info
 *             return info.tot_size             # <<<<<<<<<<<<<<
 * 
 *     property index:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_uint(__pyx_v_info->tot_size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1298; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "epr.pyx":1295
 *         '''
 * 
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             self.check_closed_product()
 *             cdef EPR_RecordInfo* info = <EPR_RecordInfo*>self._ptr.info
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("epr.Record.tot_size.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":1312
 *         '''
 * 
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self._index if self._index >= 0 else None
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_3epr_6Record_5index_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_3epr_6Record_5index_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_3epr_6Record_5index___get__(((struct __pyx_obj_3epr_Record *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_3epr_6Record_5index___get__(struct __pyx_obj_3epr_Record *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "epr.pyx":1313
 * 
 *         def __get__(self):
 *             return self._index if self._index >= 0 else None             # <<<<<<<<<<<<<<
 * 
 *     # --- high level interface ------------------------------------------------
 */
  __Pyx_XDECREF(__pyx_r);
  if (((__pyx_v_self->_index >= 0) != 0)) {
    __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->_index); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = __pyx_t_2;
    __pyx_t_2 = 0;
  } else {
    __Pyx_INCREF(Py_None);
    __pyx_t_1 = Py_None;
  }
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "epr.pyx":1312
 *         '''
 * 
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self._index if self._index >= 0 else None
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("epr.Record.index.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":1316
 * 
 *     # --- high level interface ------------------------------------------------
 *     def get_field_names(self):             # <<<<<<<<<<<<<<
 *         '''get_field_names(self)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_3epr_6Record_13get_field_names(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_3epr_6Record_12get_field_names[] = "get_field_names(self)\n\n        Return the list of names of the fields in the product\n\n        .. note:: this method has no correspondent in the C API\n\n        ";
static PyObject *__pyx_pw_3epr_6Record_13get_field_names(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_field_names (wrapper)", 0);
  __pyx_r = __pyx_pf_3epr_6Record_12get_field_names(((struct __pyx_obj_3epr_Record *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_3epr_6Record_12get_field_names(struct __pyx_obj_3epr_Record *__pyx_v_self) {
  EPR_SField *__pyx_v_field_ptr;
  int __pyx_v_idx;
  char *__pyx_v_name;
  int __pyx_v_num_fields;
  PyObject *__pyx_v_names = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  struct __pyx_opt_args_3epr__to_str __pyx_t_5;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_field_names", 0);

  /* "epr.pyx":1330
 *         cdef int num_fields
 * 
 *         self.check_closed_product()             # <<<<<<<<<<<<<<
 *         num_fields = epr_get_num_fields(self._ptr)
 * 
 */
  __pyx_t_1 = __pyx_f_3epr_6Record_check_closed_product(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1330; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "epr.pyx":1331
 * 
 *         self.check_closed_product()
 *         num_fields = epr_get_num_fields(self._ptr)             # <<<<<<<<<<<<<<
 * 
 *         names = []
 */
  __pyx_v_num_fields = epr_get_num_fields(__pyx_v_self->_ptr);

  /* "epr.pyx":1333
 *         num_fields = epr_get_num_fields(self._ptr)
 * 
 *         names = []             # <<<<<<<<<<<<<<
 *         for idx in range(num_fields):
 *             field_ptr = <EPR_SField*>epr_get_field_at(self._ptr, idx)
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1333; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_names = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "epr.pyx":1334
 * 
 *         names = []
 *         for idx in range(num_fields):             # <<<<<<<<<<<<<<
 *             field_ptr = <EPR_SField*>epr_get_field_at(self._ptr, idx)
 *             name = <char*>epr_get_field_name(field_ptr)
 */
  __pyx_t_2 = __pyx_v_num_fields;
  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
    __pyx_v_idx = __pyx_t_3;

    /* "epr.pyx":1335
 *         names = []
 *         for idx in range(num_fields):
 *             field_ptr = <EPR_SField*>epr_get_field_at(self._ptr, idx)             # <<<<<<<<<<<<<<
 *             name = <char*>epr_get_field_name(field_ptr)
 *             names.append(_to_str(name, 'ascii'))
 */
    __pyx_v_field_ptr = ((EPR_SField *)epr_get_field_at(__pyx_v_self->_ptr, __pyx_v_idx));

    /* "epr.pyx":1336
 *         for idx in range(num_fields):
 *             field_ptr = <EPR_SField*>epr_get_field_at(self._ptr, idx)
 *             name = <char*>epr_get_field_name(field_ptr)             # <<<<<<<<<<<<<<
 *             names.append(_to_str(name, 'ascii'))
 * 
 */
    __pyx_v_name = ((char *)epr_get_field_name(__pyx_v_field_ptr));

    /* "epr.pyx":1337
 *             field_ptr = <EPR_SField*>epr_get_field_at(self._ptr, idx)
 *             name = <char*>epr_get_field_name(field_ptr)
 *             names.append(_to_str(name, 'ascii'))             # <<<<<<<<<<<<<<
 * 
 *         return names
 */
    __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_name); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1337; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5.__pyx_n = 1;
    __pyx_t_5.encoding = __pyx_n_s_ascii;
    __pyx_t_4 = __pyx_f_3epr__to_str(__pyx_t_1, &__pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1337; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_6 = __Pyx_PyList_Append(__pyx_v_names, __pyx_t_4); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1337; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }

  /* "epr.pyx":1339
 *             names.append(_to_str(name, 'ascii'))
 * 
 *         return names             # <<<<<<<<<<<<<<
 * 
 *     def fields(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_names);
  __pyx_r = __pyx_v_names;
  goto __pyx_L0;

  /* "epr.pyx":1316
 * 
 *     # --- high level interface ------------------------------------------------
 *     def get_field_names(self):             # <<<<<<<<<<<<<<
 *         '''get_field_names(self)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("epr.Record.get_field_names", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_names);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":1341
 *         return names
 * 
 *     def fields(self):             # <<<<<<<<<<<<<<
 *         '''fields(self)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_3epr_6Record_15fields(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_3epr_6Record_14fields[] = "fields(self)\n\n        Return the list of fields contained in the record\n\n        ";
static PyObject *__pyx_pw_3epr_6Record_15fields(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("fields (wrapper)", 0);
  __pyx_r = __pyx_pf_3epr_6Record_14fields(((struct __pyx_obj_3epr_Record *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_3epr_6Record_14fields(struct __pyx_obj_3epr_Record *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("fields", 0);

  /* "epr.pyx":1348
 *         '''
 * 
 *         return list(self)             # <<<<<<<<<<<<<<
 * 
 *     def __iter__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1348; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_self));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyList_Type))), __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1348; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "epr.pyx":1341
 *         return names
 * 
 *     def fields(self):             # <<<<<<<<<<<<<<
 *         '''fields(self)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("epr.Record.fields", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":1350
 *         return list(self)
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         cdef int idx
 *         cdef int num_fields
 */

/* Python wrapper */
static PyObject *__pyx_pw_3epr_6Record_17__iter__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_3epr_6Record_17__iter__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  __pyx_r = __pyx_pf_3epr_6Record_16__iter__(((struct __pyx_obj_3epr_Record *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_3epr_6Record_8__iter___2generator(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */

/* "epr.pyx":1358
 *         num_fields = epr_get_num_fields(self._ptr)
 * 
 *         return (self.get_field_at(idx) for idx in range(num_fields))             # <<<<<<<<<<<<<<
 * 
 *     def __str__(self):
 */

static PyObject *__pyx_pf_3epr_6Record_8__iter___genexpr(PyObject *__pyx_self) {
  struct __pyx_obj_3epr___pyx_scope_struct_1_genexpr *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("genexpr", 0);
  __pyx_cur_scope = (struct __pyx_obj_3epr___pyx_scope_struct_1_genexpr *)__pyx_tp_new_3epr___pyx_scope_struct_1_genexpr(__pyx_ptype_3epr___pyx_scope_struct_1_genexpr, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __Pyx_GOTREF(__pyx_cur_scope);
  __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_3epr___pyx_scope_struct____iter__ *) __pyx_self;
  __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope));
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope);
  {
    __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_3epr_6Record_8__iter___2generator, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("epr.Record.__iter__.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_3epr_6Record_8__iter___2generator(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_3epr___pyx_scope_struct_1_genexpr *__pyx_cur_scope = ((struct __pyx_obj_3epr___pyx_scope_struct_1_genexpr *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("None", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L6_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_1 = __pyx_cur_scope->__pyx_outer_scope->__pyx_v_num_fields;
  for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
    __pyx_cur_scope->__pyx_v_idx = __pyx_t_2;
    if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1358; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self), __pyx_n_s_get_field_at); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_cur_scope->__pyx_v_idx); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    __pyx_cur_scope->__pyx_t_0 = __pyx_t_1;
    __pyx_cur_scope->__pyx_t_1 = __pyx_t_2;
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L6_resume_from_yield:;
    __pyx_t_1 = __pyx_cur_scope->__pyx_t_0;
    __pyx_t_2 = __pyx_cur_scope->__pyx_t_1;
    if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r);
  __pyx_generator->resume_label = -1;
  __Pyx_Generator_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return NULL;
}

/* "epr.pyx":1350
 *         return list(self)
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         cdef int idx
 *         cdef int num_fields
 */

static PyObject *__pyx_pf_3epr_6Record_16__iter__(struct __pyx_obj_3epr_Record *__pyx_v_self) {
  struct __pyx_obj_3epr___pyx_scope_struct____iter__ *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__iter__", 0);
  __pyx_cur_scope = (struct __pyx_obj_3epr___pyx_scope_struct____iter__ *)__pyx_tp_new_3epr___pyx_scope_struct____iter__(__pyx_ptype_3epr___pyx_scope_struct____iter__, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __Pyx_GOTREF(__pyx_cur_scope);
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);

  /* "epr.pyx":1354
 *         cdef int num_fields
 * 
 *         self.check_closed_product()             # <<<<<<<<<<<<<<
 * 
 *         num_fields = epr_get_num_fields(self._ptr)
 */
  __pyx_t_1 = __pyx_f_3epr_6Record_check_closed_product(__pyx_cur_scope->__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1354; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "epr.pyx":1356
 *         self.check_closed_product()
 * 
 *         num_fields = epr_get_num_fields(self._ptr)             # <<<<<<<<<<<<<<
 * 
 *         return (self.get_field_at(idx) for idx in range(num_fields))
 */
  __pyx_cur_scope->__pyx_v_num_fields = epr_get_num_fields(__pyx_cur_scope->__pyx_v_self->_ptr);

  /* "epr.pyx":1358
 *         num_fields = epr_get_num_fields(self._ptr)
 * 
 *         return (self.get_field_at(idx) for idx in range(num_fields))             # <<<<<<<<<<<<<<
 * 
 *     def __str__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_pf_3epr_6Record_8__iter___genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "epr.pyx":1350
 *         return list(self)
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         cdef int idx
 *         cdef int num_fields
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("epr.Record.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":1360
 *         return (self.get_field_at(idx) for idx in range(num_fields))
 * 
 *     def __str__(self):             # <<<<<<<<<<<<<<
 *         self.check_closed_product()
 *         return '\n'.join(map(str, self))
 */

/* Python wrapper */
static PyObject *__pyx_pw_3epr_6Record_19__str__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_3epr_6Record_19__str__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__str__ (wrapper)", 0);
  __pyx_r = __pyx_pf_3epr_6Record_18__str__(((struct __pyx_obj_3epr_Record *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_3epr_6Record_18__str__(struct __pyx_obj_3epr_Record *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__str__", 0);

  /* "epr.pyx":1361
 * 
 *     def __str__(self):
 *         self.check_closed_product()             # <<<<<<<<<<<<<<
 *         return '\n'.join(map(str, self))
 * 
 */
  __pyx_t_1 = __pyx_f_3epr_6Record_check_closed_product(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1361; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "epr.pyx":1362
 *     def __str__(self):
 *         self.check_closed_product()
 *         return '\n'.join(map(str, self))             # <<<<<<<<<<<<<<
 * 
 *     def __repr__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1362; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)((PyObject*)(&PyString_Type))));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)((PyObject*)(&PyString_Type))));
  __Pyx_GIVEREF(((PyObject *)((PyObject*)(&PyString_Type))));
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_self));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_map, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1362; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyString_Join(__pyx_kp_s__11, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1362; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "epr.pyx":1360
 *         return (self.get_field_at(idx) for idx in range(num_fields))
 * 
 *     def __str__(self):             # <<<<<<<<<<<<<<
 *         self.check_closed_product()
 *         return '\n'.join(map(str, self))
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("epr.Record.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":1364
 *         return '\n'.join(map(str, self))
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         self.check_closed_product()
 *         return '%s %d fields' % (super(Record, self).__repr__(),
 */

/* Python wrapper */
static PyObject *__pyx_pw_3epr_6Record_21__repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_3epr_6Record_21__repr__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
  __pyx_r = __pyx_pf_3epr_6Record_20__repr__(((struct __pyx_obj_3epr_Record *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_3epr_6Record_20__repr__(struct __pyx_obj_3epr_Record *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__repr__", 0);

  /* "epr.pyx":1365
 * 
 *     def __repr__(self):
 *         self.check_closed_product()             # <<<<<<<<<<<<<<
 *         return '%s %d fields' % (super(Record, self).__repr__(),
 *                                  self.get_num_fields())
 */
  __pyx_t_1 = __pyx_f_3epr_6Record_check_closed_product(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1365; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "epr.pyx":1366
 *     def __repr__(self):
 *         self.check_closed_product()
 *         return '%s %d fields' % (super(Record, self).__repr__(),             # <<<<<<<<<<<<<<
 *                                  self.get_num_fields())
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)((PyObject*)__pyx_ptype_3epr_Record)));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)((PyObject*)__pyx_ptype_3epr_Record)));
  __Pyx_GIVEREF(((PyObject *)((PyObject*)__pyx_ptype_3epr_Record)));
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_self));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_super, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_repr); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "epr.pyx":1367
 *         self.check_closed_product()
 *         return '%s %d fields' % (super(Record, self).__repr__(),
 *                                  self.get_num_fields())             # <<<<<<<<<<<<<<
 * 
 *     # --- low level interface -------------------------------------------------
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_get_num_fields); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1367; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1367; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "epr.pyx":1366
 *     def __repr__(self):
 *         self.check_closed_product()
 *         return '%s %d fields' % (super(Record, self).__repr__(),             # <<<<<<<<<<<<<<
 *                                  self.get_num_fields())
 * 
 */
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_s_d_fields, __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "epr.pyx":1364
 *         return '\n'.join(map(str, self))
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         self.check_closed_product()
 *         return '%s %d fields' % (super(Record, self).__repr__(),
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("epr.Record.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":1373
 *         '''The magic number for internal C structure'''
 * 
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             self.check_closed_product()
 *             return self._ptr.magic
 */

/* Python wrapper */
static PyObject *__pyx_pw_3epr_6Record_6_magic_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_3epr_6Record_6_magic_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_3epr_6Record_6_magic___get__(((struct __pyx_obj_3epr_Record *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_3epr_6Record_6_magic___get__(struct __pyx_obj_3epr_Record *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "epr.pyx":1374
 * 
 *         def __get__(self):
 *             self.check_closed_product()             # <<<<<<<<<<<<<<
 *             return self._ptr.magic
 * 
 */
  __pyx_t_1 = __pyx_f_3epr_6Record_check_closed_product(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1374; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "epr.pyx":1375
 *         def __get__(self):
 *             self.check_closed_product()
 *             return self._ptr.magic             # <<<<<<<<<<<<<<
 * 
 *     def get_offset(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_EPR_Magic(__pyx_v_self->_ptr->magic); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1375; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "epr.pyx":1373
 *         '''The magic number for internal C structure'''
 * 
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             self.check_closed_product()
 *             return self._ptr.magic
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("epr.Record._magic.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":1377
 *             return self._ptr.magic
 * 
 *     def get_offset(self):             # <<<<<<<<<<<<<<
 *         '''Record offset in bytes within the Dataset'''
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_3epr_6Record_23get_offset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_3epr_6Record_22get_offset[] = "Record offset in bytes within the Dataset";
static PyObject *__pyx_pw_3epr_6Record_23get_offset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_offset (wrapper)", 0);
  __pyx_r = __pyx_pf_3epr_6Record_22get_offset(((struct __pyx_obj_3epr_Record *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_3epr_6Record_22get_offset(struct __pyx_obj_3epr_Record *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_offset", 0);

  /* "epr.pyx":1380
 *         '''Record offset in bytes within the Dataset'''
 * 
 *         if self._index >= 0:             # <<<<<<<<<<<<<<
 *             self.check_closed_product()
 *             return self._get_offset()
 */
  __pyx_t_1 = ((__pyx_v_self->_index >= 0) != 0);
  if (__pyx_t_1) {

    /* "epr.pyx":1381
 * 
 *         if self._index >= 0:
 *             self.check_closed_product()             # <<<<<<<<<<<<<<
 *             return self._get_offset()
 *         else:
 */
    __pyx_t_2 = __pyx_f_3epr_6Record_check_closed_product(__pyx_v_self); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1381; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "epr.pyx":1382
 *         if self._index >= 0:
 *             self.check_closed_product()
 *             return self._get_offset()             # <<<<<<<<<<<<<<
 *         else:
 *             return None
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = __Pyx_PyInt_From_uint(__pyx_f_3epr_6Record__get_offset(__pyx_v_self, NULL)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1382; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;
  }
  /*else*/ {

    /* "epr.pyx":1384
 *             return self._get_offset()
 *         else:
 *             return None             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_None);
    __pyx_r = Py_None;
    goto __pyx_L0;
  }

  /* "epr.pyx":1377
 *             return self._ptr.magic
 * 
 *     def get_offset(self):             # <<<<<<<<<<<<<<
 *         '''Record offset in bytes within the Dataset'''
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("epr.Record.get_offset", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":1387
 * 
 * 
 * cdef new_record(EPR_SRecord* ptr, object parent=None, bint dealloc=False):             # <<<<<<<<<<<<<<
 *     if ptr is NULL:
 *         pyepr_null_ptr_error()
 */

static PyObject *__pyx_f_3epr_new_record(EPR_SRecord *__pyx_v_ptr, struct __pyx_opt_args_3epr_new_record *__pyx_optional_args) {
  PyObject *__pyx_v_parent = ((PyObject *)Py_None);
  int __pyx_v_dealloc = ((int)0);
  struct __pyx_obj_3epr_Record *__pyx_v_instance = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("new_record", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_parent = __pyx_optional_args->parent;
      if (__pyx_optional_args->__pyx_n > 1) {
        __pyx_v_dealloc = __pyx_optional_args->dealloc;
      }
    }
  }

  /* "epr.pyx":1388
 * 
 * cdef new_record(EPR_SRecord* ptr, object parent=None, bint dealloc=False):
 *     if ptr is NULL:             # <<<<<<<<<<<<<<
 *         pyepr_null_ptr_error()
 * 
 */
  __pyx_t_1 = ((__pyx_v_ptr == NULL) != 0);
  if (__pyx_t_1) {

    /* "epr.pyx":1389
 * cdef new_record(EPR_SRecord* ptr, object parent=None, bint dealloc=False):
 *     if ptr is NULL:
 *         pyepr_null_ptr_error()             # <<<<<<<<<<<<<<
 * 
 *     cdef Record instance = Record.__new__(Record)
 */
    __pyx_t_2 = __pyx_f_3epr_pyepr_null_ptr_error(NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1389; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "epr.pyx":1391
 *         pyepr_null_ptr_error()
 * 
 *     cdef Record instance = Record.__new__(Record)             # <<<<<<<<<<<<<<
 * 
 *     instance._ptr = ptr
 */
  __pyx_t_2 = __pyx_tp_new_3epr_Record(((PyTypeObject *)((PyObject*)__pyx_ptype_3epr_Record)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1391; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (!(likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_3epr_Record)))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1391; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_instance = ((struct __pyx_obj_3epr_Record *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "epr.pyx":1393
 *     cdef Record instance = Record.__new__(Record)
 * 
 *     instance._ptr = ptr             # <<<<<<<<<<<<<<
 *     instance._parent = parent       # Dataset or Product
 *     instance._dealloc = dealloc
 */
  __pyx_v_instance->_ptr = __pyx_v_ptr;

  /* "epr.pyx":1394
 * 
 *     instance._ptr = ptr
 *     instance._parent = parent       # Dataset or Product             # <<<<<<<<<<<<<<
 *     instance._dealloc = dealloc
 *     instance._index = -1
 */
  __Pyx_INCREF(__pyx_v_parent);
  __Pyx_GIVEREF(__pyx_v_parent);
  __Pyx_GOTREF(__pyx_v_instance->_parent);
  __Pyx_DECREF(__pyx_v_instance->_parent);
  __pyx_v_instance->_parent = __pyx_v_parent;

  /* "epr.pyx":1395
 *     instance._ptr = ptr
 *     instance._parent = parent       # Dataset or Product
 *     instance._dealloc = dealloc             # <<<<<<<<<<<<<<
 *     instance._index = -1
 * 
 */
  __pyx_v_instance->_dealloc = __pyx_v_dealloc;

  /* "epr.pyx":1396
 *     instance._parent = parent       # Dataset or Product
 *     instance._dealloc = dealloc
 *     instance._index = -1             # <<<<<<<<<<<<<<
 * 
 *     return instance
 */
  __pyx_v_instance->_index = -1;

  /* "epr.pyx":1398
 *     instance._index = -1
 * 
 *     return instance             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_instance));
  __pyx_r = ((PyObject *)__pyx_v_instance);
  goto __pyx_L0;

  /* "epr.pyx":1387
 * 
 * 
 * cdef new_record(EPR_SRecord* ptr, object parent=None, bint dealloc=False):             # <<<<<<<<<<<<<<
 *     if ptr is NULL:
 *         pyepr_null_ptr_error()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("epr.new_record", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_instance);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":1412
 *     cdef object _data
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         if self._ptr is not NULL:
 *             epr_free_raster(self._ptr)
 */

/* Python wrapper */
static void __pyx_pw_3epr_6Raster_1__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_3epr_6Raster_1__dealloc__(PyObject *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_pf_3epr_6Raster___dealloc__(((struct __pyx_obj_3epr_Raster *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

static void __pyx_pf_3epr_6Raster___dealloc__(struct __pyx_obj_3epr_Raster *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("__dealloc__", 0);

  /* "epr.pyx":1413
 * 
 *     def __dealloc__(self):
 *         if self._ptr is not NULL:             # <<<<<<<<<<<<<<
 *             epr_free_raster(self._ptr)
 * 
 */
  __pyx_t_1 = ((__pyx_v_self->_ptr != NULL) != 0);
  if (__pyx_t_1) {

    /* "epr.pyx":1414
 *     def __dealloc__(self):
 *         if self._ptr is not NULL:
 *             epr_free_raster(self._ptr)             # <<<<<<<<<<<<<<
 * 
 *     property data_type:
 */
    epr_free_raster(__pyx_v_self->_ptr);
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "epr.pyx":1412
 *     cdef object _data
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         if self._ptr is not NULL:
 *             epr_free_raster(self._ptr)
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

/* "epr.pyx":1423
 *         '''
 * 
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self._ptr.data_type
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_3epr_6Raster_9data_type_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_3epr_6Raster_9data_type_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_3epr_6Raster_9data_type___get__(((struct __pyx_obj_3epr_Raster *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_3epr_6Raster_9data_type___get__(struct __pyx_obj_3epr_Raster *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "epr.pyx":1424
 * 
 *         def __get__(self):
 *             return self._ptr.data_type             # <<<<<<<<<<<<<<
 * 
 *     property source_width:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyInt_FromLong(__pyx_v_self->_ptr->data_type); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1424; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "epr.pyx":1423
 *         '''
 * 
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self._ptr.data_type
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("epr.Raster.data_type.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":1429
 *         '''The width of the source'''
 * 
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self._ptr.source_width
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_3epr_6Raster_12source_width_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_3epr_6Raster_12source_width_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_3epr_6Raster_12source_width___get__(((struct __pyx_obj_3epr_Raster *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_3epr_6Raster_12source_width___get__(struct __pyx_obj_3epr_Raster *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "epr.pyx":1430
 * 
 *         def __get__(self):
 *             return self._ptr.source_width             # <<<<<<<<<<<<<<
 * 
 *     property source_height:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_uint(__pyx_v_self->_ptr->source_width); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1430; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "epr.pyx":1429
 *         '''The width of the source'''
 * 
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self._ptr.source_width
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("epr.Raster.source_width.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":1435
 *         '''The height of the source'''
 * 
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self._ptr.source_height
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_3epr_6Raster_13source_height_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_3epr_6Raster_13source_height_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_3epr_6Raster_13source_height___get__(((struct __pyx_obj_3epr_Raster *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_3epr_6Raster_13source_height___get__(struct __pyx_obj_3epr_Raster *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "epr.pyx":1436
 * 
 *         def __get__(self):
 *             return self._ptr.source_height             # <<<<<<<<<<<<<<
 * 
 *     property source_step_x:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_uint(__pyx_v_self->_ptr->source_height); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1436; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "epr.pyx":1435
 *         '''The height of the source'''
 * 
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self._ptr.source_height
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("epr.Raster.source_height.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":1441
 *         '''The sub-sampling for the across-track direction in pixel'''
 * 
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self._ptr.source_step_x
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_3epr_6Raster_13source_step_x_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_3epr_6Raster_13source_step_x_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_3epr_6Raster_13source_step_x___get__(((struct __pyx_obj_3epr_Raster *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_3epr_6Raster_13source_step_x___get__(struct __pyx_obj_3epr_Raster *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "epr.pyx":1442
 * 
 *         def __get__(self):
 *             return self._ptr.source_step_x             # <<<<<<<<<<<<<<
 * 
 *     property source_step_y:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_uint(__pyx_v_self->_ptr->source_step_x); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1442; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "epr.pyx":1441
 *         '''The sub-sampling for the across-track direction in pixel'''
 * 
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self._ptr.source_step_x
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("epr.Raster.source_step_x.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":1447
 *         '''The sub-sampling for the along-track direction in pixel'''
 * 
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self._ptr.source_step_y
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_3epr_6Raster_13source_step_y_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_3epr_6Raster_13source_step_y_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_3epr_6Raster_13source_step_y___get__(((struct __pyx_obj_3epr_Raster *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_3epr_6Raster_13source_step_y___get__(struct __pyx_obj_3epr_Raster *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "epr.pyx":1448
 * 
 *         def __get__(self):
 *             return self._ptr.source_step_y             # <<<<<<<<<<<<<<
 * 
 *     def get_width(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_uint(__pyx_v_self->_ptr->source_step_y); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1448; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "epr.pyx":1447
 *         '''The sub-sampling for the along-track direction in pixel'''
 * 
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self._ptr.source_step_y
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("epr.Raster.source_step_y.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":1450
 *             return self._ptr.source_step_y
 * 
 *     def get_width(self):             # <<<<<<<<<<<<<<
 *         '''get_width(self)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_3epr_6Raster_3get_width(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_3epr_6Raster_2get_width[] = "get_width(self)\n\n        Gets the raster's width in pixels\n\n        ";
static PyObject *__pyx_pw_3epr_6Raster_3get_width(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_width (wrapper)", 0);
  __pyx_r = __pyx_pf_3epr_6Raster_2get_width(((struct __pyx_obj_3epr_Raster *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_3epr_6Raster_2get_width(struct __pyx_obj_3epr_Raster *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_width", 0);

  /* "epr.pyx":1457
 *         '''
 * 
 *         return epr_get_raster_width(self._ptr)             # <<<<<<<<<<<<<<
 * 
 *     def get_height(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_uint(epr_get_raster_width(__pyx_v_self->_ptr)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1457; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "epr.pyx":1450
 *             return self._ptr.source_step_y
 * 
 *     def get_width(self):             # <<<<<<<<<<<<<<
 *         '''get_width(self)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("epr.Raster.get_width", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":1459
 *         return epr_get_raster_width(self._ptr)
 * 
 *     def get_height(self):             # <<<<<<<<<<<<<<
 *         '''get_height(self)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_3epr_6Raster_5get_height(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_3epr_6Raster_4get_height[] = "get_height(self)\n\n        Gets the raster's height in pixels\n\n        ";
static PyObject *__pyx_pw_3epr_6Raster_5get_height(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_height (wrapper)", 0);
  __pyx_r = __pyx_pf_3epr_6Raster_4get_height(((struct __pyx_obj_3epr_Raster *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_3epr_6Raster_4get_height(struct __pyx_obj_3epr_Raster *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_height", 0);

  /* "epr.pyx":1466
 *         '''
 * 
 *         return epr_get_raster_height(self._ptr)             # <<<<<<<<<<<<<<
 * 
 *     def get_elem_size(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_uint(epr_get_raster_height(__pyx_v_self->_ptr)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1466; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "epr.pyx":1459
 *         return epr_get_raster_width(self._ptr)
 * 
 *     def get_height(self):             # <<<<<<<<<<<<<<
 *         '''get_height(self)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("epr.Raster.get_height", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":1468
 *         return epr_get_raster_height(self._ptr)
 * 
 *     def get_elem_size(self):             # <<<<<<<<<<<<<<
 *         '''get_elem_size(self)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_3epr_6Raster_7get_elem_size(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_3epr_6Raster_6get_elem_size[] = "get_elem_size(self)\n\n        The size in byte of a single element (sample) of this\n        raster's buffer\n\n        ";
static PyObject *__pyx_pw_3epr_6Raster_7get_elem_size(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_elem_size (wrapper)", 0);
  __pyx_r = __pyx_pf_3epr_6Raster_6get_elem_size(((struct __pyx_obj_3epr_Raster *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_3epr_6Raster_6get_elem_size(struct __pyx_obj_3epr_Raster *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_elem_size", 0);

  /* "epr.pyx":1476
 *         '''
 * 
 *         return epr_get_raster_elem_size(self._ptr)             # <<<<<<<<<<<<<<
 * 
 *     def get_pixel(self, int x, int y):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_uint(epr_get_raster_elem_size(__pyx_v_self->_ptr)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1476; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "epr.pyx":1468
 *         return epr_get_raster_height(self._ptr)
 * 
 *     def get_elem_size(self):             # <<<<<<<<<<<<<<
 *         '''get_elem_size(self)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("epr.Raster.get_elem_size", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":1478
 *         return epr_get_raster_elem_size(self._ptr)
 * 
 *     def get_pixel(self, int x, int y):             # <<<<<<<<<<<<<<
 *         '''get_pixel(x, y)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_3epr_6Raster_9get_pixel(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_3epr_6Raster_8get_pixel[] = "get_pixel(x, y)\n\n        Single pixel access\n\n        This function is for getting the values of the elements of a\n        raster (i.e. pixel)\n\n        :param x:\n            the (zero-based) X coordinate of the pixel\n        :param y:\n            the (zero-based) Y coordinate of the pixel\n        :returns:\n            the typed value at the given co-ordinate\n\n        ";
static PyObject *__pyx_pw_3epr_6Raster_9get_pixel(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_x;
  int __pyx_v_y;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_pixel (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_y,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("get_pixel", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1478; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "get_pixel") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1478; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_x = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_x == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1478; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_y = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_y == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1478; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("get_pixel", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1478; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("epr.Raster.get_pixel", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_3epr_6Raster_8get_pixel(((struct __pyx_obj_3epr_Raster *)__pyx_v_self), __pyx_v_x, __pyx_v_y);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_3epr_6Raster_8get_pixel(struct __pyx_obj_3epr_Raster *__pyx_v_self, int __pyx_v_x, int __pyx_v_y) {
  EPR_EDataTypeId __pyx_v_dtype;
  double __pyx_v_val;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  enum EPR_DataTypeId __pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_pixel", 0);

  /* "epr.pyx":1495
 *         '''
 * 
 *         if (x < 0 or x >= self._ptr.raster_width or             # <<<<<<<<<<<<<<
 *             y < 0  or y >= self._ptr.raster_height):
 *             raise ValueError('index out of range: x=%d, y=%d' % (x, y))
 */
  __pyx_t_1 = ((__pyx_v_x < 0) != 0);
  if (!__pyx_t_1) {
    __pyx_t_2 = ((__pyx_v_x >= __pyx_v_self->_ptr->raster_width) != 0);
    if (!__pyx_t_2) {

      /* "epr.pyx":1496
 * 
 *         if (x < 0 or x >= self._ptr.raster_width or
 *             y < 0  or y >= self._ptr.raster_height):             # <<<<<<<<<<<<<<
 *             raise ValueError('index out of range: x=%d, y=%d' % (x, y))
 * 
 */
      __pyx_t_3 = ((__pyx_v_y < 0) != 0);
      if (!__pyx_t_3) {
        __pyx_t_4 = ((__pyx_v_y >= __pyx_v_self->_ptr->raster_height) != 0);
        __pyx_t_5 = __pyx_t_4;
      } else {
        __pyx_t_5 = __pyx_t_3;
      }
      __pyx_t_3 = __pyx_t_5;
    } else {
      __pyx_t_3 = __pyx_t_2;
    }
    __pyx_t_2 = __pyx_t_3;
  } else {
    __pyx_t_2 = __pyx_t_1;
  }
  if (__pyx_t_2) {

    /* "epr.pyx":1497
 *         if (x < 0 or x >= self._ptr.raster_width or
 *             y < 0  or y >= self._ptr.raster_height):
 *             raise ValueError('index out of range: x=%d, y=%d' % (x, y))             # <<<<<<<<<<<<<<
 * 
 *         cdef EPR_EDataTypeId dtype = self._ptr.data_type
 */
    __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_x); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1497; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_y); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1497; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1497; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_7);
    __Pyx_GIVEREF(__pyx_t_7);
    __pyx_t_6 = 0;
    __pyx_t_7 = 0;
    __pyx_t_7 = __Pyx_PyString_Format(__pyx_kp_s_index_out_of_range_x_d_y_d, __pyx_t_8); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1497; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1497; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_7);
    __Pyx_GIVEREF(__pyx_t_7);
    __pyx_t_7 = 0;
    __pyx_t_7 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_t_8, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1497; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_Raise(__pyx_t_7, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1497; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "epr.pyx":1499
 *             raise ValueError('index out of range: x=%d, y=%d' % (x, y))
 * 
 *         cdef EPR_EDataTypeId dtype = self._ptr.data_type             # <<<<<<<<<<<<<<
 * 
 *         if dtype == e_tid_uint:
 */
  __pyx_t_9 = __pyx_v_self->_ptr->data_type;
  __pyx_v_dtype = __pyx_t_9;

  /* "epr.pyx":1507
 *         elif dtype == e_tid_float:
 *             val = epr_get_pixel_as_float(self._ptr, x, y)
 *         elif dtype == e_tid_double:             # <<<<<<<<<<<<<<
 *             val = epr_get_pixel_as_double(self._ptr, x, y)
 *         else:
 */
  switch (__pyx_v_dtype) {

    /* "epr.pyx":1501
 *         cdef EPR_EDataTypeId dtype = self._ptr.data_type
 * 
 *         if dtype == e_tid_uint:             # <<<<<<<<<<<<<<
 *             val = epr_get_pixel_as_uint(self._ptr, x, y)
 *         elif dtype == e_tid_int:
 */
    case e_tid_uint:

    /* "epr.pyx":1502
 * 
 *         if dtype == e_tid_uint:
 *             val = epr_get_pixel_as_uint(self._ptr, x, y)             # <<<<<<<<<<<<<<
 *         elif dtype == e_tid_int:
 *             val = epr_get_pixel_as_int(self._ptr, x, y)
 */
    __pyx_v_val = epr_get_pixel_as_uint(__pyx_v_self->_ptr, __pyx_v_x, __pyx_v_y);
    break;

    /* "epr.pyx":1503
 *         if dtype == e_tid_uint:
 *             val = epr_get_pixel_as_uint(self._ptr, x, y)
 *         elif dtype == e_tid_int:             # <<<<<<<<<<<<<<
 *             val = epr_get_pixel_as_int(self._ptr, x, y)
 *         elif dtype == e_tid_float:
 */
    case e_tid_int:

    /* "epr.pyx":1504
 *             val = epr_get_pixel_as_uint(self._ptr, x, y)
 *         elif dtype == e_tid_int:
 *             val = epr_get_pixel_as_int(self._ptr, x, y)             # <<<<<<<<<<<<<<
 *         elif dtype == e_tid_float:
 *             val = epr_get_pixel_as_float(self._ptr, x, y)
 */
    __pyx_v_val = epr_get_pixel_as_int(__pyx_v_self->_ptr, __pyx_v_x, __pyx_v_y);
    break;

    /* "epr.pyx":1505
 *         elif dtype == e_tid_int:
 *             val = epr_get_pixel_as_int(self._ptr, x, y)
 *         elif dtype == e_tid_float:             # <<<<<<<<<<<<<<
 *             val = epr_get_pixel_as_float(self._ptr, x, y)
 *         elif dtype == e_tid_double:
 */
    case e_tid_float:

    /* "epr.pyx":1506
 *             val = epr_get_pixel_as_int(self._ptr, x, y)
 *         elif dtype == e_tid_float:
 *             val = epr_get_pixel_as_float(self._ptr, x, y)             # <<<<<<<<<<<<<<
 *         elif dtype == e_tid_double:
 *             val = epr_get_pixel_as_double(self._ptr, x, y)
 */
    __pyx_v_val = epr_get_pixel_as_float(__pyx_v_self->_ptr, __pyx_v_x, __pyx_v_y);
    break;

    /* "epr.pyx":1507
 *         elif dtype == e_tid_float:
 *             val = epr_get_pixel_as_float(self._ptr, x, y)
 *         elif dtype == e_tid_double:             # <<<<<<<<<<<<<<
 *             val = epr_get_pixel_as_double(self._ptr, x, y)
 *         else:
 */
    case e_tid_double:

    /* "epr.pyx":1508
 *             val = epr_get_pixel_as_float(self._ptr, x, y)
 *         elif dtype == e_tid_double:
 *             val = epr_get_pixel_as_double(self._ptr, x, y)             # <<<<<<<<<<<<<<
 *         else:
 *             raise ValueError('invalid data type: "%s"' %
 */
    __pyx_v_val = epr_get_pixel_as_double(__pyx_v_self->_ptr, __pyx_v_x, __pyx_v_y);
    break;
    default:

    /* "epr.pyx":1511
 *         else:
 *             raise ValueError('invalid data type: "%s"' %
 *                                         <char*>epr_data_type_id_to_str(dtype))             # <<<<<<<<<<<<<<
 * 
 *         pyepr_check_errors()    # @TODO: check
 */
    __pyx_t_7 = __Pyx_PyBytes_FromString(((char *)epr_data_type_id_to_str(__pyx_v_dtype))); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1511; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);

    /* "epr.pyx":1510
 *             val = epr_get_pixel_as_double(self._ptr, x, y)
 *         else:
 *             raise ValueError('invalid data type: "%s"' %             # <<<<<<<<<<<<<<
 *                                         <char*>epr_data_type_id_to_str(dtype))
 * 
 */
    __pyx_t_8 = __Pyx_PyString_Format(__pyx_kp_s_invalid_data_type_s, __pyx_t_7); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1510; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1510; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_8);
    __Pyx_GIVEREF(__pyx_t_8);
    __pyx_t_8 = 0;
    __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_t_7, NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1510; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_Raise(__pyx_t_8, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1510; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    break;
  }

  /* "epr.pyx":1513
 *                                         <char*>epr_data_type_id_to_str(dtype))
 * 
 *         pyepr_check_errors()    # @TODO: check             # <<<<<<<<<<<<<<
 * 
 *         return val
 */
  __pyx_t_8 = __pyx_f_3epr_pyepr_check_errors(); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1513; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "epr.pyx":1515
 *         pyepr_check_errors()    # @TODO: check
 * 
 *         return val             # <<<<<<<<<<<<<<
 * 
 *     # --- high level interface ------------------------------------------------
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_8 = PyFloat_FromDouble(__pyx_v_val); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1515; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_r = __pyx_t_8;
  __pyx_t_8 = 0;
  goto __pyx_L0;

  /* "epr.pyx":1478
 *         return epr_get_raster_elem_size(self._ptr)
 * 
 *     def get_pixel(self, int x, int y):             # <<<<<<<<<<<<<<
 *         '''get_pixel(x, y)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("epr.Raster.get_pixel", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":1518
 * 
 *     # --- high level interface ------------------------------------------------
 *     cdef np.ndarray toarray(self):             # <<<<<<<<<<<<<<
 *         cdef np.NPY_TYPES dtype = _epr_to_numpy_type_id(self._ptr.data_type)
 *         cdef np.npy_intp shape[2]
 */

static PyArrayObject *__pyx_f_3epr_6Raster_toarray(struct __pyx_obj_3epr_Raster *__pyx_v_self) {
  enum NPY_TYPES __pyx_v_dtype;
  npy_intp __pyx_v_shape[2];
  PyArrayObject *__pyx_v_result = 0;
  PyArrayObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  uint __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("toarray", 0);

  /* "epr.pyx":1519
 *     # --- high level interface ------------------------------------------------
 *     cdef np.ndarray toarray(self):
 *         cdef np.NPY_TYPES dtype = _epr_to_numpy_type_id(self._ptr.data_type)             # <<<<<<<<<<<<<<
 *         cdef np.npy_intp shape[2]
 *         cdef np.ndarray result
 */
  __pyx_v_dtype = __pyx_f_3epr__epr_to_numpy_type_id(__pyx_v_self->_ptr->data_type);

  /* "epr.pyx":1523
 *         cdef np.ndarray result
 * 
 *         if dtype == np.NPY_NOTYPE:             # <<<<<<<<<<<<<<
 *             raise TypeError('invalid data type')
 *         else:
 */
  __pyx_t_1 = ((__pyx_v_dtype == NPY_NOTYPE) != 0);
  if (__pyx_t_1) {

    /* "epr.pyx":1524
 * 
 *         if dtype == np.NPY_NOTYPE:
 *             raise TypeError('invalid data type')             # <<<<<<<<<<<<<<
 *         else:
 *             shape[0] = self._ptr.raster_height
 */
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__12, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1524; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1524; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  /*else*/ {

    /* "epr.pyx":1526
 *             raise TypeError('invalid data type')
 *         else:
 *             shape[0] = self._ptr.raster_height             # <<<<<<<<<<<<<<
 *             shape[1] = self._ptr.raster_width
 * 
 */
    __pyx_t_3 = __pyx_v_self->_ptr->raster_height;
    (__pyx_v_shape[0]) = __pyx_t_3;

    /* "epr.pyx":1527
 *         else:
 *             shape[0] = self._ptr.raster_height
 *             shape[1] = self._ptr.raster_width             # <<<<<<<<<<<<<<
 * 
 *             result = np.PyArray_SimpleNewFromData(2, shape, dtype,
 */
    __pyx_t_3 = __pyx_v_self->_ptr->raster_width;
    (__pyx_v_shape[1]) = __pyx_t_3;

    /* "epr.pyx":1529
 *             shape[1] = self._ptr.raster_width
 * 
 *             result = np.PyArray_SimpleNewFromData(2, shape, dtype,             # <<<<<<<<<<<<<<
 *                                                   self._ptr.buffer)
 * 
 */
    __pyx_t_2 = PyArray_SimpleNewFromData(2, __pyx_v_shape, __pyx_v_dtype, __pyx_v_self->_ptr->buffer); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1529; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1529; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_result = ((PyArrayObject *)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "epr.pyx":1533
 * 
 *             # Make the ndarray keep a reference to this object
 *             np.set_array_base(result, self)             # <<<<<<<<<<<<<<
 * 
 *         return result
 */
    __pyx_f_5numpy_set_array_base(__pyx_v_result, ((PyObject *)__pyx_v_self));
  }

  /* "epr.pyx":1535
 *             np.set_array_base(result, self)
 * 
 *         return result             # <<<<<<<<<<<<<<
 * 
 *     property data:
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_result));
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;

  /* "epr.pyx":1518
 * 
 *     # --- high level interface ------------------------------------------------
 *     cdef np.ndarray toarray(self):             # <<<<<<<<<<<<<<
 *         cdef np.NPY_TYPES dtype = _epr_to_numpy_type_id(self._ptr.data_type)
 *         cdef np.npy_intp shape[2]
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("epr.Raster.toarray", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_result);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":1546
 *         '''
 * 
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             cdef object data
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_3epr_6Raster_4data_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_3epr_6Raster_4data_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_3epr_6Raster_4data___get__(((struct __pyx_obj_3epr_Raster *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_3epr_6Raster_4data___get__(struct __pyx_obj_3epr_Raster *__pyx_v_self) {
  PyObject *__pyx_v_data = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "epr.pyx":1549
 *             cdef object data
 * 
 *             if self._data is not None:             # <<<<<<<<<<<<<<
 *                 data = self._data()
 *                 if data is not None:
 */
  __pyx_t_1 = (__pyx_v_self->_data != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "epr.pyx":1550
 * 
 *             if self._data is not None:
 *                 data = self._data()             # <<<<<<<<<<<<<<
 *                 if data is not None:
 *                     return data
 */
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_v_self->_data, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1550; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_v_data = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "epr.pyx":1551
 *             if self._data is not None:
 *                 data = self._data()
 *                 if data is not None:             # <<<<<<<<<<<<<<
 *                     return data
 * 
 */
    __pyx_t_2 = (__pyx_v_data != Py_None);
    __pyx_t_1 = (__pyx_t_2 != 0);
    if (__pyx_t_1) {

      /* "epr.pyx":1552
 *                 data = self._data()
 *                 if data is not None:
 *                     return data             # <<<<<<<<<<<<<<
 * 
 *             if self._ptr.buffer is NULL:
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_v_data);
      __pyx_r = __pyx_v_data;
      goto __pyx_L0;
    }
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "epr.pyx":1554
 *                     return data
 * 
 *             if self._ptr.buffer is NULL:             # <<<<<<<<<<<<<<
 *                 return np.ndarray(())
 * 
 */
  __pyx_t_1 = ((__pyx_v_self->_ptr->buffer == NULL) != 0);
  if (__pyx_t_1) {

    /* "epr.pyx":1555
 * 
 *             if self._ptr.buffer is NULL:
 *                 return np.ndarray(())             # <<<<<<<<<<<<<<
 * 
 *             data = self.toarray()
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5numpy_ndarray)), __pyx_tuple__13, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1555; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
  }

  /* "epr.pyx":1557
 *                 return np.ndarray(())
 * 
 *             data = self.toarray()             # <<<<<<<<<<<<<<
 *             self._data = PyWeakref_NewRef(data, None)
 * 
 */
  __pyx_t_3 = ((PyObject *)((struct __pyx_vtabstruct_3epr_Raster *)__pyx_v_self->__pyx_vtab)->toarray(__pyx_v_self)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1557; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_XDECREF_SET(__pyx_v_data, __pyx_t_3);
  __pyx_t_3 = 0;

  /* "epr.pyx":1558
 * 
 *             data = self.toarray()
 *             self._data = PyWeakref_NewRef(data, None)             # <<<<<<<<<<<<<<
 * 
 *             return data
 */
  __pyx_t_3 = PyWeakref_NewRef(__pyx_v_data, Py_None); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1558; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __Pyx_GOTREF(__pyx_v_self->_data);
  __Pyx_DECREF(__pyx_v_self->_data);
  __pyx_v_self->_data = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "epr.pyx":1560
 *             self._data = PyWeakref_NewRef(data, None)
 * 
 *             return data             # <<<<<<<<<<<<<<
 * 
 *     def __repr__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_data);
  __pyx_r = __pyx_v_data;
  goto __pyx_L0;

  /* "epr.pyx":1546
 *         '''
 * 
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             cdef object data
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("epr.Raster.data.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_data);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":1562
 *             return data
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return '%s %s (%dL x %dP)' % (super(Raster, self).__repr__(),
 *                                       data_type_id_to_str(self.data_type),
 */

/* Python wrapper */
static PyObject *__pyx_pw_3epr_6Raster_11__repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_3epr_6Raster_11__repr__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
  __pyx_r = __pyx_pf_3epr_6Raster_10__repr__(((struct __pyx_obj_3epr_Raster *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_3epr_6Raster_10__repr__(struct __pyx_obj_3epr_Raster *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  EPR_EDataTypeId __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__repr__", 0);

  /* "epr.pyx":1563
 * 
 *     def __repr__(self):
 *         return '%s %s (%dL x %dP)' % (super(Raster, self).__repr__(),             # <<<<<<<<<<<<<<
 *                                       data_type_id_to_str(self.data_type),
 *                                       self.get_height(), self.get_width())
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1563; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)((PyObject*)__pyx_ptype_3epr_Raster)));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)((PyObject*)__pyx_ptype_3epr_Raster)));
  __Pyx_GIVEREF(((PyObject *)((PyObject*)__pyx_ptype_3epr_Raster)));
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_self));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_super, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1563; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_repr); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1563; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1563; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "epr.pyx":1564
 *     def __repr__(self):
 *         return '%s %s (%dL x %dP)' % (super(Raster, self).__repr__(),
 *                                       data_type_id_to_str(self.data_type),             # <<<<<<<<<<<<<<
 *                                       self.get_height(), self.get_width())
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_data_type); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1564; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = ((EPR_EDataTypeId)PyInt_AsLong(__pyx_t_1)); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1564; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __pyx_f_3epr_data_type_id_to_str(__pyx_t_3, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1564; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);

  /* "epr.pyx":1565
 *         return '%s %s (%dL x %dP)' % (super(Raster, self).__repr__(),
 *                                       data_type_id_to_str(self.data_type),
 *                                       self.get_height(), self.get_width())             # <<<<<<<<<<<<<<
 * 
 *     # --- low level interface -------------------------------------------------
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_get_height); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1565; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1565; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_get_width); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1565; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1565; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "epr.pyx":1563
 * 
 *     def __repr__(self):
 *         return '%s %s (%dL x %dP)' % (super(Raster, self).__repr__(),             # <<<<<<<<<<<<<<
 *                                       data_type_id_to_str(self.data_type),
 *                                       self.get_height(), self.get_width())
 */
  __pyx_t_4 = PyTuple_New(4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1563; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_6);
  __pyx_t_2 = 0;
  __pyx_t_1 = 0;
  __pyx_t_5 = 0;
  __pyx_t_6 = 0;
  __pyx_t_6 = __Pyx_PyString_Format(__pyx_kp_s_s_s_dL_x_dP, __pyx_t_4); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1563; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_r = __pyx_t_6;
  __pyx_t_6 = 0;
  goto __pyx_L0;

  /* "epr.pyx":1562
 *             return data
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return '%s %s (%dL x %dP)' % (super(Raster, self).__repr__(),
 *                                       data_type_id_to_str(self.data_type),
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("epr.Raster.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":1571
 *         '''The magic number for internal C structure'''
 * 
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self._ptr.magic
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_3epr_6Raster_6_magic_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_3epr_6Raster_6_magic_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_3epr_6Raster_6_magic___get__(((struct __pyx_obj_3epr_Raster *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_3epr_6Raster_6_magic___get__(struct __pyx_obj_3epr_Raster *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "epr.pyx":1572
 * 
 *         def __get__(self):
 *             return self._ptr.magic             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_EPR_Magic(__pyx_v_self->_ptr->magic); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1572; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "epr.pyx":1571
 *         '''The magic number for internal C structure'''
 * 
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self._ptr.magic
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("epr.Raster._magic.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":1575
 * 
 * 
 * cdef new_raster(EPR_SRaster* ptr, Band parent=None):             # <<<<<<<<<<<<<<
 *     if ptr is NULL:
 *         pyepr_null_ptr_error()
 */

static PyObject *__pyx_f_3epr_new_raster(EPR_SRaster *__pyx_v_ptr, struct __pyx_opt_args_3epr_new_raster *__pyx_optional_args) {
  struct __pyx_obj_3epr_Band *__pyx_v_parent = ((struct __pyx_obj_3epr_Band *)Py_None);
  struct __pyx_obj_3epr_Raster *__pyx_v_instance = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("new_raster", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_parent = __pyx_optional_args->parent;
    }
  }

  /* "epr.pyx":1576
 * 
 * cdef new_raster(EPR_SRaster* ptr, Band parent=None):
 *     if ptr is NULL:             # <<<<<<<<<<<<<<
 *         pyepr_null_ptr_error()
 * 
 */
  __pyx_t_1 = ((__pyx_v_ptr == NULL) != 0);
  if (__pyx_t_1) {

    /* "epr.pyx":1577
 * cdef new_raster(EPR_SRaster* ptr, Band parent=None):
 *     if ptr is NULL:
 *         pyepr_null_ptr_error()             # <<<<<<<<<<<<<<
 * 
 *     cdef Raster instance = Raster.__new__(Raster)
 */
    __pyx_t_2 = __pyx_f_3epr_pyepr_null_ptr_error(NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1577; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "epr.pyx":1579
 *         pyepr_null_ptr_error()
 * 
 *     cdef Raster instance = Raster.__new__(Raster)             # <<<<<<<<<<<<<<
 * 
 *     instance._ptr = ptr
 */
  __pyx_t_2 = __pyx_tp_new_3epr_Raster(((PyTypeObject *)((PyObject*)__pyx_ptype_3epr_Raster)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (!(likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_3epr_Raster)))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_instance = ((struct __pyx_obj_3epr_Raster *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "epr.pyx":1581
 *     cdef Raster instance = Raster.__new__(Raster)
 * 
 *     instance._ptr = ptr             # <<<<<<<<<<<<<<
 *     instance._parent = parent       # Band or None
 *     instance._data = None
 */
  __pyx_v_instance->_ptr = __pyx_v_ptr;

  /* "epr.pyx":1582
 * 
 *     instance._ptr = ptr
 *     instance._parent = parent       # Band or None             # <<<<<<<<<<<<<<
 *     instance._data = None
 * 
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_parent));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_parent));
  __Pyx_GOTREF(__pyx_v_instance->_parent);
  __Pyx_DECREF(((PyObject *)__pyx_v_instance->_parent));
  __pyx_v_instance->_parent = __pyx_v_parent;

  /* "epr.pyx":1583
 *     instance._ptr = ptr
 *     instance._parent = parent       # Band or None
 *     instance._data = None             # <<<<<<<<<<<<<<
 * 
 *     return instance
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_instance->_data);
  __Pyx_DECREF(__pyx_v_instance->_data);
  __pyx_v_instance->_data = Py_None;

  /* "epr.pyx":1585
 *     instance._data = None
 * 
 *     return instance             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_instance));
  __pyx_r = ((PyObject *)__pyx_v_instance);
  goto __pyx_L0;

  /* "epr.pyx":1575
 * 
 * 
 * cdef new_raster(EPR_SRaster* ptr, Band parent=None):             # <<<<<<<<<<<<<<
 *     if ptr is NULL:
 *         pyepr_null_ptr_error()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("epr.new_raster", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_instance);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":1588
 * 
 * 
 * def create_raster(EPR_EDataTypeId data_type, uint src_width, uint src_height,             # <<<<<<<<<<<<<<
 *                   uint xstep=1, uint ystep=1):
 *     '''create_raster(data_type, src_width, src_height, xstep=1, ystep=1)
 */

/* Python wrapper */
static PyObject *__pyx_pw_3epr_11create_raster(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_3epr_10create_raster[] = "create_raster(data_type, src_width, src_height, xstep=1, ystep=1)\n\n    Creates a raster of the specified data type\n\n    This function can be used to create any type of raster, e.g. for\n    later use as a bit-mask.\n\n    :param data_type:\n        the type of the data to stored in the raster, must be one of\n        E_TID_*\n    :param src_width:\n        the width (across track dimension) of the source to be read\n        into the raster.\n        See description of :meth:`Band.create_compatible_raster`\n    :param src_height:\n        the height (along track dimension) of the source to be read\n        into the raster.\n        See description of :meth:`Band.create_compatible_raster`\n    :param xstep:\n        the sub-sampling step across track of the source when reading\n        into the raster\n    :param ystep:\n        the sub-sampling step along track of the source when reading\n        into the raster\n    :returns:\n        the new :class:`Raster` instance\n\n    .. seealso:: description of :meth:`Band.create_compatible_raster`\n\n    ";
static PyMethodDef __pyx_mdef_3epr_11create_raster = {__Pyx_NAMESTR("create_raster"), (PyCFunction)__pyx_pw_3epr_11create_raster, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_3epr_10create_raster)};
static PyObject *__pyx_pw_3epr_11create_raster(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  EPR_EDataTypeId __pyx_v_data_type;
  uint __pyx_v_src_width;
  uint __pyx_v_src_height;
  uint __pyx_v_xstep;
  uint __pyx_v_ystep;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("create_raster (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_data_type,&__pyx_n_s_src_width,&__pyx_n_s_src_height,&__pyx_n_s_xstep,&__pyx_n_s_ystep,0};
    PyObject* values[5] = {0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_data_type)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_src_width)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("create_raster", 0, 3, 5, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1588; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_src_height)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("create_raster", 0, 3, 5, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1588; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_xstep);
          if (value) { values[3] = value; kw_args--; }
        }
        case  4:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_ystep);
          if (value) { values[4] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "create_raster") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1588; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_data_type = ((EPR_EDataTypeId)PyInt_AsLong(values[0])); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1588; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_src_width = __Pyx_PyInt_As_uint(values[1]); if (unlikely((__pyx_v_src_width == (uint)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1588; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_src_height = __Pyx_PyInt_As_uint(values[2]); if (unlikely((__pyx_v_src_height == (uint)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1588; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    if (values[3]) {
      __pyx_v_xstep = __Pyx_PyInt_As_uint(values[3]); if (unlikely((__pyx_v_xstep == (uint)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1589; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_xstep = ((uint)1);
    }
    if (values[4]) {
      __pyx_v_ystep = __Pyx_PyInt_As_uint(values[4]); if (unlikely((__pyx_v_ystep == (uint)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1589; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_ystep = ((uint)1);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("create_raster", 0, 3, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1588; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("epr.create_raster", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_3epr_10create_raster(__pyx_self, __pyx_v_data_type, __pyx_v_src_width, __pyx_v_src_height, __pyx_v_xstep, __pyx_v_ystep);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_3epr_10create_raster(CYTHON_UNUSED PyObject *__pyx_self, EPR_EDataTypeId __pyx_v_data_type, uint __pyx_v_src_width, uint __pyx_v_src_height, uint __pyx_v_xstep, uint __pyx_v_ystep) {
  EPR_SRaster *__pyx_v_raster_ptr;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  struct __pyx_opt_args_3epr_pyepr_null_ptr_error __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("create_raster", 0);

  /* "epr.pyx":1621
 *     '''
 * 
 *     if xstep == 0 or ystep == 0:             # <<<<<<<<<<<<<<
 *         raise ValueError('invalid step: xspet=%d, ystep=%d' % (xstep, ystep))
 * 
 */
  __pyx_t_1 = ((__pyx_v_xstep == 0) != 0);
  if (!__pyx_t_1) {
    __pyx_t_2 = ((__pyx_v_ystep == 0) != 0);
    __pyx_t_3 = __pyx_t_2;
  } else {
    __pyx_t_3 = __pyx_t_1;
  }
  if (__pyx_t_3) {

    /* "epr.pyx":1622
 * 
 *     if xstep == 0 or ystep == 0:
 *         raise ValueError('invalid step: xspet=%d, ystep=%d' % (xstep, ystep))             # <<<<<<<<<<<<<<
 * 
 *     cdef EPR_SRaster* raster_ptr
 */
    __pyx_t_4 = __Pyx_PyInt_From_uint(__pyx_v_xstep); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1622; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = __Pyx_PyInt_From_uint(__pyx_v_ystep); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1622; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1622; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_5);
    __pyx_t_4 = 0;
    __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_PyString_Format(__pyx_kp_s_invalid_step_xspet_d_ystep_d, __pyx_t_6); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1622; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1622; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_5);
    __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_t_6, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1622; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_Raise(__pyx_t_5, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1622; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "epr.pyx":1625
 * 
 *     cdef EPR_SRaster* raster_ptr
 *     raster_ptr = epr_create_raster(data_type, src_width, src_height,             # <<<<<<<<<<<<<<
 *                                    xstep, ystep)
 *     if raster_ptr is NULL:
 */
  __pyx_v_raster_ptr = epr_create_raster(__pyx_v_data_type, __pyx_v_src_width, __pyx_v_src_height, __pyx_v_xstep, __pyx_v_ystep);

  /* "epr.pyx":1627
 *     raster_ptr = epr_create_raster(data_type, src_width, src_height,
 *                                    xstep, ystep)
 *     if raster_ptr is NULL:             # <<<<<<<<<<<<<<
 *         pyepr_null_ptr_error('unable to create a new raster')
 * 
 */
  __pyx_t_3 = ((__pyx_v_raster_ptr == NULL) != 0);
  if (__pyx_t_3) {

    /* "epr.pyx":1628
 *                                    xstep, ystep)
 *     if raster_ptr is NULL:
 *         pyepr_null_ptr_error('unable to create a new raster')             # <<<<<<<<<<<<<<
 * 
 *     return new_raster(raster_ptr)
 */
    __pyx_t_7.__pyx_n = 1;
    __pyx_t_7.msg = __pyx_kp_s_unable_to_create_a_new_raster;
    __pyx_t_5 = __pyx_f_3epr_pyepr_null_ptr_error(&__pyx_t_7); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1628; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "epr.pyx":1630
 *         pyepr_null_ptr_error('unable to create a new raster')
 * 
 *     return new_raster(raster_ptr)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_5 = __pyx_f_3epr_new_raster(__pyx_v_raster_ptr, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1630; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_r = __pyx_t_5;
  __pyx_t_5 = 0;
  goto __pyx_L0;

  /* "epr.pyx":1588
 * 
 * 
 * def create_raster(EPR_EDataTypeId data_type, uint src_width, uint src_height,             # <<<<<<<<<<<<<<
 *                   uint xstep=1, uint ystep=1):
 *     '''create_raster(data_type, src_width, src_height, xstep=1, ystep=1)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("epr.create_raster", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":1633
 * 
 * 
 * def create_bitmask_raster(uint src_width, uint src_height,             # <<<<<<<<<<<<<<
 *                           uint xstep=1, uint ystep=1):
 *     '''create_bitmask_raster(src_width, src_height, xstep=1, ystep=1)
 */

/* Python wrapper */
static PyObject *__pyx_pw_3epr_13create_bitmask_raster(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_3epr_12create_bitmask_raster[] = "create_bitmask_raster(src_width, src_height, xstep=1, ystep=1)\n\n    Creates a raster to be used for reading bitmasks\n\n    The raster returned always is of type ``byte``.\n\n    :param src_width:\n        the width (across track dimension) of the source to be read\n        into the raster\n    :param src_height:\n        the height (along track dimension) of the source to be read\n        into the raster\n    :param xstep:\n        the sub-sampling step across track of the source when reading\n        into the raster\n    :param ystep:\n        the sub-sampling step along track of the source when reading\n        into the raster\n    :returns:\n        the new raster instance or raises an exception\n        (:exc:`EPRValueError`) if an error occurred\n\n    .. seealso:: the description of\n                 :meth:`Band.create_compatible_raster`\n\n    ";
static PyMethodDef __pyx_mdef_3epr_13create_bitmask_raster = {__Pyx_NAMESTR("create_bitmask_raster"), (PyCFunction)__pyx_pw_3epr_13create_bitmask_raster, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_3epr_12create_bitmask_raster)};
static PyObject *__pyx_pw_3epr_13create_bitmask_raster(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  uint __pyx_v_src_width;
  uint __pyx_v_src_height;
  uint __pyx_v_xstep;
  uint __pyx_v_ystep;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("create_bitmask_raster (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_src_width,&__pyx_n_s_src_height,&__pyx_n_s_xstep,&__pyx_n_s_ystep,0};
    PyObject* values[4] = {0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_src_width)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_src_height)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("create_bitmask_raster", 0, 2, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1633; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_xstep);
          if (value) { values[2] = value; kw_args--; }
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_ystep);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "create_bitmask_raster") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1633; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_src_width = __Pyx_PyInt_As_uint(values[0]); if (unlikely((__pyx_v_src_width == (uint)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1633; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_src_height = __Pyx_PyInt_As_uint(values[1]); if (unlikely((__pyx_v_src_height == (uint)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1633; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    if (values[2]) {
      __pyx_v_xstep = __Pyx_PyInt_As_uint(values[2]); if (unlikely((__pyx_v_xstep == (uint)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1634; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_xstep = ((uint)1);
    }
    if (values[3]) {
      __pyx_v_ystep = __Pyx_PyInt_As_uint(values[3]); if (unlikely((__pyx_v_ystep == (uint)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1634; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_ystep = ((uint)1);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("create_bitmask_raster", 0, 2, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1633; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("epr.create_bitmask_raster", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_3epr_12create_bitmask_raster(__pyx_self, __pyx_v_src_width, __pyx_v_src_height, __pyx_v_xstep, __pyx_v_ystep);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_3epr_12create_bitmask_raster(CYTHON_UNUSED PyObject *__pyx_self, uint __pyx_v_src_width, uint __pyx_v_src_height, uint __pyx_v_xstep, uint __pyx_v_ystep) {
  EPR_SRaster *__pyx_v_raster_ptr;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  struct __pyx_opt_args_3epr_pyepr_null_ptr_error __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("create_bitmask_raster", 0);

  /* "epr.pyx":1662
 *     '''
 * 
 *     if xstep == 0 or ystep == 0:             # <<<<<<<<<<<<<<
 *         raise ValueError('invalid step: xspet=%d, ystep=%d' % (xstep, ystep))
 * 
 */
  __pyx_t_1 = ((__pyx_v_xstep == 0) != 0);
  if (!__pyx_t_1) {
    __pyx_t_2 = ((__pyx_v_ystep == 0) != 0);
    __pyx_t_3 = __pyx_t_2;
  } else {
    __pyx_t_3 = __pyx_t_1;
  }
  if (__pyx_t_3) {

    /* "epr.pyx":1663
 * 
 *     if xstep == 0 or ystep == 0:
 *         raise ValueError('invalid step: xspet=%d, ystep=%d' % (xstep, ystep))             # <<<<<<<<<<<<<<
 * 
 *     cdef EPR_SRaster* raster_ptr
 */
    __pyx_t_4 = __Pyx_PyInt_From_uint(__pyx_v_xstep); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1663; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = __Pyx_PyInt_From_uint(__pyx_v_ystep); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1663; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1663; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_5);
    __pyx_t_4 = 0;
    __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_PyString_Format(__pyx_kp_s_invalid_step_xspet_d_ystep_d, __pyx_t_6); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1663; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1663; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_5);
    __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_t_6, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1663; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_Raise(__pyx_t_5, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1663; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "epr.pyx":1666
 * 
 *     cdef EPR_SRaster* raster_ptr
 *     raster_ptr = epr_create_bitmask_raster(src_width, src_height, xstep, ystep)             # <<<<<<<<<<<<<<
 *     if raster_ptr is NULL:
 *         pyepr_null_ptr_error('unable to create a new raster')
 */
  __pyx_v_raster_ptr = epr_create_bitmask_raster(__pyx_v_src_width, __pyx_v_src_height, __pyx_v_xstep, __pyx_v_ystep);

  /* "epr.pyx":1667
 *     cdef EPR_SRaster* raster_ptr
 *     raster_ptr = epr_create_bitmask_raster(src_width, src_height, xstep, ystep)
 *     if raster_ptr is NULL:             # <<<<<<<<<<<<<<
 *         pyepr_null_ptr_error('unable to create a new raster')
 * 
 */
  __pyx_t_3 = ((__pyx_v_raster_ptr == NULL) != 0);
  if (__pyx_t_3) {

    /* "epr.pyx":1668
 *     raster_ptr = epr_create_bitmask_raster(src_width, src_height, xstep, ystep)
 *     if raster_ptr is NULL:
 *         pyepr_null_ptr_error('unable to create a new raster')             # <<<<<<<<<<<<<<
 * 
 *     return new_raster(raster_ptr)
 */
    __pyx_t_7.__pyx_n = 1;
    __pyx_t_7.msg = __pyx_kp_s_unable_to_create_a_new_raster;
    __pyx_t_5 = __pyx_f_3epr_pyepr_null_ptr_error(&__pyx_t_7); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1668; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "epr.pyx":1670
 *         pyepr_null_ptr_error('unable to create a new raster')
 * 
 *     return new_raster(raster_ptr)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_5 = __pyx_f_3epr_new_raster(__pyx_v_raster_ptr, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1670; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_r = __pyx_t_5;
  __pyx_t_5 = 0;
  goto __pyx_L0;

  /* "epr.pyx":1633
 * 
 * 
 * def create_bitmask_raster(uint src_width, uint src_height,             # <<<<<<<<<<<<<<
 *                           uint xstep=1, uint ystep=1):
 *     '''create_bitmask_raster(src_width, src_height, xstep=1, ystep=1)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("epr.create_bitmask_raster", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":1687
 *     cdef Product _parent
 * 
 *     cdef inline check_closed_product(self):             # <<<<<<<<<<<<<<
 *         self._parent.check_closed_product()
 * 
 */

static CYTHON_INLINE PyObject *__pyx_f_3epr_4Band_check_closed_product(struct __pyx_obj_3epr_Band *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("check_closed_product", 0);

  /* "epr.pyx":1688
 * 
 *     cdef inline check_closed_product(self):
 *         self._parent.check_closed_product()             # <<<<<<<<<<<<<<
 * 
 *     property product:
 */
  __pyx_t_1 = __pyx_f_3epr_7Product_check_closed_product(__pyx_v_self->_parent); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1688; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "epr.pyx":1687
 *     cdef Product _parent
 * 
 *     cdef inline check_closed_product(self):             # <<<<<<<<<<<<<<
 *         self._parent.check_closed_product()
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("epr.Band.check_closed_product", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":1693
 *         '''The :class:`Product` instance to which this band belongs to'''
 * 
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self._parent
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_3epr_4Band_7product_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_3epr_4Band_7product_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_3epr_4Band_7product___get__(((struct __pyx_obj_3epr_Band *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_3epr_4Band_7product___get__(struct __pyx_obj_3epr_Band *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "epr.pyx":1694
 * 
 *         def __get__(self):
 *             return self._parent             # <<<<<<<<<<<<<<
 * 
 *     property spectr_band_index:
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->_parent));
  __pyx_r = ((PyObject *)__pyx_v_self->_parent);
  goto __pyx_L0;

  /* "epr.pyx":1693
 *         '''The :class:`Product` instance to which this band belongs to'''
 * 
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self._parent
 * 
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":1703
 *         '''
 * 
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             self.check_closed_product()
 *             return self._ptr.spectr_band_index
 */

/* Python wrapper */
static PyObject *__pyx_pw_3epr_4Band_17spectr_band_index_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_3epr_4Band_17spectr_band_index_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_3epr_4Band_17spectr_band_index___get__(((struct __pyx_obj_3epr_Band *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_3epr_4Band_17spectr_band_index___get__(struct __pyx_obj_3epr_Band *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "epr.pyx":1704
 * 
 *         def __get__(self):
 *             self.check_closed_product()             # <<<<<<<<<<<<<<
 *             return self._ptr.spectr_band_index
 * 
 */
  __pyx_t_1 = __pyx_f_3epr_4Band_check_closed_product(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1704; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "epr.pyx":1705
 *         def __get__(self):
 *             self.check_closed_product()
 *             return self._ptr.spectr_band_index             # <<<<<<<<<<<<<<
 * 
 *     property sample_model:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->_ptr->spectr_band_index); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1705; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "epr.pyx":1703
 *         '''
 * 
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             self.check_closed_product()
 *             return self._ptr.spectr_band_index
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("epr.Band.spectr_band_index.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":1723
 *         '''
 * 
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self._ptr.sample_model
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_3epr_4Band_12sample_model_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_3epr_4Band_12sample_model_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_3epr_4Band_12sample_model___get__(((struct __pyx_obj_3epr_Band *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_3epr_4Band_12sample_model___get__(struct __pyx_obj_3epr_Band *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "epr.pyx":1724
 * 
 *         def __get__(self):
 *             return self._ptr.sample_model             # <<<<<<<<<<<<<<
 * 
 *     property data_type:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyInt_FromLong(__pyx_v_self->_ptr->sample_model); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "epr.pyx":1723
 *         '''
 * 
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self._ptr.sample_model
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("epr.Band.sample_model.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":1738
 *         '''
 * 
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self._ptr.data_type
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_3epr_4Band_9data_type_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_3epr_4Band_9data_type_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_3epr_4Band_9data_type___get__(((struct __pyx_obj_3epr_Band *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_3epr_4Band_9data_type___get__(struct __pyx_obj_3epr_Band *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "epr.pyx":1739
 * 
 *         def __get__(self):
 *             return self._ptr.data_type             # <<<<<<<<<<<<<<
 * 
 *     property scaling_method:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyInt_FromLong(__pyx_v_self->_ptr->data_type); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1739; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "epr.pyx":1738
 *         '''
 * 
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self._ptr.data_type
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("epr.Band.data_type.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":1760
 *         '''
 * 
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self._ptr.scaling_method
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_3epr_4Band_14scaling_method_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_3epr_4Band_14scaling_method_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_3epr_4Band_14scaling_method___get__(((struct __pyx_obj_3epr_Band *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_3epr_4Band_14scaling_method___get__(struct __pyx_obj_3epr_Band *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "epr.pyx":1761
 * 
 *         def __get__(self):
 *             return self._ptr.scaling_method             # <<<<<<<<<<<<<<
 * 
 *     property scaling_offset:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyInt_FromLong(__pyx_v_self->_ptr->scaling_method); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1761; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "epr.pyx":1760
 *         '''
 * 
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self._ptr.scaling_method
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("epr.Band.scaling_method.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":1777
 *         '''
 * 
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self._ptr.scaling_offset
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_3epr_4Band_14scaling_offset_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_3epr_4Band_14scaling_offset_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_3epr_4Band_14scaling_offset___get__(((struct __pyx_obj_3epr_Band *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_3epr_4Band_14scaling_offset___get__(struct __pyx_obj_3epr_Band *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "epr.pyx":1778
 * 
 *         def __get__(self):
 *             return self._ptr.scaling_offset             # <<<<<<<<<<<<<<
 * 
 *     property scaling_factor:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->_ptr->scaling_offset); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1778; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "epr.pyx":1777
 *         '''
 * 
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self._ptr.scaling_offset
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("epr.Band.scaling_offset.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":1794
 *         '''
 * 
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self._ptr.scaling_factor
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_3epr_4Band_14scaling_factor_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_3epr_4Band_14scaling_factor_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_3epr_4Band_14scaling_factor___get__(((struct __pyx_obj_3epr_Band *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_3epr_4Band_14scaling_factor___get__(struct __pyx_obj_3epr_Band *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "epr.pyx":1795
 * 
 *         def __get__(self):
 *             return self._ptr.scaling_factor             # <<<<<<<<<<<<<<
 * 
 *     property bm_expr:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->_ptr->scaling_factor); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1795; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "epr.pyx":1794
 *         '''
 * 
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self._ptr.scaling_factor
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("epr.Band.scaling_factor.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":1804
 *         '''
 * 
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             if self._ptr.bm_expr is NULL:
 *                 return None
 */

/* Python wrapper */
static PyObject *__pyx_pw_3epr_4Band_7bm_expr_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_3epr_4Band_7bm_expr_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_3epr_4Band_7bm_expr___get__(((struct __pyx_obj_3epr_Band *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_3epr_4Band_7bm_expr___get__(struct __pyx_obj_3epr_Band *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  struct __pyx_opt_args_3epr__to_str __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "epr.pyx":1805
 * 
 *         def __get__(self):
 *             if self._ptr.bm_expr is NULL:             # <<<<<<<<<<<<<<
 *                 return None
 *             else:
 */
  __pyx_t_1 = ((__pyx_v_self->_ptr->bm_expr == NULL) != 0);
  if (__pyx_t_1) {

    /* "epr.pyx":1806
 *         def __get__(self):
 *             if self._ptr.bm_expr is NULL:
 *                 return None             # <<<<<<<<<<<<<<
 *             else:
 *                 return _to_str(self._ptr.bm_expr, 'ascii')
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_None);
    __pyx_r = Py_None;
    goto __pyx_L0;
  }
  /*else*/ {

    /* "epr.pyx":1808
 *                 return None
 *             else:
 *                 return _to_str(self._ptr.bm_expr, 'ascii')             # <<<<<<<<<<<<<<
 * 
 *     property unit:
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = __Pyx_PyBytes_FromString(__pyx_v_self->_ptr->bm_expr); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1808; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4.__pyx_n = 1;
    __pyx_t_4.encoding = __pyx_n_s_ascii;
    __pyx_t_3 = __pyx_f_3epr__to_str(__pyx_t_2, &__pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1808; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
  }

  /* "epr.pyx":1804
 *         '''
 * 
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             if self._ptr.bm_expr is NULL:
 *                 return None
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("epr.Band.bm_expr.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":1813
 *         '''The geophysical unit for the band's pixel values'''
 * 
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             if self._ptr.unit is NULL:
 *                 return None
 */

/* Python wrapper */
static PyObject *__pyx_pw_3epr_4Band_4unit_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_3epr_4Band_4unit_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_3epr_4Band_4unit___get__(((struct __pyx_obj_3epr_Band *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_3epr_4Band_4unit___get__(struct __pyx_obj_3epr_Band *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  struct __pyx_opt_args_3epr__to_str __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "epr.pyx":1814
 * 
 *         def __get__(self):
 *             if self._ptr.unit is NULL:             # <<<<<<<<<<<<<<
 *                 return None
 *             else:
 */
  __pyx_t_1 = ((__pyx_v_self->_ptr->unit == NULL) != 0);
  if (__pyx_t_1) {

    /* "epr.pyx":1815
 *         def __get__(self):
 *             if self._ptr.unit is NULL:
 *                 return None             # <<<<<<<<<<<<<<
 *             else:
 *                 return _to_str(self._ptr.unit, 'ascii')
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_None);
    __pyx_r = Py_None;
    goto __pyx_L0;
  }
  /*else*/ {

    /* "epr.pyx":1817
 *                 return None
 *             else:
 *                 return _to_str(self._ptr.unit, 'ascii')             # <<<<<<<<<<<<<<
 * 
 *     property description:
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = __Pyx_PyBytes_FromString(__pyx_v_self->_ptr->unit); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1817; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4.__pyx_n = 1;
    __pyx_t_4.encoding = __pyx_n_s_ascii;
    __pyx_t_3 = __pyx_f_3epr__to_str(__pyx_t_2, &__pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1817; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
  }

  /* "epr.pyx":1813
 *         '''The geophysical unit for the band's pixel values'''
 * 
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             if self._ptr.unit is NULL:
 *                 return None
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("epr.Band.unit.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":1822
 *         '''A short description of the band's contents'''
 * 
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             if self._ptr.description is NULL:
 *                 return None
 */

/* Python wrapper */
static PyObject *__pyx_pw_3epr_4Band_11description_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_3epr_4Band_11description_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_3epr_4Band_11description___get__(((struct __pyx_obj_3epr_Band *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_3epr_4Band_11description___get__(struct __pyx_obj_3epr_Band *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  struct __pyx_opt_args_3epr__to_str __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "epr.pyx":1823
 * 
 *         def __get__(self):
 *             if self._ptr.description is NULL:             # <<<<<<<<<<<<<<
 *                 return None
 *             else:
 */
  __pyx_t_1 = ((__pyx_v_self->_ptr->description == NULL) != 0);
  if (__pyx_t_1) {

    /* "epr.pyx":1824
 *         def __get__(self):
 *             if self._ptr.description is NULL:
 *                 return None             # <<<<<<<<<<<<<<
 *             else:
 *                 return _to_str(self._ptr.description, 'ascii')
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_None);
    __pyx_r = Py_None;
    goto __pyx_L0;
  }
  /*else*/ {

    /* "epr.pyx":1826
 *                 return None
 *             else:
 *                 return _to_str(self._ptr.description, 'ascii')             # <<<<<<<<<<<<<<
 * 
 *     property lines_mirrored:
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = __Pyx_PyBytes_FromString(__pyx_v_self->_ptr->description); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1826; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4.__pyx_n = 1;
    __pyx_t_4.encoding = __pyx_n_s_ascii;
    __pyx_t_3 = __pyx_f_3epr__to_str(__pyx_t_2, &__pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1826; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
  }

  /* "epr.pyx":1822
 *         '''A short description of the band's contents'''
 * 
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             if self._ptr.description is NULL:
 *                 return None
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("epr.Band.description.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":1837
 *         '''
 * 
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return <bint>self._ptr.lines_mirrored
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_3epr_4Band_14lines_mirrored_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_3epr_4Band_14lines_mirrored_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_3epr_4Band_14lines_mirrored___get__(((struct __pyx_obj_3epr_Band *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_3epr_4Band_14lines_mirrored___get__(struct __pyx_obj_3epr_Band *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "epr.pyx":1838
 * 
 *         def __get__(self):
 *             return <bint>self._ptr.lines_mirrored             # <<<<<<<<<<<<<<
 * 
 *     property dataset:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBool_FromLong((__pyx_v_self->_ptr->lines_mirrored != 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1838; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "epr.pyx":1837
 *         '''
 * 
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return <bint>self._ptr.lines_mirrored
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("epr.Band.lines_mirrored.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":1848
 *         '''
 * 
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             cdef EPR_SDatasetId* dataset_id = self._ptr.dataset_ref.dataset_id
 *             cdef const char* name = epr_get_dataset_name(dataset_id)
 */

/* Python wrapper */
static PyObject *__pyx_pw_3epr_4Band_7dataset_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_3epr_4Band_7dataset_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_3epr_4Band_7dataset___get__(((struct __pyx_obj_3epr_Band *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_3epr_4Band_7dataset___get__(struct __pyx_obj_3epr_Band *__pyx_v_self) {
  EPR_SDatasetId *__pyx_v_dataset_id;
  char const *__pyx_v_name;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  struct EPR_DatasetId *__pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "epr.pyx":1849
 * 
 *         def __get__(self):
 *             cdef EPR_SDatasetId* dataset_id = self._ptr.dataset_ref.dataset_id             # <<<<<<<<<<<<<<
 *             cdef const char* name = epr_get_dataset_name(dataset_id)
 *             return self.product.get_dataset(name)
 */
  __pyx_t_1 = __pyx_v_self->_ptr->dataset_ref.dataset_id;
  __pyx_v_dataset_id = __pyx_t_1;

  /* "epr.pyx":1850
 *         def __get__(self):
 *             cdef EPR_SDatasetId* dataset_id = self._ptr.dataset_ref.dataset_id
 *             cdef const char* name = epr_get_dataset_name(dataset_id)             # <<<<<<<<<<<<<<
 *             return self.product.get_dataset(name)
 * 
 */
  __pyx_v_name = epr_get_dataset_name(__pyx_v_dataset_id);

  /* "epr.pyx":1851
 *             cdef EPR_SDatasetId* dataset_id = self._ptr.dataset_ref.dataset_id
 *             cdef const char* name = epr_get_dataset_name(dataset_id)
 *             return self.product.get_dataset(name)             # <<<<<<<<<<<<<<
 * 
 *     def get_name(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_product); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1851; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_get_dataset); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1851; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyBytes_FromString(__pyx_v_name); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1851; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1851; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1851; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "epr.pyx":1848
 *         '''
 * 
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             cdef EPR_SDatasetId* dataset_id = self._ptr.dataset_ref.dataset_id
 *             cdef const char* name = epr_get_dataset_name(dataset_id)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("epr.Band.dataset.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":1853
 *             return self.product.get_dataset(name)
 * 
 *     def get_name(self):             # <<<<<<<<<<<<<<
 *         '''get_name(self)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_3epr_4Band_1get_name(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_3epr_4Band_get_name[] = "get_name(self)\n\n        Gets the name of the band\n\n        ";
static PyObject *__pyx_pw_3epr_4Band_1get_name(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_name (wrapper)", 0);
  __pyx_r = __pyx_pf_3epr_4Band_get_name(((struct __pyx_obj_3epr_Band *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_3epr_4Band_get_name(struct __pyx_obj_3epr_Band *__pyx_v_self) {
  char *__pyx_v_name;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  struct __pyx_opt_args_3epr__to_str __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_name", 0);

  /* "epr.pyx":1860
 *         '''
 * 
 *         cdef char* name = NULL             # <<<<<<<<<<<<<<
 * 
 *         self.check_closed_product()
 */
  __pyx_v_name = NULL;

  /* "epr.pyx":1862
 *         cdef char* name = NULL
 * 
 *         self.check_closed_product()             # <<<<<<<<<<<<<<
 * 
 *         name = <char*>epr_get_band_name(self._ptr)
 */
  __pyx_t_1 = __pyx_f_3epr_4Band_check_closed_product(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1862; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "epr.pyx":1864
 *         self.check_closed_product()
 * 
 *         name = <char*>epr_get_band_name(self._ptr)             # <<<<<<<<<<<<<<
 * 
 *         return _to_str(name, 'ascii')
 */
  __pyx_v_name = ((char *)epr_get_band_name(__pyx_v_self->_ptr));

  /* "epr.pyx":1866
 *         name = <char*>epr_get_band_name(self._ptr)
 * 
 *         return _to_str(name, 'ascii')             # <<<<<<<<<<<<<<
 * 
 *     def create_compatible_raster(self, uint src_width=0, uint src_height=0,
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_name); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1866; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3.__pyx_n = 1;
  __pyx_t_3.encoding = __pyx_n_s_ascii;
  __pyx_t_2 = __pyx_f_3epr__to_str(__pyx_t_1, &__pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1866; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "epr.pyx":1853
 *             return self.product.get_dataset(name)
 * 
 *     def get_name(self):             # <<<<<<<<<<<<<<
 *         '''get_name(self)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("epr.Band.get_name", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":1868
 *         return _to_str(name, 'ascii')
 * 
 *     def create_compatible_raster(self, uint src_width=0, uint src_height=0,             # <<<<<<<<<<<<<<
 *                                  uint xstep=1, uint ystep=1):
 *         '''create_compatible_raster(self, src_width, src_height, xstep=1, ystep=1)
 */

/* Python wrapper */
static PyObject *__pyx_pw_3epr_4Band_3create_compatible_raster(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_3epr_4Band_2create_compatible_raster[] = "create_compatible_raster(self, src_width, src_height, xstep=1, ystep=1)\n\n        Creates a raster which is compatible with the data type of\n        the band\n\n        The created raster is used to read the data in it (see\n        :meth:`Band.read_raster`).\n\n        The raster is defined on the grid of the product, from which\n        the data are read. Spatial subsets and under-sampling are\n        possible) through the parameter of the method.\n\n        A raster is an object that allows direct access to data of a\n        certain portion of the ENVISAT product that are read into the\n        it.\n        Such a portion is called the source. The complete ENVISAT\n        product can be much greater than the source.\n        One can move the raster over the complete ENVISAT product and\n        read in turn different parts (always of the size of the source)\n        of it into the raster.\n        The source is specified by the parameters *height* and *width*.\n\n        A typical example is a processing in blocks. Lets say, a block\n        has 64x32 pixel. Then, my source has a width of 64 pixel and a\n        height of 32 pixel.\n\n        Another example is a processing of complete image lines. Then,\n        my source has a widths of the complete product (for example\n        1121 for a MERIS RR product), and a height of 1).\n        One can loop over all blocks read into the raster and process\n        it.\n\n        In addition, it is possible to defined a sub-sampling step for\n        a raster. This means, that the source is not read 1:1 into the\n        raster, but that only every 2nd or 3rd pixel is read. This step\n        can be set differently for the across track (source_step_x) and\n        along track (source_step_y) directions.\n\n        :param src_width:\n            the width (across track dimension) of the source to be read\n            into the raster (default: scene_width)\n        :param src_height:\n            the height (along tr""ack dimension) of the source to be read\n            into the raster (default: scene_height)\n        :param xstep:\n            the sub-sampling step across track of the source when\n            reading into the raster (default=1)\n        :param ystep:\n            the sub-sampling step along track of the source when\n            reading into the raster (default=1)\n        :returns:\n            the new raster instance or raises an exception\n            (:exc:`EPRValueError`) if an error occurred\n\n        .. note::\n\n            src_width and src_height are the dimantion of the of the source\n            area. If one specifies a *step* parameter the resulting raster\n            will have a size that is smaller that the specifies source size::\n\n                raster_size = src_size // step\n\n        ";
static PyObject *__pyx_pw_3epr_4Band_3create_compatible_raster(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  uint __pyx_v_src_width;
  uint __pyx_v_src_height;
  uint __pyx_v_xstep;
  uint __pyx_v_ystep;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("create_compatible_raster (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_src_width,&__pyx_n_s_src_height,&__pyx_n_s_xstep,&__pyx_n_s_ystep,0};
    PyObject* values[4] = {0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_src_width);
          if (value) { values[0] = value; kw_args--; }
        }
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_src_height);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_xstep);
          if (value) { values[2] = value; kw_args--; }
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_ystep);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "create_compatible_raster") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1868; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_src_width = __Pyx_PyInt_As_uint(values[0]); if (unlikely((__pyx_v_src_width == (uint)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1868; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_src_width = ((uint)0);
    }
    if (values[1]) {
      __pyx_v_src_height = __Pyx_PyInt_As_uint(values[1]); if (unlikely((__pyx_v_src_height == (uint)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1868; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_src_height = ((uint)0);
    }
    if (values[2]) {
      __pyx_v_xstep = __Pyx_PyInt_As_uint(values[2]); if (unlikely((__pyx_v_xstep == (uint)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1869; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_xstep = ((uint)1);
    }
    if (values[3]) {
      __pyx_v_ystep = __Pyx_PyInt_As_uint(values[3]); if (unlikely((__pyx_v_ystep == (uint)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1869; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_ystep = ((uint)1);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("create_compatible_raster", 0, 0, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1868; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("epr.Band.create_compatible_raster", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_3epr_4Band_2create_compatible_raster(((struct __pyx_obj_3epr_Band *)__pyx_v_self), __pyx_v_src_width, __pyx_v_src_height, __pyx_v_xstep, __pyx_v_ystep);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_3epr_4Band_2create_compatible_raster(struct __pyx_obj_3epr_Band *__pyx_v_self, uint __pyx_v_src_width, uint __pyx_v_src_height, uint __pyx_v_xstep, uint __pyx_v_ystep) {
  EPR_SRaster *__pyx_v_raster_ptr;
  int __pyx_v_scene_width;
  int __pyx_v_scene_height;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  struct __pyx_opt_args_3epr_pyepr_null_ptr_error __pyx_t_7;
  struct __pyx_opt_args_3epr_new_raster __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("create_compatible_raster", 0);

  /* "epr.pyx":1934
 *         '''
 * 
 *         cdef EPR_SRaster* raster_ptr = NULL             # <<<<<<<<<<<<<<
 *         cdef int scene_width
 *         cdef int scene_height
 */
  __pyx_v_raster_ptr = NULL;

  /* "epr.pyx":1938
 *         cdef int scene_height
 * 
 *         self.check_closed_product()             # <<<<<<<<<<<<<<
 * 
 *         scene_width = epr_get_scene_width(self._parent._ptr)
 */
  __pyx_t_1 = __pyx_f_3epr_4Band_check_closed_product(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1938; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "epr.pyx":1940
 *         self.check_closed_product()
 * 
 *         scene_width = epr_get_scene_width(self._parent._ptr)             # <<<<<<<<<<<<<<
 *         scene_height = epr_get_scene_height(self._parent._ptr)
 * 
 */
  __pyx_v_scene_width = epr_get_scene_width(__pyx_v_self->_parent->_ptr);

  /* "epr.pyx":1941
 * 
 *         scene_width = epr_get_scene_width(self._parent._ptr)
 *         scene_height = epr_get_scene_height(self._parent._ptr)             # <<<<<<<<<<<<<<
 * 
 *         if src_width == 0:
 */
  __pyx_v_scene_height = epr_get_scene_height(__pyx_v_self->_parent->_ptr);

  /* "epr.pyx":1943
 *         scene_height = epr_get_scene_height(self._parent._ptr)
 * 
 *         if src_width == 0:             # <<<<<<<<<<<<<<
 *             src_width = scene_width
 *         elif src_width > scene_width:
 */
  __pyx_t_2 = ((__pyx_v_src_width == 0) != 0);
  if (__pyx_t_2) {

    /* "epr.pyx":1944
 * 
 *         if src_width == 0:
 *             src_width = scene_width             # <<<<<<<<<<<<<<
 *         elif src_width > scene_width:
 *             raise ValueError(
 */
    __pyx_v_src_width = __pyx_v_scene_width;
    goto __pyx_L3;
  }

  /* "epr.pyx":1945
 *         if src_width == 0:
 *             src_width = scene_width
 *         elif src_width > scene_width:             # <<<<<<<<<<<<<<
 *             raise ValueError(
 *                 'requeted raster width (%d) is too large for the Band '
 */
  __pyx_t_2 = ((__pyx_v_src_width > __pyx_v_scene_width) != 0);
  if (__pyx_t_2) {

    /* "epr.pyx":1948
 *             raise ValueError(
 *                 'requeted raster width (%d) is too large for the Band '
 *                 '(scene_width=%d)' % (src_width, scene_width))             # <<<<<<<<<<<<<<
 * 
 *         if src_height == 0:
 */
    __pyx_t_1 = __Pyx_PyInt_From_uint(__pyx_v_src_width); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1948; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_scene_width); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1948; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1948; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    __pyx_t_1 = 0;
    __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_requeted_raster_width_d_is_too_l, __pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1948; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "epr.pyx":1946
 *             src_width = scene_width
 *         elif src_width > scene_width:
 *             raise ValueError(             # <<<<<<<<<<<<<<
 *                 'requeted raster width (%d) is too large for the Band '
 *                 '(scene_width=%d)' % (src_width, scene_width))
 */
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1946; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1946; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1946; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_L3:;

  /* "epr.pyx":1950
 *                 '(scene_width=%d)' % (src_width, scene_width))
 * 
 *         if src_height == 0:             # <<<<<<<<<<<<<<
 *             src_height = scene_height
 *         elif src_height > scene_height:
 */
  __pyx_t_2 = ((__pyx_v_src_height == 0) != 0);
  if (__pyx_t_2) {

    /* "epr.pyx":1951
 * 
 *         if src_height == 0:
 *             src_height = scene_height             # <<<<<<<<<<<<<<
 *         elif src_height > scene_height:
 *             raise ValueError(
 */
    __pyx_v_src_height = __pyx_v_scene_height;
    goto __pyx_L4;
  }

  /* "epr.pyx":1952
 *         if src_height == 0:
 *             src_height = scene_height
 *         elif src_height > scene_height:             # <<<<<<<<<<<<<<
 *             raise ValueError(
 *                 'requeted raster height (%d) is too large for the Band '
 */
  __pyx_t_2 = ((__pyx_v_src_height > __pyx_v_scene_height) != 0);
  if (__pyx_t_2) {

    /* "epr.pyx":1955
 *             raise ValueError(
 *                 'requeted raster height (%d) is too large for the Band '
 *                 '(scene_height=%d)' % (src_height, scene_height))             # <<<<<<<<<<<<<<
 * 
 *         if xstep > src_width:
 */
    __pyx_t_3 = __Pyx_PyInt_From_uint(__pyx_v_src_height); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1955; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_scene_height); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1955; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1955; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    __pyx_t_3 = 0;
    __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_requeted_raster_height_d_is_too, __pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1955; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "epr.pyx":1953
 *             src_height = scene_height
 *         elif src_height > scene_height:
 *             raise ValueError(             # <<<<<<<<<<<<<<
 *                 'requeted raster height (%d) is too large for the Band '
 *                 '(scene_height=%d)' % (src_height, scene_height))
 */
    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1953; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_t_1, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1953; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_Raise(__pyx_t_4, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1953; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_L4:;

  /* "epr.pyx":1957
 *                 '(scene_height=%d)' % (src_height, scene_height))
 * 
 *         if xstep > src_width:             # <<<<<<<<<<<<<<
 *             raise ValueError('xstep (%d) too large for the requested width '
 *                              '(%d)' % (xstep, src_width))
 */
  __pyx_t_2 = ((__pyx_v_xstep > __pyx_v_src_width) != 0);
  if (__pyx_t_2) {

    /* "epr.pyx":1959
 *         if xstep > src_width:
 *             raise ValueError('xstep (%d) too large for the requested width '
 *                              '(%d)' % (xstep, src_width))             # <<<<<<<<<<<<<<
 * 
 *         if ystep > src_height:
 */
    __pyx_t_4 = __Pyx_PyInt_From_uint(__pyx_v_xstep); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1959; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = __Pyx_PyInt_From_uint(__pyx_v_src_width); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1959; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1959; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    __pyx_t_4 = 0;
    __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_xstep_d_too_large_for_the_reques, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1959; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "epr.pyx":1958
 * 
 *         if xstep > src_width:
 *             raise ValueError('xstep (%d) too large for the requested width '             # <<<<<<<<<<<<<<
 *                              '(%d)' % (xstep, src_width))
 * 
 */
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1958; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1958; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1958; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "epr.pyx":1961
 *                              '(%d)' % (xstep, src_width))
 * 
 *         if ystep > src_height:             # <<<<<<<<<<<<<<
 *             raise ValueError('ystep (%d) too large for the requested height '
 *                              '(%d)' % (ystep, src_height))
 */
  __pyx_t_2 = ((__pyx_v_ystep > __pyx_v_src_height) != 0);
  if (__pyx_t_2) {

    /* "epr.pyx":1963
 *         if ystep > src_height:
 *             raise ValueError('ystep (%d) too large for the requested height '
 *                              '(%d)' % (ystep, src_height))             # <<<<<<<<<<<<<<
 * 
 *         raster_ptr = epr_create_compatible_raster(self._ptr,
 */
    __pyx_t_1 = __Pyx_PyInt_From_uint(__pyx_v_ystep); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1963; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = __Pyx_PyInt_From_uint(__pyx_v_src_height); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1963; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1963; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    __pyx_t_1 = 0;
    __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_ystep_d_too_large_for_the_reques, __pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1963; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "epr.pyx":1962
 * 
 *         if ystep > src_height:
 *             raise ValueError('ystep (%d) too large for the requested height '             # <<<<<<<<<<<<<<
 *                              '(%d)' % (ystep, src_height))
 * 
 */
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1962; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1962; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1962; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "epr.pyx":1965
 *                              '(%d)' % (ystep, src_height))
 * 
 *         raster_ptr = epr_create_compatible_raster(self._ptr,             # <<<<<<<<<<<<<<
 *                                                   src_width, src_height,
 *                                                   xstep, ystep)
 */
  __pyx_v_raster_ptr = epr_create_compatible_raster(__pyx_v_self->_ptr, __pyx_v_src_width, __pyx_v_src_height, __pyx_v_xstep, __pyx_v_ystep);

  /* "epr.pyx":1968
 *                                                   src_width, src_height,
 *                                                   xstep, ystep)
 *         if raster_ptr is NULL:             # <<<<<<<<<<<<<<
 *             pyepr_null_ptr_error('unable to create compatible raster with '
 *                                  'width=%d, height=%d xstep=%d, ystep=%d' %
 */
  __pyx_t_2 = ((__pyx_v_raster_ptr == NULL) != 0);
  if (__pyx_t_2) {

    /* "epr.pyx":1971
 *             pyepr_null_ptr_error('unable to create compatible raster with '
 *                                  'width=%d, height=%d xstep=%d, ystep=%d' %
 *                                         (src_width, src_height, xstep, ystep))             # <<<<<<<<<<<<<<
 * 
 *         return new_raster(raster_ptr, self)
 */
    __pyx_t_3 = __Pyx_PyInt_From_uint(__pyx_v_src_width); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1971; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyInt_From_uint(__pyx_v_src_height); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1971; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = __Pyx_PyInt_From_uint(__pyx_v_xstep); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1971; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = __Pyx_PyInt_From_uint(__pyx_v_ystep); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1971; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = PyTuple_New(4); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1971; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_6, 3, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_5);
    __pyx_t_3 = 0;
    __pyx_t_4 = 0;
    __pyx_t_1 = 0;
    __pyx_t_5 = 0;

    /* "epr.pyx":1970
 *         if raster_ptr is NULL:
 *             pyepr_null_ptr_error('unable to create compatible raster with '
 *                                  'width=%d, height=%d xstep=%d, ystep=%d' %             # <<<<<<<<<<<<<<
 *                                         (src_width, src_height, xstep, ystep))
 * 
 */
    __pyx_t_5 = __Pyx_PyString_Format(__pyx_kp_s_unable_to_create_compatible_rast, __pyx_t_6); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1970; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "epr.pyx":1969
 *                                                   xstep, ystep)
 *         if raster_ptr is NULL:
 *             pyepr_null_ptr_error('unable to create compatible raster with '             # <<<<<<<<<<<<<<
 *                                  'width=%d, height=%d xstep=%d, ystep=%d' %
 *                                         (src_width, src_height, xstep, ystep))
 */
    __pyx_t_7.__pyx_n = 1;
    __pyx_t_7.msg = __pyx_t_5;
    __pyx_t_6 = __pyx_f_3epr_pyepr_null_ptr_error(&__pyx_t_7); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1969; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    goto __pyx_L7;
  }
  __pyx_L7:;

  /* "epr.pyx":1973
 *                                         (src_width, src_height, xstep, ystep))
 * 
 *         return new_raster(raster_ptr, self)             # <<<<<<<<<<<<<<
 * 
 *     cpdef read_raster(self, int xoffset=0, int yoffset=0, Raster raster=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_8.__pyx_n = 1;
  __pyx_t_8.parent = __pyx_v_self;
  __pyx_t_6 = __pyx_f_3epr_new_raster(__pyx_v_raster_ptr, &__pyx_t_8); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1973; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_r = __pyx_t_6;
  __pyx_t_6 = 0;
  goto __pyx_L0;

  /* "epr.pyx":1868
 *         return _to_str(name, 'ascii')
 * 
 *     def create_compatible_raster(self, uint src_width=0, uint src_height=0,             # <<<<<<<<<<<<<<
 *                                  uint xstep=1, uint ystep=1):
 *         '''create_compatible_raster(self, src_width, src_height, xstep=1, ystep=1)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("epr.Band.create_compatible_raster", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":1975
 *         return new_raster(raster_ptr, self)
 * 
 *     cpdef read_raster(self, int xoffset=0, int yoffset=0, Raster raster=None):             # <<<<<<<<<<<<<<
 *         '''read_raster(self, xoffset=0, yoffset=0, Raster raster=None)
 * 
 */

static PyObject *__pyx_pw_3epr_4Band_5read_raster(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_3epr_4Band_read_raster(struct __pyx_obj_3epr_Band *__pyx_v_self, int __pyx_skip_dispatch, struct __pyx_opt_args_3epr_4Band_read_raster *__pyx_optional_args) {
  int __pyx_v_xoffset = ((int)0);
  int __pyx_v_yoffset = ((int)0);
  struct __pyx_obj_3epr_Raster *__pyx_v_raster = ((struct __pyx_obj_3epr_Raster *)Py_None);
  int __pyx_v_ret;
  int __pyx_v_scene_width;
  int __pyx_v_scene_height;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_t_6;
  int __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("read_raster", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_xoffset = __pyx_optional_args->xoffset;
      if (__pyx_optional_args->__pyx_n > 1) {
        __pyx_v_yoffset = __pyx_optional_args->yoffset;
        if (__pyx_optional_args->__pyx_n > 2) {
          __pyx_v_raster = __pyx_optional_args->raster;
        }
      }
    }
  }
  __Pyx_INCREF((PyObject *)__pyx_v_raster);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_read_raster); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1975; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_3epr_4Band_5read_raster)) {
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_xoffset); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1975; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_yoffset); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1975; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1975; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_3);
      __Pyx_INCREF(((PyObject *)__pyx_v_raster));
      PyTuple_SET_ITEM(__pyx_t_4, 2, ((PyObject *)__pyx_v_raster));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_raster));
      __pyx_t_2 = 0;
      __pyx_t_3 = 0;
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1975; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_r = __pyx_t_3;
      __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "epr.pyx":2013
 *         cdef int scene_height
 * 
 *         self.check_closed_product()             # <<<<<<<<<<<<<<
 * 
 *         if raster is None:
 */
  __pyx_t_1 = __pyx_f_3epr_4Band_check_closed_product(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2013; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "epr.pyx":2015
 *         self.check_closed_product()
 * 
 *         if raster is None:             # <<<<<<<<<<<<<<
 *             raster = self.create_compatible_raster()
 * 
 */
  __pyx_t_5 = (((PyObject *)__pyx_v_raster) == Py_None);
  __pyx_t_6 = (__pyx_t_5 != 0);
  if (__pyx_t_6) {

    /* "epr.pyx":2016
 * 
 *         if raster is None:
 *             raster = self.create_compatible_raster()             # <<<<<<<<<<<<<<
 * 
 *         scene_width = epr_get_scene_width(self._parent._ptr)
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_create_compatible_raster); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2016; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2016; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_3epr_Raster))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2016; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF_SET(__pyx_v_raster, ((struct __pyx_obj_3epr_Raster *)__pyx_t_3));
    __pyx_t_3 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "epr.pyx":2018
 *             raster = self.create_compatible_raster()
 * 
 *         scene_width = epr_get_scene_width(self._parent._ptr)             # <<<<<<<<<<<<<<
 *         scene_height = epr_get_scene_height(self._parent._ptr)
 * 
 */
  __pyx_v_scene_width = epr_get_scene_width(__pyx_v_self->_parent->_ptr);

  /* "epr.pyx":2019
 * 
 *         scene_width = epr_get_scene_width(self._parent._ptr)
 *         scene_height = epr_get_scene_height(self._parent._ptr)             # <<<<<<<<<<<<<<
 * 
 *         if (xoffset + raster._ptr.source_width > scene_width or
 */
  __pyx_v_scene_height = epr_get_scene_height(__pyx_v_self->_parent->_ptr);

  /* "epr.pyx":2021
 *         scene_height = epr_get_scene_height(self._parent._ptr)
 * 
 *         if (xoffset + raster._ptr.source_width > scene_width or             # <<<<<<<<<<<<<<
 *                 yoffset + raster._ptr.source_height > scene_height):
 *             raise ValueError(
 */
  __pyx_t_6 = (((__pyx_v_xoffset + __pyx_v_raster->_ptr->source_width) > __pyx_v_scene_width) != 0);
  if (!__pyx_t_6) {

    /* "epr.pyx":2022
 * 
 *         if (xoffset + raster._ptr.source_width > scene_width or
 *                 yoffset + raster._ptr.source_height > scene_height):             # <<<<<<<<<<<<<<
 *             raise ValueError(
 *                 'at lease part of the requested area is outside the scene')
 */
    __pyx_t_5 = (((__pyx_v_yoffset + __pyx_v_raster->_ptr->source_height) > __pyx_v_scene_height) != 0);
    __pyx_t_7 = __pyx_t_5;
  } else {
    __pyx_t_7 = __pyx_t_6;
  }
  if (__pyx_t_7) {

    /* "epr.pyx":2023
 *         if (xoffset + raster._ptr.source_width > scene_width or
 *                 yoffset + raster._ptr.source_height > scene_height):
 *             raise ValueError(             # <<<<<<<<<<<<<<
 *                 'at lease part of the requested area is outside the scene')
 * 
 */
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__14, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2023; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2023; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "epr.pyx":2026
 *                 'at lease part of the requested area is outside the scene')
 * 
 *         raster._data = None             # <<<<<<<<<<<<<<
 * 
 *         with nogil:
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_raster->_data);
  __Pyx_DECREF(__pyx_v_raster->_data);
  __pyx_v_raster->_data = Py_None;

  /* "epr.pyx":2028
 *         raster._data = None
 * 
 *         with nogil:             # <<<<<<<<<<<<<<
 *             ret = epr_read_band_raster(self._ptr, xoffset, yoffset,
 *                                        raster._ptr)
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      #endif
      /*try:*/ {

        /* "epr.pyx":2029
 * 
 *         with nogil:
 *             ret = epr_read_band_raster(self._ptr, xoffset, yoffset,             # <<<<<<<<<<<<<<
 *                                        raster._ptr)
 * 
 */
        __pyx_v_ret = epr_read_band_raster(__pyx_v_self->_ptr, __pyx_v_xoffset, __pyx_v_yoffset, __pyx_v_raster->_ptr);
      }

      /* "epr.pyx":2028
 *         raster._data = None
 * 
 *         with nogil:             # <<<<<<<<<<<<<<
 *             ret = epr_read_band_raster(self._ptr, xoffset, yoffset,
 *                                        raster._ptr)
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L7;
        }
        __pyx_L7:;
      }
  }

  /* "epr.pyx":2032
 *                                        raster._ptr)
 * 
 *         if ret != 0:             # <<<<<<<<<<<<<<
 *             pyepr_check_errors()
 * 
 */
  __pyx_t_7 = ((__pyx_v_ret != 0) != 0);
  if (__pyx_t_7) {

    /* "epr.pyx":2033
 * 
 *         if ret != 0:
 *             pyepr_check_errors()             # <<<<<<<<<<<<<<
 * 
 *         return raster
 */
    __pyx_t_3 = __pyx_f_3epr_pyepr_check_errors(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2033; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L8;
  }
  __pyx_L8:;

  /* "epr.pyx":2035
 *             pyepr_check_errors()
 * 
 *         return raster             # <<<<<<<<<<<<<<
 * 
 *     # --- high level interface ------------------------------------------------
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_raster));
  __pyx_r = ((PyObject *)__pyx_v_raster);
  goto __pyx_L0;

  /* "epr.pyx":1975
 *         return new_raster(raster_ptr, self)
 * 
 *     cpdef read_raster(self, int xoffset=0, int yoffset=0, Raster raster=None):             # <<<<<<<<<<<<<<
 *         '''read_raster(self, xoffset=0, yoffset=0, Raster raster=None)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("epr.Band.read_raster", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_raster);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_3epr_4Band_5read_raster(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_3epr_4Band_4read_raster[] = "read_raster(self, xoffset=0, yoffset=0, Raster raster=None)\n\n        Reads (geo-)physical values of the band of the specified\n        source-region\n\n        The source-region is a defined part of the whole ENVISAT\n        product image, which shall be read into a raster.\n        In this routine the co-ordinates are specified, where the\n        source-region to be read starts.\n        The dimension of the region and the sub-sampling are attributes\n        of the raster into which the data are read.\n\n        :param xoffset:\n            across-track source co-ordinate in pixel co-ordinates\n            (zero-based) of the upper right corner of the source-region\n        :param yoffset:\n            along-track source co-ordinate in pixel co-ordinates\n            (zero-based) of the upper right corner of the source-region\n        :param raster:\n            :class:`Raster` instance set with appropriate parameters to\n            read into. If not provided a new :class:`Raster` is\n            instantiated\n        :returns:\n            the :class:`Raster` instance in which data are read\n\n        This method raises an instance of the appropriate\n        :exc:`EPRError` sub-class if case of errors\n\n        .. seealso:: :meth:`Band.create_compatible_raster` and\n                     :func:`create_raster`\n\n        ";
static PyObject *__pyx_pw_3epr_4Band_5read_raster(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_xoffset;
  int __pyx_v_yoffset;
  struct __pyx_obj_3epr_Raster *__pyx_v_raster = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("read_raster (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_xoffset,&__pyx_n_s_yoffset,&__pyx_n_s_raster,0};
    PyObject* values[3] = {0,0,0};
    values[2] = (PyObject *)((struct __pyx_obj_3epr_Raster *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_xoffset);
          if (value) { values[0] = value; kw_args--; }
        }
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_yoffset);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_raster);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "read_raster") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1975; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_xoffset = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_xoffset == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1975; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_xoffset = ((int)0);
    }
    if (values[1]) {
      __pyx_v_yoffset = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_yoffset == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1975; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_yoffset = ((int)0);
    }
    __pyx_v_raster = ((struct __pyx_obj_3epr_Raster *)values[2]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("read_raster", 0, 0, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1975; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("epr.Band.read_raster", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_raster), __pyx_ptype_3epr_Raster, 1, "raster", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1975; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_3epr_4Band_4read_raster(((struct __pyx_obj_3epr_Band *)__pyx_v_self), __pyx_v_xoffset, __pyx_v_yoffset, __pyx_v_raster);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_3epr_4Band_4read_raster(struct __pyx_obj_3epr_Band *__pyx_v_self, int __pyx_v_xoffset, int __pyx_v_yoffset, struct __pyx_obj_3epr_Raster *__pyx_v_raster) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  struct __pyx_opt_args_3epr_4Band_read_raster __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("read_raster", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2.__pyx_n = 3;
  __pyx_t_2.xoffset = __pyx_v_xoffset;
  __pyx_t_2.yoffset = __pyx_v_yoffset;
  __pyx_t_2.raster = __pyx_v_raster;
  __pyx_t_1 = ((struct __pyx_vtabstruct_3epr_Band *)__pyx_v_self->__pyx_vtab)->read_raster(__pyx_v_self, 1, &__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1975; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("epr.Band.read_raster", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":2038
 * 
 *     # --- high level interface ------------------------------------------------
 *     def read_as_array(self, width=None, height=None,             # <<<<<<<<<<<<<<
 *                       uint xoffset=0, uint yoffset=0,
 *                       uint xstep=1, uint ystep=1):
 */

/* Python wrapper */
static PyObject *__pyx_pw_3epr_4Band_7read_as_array(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_3epr_4Band_6read_as_array[] = "read_as_array(self, width=None, height=None, xoffset=0, yoffset=0, xstep=1, ystep=1):\n\n        Reads the specified source region as an :class:`numpy.ndarray`\n\n        The source-region is a defined part of the whole ENVISAT\n        product image, which shall be read into a raster.\n        In this routine the co-ordinates are specified, where the\n        source-region to be read starts.\n        The dimension of the region and the sub-sampling are attributes\n        of the raster into which the data are read.\n\n        :param src_width:\n            the width (across track dimension) of the source to be read\n            into the raster. If not provided reads as much as possible\n        :param src_height:\n            the height (along track dimension) of the source to be read\n            into the raster. If not provided reads as much as possible\n        :param xoffset:\n            across-track source co-ordinate in pixel co-ordinates\n            (zero-based) of the upper right corner of the source-region\n        :param yoffset:\n            along-track source co-ordinate in pixel co-ordinates\n            (zero-based) of the upper right corner of the source-region\n        :param xstep:\n            the sub-sampling step across track of the source when\n            reading into the raster\n        :param ystep:\n            the sub-sampling step along track of the source when\n            reading into the raster\n        :returns:\n            the :class:`numpy.ndarray` instance in which data are read\n\n        This method raises an instance of the appropriate\n        :exc:`EPRError` sub-class if case of errors\n\n        .. seealso:: :meth:`Band.create_compatible_raster`,\n                     :func:`create_raster` and :meth:`Band.read_raster`\n\n        ";
static PyObject *__pyx_pw_3epr_4Band_7read_as_array(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_width = 0;
  PyObject *__pyx_v_height = 0;
  uint __pyx_v_xoffset;
  uint __pyx_v_yoffset;
  uint __pyx_v_xstep;
  uint __pyx_v_ystep;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("read_as_array (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_width,&__pyx_n_s_height,&__pyx_n_s_xoffset,&__pyx_n_s_yoffset,&__pyx_n_s_xstep,&__pyx_n_s_ystep,0};
    PyObject* values[6] = {0,0,0,0,0,0};
    values[0] = ((PyObject *)Py_None);
    values[1] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_width);
          if (value) { values[0] = value; kw_args--; }
        }
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_height);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_xoffset);
          if (value) { values[2] = value; kw_args--; }
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_yoffset);
          if (value) { values[3] = value; kw_args--; }
        }
        case  4:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_xstep);
          if (value) { values[4] = value; kw_args--; }
        }
        case  5:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_ystep);
          if (value) { values[5] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "read_as_array") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2038; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_width = values[0];
    __pyx_v_height = values[1];
    if (values[2]) {
      __pyx_v_xoffset = __Pyx_PyInt_As_uint(values[2]); if (unlikely((__pyx_v_xoffset == (uint)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2039; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_xoffset = ((uint)0);
    }
    if (values[3]) {
      __pyx_v_yoffset = __Pyx_PyInt_As_uint(values[3]); if (unlikely((__pyx_v_yoffset == (uint)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2039; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_yoffset = ((uint)0);
    }
    if (values[4]) {
      __pyx_v_xstep = __Pyx_PyInt_As_uint(values[4]); if (unlikely((__pyx_v_xstep == (uint)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2040; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_xstep = ((uint)1);
    }
    if (values[5]) {
      __pyx_v_ystep = __Pyx_PyInt_As_uint(values[5]); if (unlikely((__pyx_v_ystep == (uint)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2040; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_ystep = ((uint)1);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("read_as_array", 0, 0, 6, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2038; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("epr.Band.read_as_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_3epr_4Band_6read_as_array(((struct __pyx_obj_3epr_Band *)__pyx_v_self), __pyx_v_width, __pyx_v_height, __pyx_v_xoffset, __pyx_v_yoffset, __pyx_v_xstep, __pyx_v_ystep);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_3epr_4Band_6read_as_array(struct __pyx_obj_3epr_Band *__pyx_v_self, PyObject *__pyx_v_width, PyObject *__pyx_v_height, uint __pyx_v_xoffset, uint __pyx_v_yoffset, uint __pyx_v_xstep, uint __pyx_v_ystep) {
  int __pyx_v_w;
  int __pyx_v_h;
  struct EPR_ProductId *__pyx_v_product_id;
  PyObject *__pyx_v_raster = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  EPR_SProductId *__pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  struct __pyx_opt_args_3epr_4Band_read_raster __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("read_as_array", 0);
  __Pyx_INCREF(__pyx_v_width);
  __Pyx_INCREF(__pyx_v_height);

  /* "epr.pyx":2085
 *         cdef EPR_ProductId* product_id
 * 
 *         self.check_closed_product()             # <<<<<<<<<<<<<<
 *         product_id = self._parent._ptr
 * 
 */
  __pyx_t_1 = __pyx_f_3epr_4Band_check_closed_product(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2085; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "epr.pyx":2086
 * 
 *         self.check_closed_product()
 *         product_id = self._parent._ptr             # <<<<<<<<<<<<<<
 * 
 *         if width is None:
 */
  __pyx_t_2 = __pyx_v_self->_parent->_ptr;
  __pyx_v_product_id = __pyx_t_2;

  /* "epr.pyx":2088
 *         product_id = self._parent._ptr
 * 
 *         if width is None:             # <<<<<<<<<<<<<<
 *             w = epr_get_scene_width(product_id)
 *             if w > xoffset:
 */
  __pyx_t_3 = (__pyx_v_width == Py_None);
  __pyx_t_4 = (__pyx_t_3 != 0);
  if (__pyx_t_4) {

    /* "epr.pyx":2089
 * 
 *         if width is None:
 *             w = epr_get_scene_width(product_id)             # <<<<<<<<<<<<<<
 *             if w > xoffset:
 *                 width = w - xoffset
 */
    __pyx_v_w = epr_get_scene_width(__pyx_v_product_id);

    /* "epr.pyx":2090
 *         if width is None:
 *             w = epr_get_scene_width(product_id)
 *             if w > xoffset:             # <<<<<<<<<<<<<<
 *                 width = w - xoffset
 *             else:
 */
    __pyx_t_4 = ((__pyx_v_w > __pyx_v_xoffset) != 0);
    if (__pyx_t_4) {

      /* "epr.pyx":2091
 *             w = epr_get_scene_width(product_id)
 *             if w > xoffset:
 *                 width = w - xoffset             # <<<<<<<<<<<<<<
 *             else:
 *                 raise ValueError('xoffset os larger that he scene width')
 */
      __pyx_t_1 = __Pyx_PyInt_From_uint((__pyx_v_w - __pyx_v_xoffset)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2091; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF_SET(__pyx_v_width, __pyx_t_1);
      __pyx_t_1 = 0;
      goto __pyx_L4;
    }
    /*else*/ {

      /* "epr.pyx":2093
 *                 width = w - xoffset
 *             else:
 *                 raise ValueError('xoffset os larger that he scene width')             # <<<<<<<<<<<<<<
 * 
 *         if height is None:
 */
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__15, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2093; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_Raise(__pyx_t_1, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2093; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_L4:;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "epr.pyx":2095
 *                 raise ValueError('xoffset os larger that he scene width')
 * 
 *         if height is None:             # <<<<<<<<<<<<<<
 *             h = epr_get_scene_height(product_id)
 *             if h > yoffset:
 */
  __pyx_t_4 = (__pyx_v_height == Py_None);
  __pyx_t_3 = (__pyx_t_4 != 0);
  if (__pyx_t_3) {

    /* "epr.pyx":2096
 * 
 *         if height is None:
 *             h = epr_get_scene_height(product_id)             # <<<<<<<<<<<<<<
 *             if h > yoffset:
 *                 height = h - yoffset
 */
    __pyx_v_h = epr_get_scene_height(__pyx_v_product_id);

    /* "epr.pyx":2097
 *         if height is None:
 *             h = epr_get_scene_height(product_id)
 *             if h > yoffset:             # <<<<<<<<<<<<<<
 *                 height = h - yoffset
 *             else:
 */
    __pyx_t_3 = ((__pyx_v_h > __pyx_v_yoffset) != 0);
    if (__pyx_t_3) {

      /* "epr.pyx":2098
 *             h = epr_get_scene_height(product_id)
 *             if h > yoffset:
 *                 height = h - yoffset             # <<<<<<<<<<<<<<
 *             else:
 *                 raise ValueError('yoffset os larger that he scene height')
 */
      __pyx_t_1 = __Pyx_PyInt_From_uint((__pyx_v_h - __pyx_v_yoffset)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2098; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF_SET(__pyx_v_height, __pyx_t_1);
      __pyx_t_1 = 0;
      goto __pyx_L6;
    }
    /*else*/ {

      /* "epr.pyx":2100
 *                 height = h - yoffset
 *             else:
 *                 raise ValueError('yoffset os larger that he scene height')             # <<<<<<<<<<<<<<
 * 
 *         raster = self.create_compatible_raster(width, height, xstep, ystep)
 */
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__16, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_Raise(__pyx_t_1, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_L6:;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "epr.pyx":2102
 *                 raise ValueError('yoffset os larger that he scene height')
 * 
 *         raster = self.create_compatible_raster(width, height, xstep, ystep)             # <<<<<<<<<<<<<<
 *         self.read_raster(xoffset, yoffset, raster)
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_create_compatible_raster); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = __Pyx_PyInt_From_uint(__pyx_v_xstep); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = __Pyx_PyInt_From_uint(__pyx_v_ystep); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = PyTuple_New(4); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_INCREF(__pyx_v_width);
  PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_width);
  __Pyx_GIVEREF(__pyx_v_width);
  __Pyx_INCREF(__pyx_v_height);
  PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_v_height);
  __Pyx_GIVEREF(__pyx_v_height);
  PyTuple_SET_ITEM(__pyx_t_7, 2, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_7, 3, __pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_6);
  __pyx_t_5 = 0;
  __pyx_t_6 = 0;
  __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_7, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_v_raster = __pyx_t_6;
  __pyx_t_6 = 0;

  /* "epr.pyx":2103
 * 
 *         raster = self.create_compatible_raster(width, height, xstep, ystep)
 *         self.read_raster(xoffset, yoffset, raster)             # <<<<<<<<<<<<<<
 * 
 *         return raster.data
 */
  if (!(likely(((__pyx_v_raster) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_raster, __pyx_ptype_3epr_Raster))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_8.__pyx_n = 3;
  __pyx_t_8.xoffset = __pyx_v_xoffset;
  __pyx_t_8.yoffset = __pyx_v_yoffset;
  __pyx_t_8.raster = ((struct __pyx_obj_3epr_Raster *)__pyx_v_raster);
  __pyx_t_6 = ((struct __pyx_vtabstruct_3epr_Band *)__pyx_v_self->__pyx_vtab)->read_raster(__pyx_v_self, 0, &__pyx_t_8); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "epr.pyx":2105
 *         self.read_raster(xoffset, yoffset, raster)
 * 
 *         return raster.data             # <<<<<<<<<<<<<<
 * 
 *     def __repr__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_raster, __pyx_n_s_data); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_r = __pyx_t_6;
  __pyx_t_6 = 0;
  goto __pyx_L0;

  /* "epr.pyx":2038
 * 
 *     # --- high level interface ------------------------------------------------
 *     def read_as_array(self, width=None, height=None,             # <<<<<<<<<<<<<<
 *                       uint xoffset=0, uint yoffset=0,
 *                       uint xstep=1, uint ystep=1):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("epr.Band.read_as_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_raster);
  __Pyx_XDECREF(__pyx_v_width);
  __Pyx_XDECREF(__pyx_v_height);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":2107
 *         return raster.data
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return 'epr.Band(%s) of epr.Product(%s)' % (self.get_name(),
 *                                                     self.product.id_string)
 */

/* Python wrapper */
static PyObject *__pyx_pw_3epr_4Band_9__repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_3epr_4Band_9__repr__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
  __pyx_r = __pyx_pf_3epr_4Band_8__repr__(((struct __pyx_obj_3epr_Band *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_3epr_4Band_8__repr__(struct __pyx_obj_3epr_Band *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__repr__", 0);

  /* "epr.pyx":2108
 * 
 *     def __repr__(self):
 *         return 'epr.Band(%s) of epr.Product(%s)' % (self.get_name(),             # <<<<<<<<<<<<<<
 *                                                     self.product.id_string)
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_get_name); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "epr.pyx":2109
 *     def __repr__(self):
 *         return 'epr.Band(%s) of epr.Product(%s)' % (self.get_name(),
 *                                                     self.product.id_string)             # <<<<<<<<<<<<<<
 * 
 *     # --- low level interface -------------------------------------------------
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_product); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_id_string); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "epr.pyx":2108
 * 
 *     def __repr__(self):
 *         return 'epr.Band(%s) of epr.Product(%s)' % (self.get_name(),             # <<<<<<<<<<<<<<
 *                                                     self.product.id_string)
 * 
 */
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_epr_Band_s_of_epr_Product_s, __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "epr.pyx":2107
 *         return raster.data
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return 'epr.Band(%s) of epr.Product(%s)' % (self.get_name(),
 *                                                     self.product.id_string)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("epr.Band.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":2115
 *         '''The magic number for internal C structure'''
 * 
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             self.check_closed_product()
 *             return self._ptr.magic
 */

/* Python wrapper */
static PyObject *__pyx_pw_3epr_4Band_6_magic_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_3epr_4Band_6_magic_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_3epr_4Band_6_magic___get__(((struct __pyx_obj_3epr_Band *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_3epr_4Band_6_magic___get__(struct __pyx_obj_3epr_Band *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "epr.pyx":2116
 * 
 *         def __get__(self):
 *             self.check_closed_product()             # <<<<<<<<<<<<<<
 *             return self._ptr.magic
 * 
 */
  __pyx_t_1 = __pyx_f_3epr_4Band_check_closed_product(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "epr.pyx":2117
 *         def __get__(self):
 *             self.check_closed_product()
 *             return self._ptr.magic             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_EPR_Magic(__pyx_v_self->_ptr->magic); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "epr.pyx":2115
 *         '''The magic number for internal C structure'''
 * 
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             self.check_closed_product()
 *             return self._ptr.magic
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("epr.Band._magic.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":2128
 *         '''
 * 
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self._ptr.dataset_ref.field_index
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_3epr_4Band_12_field_index_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_3epr_4Band_12_field_index_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_3epr_4Band_12_field_index___get__(((struct __pyx_obj_3epr_Band *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_3epr_4Band_12_field_index___get__(struct __pyx_obj_3epr_Band *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "epr.pyx":2129
 * 
 *         def __get__(self):
 *             return self._ptr.dataset_ref.field_index             # <<<<<<<<<<<<<<
 * 
 *     property _elem_index:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->_ptr->dataset_ref.field_index); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "epr.pyx":2128
 *         '''
 * 
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self._ptr.dataset_ref.field_index
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("epr.Band._field_index.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":2139
 *         '''
 * 
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self._ptr.dataset_ref.elem_index
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_3epr_4Band_11_elem_index_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_3epr_4Band_11_elem_index_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_3epr_4Band_11_elem_index___get__(((struct __pyx_obj_3epr_Band *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_3epr_4Band_11_elem_index___get__(struct __pyx_obj_3epr_Band *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "epr.pyx":2140
 * 
 *         def __get__(self):
 *             return self._ptr.dataset_ref.elem_index             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->_ptr->dataset_ref.elem_index); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "epr.pyx":2139
 *         '''
 * 
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self._ptr.dataset_ref.elem_index
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("epr.Band._elem_index.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":2143
 * 
 * 
 * cdef new_band(EPR_SBandId* ptr, Product parent=None):             # <<<<<<<<<<<<<<
 *     if ptr is NULL:
 *         pyepr_null_ptr_error()
 */

static PyObject *__pyx_f_3epr_new_band(EPR_SBandId *__pyx_v_ptr, struct __pyx_opt_args_3epr_new_band *__pyx_optional_args) {
  struct __pyx_obj_3epr_Product *__pyx_v_parent = ((struct __pyx_obj_3epr_Product *)Py_None);
  struct __pyx_obj_3epr_Band *__pyx_v_instance = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("new_band", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_parent = __pyx_optional_args->parent;
    }
  }

  /* "epr.pyx":2144
 * 
 * cdef new_band(EPR_SBandId* ptr, Product parent=None):
 *     if ptr is NULL:             # <<<<<<<<<<<<<<
 *         pyepr_null_ptr_error()
 * 
 */
  __pyx_t_1 = ((__pyx_v_ptr == NULL) != 0);
  if (__pyx_t_1) {

    /* "epr.pyx":2145
 * cdef new_band(EPR_SBandId* ptr, Product parent=None):
 *     if ptr is NULL:
 *         pyepr_null_ptr_error()             # <<<<<<<<<<<<<<
 * 
 *     cdef Band instance = Band.__new__(Band)
 */
    __pyx_t_2 = __pyx_f_3epr_pyepr_null_ptr_error(NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "epr.pyx":2147
 *         pyepr_null_ptr_error()
 * 
 *     cdef Band instance = Band.__new__(Band)             # <<<<<<<<<<<<<<
 * 
 *     instance._ptr = ptr
 */
  __pyx_t_2 = __pyx_tp_new_3epr_Band(((PyTypeObject *)((PyObject*)__pyx_ptype_3epr_Band)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (!(likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_3epr_Band)))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_instance = ((struct __pyx_obj_3epr_Band *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "epr.pyx":2149
 *     cdef Band instance = Band.__new__(Band)
 * 
 *     instance._ptr = ptr             # <<<<<<<<<<<<<<
 *     instance._parent = parent
 * 
 */
  __pyx_v_instance->_ptr = __pyx_v_ptr;

  /* "epr.pyx":2150
 * 
 *     instance._ptr = ptr
 *     instance._parent = parent             # <<<<<<<<<<<<<<
 * 
 *     return instance
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_parent));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_parent));
  __Pyx_GOTREF(__pyx_v_instance->_parent);
  __Pyx_DECREF(((PyObject *)__pyx_v_instance->_parent));
  __pyx_v_instance->_parent = __pyx_v_parent;

  /* "epr.pyx":2152
 *     instance._parent = parent
 * 
 *     return instance             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_instance));
  __pyx_r = ((PyObject *)__pyx_v_instance);
  goto __pyx_L0;

  /* "epr.pyx":2143
 * 
 * 
 * cdef new_band(EPR_SBandId* ptr, Product parent=None):             # <<<<<<<<<<<<<<
 *     if ptr is NULL:
 *         pyepr_null_ptr_error()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("epr.new_band", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_instance);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":2171
 *     cdef Product _parent
 * 
 *     cdef inline check_closed_product(self):             # <<<<<<<<<<<<<<
 *         self._parent.check_closed_product()
 * 
 */

static CYTHON_INLINE PyObject *__pyx_f_3epr_7Dataset_check_closed_product(struct __pyx_obj_3epr_Dataset *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("check_closed_product", 0);

  /* "epr.pyx":2172
 * 
 *     cdef inline check_closed_product(self):
 *         self._parent.check_closed_product()             # <<<<<<<<<<<<<<
 * 
 *     cdef inline _check_write_mode(self):
 */
  __pyx_t_1 = __pyx_f_3epr_7Product_check_closed_product(__pyx_v_self->_parent); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "epr.pyx":2171
 *     cdef Product _parent
 * 
 *     cdef inline check_closed_product(self):             # <<<<<<<<<<<<<<
 *         self._parent.check_closed_product()
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("epr.Dataset.check_closed_product", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":2174
 *         self._parent.check_closed_product()
 * 
 *     cdef inline _check_write_mode(self):             # <<<<<<<<<<<<<<
 *         self._parent._check_write_mode()
 * 
 */

static CYTHON_INLINE PyObject *__pyx_f_3epr_7Dataset__check_write_mode(struct __pyx_obj_3epr_Dataset *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_check_write_mode", 0);

  /* "epr.pyx":2175
 * 
 *     cdef inline _check_write_mode(self):
 *         self._parent._check_write_mode()             # <<<<<<<<<<<<<<
 * 
 *     cdef inline uint _get_offset(self):
 */
  __pyx_t_1 = __pyx_f_3epr_7Product__check_write_mode(__pyx_v_self->_parent); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "epr.pyx":2174
 *         self._parent.check_closed_product()
 * 
 *     cdef inline _check_write_mode(self):             # <<<<<<<<<<<<<<
 *         self._parent._check_write_mode()
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("epr.Dataset._check_write_mode", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":2177
 *         self._parent._check_write_mode()
 * 
 *     cdef inline uint _get_offset(self):             # <<<<<<<<<<<<<<
 *         cdef const EPR_SDSD* dsd = epr_get_dsd(self._ptr)
 *         return dsd.ds_offset
 */

static CYTHON_INLINE uint __pyx_f_3epr_7Dataset__get_offset(struct __pyx_obj_3epr_Dataset *__pyx_v_self) {
  EPR_SDSD const *__pyx_v_dsd;
  uint __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_get_offset", 0);

  /* "epr.pyx":2178
 * 
 *     cdef inline uint _get_offset(self):
 *         cdef const EPR_SDSD* dsd = epr_get_dsd(self._ptr)             # <<<<<<<<<<<<<<
 *         return dsd.ds_offset
 * 
 */
  __pyx_v_dsd = epr_get_dsd(__pyx_v_self->_ptr);

  /* "epr.pyx":2179
 *     cdef inline uint _get_offset(self):
 *         cdef const EPR_SDSD* dsd = epr_get_dsd(self._ptr)
 *         return dsd.ds_offset             # <<<<<<<<<<<<<<
 * 
 *     property product:
 */
  __pyx_r = __pyx_v_dsd->ds_offset;
  goto __pyx_L0;

  /* "epr.pyx":2177
 *         self._parent._check_write_mode()
 * 
 *     cdef inline uint _get_offset(self):             # <<<<<<<<<<<<<<
 *         cdef const EPR_SDSD* dsd = epr_get_dsd(self._ptr)
 *         return dsd.ds_offset
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":2184
 *         '''The :class:`Product` instance to which this dataset belongs to'''
 * 
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self._parent
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_3epr_7Dataset_7product_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_3epr_7Dataset_7product_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_3epr_7Dataset_7product___get__(((struct __pyx_obj_3epr_Dataset *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_3epr_7Dataset_7product___get__(struct __pyx_obj_3epr_Dataset *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "epr.pyx":2185
 * 
 *         def __get__(self):
 *             return self._parent             # <<<<<<<<<<<<<<
 * 
 *     property description:
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->_parent));
  __pyx_r = ((PyObject *)__pyx_v_self->_parent);
  goto __pyx_L0;

  /* "epr.pyx":2184
 *         '''The :class:`Product` instance to which this dataset belongs to'''
 * 
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self._parent
 * 
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":2190
 *         '''A short description of the band's contents'''
 * 
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             if self._ptr is not NULL:
 *                 self.check_closed_product()
 */

/* Python wrapper */
static PyObject *__pyx_pw_3epr_7Dataset_11description_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_3epr_7Dataset_11description_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_3epr_7Dataset_11description___get__(((struct __pyx_obj_3epr_Dataset *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_3epr_7Dataset_11description___get__(struct __pyx_obj_3epr_Dataset *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  struct __pyx_opt_args_3epr__to_str __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "epr.pyx":2191
 * 
 *         def __get__(self):
 *             if self._ptr is not NULL:             # <<<<<<<<<<<<<<
 *                 self.check_closed_product()
 *                 if self._ptr.description is not NULL:
 */
  __pyx_t_1 = ((__pyx_v_self->_ptr != NULL) != 0);
  if (__pyx_t_1) {

    /* "epr.pyx":2192
 *         def __get__(self):
 *             if self._ptr is not NULL:
 *                 self.check_closed_product()             # <<<<<<<<<<<<<<
 *                 if self._ptr.description is not NULL:
 *                     return _to_str(self._ptr.description, 'ascii')
 */
    __pyx_t_2 = __pyx_f_3epr_7Dataset_check_closed_product(__pyx_v_self); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "epr.pyx":2193
 *             if self._ptr is not NULL:
 *                 self.check_closed_product()
 *                 if self._ptr.description is not NULL:             # <<<<<<<<<<<<<<
 *                     return _to_str(self._ptr.description, 'ascii')
 *             return ''
 */
    __pyx_t_1 = ((__pyx_v_self->_ptr->description != NULL) != 0);
    if (__pyx_t_1) {

      /* "epr.pyx":2194
 *                 self.check_closed_product()
 *                 if self._ptr.description is not NULL:
 *                     return _to_str(self._ptr.description, 'ascii')             # <<<<<<<<<<<<<<
 *             return ''
 * 
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_2 = __Pyx_PyBytes_FromString(__pyx_v_self->_ptr->description); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_4.__pyx_n = 1;
      __pyx_t_4.encoding = __pyx_n_s_ascii;
      __pyx_t_3 = __pyx_f_3epr__to_str(__pyx_t_2, &__pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_r = __pyx_t_3;
      __pyx_t_3 = 0;
      goto __pyx_L0;
    }
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "epr.pyx":2195
 *                 if self._ptr.description is not NULL:
 *                     return _to_str(self._ptr.description, 'ascii')
 *             return ''             # <<<<<<<<<<<<<<
 * 
 *     def get_name(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_kp_s_);
  __pyx_r = __pyx_kp_s_;
  goto __pyx_L0;

  /* "epr.pyx":2190
 *         '''A short description of the band's contents'''
 * 
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             if self._ptr is not NULL:
 *                 self.check_closed_product()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("epr.Dataset.description.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":2197
 *             return ''
 * 
 *     def get_name(self):             # <<<<<<<<<<<<<<
 *         '''get_name(self)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_3epr_7Dataset_1get_name(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_3epr_7Dataset_get_name[] = "get_name(self)\n\n        Gets the name of the dataset\n\n        ";
static PyObject *__pyx_pw_3epr_7Dataset_1get_name(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_name (wrapper)", 0);
  __pyx_r = __pyx_pf_3epr_7Dataset_get_name(((struct __pyx_obj_3epr_Dataset *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_3epr_7Dataset_get_name(struct __pyx_obj_3epr_Dataset *__pyx_v_self) {
  char *__pyx_v_name;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  struct __pyx_opt_args_3epr__to_str __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_name", 0);

  /* "epr.pyx":2206
 *         cdef char* name
 * 
 *         if self._ptr is not NULL:             # <<<<<<<<<<<<<<
 *             self.check_closed_product()
 *             name = <char*>epr_get_dataset_name(self._ptr)
 */
  __pyx_t_1 = ((__pyx_v_self->_ptr != NULL) != 0);
  if (__pyx_t_1) {

    /* "epr.pyx":2207
 * 
 *         if self._ptr is not NULL:
 *             self.check_closed_product()             # <<<<<<<<<<<<<<
 *             name = <char*>epr_get_dataset_name(self._ptr)
 *             return _to_str(name, 'ascii')
 */
    __pyx_t_2 = __pyx_f_3epr_7Dataset_check_closed_product(__pyx_v_self); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2207; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "epr.pyx":2208
 *         if self._ptr is not NULL:
 *             self.check_closed_product()
 *             name = <char*>epr_get_dataset_name(self._ptr)             # <<<<<<<<<<<<<<
 *             return _to_str(name, 'ascii')
 *         return ''
 */
    __pyx_v_name = ((char *)epr_get_dataset_name(__pyx_v_self->_ptr));

    /* "epr.pyx":2209
 *             self.check_closed_product()
 *             name = <char*>epr_get_dataset_name(self._ptr)
 *             return _to_str(name, 'ascii')             # <<<<<<<<<<<<<<
 *         return ''
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = __Pyx_PyBytes_FromString(__pyx_v_name); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4.__pyx_n = 1;
    __pyx_t_4.encoding = __pyx_n_s_ascii;
    __pyx_t_3 = __pyx_f_3epr__to_str(__pyx_t_2, &__pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
  }

  /* "epr.pyx":2210
 *             name = <char*>epr_get_dataset_name(self._ptr)
 *             return _to_str(name, 'ascii')
 *         return ''             # <<<<<<<<<<<<<<
 * 
 *     def get_dsd_name(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_kp_s_);
  __pyx_r = __pyx_kp_s_;
  goto __pyx_L0;

  /* "epr.pyx":2197
 *             return ''
 * 
 *     def get_name(self):             # <<<<<<<<<<<<<<
 *         '''get_name(self)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("epr.Dataset.get_name", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":2212
 *         return ''
 * 
 *     def get_dsd_name(self):             # <<<<<<<<<<<<<<
 *         '''get_dsd_name(self)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_3epr_7Dataset_3get_dsd_name(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_3epr_7Dataset_2get_dsd_name[] = "get_dsd_name(self)\n\n        Gets the name of the DSD (dataset descriptor)\n\n        ";
static PyObject *__pyx_pw_3epr_7Dataset_3get_dsd_name(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_dsd_name (wrapper)", 0);
  __pyx_r = __pyx_pf_3epr_7Dataset_2get_dsd_name(((struct __pyx_obj_3epr_Dataset *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_3epr_7Dataset_2get_dsd_name(struct __pyx_obj_3epr_Dataset *__pyx_v_self) {
  char *__pyx_v_name;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  struct __pyx_opt_args_3epr__to_str __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_dsd_name", 0);

  /* "epr.pyx":2221
 *         cdef char* name
 * 
 *         if self._ptr is not NULL:             # <<<<<<<<<<<<<<
 *             self.check_closed_product()
 *             name = <char*>epr_get_dsd_name(self._ptr)
 */
  __pyx_t_1 = ((__pyx_v_self->_ptr != NULL) != 0);
  if (__pyx_t_1) {

    /* "epr.pyx":2222
 * 
 *         if self._ptr is not NULL:
 *             self.check_closed_product()             # <<<<<<<<<<<<<<
 *             name = <char*>epr_get_dsd_name(self._ptr)
 *             return _to_str(name, 'ascii')
 */
    __pyx_t_2 = __pyx_f_3epr_7Dataset_check_closed_product(__pyx_v_self); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2222; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "epr.pyx":2223
 *         if self._ptr is not NULL:
 *             self.check_closed_product()
 *             name = <char*>epr_get_dsd_name(self._ptr)             # <<<<<<<<<<<<<<
 *             return _to_str(name, 'ascii')
 *         return ''
 */
    __pyx_v_name = ((char *)epr_get_dsd_name(__pyx_v_self->_ptr));

    /* "epr.pyx":2224
 *             self.check_closed_product()
 *             name = <char*>epr_get_dsd_name(self._ptr)
 *             return _to_str(name, 'ascii')             # <<<<<<<<<<<<<<
 *         return ''
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = __Pyx_PyBytes_FromString(__pyx_v_name); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2224; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4.__pyx_n = 1;
    __pyx_t_4.encoding = __pyx_n_s_ascii;
    __pyx_t_3 = __pyx_f_3epr__to_str(__pyx_t_2, &__pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2224; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
  }

  /* "epr.pyx":2225
 *             name = <char*>epr_get_dsd_name(self._ptr)
 *             return _to_str(name, 'ascii')
 *         return ''             # <<<<<<<<<<<<<<
 * 
 *     def get_num_records(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_kp_s_);
  __pyx_r = __pyx_kp_s_;
  goto __pyx_L0;

  /* "epr.pyx":2212
 *         return ''
 * 
 *     def get_dsd_name(self):             # <<<<<<<<<<<<<<
 *         '''get_dsd_name(self)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("epr.Dataset.get_dsd_name", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":2227
 *         return ''
 * 
 *     def get_num_records(self):             # <<<<<<<<<<<<<<
 *         '''get_num_records(self)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_3epr_7Dataset_5get_num_records(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_3epr_7Dataset_4get_num_records[] = "get_num_records(self)\n\n        Gets the number of records of the dataset\n\n        ";
static PyObject *__pyx_pw_3epr_7Dataset_5get_num_records(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_num_records (wrapper)", 0);
  __pyx_r = __pyx_pf_3epr_7Dataset_4get_num_records(((struct __pyx_obj_3epr_Dataset *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_3epr_7Dataset_4get_num_records(struct __pyx_obj_3epr_Dataset *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_num_records", 0);

  /* "epr.pyx":2234
 *         '''
 * 
 *         if self._ptr is not NULL:             # <<<<<<<<<<<<<<
 *             self.check_closed_product()
 *             return epr_get_num_records(self._ptr)
 */
  __pyx_t_1 = ((__pyx_v_self->_ptr != NULL) != 0);
  if (__pyx_t_1) {

    /* "epr.pyx":2235
 * 
 *         if self._ptr is not NULL:
 *             self.check_closed_product()             # <<<<<<<<<<<<<<
 *             return epr_get_num_records(self._ptr)
 *         return 0
 */
    __pyx_t_2 = __pyx_f_3epr_7Dataset_check_closed_product(__pyx_v_self); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "epr.pyx":2236
 *         if self._ptr is not NULL:
 *             self.check_closed_product()
 *             return epr_get_num_records(self._ptr)             # <<<<<<<<<<<<<<
 *         return 0
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = __Pyx_PyInt_From_uint(epr_get_num_records(__pyx_v_self->_ptr)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2236; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;
  }

  /* "epr.pyx":2237
 *             self.check_closed_product()
 *             return epr_get_num_records(self._ptr)
 *         return 0             # <<<<<<<<<<<<<<
 * 
 *     def get_dsd(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_int_0);
  __pyx_r = __pyx_int_0;
  goto __pyx_L0;

  /* "epr.pyx":2227
 *         return ''
 * 
 *     def get_num_records(self):             # <<<<<<<<<<<<<<
 *         '''get_num_records(self)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("epr.Dataset.get_num_records", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":2239
 *         return 0
 * 
 *     def get_dsd(self):             # <<<<<<<<<<<<<<
 *         '''get_dsd(self)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_3epr_7Dataset_7get_dsd(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_3epr_7Dataset_6get_dsd[] = "get_dsd(self)\n\n        Gets the dataset descriptor (DSD)\n\n        ";
static PyObject *__pyx_pw_3epr_7Dataset_7get_dsd(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_dsd (wrapper)", 0);
  __pyx_r = __pyx_pf_3epr_7Dataset_6get_dsd(((struct __pyx_obj_3epr_Dataset *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_3epr_7Dataset_6get_dsd(struct __pyx_obj_3epr_Dataset *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  struct __pyx_opt_args_3epr_new_dsd __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_dsd", 0);

  /* "epr.pyx":2246
 *         '''
 * 
 *         self.check_closed_product()             # <<<<<<<<<<<<<<
 * 
 *         return new_dsd(<EPR_SDSD*>epr_get_dsd(self._ptr), self)
 */
  __pyx_t_1 = __pyx_f_3epr_7Dataset_check_closed_product(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2246; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "epr.pyx":2248
 *         self.check_closed_product()
 * 
 *         return new_dsd(<EPR_SDSD*>epr_get_dsd(self._ptr), self)             # <<<<<<<<<<<<<<
 * 
 *     def create_record(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2.__pyx_n = 1;
  __pyx_t_2.parent = ((PyObject *)__pyx_v_self);
  __pyx_t_1 = __pyx_f_3epr_new_dsd(((EPR_SDSD *)epr_get_dsd(__pyx_v_self->_ptr)), &__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2248; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "epr.pyx":2239
 *         return 0
 * 
 *     def get_dsd(self):             # <<<<<<<<<<<<<<
 *         '''get_dsd(self)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("epr.Dataset.get_dsd", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":2250
 *         return new_dsd(<EPR_SDSD*>epr_get_dsd(self._ptr), self)
 * 
 *     def create_record(self):             # <<<<<<<<<<<<<<
 *         '''create_record(self)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_3epr_7Dataset_9create_record(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_3epr_7Dataset_8create_record[] = "create_record(self)\n\n        Creates a new record\n\n        Creates a new, empty record with a structure compatible with\n        the dataset. Such a record is typically used in subsequent\n        calls to :meth:`Dataset.read_record`.\n\n        :returns:\n            the new record instance\n\n        ";
static PyObject *__pyx_pw_3epr_7Dataset_9create_record(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("create_record (wrapper)", 0);
  __pyx_r = __pyx_pf_3epr_7Dataset_8create_record(((struct __pyx_obj_3epr_Dataset *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_3epr_7Dataset_8create_record(struct __pyx_obj_3epr_Dataset *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  struct __pyx_opt_args_3epr_new_record __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("create_record", 0);

  /* "epr.pyx":2264
 *         '''
 * 
 *         self.check_closed_product()             # <<<<<<<<<<<<<<
 * 
 *         return new_record(epr_create_record(self._ptr), self, True)
 */
  __pyx_t_1 = __pyx_f_3epr_7Dataset_check_closed_product(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2264; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "epr.pyx":2266
 *         self.check_closed_product()
 * 
 *         return new_record(epr_create_record(self._ptr), self, True)             # <<<<<<<<<<<<<<
 * 
 *     def read_record(self, uint index=0, Record record=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2.__pyx_n = 2;
  __pyx_t_2.parent = ((PyObject *)__pyx_v_self);
  __pyx_t_2.dealloc = 1;
  __pyx_t_1 = __pyx_f_3epr_new_record(epr_create_record(__pyx_v_self->_ptr), &__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2266; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "epr.pyx":2250
 *         return new_dsd(<EPR_SDSD*>epr_get_dsd(self._ptr), self)
 * 
 *     def create_record(self):             # <<<<<<<<<<<<<<
 *         '''create_record(self)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("epr.Dataset.create_record", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":2268
 *         return new_record(epr_create_record(self._ptr), self, True)
 * 
 *     def read_record(self, uint index=0, Record record=None):             # <<<<<<<<<<<<<<
 *         '''read_record(self, index, record=None)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_3epr_7Dataset_11read_record(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_3epr_7Dataset_10read_record[] = "read_record(self, index, record=None)\n\n        Reads specified record of the dataset\n\n        The record is identified through the given zero-based record\n        index. In order to reduce memory reallocation, a record\n        (pre-)created by the method :meth:`Dataset.create_record` can\n        be passed to this method.\n        Data is then read into this given record.\n\n        If no record (``None``) is given, the method initiates a new\n        one.\n\n        In both cases, the record in which the data is read into will\n        be  returned.\n\n        :param index:\n            the zero-based record index (default: 0)\n        :param record:\n            a pre-created record to reduce memory reallocation, can be\n            ``None`` (default) to let the function allocate a new\n            record\n        :returns:\n            the record in which the data has been read into or raises\n            an exception (:exc:`EPRValueError`) if an error occurred\n\n        .. versionchanged:: 0.9\n\n           The *index* parameter now defaults to zero\n\n        ";
static PyObject *__pyx_pw_3epr_7Dataset_11read_record(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  uint __pyx_v_index;
  struct __pyx_obj_3epr_Record *__pyx_v_record = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("read_record (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_index,&__pyx_n_s_record,0};
    PyObject* values[2] = {0,0};
    values[1] = (PyObject *)((struct __pyx_obj_3epr_Record *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_index);
          if (value) { values[0] = value; kw_args--; }
        }
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_record);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "read_record") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2268; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_index = __Pyx_PyInt_As_uint(values[0]); if (unlikely((__pyx_v_index == (uint)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2268; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_index = ((uint)0);
    }
    __pyx_v_record = ((struct __pyx_obj_3epr_Record *)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("read_record", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2268; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("epr.Dataset.read_record", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_record), __pyx_ptype_3epr_Record, 1, "record", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2268; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_3epr_7Dataset_10read_record(((struct __pyx_obj_3epr_Dataset *)__pyx_v_self), __pyx_v_index, __pyx_v_record);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_3epr_7Dataset_10read_record(struct __pyx_obj_3epr_Dataset *__pyx_v_self, uint __pyx_v_index, struct __pyx_obj_3epr_Record *__pyx_v_record) {
  EPR_SRecord *__pyx_v_record_ptr;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  EPR_SRecord *__pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  struct __pyx_opt_args_3epr_pyepr_null_ptr_error __pyx_t_5;
  int __pyx_t_6;
  struct __pyx_opt_args_3epr_new_record __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("read_record", 0);
  __Pyx_INCREF((PyObject *)__pyx_v_record);

  /* "epr.pyx":2301
 *         '''
 * 
 *         cdef EPR_SRecord* record_ptr = NULL             # <<<<<<<<<<<<<<
 * 
 *         self.check_closed_product()
 */
  __pyx_v_record_ptr = NULL;

  /* "epr.pyx":2303
 *         cdef EPR_SRecord* record_ptr = NULL
 * 
 *         self.check_closed_product()             # <<<<<<<<<<<<<<
 * 
 *         if record:
 */
  __pyx_t_1 = __pyx_f_3epr_7Dataset_check_closed_product(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2303; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "epr.pyx":2305
 *         self.check_closed_product()
 * 
 *         if record:             # <<<<<<<<<<<<<<
 *             record_ptr = (<Record>record)._ptr
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_record)); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2305; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_2) {

    /* "epr.pyx":2306
 * 
 *         if record:
 *             record_ptr = (<Record>record)._ptr             # <<<<<<<<<<<<<<
 * 
 *         with nogil:
 */
    __pyx_t_3 = __pyx_v_record->_ptr;
    __pyx_v_record_ptr = __pyx_t_3;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "epr.pyx":2308
 *             record_ptr = (<Record>record)._ptr
 * 
 *         with nogil:             # <<<<<<<<<<<<<<
 *             record_ptr = epr_read_record(self._ptr, index, record_ptr)
 * 
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      #endif
      /*try:*/ {

        /* "epr.pyx":2309
 * 
 *         with nogil:
 *             record_ptr = epr_read_record(self._ptr, index, record_ptr)             # <<<<<<<<<<<<<<
 * 
 *         if record_ptr is NULL:
 */
        __pyx_v_record_ptr = epr_read_record(__pyx_v_self->_ptr, __pyx_v_index, __pyx_v_record_ptr);
      }

      /* "epr.pyx":2308
 *             record_ptr = (<Record>record)._ptr
 * 
 *         with nogil:             # <<<<<<<<<<<<<<
 *             record_ptr = epr_read_record(self._ptr, index, record_ptr)
 * 
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L6;
        }
        __pyx_L6:;
      }
  }

  /* "epr.pyx":2311
 *             record_ptr = epr_read_record(self._ptr, index, record_ptr)
 * 
 *         if record_ptr is NULL:             # <<<<<<<<<<<<<<
 *             pyepr_null_ptr_error('unable to read record at index %d' % index)
 * 
 */
  __pyx_t_2 = ((__pyx_v_record_ptr == NULL) != 0);
  if (__pyx_t_2) {

    /* "epr.pyx":2312
 * 
 *         if record_ptr is NULL:
 *             pyepr_null_ptr_error('unable to read record at index %d' % index)             # <<<<<<<<<<<<<<
 * 
 *         if not record:
 */
    __pyx_t_1 = __Pyx_PyInt_From_uint(__pyx_v_index); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2312; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_unable_to_read_record_at_index_d, __pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2312; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_5.__pyx_n = 1;
    __pyx_t_5.msg = __pyx_t_4;
    __pyx_t_1 = __pyx_f_3epr_pyepr_null_ptr_error(&__pyx_t_5); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2312; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    goto __pyx_L7;
  }
  __pyx_L7:;

  /* "epr.pyx":2314
 *             pyepr_null_ptr_error('unable to read record at index %d' % index)
 * 
 *         if not record:             # <<<<<<<<<<<<<<
 *             record = new_record(record_ptr, self, True)
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_record)); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_6 = ((!__pyx_t_2) != 0);
  if (__pyx_t_6) {

    /* "epr.pyx":2315
 * 
 *         if not record:
 *             record = new_record(record_ptr, self, True)             # <<<<<<<<<<<<<<
 * 
 *         record._index = index
 */
    __pyx_t_7.__pyx_n = 2;
    __pyx_t_7.parent = ((PyObject *)__pyx_v_self);
    __pyx_t_7.dealloc = 1;
    __pyx_t_1 = __pyx_f_3epr_new_record(__pyx_v_record_ptr, &__pyx_t_7); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2315; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_3epr_Record))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2315; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF_SET(__pyx_v_record, ((struct __pyx_obj_3epr_Record *)__pyx_t_1));
    __pyx_t_1 = 0;
    goto __pyx_L8;
  }
  __pyx_L8:;

  /* "epr.pyx":2317
 *             record = new_record(record_ptr, self, True)
 * 
 *         record._index = index             # <<<<<<<<<<<<<<
 * 
 *         return record
 */
  __pyx_v_record->_index = __pyx_v_index;

  /* "epr.pyx":2319
 *         record._index = index
 * 
 *         return record             # <<<<<<<<<<<<<<
 * 
 *     # --- high level interface ------------------------------------------------
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_record));
  __pyx_r = ((PyObject *)__pyx_v_record);
  goto __pyx_L0;

  /* "epr.pyx":2268
 *         return new_record(epr_create_record(self._ptr), self, True)
 * 
 *     def read_record(self, uint index=0, Record record=None):             # <<<<<<<<<<<<<<
 *         '''read_record(self, index, record=None)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("epr.Dataset.read_record", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_record);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":2322
 * 
 *     # --- high level interface ------------------------------------------------
 *     def records(self):             # <<<<<<<<<<<<<<
 *         '''records(self)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_3epr_7Dataset_13records(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_3epr_7Dataset_12records[] = "records(self)\n\n        Return the list of records contained in the dataset\n\n        ";
static PyObject *__pyx_pw_3epr_7Dataset_13records(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("records (wrapper)", 0);
  __pyx_r = __pyx_pf_3epr_7Dataset_12records(((struct __pyx_obj_3epr_Dataset *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_3epr_7Dataset_12records(struct __pyx_obj_3epr_Dataset *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("records", 0);

  /* "epr.pyx":2329
 *         '''
 * 
 *         return list(self)             # <<<<<<<<<<<<<<
 * 
 *     def __iter__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2329; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_self));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyList_Type))), __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2329; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "epr.pyx":2322
 * 
 *     # --- high level interface ------------------------------------------------
 *     def records(self):             # <<<<<<<<<<<<<<
 *         '''records(self)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("epr.Dataset.records", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":2331
 *         return list(self)
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         cdef int idx
 *         self.check_closed_product()
 */

/* Python wrapper */
static PyObject *__pyx_pw_3epr_7Dataset_15__iter__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_3epr_7Dataset_15__iter__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  __pyx_r = __pyx_pf_3epr_7Dataset_14__iter__(((struct __pyx_obj_3epr_Dataset *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_3epr_7Dataset_8__iter___2generator1(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */

/* "epr.pyx":2334
 *         cdef int idx
 *         self.check_closed_product()
 *         return (self.read_record(idx)             # <<<<<<<<<<<<<<
 *                             for idx in range(epr_get_num_records(self._ptr)))
 * 
 */

static PyObject *__pyx_pf_3epr_7Dataset_8__iter___genexpr(PyObject *__pyx_self) {
  struct __pyx_obj_3epr___pyx_scope_struct_3_genexpr *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("genexpr", 0);
  __pyx_cur_scope = (struct __pyx_obj_3epr___pyx_scope_struct_3_genexpr *)__pyx_tp_new_3epr___pyx_scope_struct_3_genexpr(__pyx_ptype_3epr___pyx_scope_struct_3_genexpr, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __Pyx_GOTREF(__pyx_cur_scope);
  __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_3epr___pyx_scope_struct_2___iter__ *) __pyx_self;
  __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope));
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope);
  {
    __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_3epr_7Dataset_8__iter___2generator1, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2334; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("epr.Dataset.__iter__.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_3epr_7Dataset_8__iter___2generator1(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_3epr___pyx_scope_struct_3_genexpr *__pyx_cur_scope = ((struct __pyx_obj_3epr___pyx_scope_struct_3_genexpr *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  uint __pyx_t_1;
  uint __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("None", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L6_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2334; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "epr.pyx":2335
 *         self.check_closed_product()
 *         return (self.read_record(idx)
 *                             for idx in range(epr_get_num_records(self._ptr)))             # <<<<<<<<<<<<<<
 * 
 *     def __str__(self):
 */
  if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2335; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
  __pyx_t_1 = epr_get_num_records(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self->_ptr);
  for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
    __pyx_cur_scope->__pyx_v_idx = __pyx_t_2;

    /* "epr.pyx":2334
 *         cdef int idx
 *         self.check_closed_product()
 *         return (self.read_record(idx)             # <<<<<<<<<<<<<<
 *                             for idx in range(epr_get_num_records(self._ptr)))
 * 
 */
    if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2334; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self), __pyx_n_s_read_record); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2334; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyInt_From_uint(__pyx_cur_scope->__pyx_v_idx); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2334; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2334; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2334; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    __pyx_cur_scope->__pyx_t_0 = __pyx_t_1;
    __pyx_cur_scope->__pyx_t_1 = __pyx_t_2;
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L6_resume_from_yield:;
    __pyx_t_1 = __pyx_cur_scope->__pyx_t_0;
    __pyx_t_2 = __pyx_cur_scope->__pyx_t_1;
    if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2334; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r);
  __pyx_generator->resume_label = -1;
  __Pyx_Generator_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return NULL;
}

/* "epr.pyx":2331
 *         return list(self)
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         cdef int idx
 *         self.check_closed_product()
 */

static PyObject *__pyx_pf_3epr_7Dataset_14__iter__(struct __pyx_obj_3epr_Dataset *__pyx_v_self) {
  struct __pyx_obj_3epr___pyx_scope_struct_2___iter__ *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__iter__", 0);
  __pyx_cur_scope = (struct __pyx_obj_3epr___pyx_scope_struct_2___iter__ *)__pyx_tp_new_3epr___pyx_scope_struct_2___iter__(__pyx_ptype_3epr___pyx_scope_struct_2___iter__, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __Pyx_GOTREF(__pyx_cur_scope);
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);

  /* "epr.pyx":2333
 *     def __iter__(self):
 *         cdef int idx
 *         self.check_closed_product()             # <<<<<<<<<<<<<<
 *         return (self.read_record(idx)
 *                             for idx in range(epr_get_num_records(self._ptr)))
 */
  __pyx_t_1 = __pyx_f_3epr_7Dataset_check_closed_product(__pyx_cur_scope->__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2333; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "epr.pyx":2334
 *         cdef int idx
 *         self.check_closed_product()
 *         return (self.read_record(idx)             # <<<<<<<<<<<<<<
 *                             for idx in range(epr_get_num_records(self._ptr)))
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_pf_3epr_7Dataset_8__iter___genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2334; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "epr.pyx":2331
 *         return list(self)
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         cdef int idx
 *         self.check_closed_product()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("epr.Dataset.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":2337
 *                             for idx in range(epr_get_num_records(self._ptr)))
 * 
 *     def __str__(self):             # <<<<<<<<<<<<<<
 *         lines = [repr(self), '']
 *         lines.extend(map(str, self))
 */

/* Python wrapper */
static PyObject *__pyx_pw_3epr_7Dataset_17__str__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_3epr_7Dataset_17__str__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__str__ (wrapper)", 0);
  __pyx_r = __pyx_pf_3epr_7Dataset_16__str__(((struct __pyx_obj_3epr_Dataset *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_3epr_7Dataset_16__str__(struct __pyx_obj_3epr_Dataset *__pyx_v_self) {
  PyObject *__pyx_v_lines = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__str__", 0);

  /* "epr.pyx":2338
 * 
 *     def __str__(self):
 *         lines = [repr(self), '']             # <<<<<<<<<<<<<<
 *         lines.extend(map(str, self))
 *         return '\n'.join(lines)
 */
  __pyx_t_1 = PyObject_Repr(((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2338; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyList_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2338; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  PyList_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_kp_s_);
  PyList_SET_ITEM(__pyx_t_2, 1, __pyx_kp_s_);
  __Pyx_GIVEREF(__pyx_kp_s_);
  __pyx_t_1 = 0;
  __pyx_v_lines = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "epr.pyx":2339
 *     def __str__(self):
 *         lines = [repr(self), '']
 *         lines.extend(map(str, self))             # <<<<<<<<<<<<<<
 *         return '\n'.join(lines)
 * 
 */
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2339; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(((PyObject *)((PyObject*)(&PyString_Type))));
  PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)((PyObject*)(&PyString_Type))));
  __Pyx_GIVEREF(((PyObject *)((PyObject*)(&PyString_Type))));
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_self));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_map, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2339; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_3 = __Pyx_PyList_Extend(__pyx_v_lines, __pyx_t_1); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2339; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "epr.pyx":2340
 *         lines = [repr(self), '']
 *         lines.extend(map(str, self))
 *         return '\n'.join(lines)             # <<<<<<<<<<<<<<
 * 
 *     def __repr__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyString_Join(__pyx_kp_s__11, __pyx_v_lines); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2340; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "epr.pyx":2337
 *                             for idx in range(epr_get_num_records(self._ptr)))
 * 
 *     def __str__(self):             # <<<<<<<<<<<<<<
 *         lines = [repr(self), '']
 *         lines.extend(map(str, self))
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("epr.Dataset.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_lines);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":2342
 *         return '\n'.join(lines)
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return 'epr.Dataset(%s) %d records' % (self.get_name(),
 *                                                self.get_num_records())
 */

/* Python wrapper */
static PyObject *__pyx_pw_3epr_7Dataset_19__repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_3epr_7Dataset_19__repr__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
  __pyx_r = __pyx_pf_3epr_7Dataset_18__repr__(((struct __pyx_obj_3epr_Dataset *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_3epr_7Dataset_18__repr__(struct __pyx_obj_3epr_Dataset *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__repr__", 0);

  /* "epr.pyx":2343
 * 
 *     def __repr__(self):
 *         return 'epr.Dataset(%s) %d records' % (self.get_name(),             # <<<<<<<<<<<<<<
 *                                                self.get_num_records())
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_get_name); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2343; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2343; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "epr.pyx":2344
 *     def __repr__(self):
 *         return 'epr.Dataset(%s) %d records' % (self.get_name(),
 *                                                self.get_num_records())             # <<<<<<<<<<<<<<
 * 
 *     # --- low level interface -------------------------------------------------
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_get_num_records); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2344; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2344; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "epr.pyx":2343
 * 
 *     def __repr__(self):
 *         return 'epr.Dataset(%s) %d records' % (self.get_name(),             # <<<<<<<<<<<<<<
 *                                                self.get_num_records())
 * 
 */
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2343; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_epr_Dataset_s_d_records, __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2343; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "epr.pyx":2342
 *         return '\n'.join(lines)
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return 'epr.Dataset(%s) %d records' % (self.get_name(),
 *                                                self.get_num_records())
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("epr.Dataset.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":2350
 *         '''The magic number for internal C structure'''
 * 
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             self.check_closed_product()
 *             return self._ptr.magic
 */

/* Python wrapper */
static PyObject *__pyx_pw_3epr_7Dataset_6_magic_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_3epr_7Dataset_6_magic_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_3epr_7Dataset_6_magic___get__(((struct __pyx_obj_3epr_Dataset *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_3epr_7Dataset_6_magic___get__(struct __pyx_obj_3epr_Dataset *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "epr.pyx":2351
 * 
 *         def __get__(self):
 *             self.check_closed_product()             # <<<<<<<<<<<<<<
 *             return self._ptr.magic
 * 
 */
  __pyx_t_1 = __pyx_f_3epr_7Dataset_check_closed_product(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2351; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "epr.pyx":2352
 *         def __get__(self):
 *             self.check_closed_product()
 *             return self._ptr.magic             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_EPR_Magic(__pyx_v_self->_ptr->magic); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2352; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "epr.pyx":2350
 *         '''The magic number for internal C structure'''
 * 
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             self.check_closed_product()
 *             return self._ptr.magic
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("epr.Dataset._magic.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":2355
 * 
 * 
 * cdef new_dataset(EPR_SDatasetId* ptr, Product parent=None):             # <<<<<<<<<<<<<<
 *     if ptr is NULL:
 *         pyepr_null_ptr_error()
 */

static PyObject *__pyx_f_3epr_new_dataset(EPR_SDatasetId *__pyx_v_ptr, struct __pyx_opt_args_3epr_new_dataset *__pyx_optional_args) {
  struct __pyx_obj_3epr_Product *__pyx_v_parent = ((struct __pyx_obj_3epr_Product *)Py_None);
  struct __pyx_obj_3epr_Dataset *__pyx_v_instance = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("new_dataset", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_parent = __pyx_optional_args->parent;
    }
  }

  /* "epr.pyx":2356
 * 
 * cdef new_dataset(EPR_SDatasetId* ptr, Product parent=None):
 *     if ptr is NULL:             # <<<<<<<<<<<<<<
 *         pyepr_null_ptr_error()
 * 
 */
  __pyx_t_1 = ((__pyx_v_ptr == NULL) != 0);
  if (__pyx_t_1) {

    /* "epr.pyx":2357
 * cdef new_dataset(EPR_SDatasetId* ptr, Product parent=None):
 *     if ptr is NULL:
 *         pyepr_null_ptr_error()             # <<<<<<<<<<<<<<
 * 
 *     cdef Dataset instance = Dataset.__new__(Dataset)
 */
    __pyx_t_2 = __pyx_f_3epr_pyepr_null_ptr_error(NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2357; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "epr.pyx":2359
 *         pyepr_null_ptr_error()
 * 
 *     cdef Dataset instance = Dataset.__new__(Dataset)             # <<<<<<<<<<<<<<
 * 
 *     instance._ptr = ptr
 */
  __pyx_t_2 = __pyx_tp_new_3epr_Dataset(((PyTypeObject *)((PyObject*)__pyx_ptype_3epr_Dataset)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2359; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (!(likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_3epr_Dataset)))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2359; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_instance = ((struct __pyx_obj_3epr_Dataset *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "epr.pyx":2361
 *     cdef Dataset instance = Dataset.__new__(Dataset)
 * 
 *     instance._ptr = ptr             # <<<<<<<<<<<<<<
 *     instance._parent = parent
 * 
 */
  __pyx_v_instance->_ptr = __pyx_v_ptr;

  /* "epr.pyx":2362
 * 
 *     instance._ptr = ptr
 *     instance._parent = parent             # <<<<<<<<<<<<<<
 * 
 *     return instance
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_parent));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_parent));
  __Pyx_GOTREF(__pyx_v_instance->_parent);
  __Pyx_DECREF(((PyObject *)__pyx_v_instance->_parent));
  __pyx_v_instance->_parent = __pyx_v_parent;

  /* "epr.pyx":2364
 *     instance._parent = parent
 * 
 *     return instance             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_instance));
  __pyx_r = ((PyObject *)__pyx_v_instance);
  goto __pyx_L0;

  /* "epr.pyx":2355
 * 
 * 
 * cdef new_dataset(EPR_SDatasetId* ptr, Product parent=None):             # <<<<<<<<<<<<<<
 *     if ptr is NULL:
 *         pyepr_null_ptr_error()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("epr.new_dataset", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_instance);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":2380
 *     cdef str _mode
 * 
 *     def __cinit__(self, filename, str mode='rb'):             # <<<<<<<<<<<<<<
 *         cdef bytes bfilename = _to_bytes(filename, _DEFAULT_FS_ENCODING)
 *         cdef char* cfilename = bfilename
 */

/* Python wrapper */
static int __pyx_pw_3epr_7Product_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_3epr_7Product_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_filename = 0;
  PyObject *__pyx_v_mode = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_filename,&__pyx_n_s_mode,0};
    PyObject* values[2] = {0,0};
    values[1] = ((PyObject*)__pyx_n_s_rb);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_filename)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_mode);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2380; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_filename = values[0];
    __pyx_v_mode = ((PyObject*)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2380; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("epr.Product.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_mode), (&PyString_Type), 1, "mode", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2380; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_3epr_7Product___cinit__(((struct __pyx_obj_3epr_Product *)__pyx_v_self), __pyx_v_filename, __pyx_v_mode);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_3epr_7Product___cinit__(struct __pyx_obj_3epr_Product *__pyx_v_self, PyObject *__pyx_v_filename, PyObject *__pyx_v_mode) {
  PyObject *__pyx_v_bfilename = 0;
  char *__pyx_v_cfilename;
  PyObject *__pyx_v_bmode = 0;
  char *__pyx_v_cmode;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  struct __pyx_opt_args_3epr__to_bytes __pyx_t_3;
  char *__pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  int __pyx_t_7;
  int __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "epr.pyx":2381
 * 
 *     def __cinit__(self, filename, str mode='rb'):
 *         cdef bytes bfilename = _to_bytes(filename, _DEFAULT_FS_ENCODING)             # <<<<<<<<<<<<<<
 *         cdef char* cfilename = bfilename
 *         cdef bytes bmode
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_DEFAULT_FS_ENCODING); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2381; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3.__pyx_n = 1;
  __pyx_t_3.encoding = __pyx_t_1;
  __pyx_t_2 = __pyx_f_3epr__to_bytes(__pyx_v_filename, &__pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2381; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_bfilename = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "epr.pyx":2382
 *     def __cinit__(self, filename, str mode='rb'):
 *         cdef bytes bfilename = _to_bytes(filename, _DEFAULT_FS_ENCODING)
 *         cdef char* cfilename = bfilename             # <<<<<<<<<<<<<<
 *         cdef bytes bmode
 *         cdef char* cmode
 */
  __pyx_t_4 = __Pyx_PyObject_AsString(__pyx_v_bfilename); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2382; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_cfilename = __pyx_t_4;

  /* "epr.pyx":2387
 *         cdef int ret
 * 
 *         if mode not in ('rb', 'rb+', 'r+b'):             # <<<<<<<<<<<<<<
 *             raise ValueError('invalid open mode: "%s"' % mode)
 * 
 */
  __Pyx_INCREF(__pyx_v_mode);
  __pyx_t_5 = __pyx_v_mode;
  __pyx_t_6 = (__Pyx_PyString_Equals(__pyx_t_5, __pyx_n_s_rb, Py_NE)); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2387; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_7 = (__pyx_t_6 != 0);
  if (__pyx_t_7) {
    __pyx_t_6 = (__Pyx_PyString_Equals(__pyx_t_5, __pyx_kp_s_rb_2, Py_NE)); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2387; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_8 = (__pyx_t_6 != 0);
    __pyx_t_6 = __pyx_t_8;
  } else {
    __pyx_t_6 = __pyx_t_7;
  }
  if (__pyx_t_6) {
    __pyx_t_7 = (__Pyx_PyString_Equals(__pyx_t_5, __pyx_kp_s_r_b, Py_NE)); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2387; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_8 = (__pyx_t_7 != 0);
    __pyx_t_7 = __pyx_t_8;
  } else {
    __pyx_t_7 = __pyx_t_6;
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_6 = (__pyx_t_7 != 0);
  if (__pyx_t_6) {

    /* "epr.pyx":2388
 * 
 *         if mode not in ('rb', 'rb+', 'r+b'):
 *             raise ValueError('invalid open mode: "%s"' % mode)             # <<<<<<<<<<<<<<
 * 
 *         self._mode = mode
 */
    __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_invalid_open_mode_s, __pyx_v_mode); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2388; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2388; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_2);
    __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2388; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2388; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "epr.pyx":2390
 *             raise ValueError('invalid open mode: "%s"' % mode)
 * 
 *         self._mode = mode             # <<<<<<<<<<<<<<
 * 
 *         with nogil:
 */
  __Pyx_INCREF(__pyx_v_mode);
  __Pyx_GIVEREF(__pyx_v_mode);
  __Pyx_GOTREF(__pyx_v_self->_mode);
  __Pyx_DECREF(__pyx_v_self->_mode);
  __pyx_v_self->_mode = __pyx_v_mode;

  /* "epr.pyx":2392
 *         self._mode = mode
 * 
 *         with nogil:             # <<<<<<<<<<<<<<
 *             self._ptr = epr_open_product(cfilename)
 * 
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      #endif
      /*try:*/ {

        /* "epr.pyx":2393
 * 
 *         with nogil:
 *             self._ptr = epr_open_product(cfilename)             # <<<<<<<<<<<<<<
 * 
 *         if '+' in mode:
 */
        __pyx_v_self->_ptr = epr_open_product(__pyx_v_cfilename);
      }

      /* "epr.pyx":2392
 *         self._mode = mode
 * 
 *         with nogil:             # <<<<<<<<<<<<<<
 *             self._ptr = epr_open_product(cfilename)
 * 
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L6;
        }
        __pyx_L6:;
      }
  }

  /* "epr.pyx":2395
 *             self._ptr = epr_open_product(cfilename)
 * 
 *         if '+' in mode:             # <<<<<<<<<<<<<<
 *             # reopen in 'rb+ mode
 * 
 */
  __pyx_t_6 = (__Pyx_PySequence_Contains(__pyx_kp_s__17, __pyx_v_mode, Py_EQ)); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2395; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_7 = (__pyx_t_6 != 0);
  if (__pyx_t_7) {

    /* "epr.pyx":2398
 *             # reopen in 'rb+ mode
 * 
 *             bmode = _to_bytes(mode)             # <<<<<<<<<<<<<<
 *             cmode = bmode
 * 
 */
    __pyx_t_2 = __pyx_f_3epr__to_bytes(__pyx_v_mode, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2398; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_v_bmode = ((PyObject*)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "epr.pyx":2399
 * 
 *             bmode = _to_bytes(mode)
 *             cmode = bmode             # <<<<<<<<<<<<<<
 * 
 *             with nogil:
 */
    __pyx_t_4 = __Pyx_PyObject_AsString(__pyx_v_bmode); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2399; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_cmode = __pyx_t_4;

    /* "epr.pyx":2401
 *             cmode = bmode
 * 
 *             with nogil:             # <<<<<<<<<<<<<<
 *                 self._ptr.istream = stdio.freopen(cfilename, cmode,
 *                                                   self._ptr.istream)
 */
    {
        #ifdef WITH_THREAD
        PyThreadState *_save;
        Py_UNBLOCK_THREADS
        #endif
        /*try:*/ {

          /* "epr.pyx":2402
 * 
 *             with nogil:
 *                 self._ptr.istream = stdio.freopen(cfilename, cmode,             # <<<<<<<<<<<<<<
 *                                                   self._ptr.istream)
 *             if self._ptr.istream is NULL:
 */
          __pyx_v_self->_ptr->istream = freopen(__pyx_v_cfilename, __pyx_v_cmode, __pyx_v_self->_ptr->istream);
        }

        /* "epr.pyx":2401
 *             cmode = bmode
 * 
 *             with nogil:             # <<<<<<<<<<<<<<
 *                 self._ptr.istream = stdio.freopen(cfilename, cmode,
 *                                                   self._ptr.istream)
 */
        /*finally:*/ {
          /*normal exit:*/{
            #ifdef WITH_THREAD
            Py_BLOCK_THREADS
            #endif
            goto __pyx_L10;
          }
          __pyx_L10:;
        }
    }

    /* "epr.pyx":2404
 *                 self._ptr.istream = stdio.freopen(cfilename, cmode,
 *                                                   self._ptr.istream)
 *             if self._ptr.istream is NULL:             # <<<<<<<<<<<<<<
 *                 errno.errno = 0
 *                 raise ValueError(
 */
    __pyx_t_7 = ((__pyx_v_self->_ptr->istream == NULL) != 0);
    if (__pyx_t_7) {

      /* "epr.pyx":2405
 *                                                   self._ptr.istream)
 *             if self._ptr.istream is NULL:
 *                 errno.errno = 0             # <<<<<<<<<<<<<<
 *                 raise ValueError(
 *                     'unable to open file "%s" in "%s" mode' % (filename, mode))
 */
      errno = 0;

      /* "epr.pyx":2407
 *                 errno.errno = 0
 *                 raise ValueError(
 *                     'unable to open file "%s" in "%s" mode' % (filename, mode))             # <<<<<<<<<<<<<<
 * 
 *         if self._ptr is NULL:
 */
      __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2407; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_INCREF(__pyx_v_filename);
      PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_filename);
      __Pyx_GIVEREF(__pyx_v_filename);
      __Pyx_INCREF(__pyx_v_mode);
      PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_mode);
      __Pyx_GIVEREF(__pyx_v_mode);
      __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_unable_to_open_file_s_in_s_mode, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2407; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "epr.pyx":2406
 *             if self._ptr.istream is NULL:
 *                 errno.errno = 0
 *                 raise ValueError(             # <<<<<<<<<<<<<<
 *                     'unable to open file "%s" in "%s" mode' % (filename, mode))
 * 
 */
      __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2406; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
      __Pyx_GIVEREF(__pyx_t_1);
      __pyx_t_1 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2406; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_Raise(__pyx_t_1, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2406; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    goto __pyx_L7;
  }
  __pyx_L7:;

  /* "epr.pyx":2409
 *                     'unable to open file "%s" in "%s" mode' % (filename, mode))
 * 
 *         if self._ptr is NULL:             # <<<<<<<<<<<<<<
 *             # try to get error info from the lib
 *             pyepr_check_errors()
 */
  __pyx_t_7 = ((__pyx_v_self->_ptr == NULL) != 0);
  if (__pyx_t_7) {

    /* "epr.pyx":2411
 *         if self._ptr is NULL:
 *             # try to get error info from the lib
 *             pyepr_check_errors()             # <<<<<<<<<<<<<<
 * 
 *             raise ValueError('unable to open "%s"' % filename)
 */
    __pyx_t_1 = __pyx_f_3epr_pyepr_check_errors(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2411; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "epr.pyx":2413
 *             pyepr_check_errors()
 * 
 *             raise ValueError('unable to open "%s"' % filename)             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(self):
 */
    __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_unable_to_open_s, __pyx_v_filename); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2413; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2413; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2413; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2413; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "epr.pyx":2380
 *     cdef str _mode
 * 
 *     def __cinit__(self, filename, str mode='rb'):             # <<<<<<<<<<<<<<
 *         cdef bytes bfilename = _to_bytes(filename, _DEFAULT_FS_ENCODING)
 *         cdef char* cfilename = bfilename
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("epr.Product.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_bfilename);
  __Pyx_XDECREF(__pyx_v_bmode);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":2415
 *             raise ValueError('unable to open "%s"' % filename)
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         if self._ptr is not NULL:
 *             if '+' in self._mode:
 */

/* Python wrapper */
static void __pyx_pw_3epr_7Product_3__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_3epr_7Product_3__dealloc__(PyObject *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_pf_3epr_7Product_2__dealloc__(((struct __pyx_obj_3epr_Product *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

static void __pyx_pf_3epr_7Product_2__dealloc__(struct __pyx_obj_3epr_Product *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__dealloc__", 0);

  /* "epr.pyx":2416
 * 
 *     def __dealloc__(self):
 *         if self._ptr is not NULL:             # <<<<<<<<<<<<<<
 *             if '+' in self._mode:
 *                 stdio.fflush(self._ptr.istream)
 */
  __pyx_t_1 = ((__pyx_v_self->_ptr != NULL) != 0);
  if (__pyx_t_1) {

    /* "epr.pyx":2417
 *     def __dealloc__(self):
 *         if self._ptr is not NULL:
 *             if '+' in self._mode:             # <<<<<<<<<<<<<<
 *                 stdio.fflush(self._ptr.istream)
 *             epr_close_product(self._ptr)
 */
    __pyx_t_1 = (__Pyx_PySequence_Contains(__pyx_kp_s__17, __pyx_v_self->_mode, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2417; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_2 = (__pyx_t_1 != 0);
    if (__pyx_t_2) {

      /* "epr.pyx":2418
 *         if self._ptr is not NULL:
 *             if '+' in self._mode:
 *                 stdio.fflush(self._ptr.istream)             # <<<<<<<<<<<<<<
 *             epr_close_product(self._ptr)
 *             pyepr_check_errors()
 */
      fflush(__pyx_v_self->_ptr->istream);
      goto __pyx_L4;
    }
    __pyx_L4:;

    /* "epr.pyx":2419
 *             if '+' in self._mode:
 *                 stdio.fflush(self._ptr.istream)
 *             epr_close_product(self._ptr)             # <<<<<<<<<<<<<<
 *             pyepr_check_errors()
 *             self._ptr = NULL
 */
    epr_close_product(__pyx_v_self->_ptr);

    /* "epr.pyx":2420
 *                 stdio.fflush(self._ptr.istream)
 *             epr_close_product(self._ptr)
 *             pyepr_check_errors()             # <<<<<<<<<<<<<<
 *             self._ptr = NULL
 * 
 */
    __pyx_t_3 = __pyx_f_3epr_pyepr_check_errors(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2420; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "epr.pyx":2421
 *             epr_close_product(self._ptr)
 *             pyepr_check_errors()
 *             self._ptr = NULL             # <<<<<<<<<<<<<<
 * 
 *     cdef inline check_closed_product(self):
 */
    __pyx_v_self->_ptr = NULL;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "epr.pyx":2415
 *             raise ValueError('unable to open "%s"' % filename)
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         if self._ptr is not NULL:
 *             if '+' in self._mode:
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_WriteUnraisable("epr.Product.__dealloc__", __pyx_clineno, __pyx_lineno, __pyx_filename, 0);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* "epr.pyx":2423
 *             self._ptr = NULL
 * 
 *     cdef inline check_closed_product(self):             # <<<<<<<<<<<<<<
 *         if self._ptr is NULL:
 *             raise ValueError('I/O operation on closed file')
 */

static CYTHON_INLINE PyObject *__pyx_f_3epr_7Product_check_closed_product(struct __pyx_obj_3epr_Product *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("check_closed_product", 0);

  /* "epr.pyx":2424
 * 
 *     cdef inline check_closed_product(self):
 *         if self._ptr is NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError('I/O operation on closed file')
 * 
 */
  __pyx_t_1 = ((__pyx_v_self->_ptr == NULL) != 0);
  if (__pyx_t_1) {

    /* "epr.pyx":2425
 *     cdef inline check_closed_product(self):
 *         if self._ptr is NULL:
 *             raise ValueError('I/O operation on closed file')             # <<<<<<<<<<<<<<
 * 
 *     cdef inline _check_write_mode(self):
 */
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__18, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2425; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2425; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "epr.pyx":2423
 *             self._ptr = NULL
 * 
 *     cdef inline check_closed_product(self):             # <<<<<<<<<<<<<<
 *         if self._ptr is NULL:
 *             raise ValueError('I/O operation on closed file')
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("epr.Product.check_closed_product", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":2427
 *             raise ValueError('I/O operation on closed file')
 * 
 *     cdef inline _check_write_mode(self):             # <<<<<<<<<<<<<<
 *         if '+' not in self._mode:
 *             raise TypeError('write operation on read-only file')
 */

static CYTHON_INLINE PyObject *__pyx_f_3epr_7Product__check_write_mode(struct __pyx_obj_3epr_Product *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_check_write_mode", 0);

  /* "epr.pyx":2428
 * 
 *     cdef inline _check_write_mode(self):
 *         if '+' not in self._mode:             # <<<<<<<<<<<<<<
 *             raise TypeError('write operation on read-only file')
 * 
 */
  __pyx_t_1 = (__Pyx_PySequence_Contains(__pyx_kp_s__17, __pyx_v_self->_mode, Py_NE)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2428; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "epr.pyx":2429
 *     cdef inline _check_write_mode(self):
 *         if '+' not in self._mode:
 *             raise TypeError('write operation on read-only file')             # <<<<<<<<<<<<<<
 * 
 *     def __init__(self, filename, mode='rb'):
 */
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__19, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2429; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2429; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "epr.pyx":2427
 *             raise ValueError('I/O operation on closed file')
 * 
 *     cdef inline _check_write_mode(self):             # <<<<<<<<<<<<<<
 *         if '+' not in self._mode:
 *             raise TypeError('write operation on read-only file')
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("epr.Product._check_write_mode", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":2431
 *             raise TypeError('write operation on read-only file')
 * 
 *     def __init__(self, filename, mode='rb'):             # <<<<<<<<<<<<<<
 *         # @NOTE: this method suppresses the default behavior of EprObject
 *         #        that is raising an exception when it is instantiated by
 */

/* Python wrapper */
static int __pyx_pw_3epr_7Product_5__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_3epr_7Product_5__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED PyObject *__pyx_v_filename = 0;
  CYTHON_UNUSED PyObject *__pyx_v_mode = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_filename,&__pyx_n_s_mode,0};
    PyObject* values[2] = {0,0};
    values[1] = ((PyObject *)__pyx_n_s_rb);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_filename)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_mode);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2431; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_filename = values[0];
    __pyx_v_mode = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2431; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("epr.Product.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_3epr_7Product_4__init__(((struct __pyx_obj_3epr_Product *)__pyx_v_self), __pyx_v_filename, __pyx_v_mode);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_3epr_7Product_4__init__(CYTHON_UNUSED struct __pyx_obj_3epr_Product *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_filename, CYTHON_UNUSED PyObject *__pyx_v_mode) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__", 0);

  /* function exit code */
  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":2437
 *         pass
 * 
 *     def close(self):             # <<<<<<<<<<<<<<
 *         '''close(self)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_3epr_7Product_7close(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_3epr_7Product_6close[] = "close(self)\n\n        Closes the ENVISAT :class:`epr.Product` product\n\n        Closes the :class:`epr.Product` product and free the underlying\n        file descriptor.\n\n        This method has no effect if the :class:`Product` is already\n        closed. Once the :class:`Product` is closed, any operation on\n        it will raise a ValueError.\n\n        As a convenience, it is allowed to call this method more than\n        once; only the first call, however, will have an effect.\n\n        ";
static PyObject *__pyx_pw_3epr_7Product_7close(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("close (wrapper)", 0);
  __pyx_r = __pyx_pf_3epr_7Product_6close(((struct __pyx_obj_3epr_Product *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_3epr_7Product_6close(struct __pyx_obj_3epr_Product *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("close", 0);

  /* "epr.pyx":2454
 *         '''
 * 
 *         if self._ptr is not NULL:             # <<<<<<<<<<<<<<
 *             #if '+' in self.mode:
 *             #    stdio.fflush(self._ptr.istream)
 */
  __pyx_t_1 = ((__pyx_v_self->_ptr != NULL) != 0);
  if (__pyx_t_1) {

    /* "epr.pyx":2457
 *             #if '+' in self.mode:
 *             #    stdio.fflush(self._ptr.istream)
 *             epr_close_product(self._ptr)             # <<<<<<<<<<<<<<
 *             pyepr_check_errors()
 *             self._ptr = NULL
 */
    epr_close_product(__pyx_v_self->_ptr);

    /* "epr.pyx":2458
 *             #    stdio.fflush(self._ptr.istream)
 *             epr_close_product(self._ptr)
 *             pyepr_check_errors()             # <<<<<<<<<<<<<<
 *             self._ptr = NULL
 * 
 */
    __pyx_t_2 = __pyx_f_3epr_pyepr_check_errors(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2458; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "epr.pyx":2459
 *             epr_close_product(self._ptr)
 *             pyepr_check_errors()
 *             self._ptr = NULL             # <<<<<<<<<<<<<<
 * 
 *     def flush(self):
 */
    __pyx_v_self->_ptr = NULL;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "epr.pyx":2437
 *         pass
 * 
 *     def close(self):             # <<<<<<<<<<<<<<
 *         '''close(self)
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("epr.Product.close", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":2461
 *             self._ptr = NULL
 * 
 *     def flush(self):             # <<<<<<<<<<<<<<
 *         '''Flush the file stream'''
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_3epr_7Product_9flush(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_3epr_7Product_8flush[] = "Flush the file stream";
static PyObject *__pyx_pw_3epr_7Product_9flush(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("flush (wrapper)", 0);
  __pyx_r = __pyx_pf_3epr_7Product_8flush(((struct __pyx_obj_3epr_Product *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_3epr_7Product_8flush(struct __pyx_obj_3epr_Product *__pyx_v_self) {
  int __pyx_v_ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("flush", 0);

  /* "epr.pyx":2465
 * 
 *         cdef int ret
 *         if '+' in self.mode:             # <<<<<<<<<<<<<<
 *             ret = stdio.fflush(self._ptr.istream)
 *             if ret != 0:
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_mode); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2465; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = (__Pyx_PySequence_Contains(__pyx_kp_s__17, __pyx_t_1, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2465; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "epr.pyx":2466
 *         cdef int ret
 *         if '+' in self.mode:
 *             ret = stdio.fflush(self._ptr.istream)             # <<<<<<<<<<<<<<
 *             if ret != 0:
 *                 errno.errno = 0
 */
    __pyx_v_ret = fflush(__pyx_v_self->_ptr->istream);

    /* "epr.pyx":2467
 *         if '+' in self.mode:
 *             ret = stdio.fflush(self._ptr.istream)
 *             if ret != 0:             # <<<<<<<<<<<<<<
 *                 errno.errno = 0
 *                 raise IOError('flush error')
 */
    __pyx_t_3 = ((__pyx_v_ret != 0) != 0);
    if (__pyx_t_3) {

      /* "epr.pyx":2468
 *             ret = stdio.fflush(self._ptr.istream)
 *             if ret != 0:
 *                 errno.errno = 0             # <<<<<<<<<<<<<<
 *                 raise IOError('flush error')
 * 
 */
      errno = 0;

      /* "epr.pyx":2469
 *             if ret != 0:
 *                 errno.errno = 0
 *                 raise IOError('flush error')             # <<<<<<<<<<<<<<
 * 
 *     property file_path:
 */
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_IOError, __pyx_tuple__20, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_Raise(__pyx_t_1, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "epr.pyx":2461
 *             self._ptr = NULL
 * 
 *     def flush(self):             # <<<<<<<<<<<<<<
 *         '''Flush the file stream'''
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("epr.Product.flush", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":2474
 *         '''The file's path including the file name'''
 * 
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             self.check_closed_product()
 *             if self._ptr.file_path is NULL:
 */

/* Python wrapper */
static PyObject *__pyx_pw_3epr_7Product_9file_path_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_3epr_7Product_9file_path_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_3epr_7Product_9file_path___get__(((struct __pyx_obj_3epr_Product *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_3epr_7Product_9file_path___get__(struct __pyx_obj_3epr_Product *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  struct __pyx_opt_args_3epr__to_str __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "epr.pyx":2475
 * 
 *         def __get__(self):
 *             self.check_closed_product()             # <<<<<<<<<<<<<<
 *             if self._ptr.file_path is NULL:
 *                 return None
 */
  __pyx_t_1 = __pyx_f_3epr_7Product_check_closed_product(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2475; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "epr.pyx":2476
 *         def __get__(self):
 *             self.check_closed_product()
 *             if self._ptr.file_path is NULL:             # <<<<<<<<<<<<<<
 *                 return None
 *             else:
 */
  __pyx_t_2 = ((__pyx_v_self->_ptr->file_path == NULL) != 0);
  if (__pyx_t_2) {

    /* "epr.pyx":2477
 *             self.check_closed_product()
 *             if self._ptr.file_path is NULL:
 *                 return None             # <<<<<<<<<<<<<<
 *             else:
 *                 return _to_str(self._ptr.file_path, 'ascii')
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_None);
    __pyx_r = Py_None;
    goto __pyx_L0;
  }
  /*else*/ {

    /* "epr.pyx":2479
 *                 return None
 *             else:
 *                 return _to_str(self._ptr.file_path, 'ascii')             # <<<<<<<<<<<<<<
 * 
 *     property _fileno:
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_self->_ptr->file_path); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2479; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4.__pyx_n = 1;
    __pyx_t_4.encoding = __pyx_n_s_ascii;
    __pyx_t_3 = __pyx_f_3epr__to_str(__pyx_t_1, &__pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2479; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
  }

  /* "epr.pyx":2474
 *         '''The file's path including the file name'''
 * 
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             self.check_closed_product()
 *             if self._ptr.file_path is NULL:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("epr.Product.file_path.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":2488
 *         '''
 * 
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             if self._ptr.istream is NULL:
 *                 return None
 */

/* Python wrapper */
static PyObject *__pyx_pw_3epr_7Product_7_fileno_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_3epr_7Product_7_fileno_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_3epr_7Product_7_fileno___get__(((struct __pyx_obj_3epr_Product *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_3epr_7Product_7_fileno___get__(struct __pyx_obj_3epr_Product *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "epr.pyx":2489
 * 
 *         def __get__(self):
 *             if self._ptr.istream is NULL:             # <<<<<<<<<<<<<<
 *                 return None
 *             else:
 */
  __pyx_t_1 = ((__pyx_v_self->_ptr->istream == NULL) != 0);
  if (__pyx_t_1) {

    /* "epr.pyx":2490
 *         def __get__(self):
 *             if self._ptr.istream is NULL:
 *                 return None             # <<<<<<<<<<<<<<
 *             else:
 *                 return fileno(self._ptr.istream)
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_None);
    __pyx_r = Py_None;
    goto __pyx_L0;
  }
  /*else*/ {

    /* "epr.pyx":2492
 *                 return None
 *             else:
 *                 return fileno(self._ptr.istream)             # <<<<<<<<<<<<<<
 * 
 *     property mode:
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = __Pyx_PyInt_From_int(fileno(__pyx_v_self->_ptr->istream)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2492; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;
  }

  /* "epr.pyx":2488
 *         '''
 * 
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             if self._ptr.istream is NULL:
 *                 return None
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("epr.Product._fileno.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":2495
 * 
 *     property mode:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             '''String that specifies the mode in which the file is opened
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_3epr_7Product_4mode_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_3epr_7Product_4mode_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_3epr_7Product_4mode___get__(((struct __pyx_obj_3epr_Product *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_3epr_7Product_4mode___get__(struct __pyx_obj_3epr_Product *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "epr.pyx":2503
 *             '''
 * 
 *             return self._mode             # <<<<<<<<<<<<<<
 * 
 *     property tot_size:
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->_mode);
  __pyx_r = __pyx_v_self->_mode;
  goto __pyx_L0;

  /* "epr.pyx":2495
 * 
 *     property mode:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             '''String that specifies the mode in which the file is opened
 * 
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":2508
 *         '''The total size in bytes of the product file'''
 * 
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             self.check_closed_product()
 *             return self._ptr.tot_size
 */

/* Python wrapper */
static PyObject *__pyx_pw_3epr_7Product_8tot_size_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_3epr_7Product_8tot_size_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_3epr_7Product_8tot_size___get__(((struct __pyx_obj_3epr_Product *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_3epr_7Product_8tot_size___get__(struct __pyx_obj_3epr_Product *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "epr.pyx":2509
 * 
 *         def __get__(self):
 *             self.check_closed_product()             # <<<<<<<<<<<<<<
 *             return self._ptr.tot_size
 * 
 */
  __pyx_t_1 = __pyx_f_3epr_7Product_check_closed_product(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2509; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "epr.pyx":2510
 *         def __get__(self):
 *             self.check_closed_product()
 *             return self._ptr.tot_size             # <<<<<<<<<<<<<<
 * 
 *     property id_string:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_uint(__pyx_v_self->_ptr->tot_size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2510; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "epr.pyx":2508
 *         '''The total size in bytes of the product file'''
 * 
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             self.check_closed_product()
 *             return self._ptr.tot_size
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("epr.Product.tot_size.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":2523
 *         '''
 * 
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             self.check_closed_product()
 *             if self._ptr.id_string is NULL:
 */

/* Python wrapper */
static PyObject *__pyx_pw_3epr_7Product_9id_string_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_3epr_7Product_9id_string_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_3epr_7Product_9id_string___get__(((struct __pyx_obj_3epr_Product *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_3epr_7Product_9id_string___get__(struct __pyx_obj_3epr_Product *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  struct __pyx_opt_args_3epr__to_str __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "epr.pyx":2524
 * 
 *         def __get__(self):
 *             self.check_closed_product()             # <<<<<<<<<<<<<<
 *             if self._ptr.id_string is NULL:
 *                 return None
 */
  __pyx_t_1 = __pyx_f_3epr_7Product_check_closed_product(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2524; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "epr.pyx":2525
 *         def __get__(self):
 *             self.check_closed_product()
 *             if self._ptr.id_string is NULL:             # <<<<<<<<<<<<<<
 *                 return None
 *             else:
 */
  __pyx_t_2 = ((__pyx_v_self->_ptr->id_string == NULL) != 0);
  if (__pyx_t_2) {

    /* "epr.pyx":2526
 *             self.check_closed_product()
 *             if self._ptr.id_string is NULL:
 *                 return None             # <<<<<<<<<<<<<<
 *             else:
 *                 return _to_str(self._ptr.id_string, 'ascii')
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_None);
    __pyx_r = Py_None;
    goto __pyx_L0;
  }
  /*else*/ {

    /* "epr.pyx":2528
 *                 return None
 *             else:
 *                 return _to_str(self._ptr.id_string, 'ascii')             # <<<<<<<<<<<<<<
 * 
 *     property meris_iodd_version:
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_self->_ptr->id_string); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2528; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4.__pyx_n = 1;
    __pyx_t_4.encoding = __pyx_n_s_ascii;
    __pyx_t_3 = __pyx_f_3epr__to_str(__pyx_t_1, &__pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2528; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
  }

  /* "epr.pyx":2523
 *         '''
 * 
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             self.check_closed_product()
 *             if self._ptr.id_string is NULL:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("epr.Product.id_string.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":2533
 *         '''For MERIS L1b and RR and FR to provide backward compatibility'''
 * 
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             self.check_closed_product()
 *             return self._ptr.meris_iodd_version
 */

/* Python wrapper */
static PyObject *__pyx_pw_3epr_7Product_18meris_iodd_version_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_3epr_7Product_18meris_iodd_version_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_3epr_7Product_18meris_iodd_version___get__(((struct __pyx_obj_3epr_Product *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_3epr_7Product_18meris_iodd_version___get__(struct __pyx_obj_3epr_Product *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "epr.pyx":2534
 * 
 *         def __get__(self):
 *             self.check_closed_product()             # <<<<<<<<<<<<<<
 *             return self._ptr.meris_iodd_version
 * 
 */
  __pyx_t_1 = __pyx_f_3epr_7Product_check_closed_product(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2534; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "epr.pyx":2535
 *         def __get__(self):
 *             self.check_closed_product()
 *             return self._ptr.meris_iodd_version             # <<<<<<<<<<<<<<
 * 
 *     def get_scene_width(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->_ptr->meris_iodd_version); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2535; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "epr.pyx":2533
 *         '''For MERIS L1b and RR and FR to provide backward compatibility'''
 * 
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             self.check_closed_product()
 *             return self._ptr.meris_iodd_version
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("epr.Product.meris_iodd_version.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":2537
 *             return self._ptr.meris_iodd_version
 * 
 *     def get_scene_width(self):             # <<<<<<<<<<<<<<
 *         '''get_scene_width(self)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_3epr_7Product_11get_scene_width(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_3epr_7Product_10get_scene_width[] = "get_scene_width(self)\n\n        Gets the product's scene width in pixels\n\n        ";
static PyObject *__pyx_pw_3epr_7Product_11get_scene_width(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_scene_width (wrapper)", 0);
  __pyx_r = __pyx_pf_3epr_7Product_10get_scene_width(((struct __pyx_obj_3epr_Product *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_3epr_7Product_10get_scene_width(struct __pyx_obj_3epr_Product *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_scene_width", 0);

  /* "epr.pyx":2544
 *         '''
 * 
 *         self.check_closed_product()             # <<<<<<<<<<<<<<
 *         return epr_get_scene_width(self._ptr)
 * 
 */
  __pyx_t_1 = __pyx_f_3epr_7Product_check_closed_product(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2544; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "epr.pyx":2545
 * 
 *         self.check_closed_product()
 *         return epr_get_scene_width(self._ptr)             # <<<<<<<<<<<<<<
 * 
 *     def get_scene_height(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_uint(epr_get_scene_width(__pyx_v_self->_ptr)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2545; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "epr.pyx":2537
 *             return self._ptr.meris_iodd_version
 * 
 *     def get_scene_width(self):             # <<<<<<<<<<<<<<
 *         '''get_scene_width(self)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("epr.Product.get_scene_width", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":2547
 *         return epr_get_scene_width(self._ptr)
 * 
 *     def get_scene_height(self):             # <<<<<<<<<<<<<<
 *         '''get_scene_height(self)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_3epr_7Product_13get_scene_height(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_3epr_7Product_12get_scene_height[] = "get_scene_height(self)\n\n        Gets the product's scene height in pixels\n\n        ";
static PyObject *__pyx_pw_3epr_7Product_13get_scene_height(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_scene_height (wrapper)", 0);
  __pyx_r = __pyx_pf_3epr_7Product_12get_scene_height(((struct __pyx_obj_3epr_Product *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_3epr_7Product_12get_scene_height(struct __pyx_obj_3epr_Product *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_scene_height", 0);

  /* "epr.pyx":2554
 *         '''
 * 
 *         self.check_closed_product()             # <<<<<<<<<<<<<<
 *         return epr_get_scene_height(self._ptr)
 * 
 */
  __pyx_t_1 = __pyx_f_3epr_7Product_check_closed_product(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2554; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "epr.pyx":2555
 * 
 *         self.check_closed_product()
 *         return epr_get_scene_height(self._ptr)             # <<<<<<<<<<<<<<
 * 
 *     def get_num_datasets(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_uint(epr_get_scene_height(__pyx_v_self->_ptr)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2555; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "epr.pyx":2547
 *         return epr_get_scene_width(self._ptr)
 * 
 *     def get_scene_height(self):             # <<<<<<<<<<<<<<
 *         '''get_scene_height(self)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("epr.Product.get_scene_height", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":2557
 *         return epr_get_scene_height(self._ptr)
 * 
 *     def get_num_datasets(self):             # <<<<<<<<<<<<<<
 *         '''get_num_datasets(self)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_3epr_7Product_15get_num_datasets(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_3epr_7Product_14get_num_datasets[] = "get_num_datasets(self)\n\n        Gets the number of all datasets contained in a product\n\n        ";
static PyObject *__pyx_pw_3epr_7Product_15get_num_datasets(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_num_datasets (wrapper)", 0);
  __pyx_r = __pyx_pf_3epr_7Product_14get_num_datasets(((struct __pyx_obj_3epr_Product *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_3epr_7Product_14get_num_datasets(struct __pyx_obj_3epr_Product *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_num_datasets", 0);

  /* "epr.pyx":2564
 *         '''
 * 
 *         self.check_closed_product()             # <<<<<<<<<<<<<<
 *         return epr_get_num_datasets(self._ptr)
 * 
 */
  __pyx_t_1 = __pyx_f_3epr_7Product_check_closed_product(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2564; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "epr.pyx":2565
 * 
 *         self.check_closed_product()
 *         return epr_get_num_datasets(self._ptr)             # <<<<<<<<<<<<<<
 * 
 *     def get_num_dsds(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_uint(epr_get_num_datasets(__pyx_v_self->_ptr)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2565; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "epr.pyx":2557
 *         return epr_get_scene_height(self._ptr)
 * 
 *     def get_num_datasets(self):             # <<<<<<<<<<<<<<
 *         '''get_num_datasets(self)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("epr.Product.get_num_datasets", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":2567
 *         return epr_get_num_datasets(self._ptr)
 * 
 *     def get_num_dsds(self):             # <<<<<<<<<<<<<<
 *         '''get_num_dsds(self)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_3epr_7Product_17get_num_dsds(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_3epr_7Product_16get_num_dsds[] = "get_num_dsds(self)\n\n        Gets the number of all :class:`DSD`\\ s\n\n        Gets the number of all :class:`DSD`\\ s (dataset descriptors)\n        contained in the product\n\n        ";
static PyObject *__pyx_pw_3epr_7Product_17get_num_dsds(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_num_dsds (wrapper)", 0);
  __pyx_r = __pyx_pf_3epr_7Product_16get_num_dsds(((struct __pyx_obj_3epr_Product *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_3epr_7Product_16get_num_dsds(struct __pyx_obj_3epr_Product *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_num_dsds", 0);

  /* "epr.pyx":2577
 *         '''
 * 
 *         self.check_closed_product()             # <<<<<<<<<<<<<<
 *         return epr_get_num_dsds(self._ptr)
 * 
 */
  __pyx_t_1 = __pyx_f_3epr_7Product_check_closed_product(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2577; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "epr.pyx":2578
 * 
 *         self.check_closed_product()
 *         return epr_get_num_dsds(self._ptr)             # <<<<<<<<<<<<<<
 * 
 *     def get_num_bands(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_uint(epr_get_num_dsds(__pyx_v_self->_ptr)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2578; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "epr.pyx":2567
 *         return epr_get_num_datasets(self._ptr)
 * 
 *     def get_num_dsds(self):             # <<<<<<<<<<<<<<
 *         '''get_num_dsds(self)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("epr.Product.get_num_dsds", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":2580
 *         return epr_get_num_dsds(self._ptr)
 * 
 *     def get_num_bands(self):             # <<<<<<<<<<<<<<
 *         '''get_num_bands(self)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_3epr_7Product_19get_num_bands(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_3epr_7Product_18get_num_bands[] = "get_num_bands(self)\n\n        Gets the number of all bands contained in a product\n\n        ";
static PyObject *__pyx_pw_3epr_7Product_19get_num_bands(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_num_bands (wrapper)", 0);
  __pyx_r = __pyx_pf_3epr_7Product_18get_num_bands(((struct __pyx_obj_3epr_Product *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_3epr_7Product_18get_num_bands(struct __pyx_obj_3epr_Product *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_num_bands", 0);

  /* "epr.pyx":2587
 *         '''
 * 
 *         self.check_closed_product()             # <<<<<<<<<<<<<<
 *         return epr_get_num_bands(self._ptr)
 * 
 */
  __pyx_t_1 = __pyx_f_3epr_7Product_check_closed_product(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2587; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "epr.pyx":2588
 * 
 *         self.check_closed_product()
 *         return epr_get_num_bands(self._ptr)             # <<<<<<<<<<<<<<
 * 
 *     def get_dataset_at(self, uint index):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_uint(epr_get_num_bands(__pyx_v_self->_ptr)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2588; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "epr.pyx":2580
 *         return epr_get_num_dsds(self._ptr)
 * 
 *     def get_num_bands(self):             # <<<<<<<<<<<<<<
 *         '''get_num_bands(self)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("epr.Product.get_num_bands", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":2590
 *         return epr_get_num_bands(self._ptr)
 * 
 *     def get_dataset_at(self, uint index):             # <<<<<<<<<<<<<<
 *         '''get_dataset_at(self, index)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_3epr_7Product_21get_dataset_at(PyObject *__pyx_v_self, PyObject *__pyx_arg_index); /*proto*/
static char __pyx_doc_3epr_7Product_20get_dataset_at[] = "get_dataset_at(self, index)\n\n        Gets the dataset at the specified position within the product\n\n        :param index:\n            the index identifying the position of the dataset, starting\n            with 0, must not be negative\n        :returns:\n            the requested :class:`Dataset`\n\n        ";
static PyObject *__pyx_pw_3epr_7Product_21get_dataset_at(PyObject *__pyx_v_self, PyObject *__pyx_arg_index) {
  uint __pyx_v_index;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_dataset_at (wrapper)", 0);
  assert(__pyx_arg_index); {
    __pyx_v_index = __Pyx_PyInt_As_uint(__pyx_arg_index); if (unlikely((__pyx_v_index == (uint)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2590; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("epr.Product.get_dataset_at", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_3epr_7Product_20get_dataset_at(((struct __pyx_obj_3epr_Product *)__pyx_v_self), ((uint)__pyx_v_index));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_3epr_7Product_20get_dataset_at(struct __pyx_obj_3epr_Product *__pyx_v_self, uint __pyx_v_index) {
  EPR_SDatasetId *__pyx_v_dataset_id;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  struct __pyx_opt_args_3epr_pyepr_null_ptr_error __pyx_t_4;
  struct __pyx_opt_args_3epr_new_dataset __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_dataset_at", 0);

  /* "epr.pyx":2604
 * 
 *         cdef EPR_SDatasetId* dataset_id
 *         dataset_id = epr_get_dataset_id_at(self._ptr, index)             # <<<<<<<<<<<<<<
 *         if dataset_id is NULL:
 *             pyepr_null_ptr_error('unable to get dataset at index %d' % index)
 */
  __pyx_v_dataset_id = epr_get_dataset_id_at(__pyx_v_self->_ptr, __pyx_v_index);

  /* "epr.pyx":2605
 *         cdef EPR_SDatasetId* dataset_id
 *         dataset_id = epr_get_dataset_id_at(self._ptr, index)
 *         if dataset_id is NULL:             # <<<<<<<<<<<<<<
 *             pyepr_null_ptr_error('unable to get dataset at index %d' % index)
 * 
 */
  __pyx_t_1 = ((__pyx_v_dataset_id == NULL) != 0);
  if (__pyx_t_1) {

    /* "epr.pyx":2606
 *         dataset_id = epr_get_dataset_id_at(self._ptr, index)
 *         if dataset_id is NULL:
 *             pyepr_null_ptr_error('unable to get dataset at index %d' % index)             # <<<<<<<<<<<<<<
 * 
 *         return new_dataset(dataset_id, self)
 */
    __pyx_t_2 = __Pyx_PyInt_From_uint(__pyx_v_index); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2606; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_unable_to_get_dataset_at_index_d, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2606; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_4.__pyx_n = 1;
    __pyx_t_4.msg = __pyx_t_3;
    __pyx_t_2 = __pyx_f_3epr_pyepr_null_ptr_error(&__pyx_t_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2606; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "epr.pyx":2608
 *             pyepr_null_ptr_error('unable to get dataset at index %d' % index)
 * 
 *         return new_dataset(dataset_id, self)             # <<<<<<<<<<<<<<
 * 
 *     def get_dataset(self, name):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_5.__pyx_n = 1;
  __pyx_t_5.parent = __pyx_v_self;
  __pyx_t_2 = __pyx_f_3epr_new_dataset(__pyx_v_dataset_id, &__pyx_t_5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2608; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "epr.pyx":2590
 *         return epr_get_num_bands(self._ptr)
 * 
 *     def get_dataset_at(self, uint index):             # <<<<<<<<<<<<<<
 *         '''get_dataset_at(self, index)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("epr.Product.get_dataset_at", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":2610
 *         return new_dataset(dataset_id, self)
 * 
 *     def get_dataset(self, name):             # <<<<<<<<<<<<<<
 *         '''get_dataset(self, name)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_3epr_7Product_23get_dataset(PyObject *__pyx_v_self, PyObject *__pyx_v_name); /*proto*/
static char __pyx_doc_3epr_7Product_22get_dataset[] = "get_dataset(self, name)\n\n        Gets the dataset corresponding to the specified dataset name\n\n        :param name:\n            the dataset name\n        :returns:\n            the requested :class:`Dataset` instance\n\n        ";
static PyObject *__pyx_pw_3epr_7Product_23get_dataset(PyObject *__pyx_v_self, PyObject *__pyx_v_name) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_dataset (wrapper)", 0);
  __pyx_r = __pyx_pf_3epr_7Product_22get_dataset(((struct __pyx_obj_3epr_Product *)__pyx_v_self), ((PyObject *)__pyx_v_name));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_3epr_7Product_22get_dataset(struct __pyx_obj_3epr_Product *__pyx_v_self, PyObject *__pyx_v_name) {
  EPR_SDatasetId *__pyx_v_dataset_id;
  PyObject *__pyx_v_cname = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  char *__pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  struct __pyx_opt_args_3epr_pyepr_null_ptr_error __pyx_t_5;
  struct __pyx_opt_args_3epr_new_dataset __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_dataset", 0);

  /* "epr.pyx":2623
 * 
 *         cdef EPR_SDatasetId* dataset_id
 *         cdef bytes cname = _to_bytes(name)             # <<<<<<<<<<<<<<
 *         dataset_id = epr_get_dataset_id(self._ptr, cname)
 *         if dataset_id is NULL:
 */
  __pyx_t_1 = __pyx_f_3epr__to_bytes(__pyx_v_name, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2623; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_cname = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "epr.pyx":2624
 *         cdef EPR_SDatasetId* dataset_id
 *         cdef bytes cname = _to_bytes(name)
 *         dataset_id = epr_get_dataset_id(self._ptr, cname)             # <<<<<<<<<<<<<<
 *         if dataset_id is NULL:
 *             pyepr_null_ptr_error(r'unable to get dataset "%s"' % name)
 */
  __pyx_t_2 = __Pyx_PyObject_AsString(__pyx_v_cname); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2624; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_dataset_id = epr_get_dataset_id(__pyx_v_self->_ptr, __pyx_t_2);

  /* "epr.pyx":2625
 *         cdef bytes cname = _to_bytes(name)
 *         dataset_id = epr_get_dataset_id(self._ptr, cname)
 *         if dataset_id is NULL:             # <<<<<<<<<<<<<<
 *             pyepr_null_ptr_error(r'unable to get dataset "%s"' % name)
 * 
 */
  __pyx_t_3 = ((__pyx_v_dataset_id == NULL) != 0);
  if (__pyx_t_3) {

    /* "epr.pyx":2626
 *         dataset_id = epr_get_dataset_id(self._ptr, cname)
 *         if dataset_id is NULL:
 *             pyepr_null_ptr_error(r'unable to get dataset "%s"' % name)             # <<<<<<<<<<<<<<
 * 
 *         return new_dataset(dataset_id, self)
 */
    __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_unable_to_get_dataset_s, __pyx_v_name); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2626; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5.__pyx_n = 1;
    __pyx_t_5.msg = __pyx_t_1;
    __pyx_t_4 = __pyx_f_3epr_pyepr_null_ptr_error(&__pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2626; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "epr.pyx":2628
 *             pyepr_null_ptr_error(r'unable to get dataset "%s"' % name)
 * 
 *         return new_dataset(dataset_id, self)             # <<<<<<<<<<<<<<
 * 
 *     def get_dsd_at(self, uint index):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_6.__pyx_n = 1;
  __pyx_t_6.parent = __pyx_v_self;
  __pyx_t_4 = __pyx_f_3epr_new_dataset(__pyx_v_dataset_id, &__pyx_t_6); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2628; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "epr.pyx":2610
 *         return new_dataset(dataset_id, self)
 * 
 *     def get_dataset(self, name):             # <<<<<<<<<<<<<<
 *         '''get_dataset(self, name)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("epr.Product.get_dataset", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_cname);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":2630
 *         return new_dataset(dataset_id, self)
 * 
 *     def get_dsd_at(self, uint index):             # <<<<<<<<<<<<<<
 *         '''get_dsd_at(self, index)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_3epr_7Product_25get_dsd_at(PyObject *__pyx_v_self, PyObject *__pyx_arg_index); /*proto*/
static char __pyx_doc_3epr_7Product_24get_dsd_at[] = "get_dsd_at(self, index)\n\n        Gets the :class:`DSD` at the specified position\n\n        Gets the :class:`DSD` (dataset descriptor) at the specified\n        position within the product.\n\n        :param index:\n            the index identifying the position of the :class:`DSD`,\n            starting with 0, must not be negative\n        :returns:\n            the requested :class:`DSD` instance\n\n        ";
static PyObject *__pyx_pw_3epr_7Product_25get_dsd_at(PyObject *__pyx_v_self, PyObject *__pyx_arg_index) {
  uint __pyx_v_index;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_dsd_at (wrapper)", 0);
  assert(__pyx_arg_index); {
    __pyx_v_index = __Pyx_PyInt_As_uint(__pyx_arg_index); if (unlikely((__pyx_v_index == (uint)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2630; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("epr.Product.get_dsd_at", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_3epr_7Product_24get_dsd_at(((struct __pyx_obj_3epr_Product *)__pyx_v_self), ((uint)__pyx_v_index));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_3epr_7Product_24get_dsd_at(struct __pyx_obj_3epr_Product *__pyx_v_self, uint __pyx_v_index) {
  EPR_SDSD *__pyx_v_dsd_ptr;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  struct __pyx_opt_args_3epr_pyepr_null_ptr_error __pyx_t_4;
  struct __pyx_opt_args_3epr_new_dsd __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_dsd_at", 0);

  /* "epr.pyx":2648
 *         cdef EPR_SDSD* dsd_ptr
 * 
 *         self.check_closed_product()             # <<<<<<<<<<<<<<
 * 
 *         dsd_ptr = epr_get_dsd_at(self._ptr, index)
 */
  __pyx_t_1 = __pyx_f_3epr_7Product_check_closed_product(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2648; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "epr.pyx":2650
 *         self.check_closed_product()
 * 
 *         dsd_ptr = epr_get_dsd_at(self._ptr, index)             # <<<<<<<<<<<<<<
 *         if dsd_ptr is NULL:
 *             pyepr_null_ptr_error('unable to get DSD at index "%d"' % index)
 */
  __pyx_v_dsd_ptr = epr_get_dsd_at(__pyx_v_self->_ptr, __pyx_v_index);

  /* "epr.pyx":2651
 * 
 *         dsd_ptr = epr_get_dsd_at(self._ptr, index)
 *         if dsd_ptr is NULL:             # <<<<<<<<<<<<<<
 *             pyepr_null_ptr_error('unable to get DSD at index "%d"' % index)
 * 
 */
  __pyx_t_2 = ((__pyx_v_dsd_ptr == NULL) != 0);
  if (__pyx_t_2) {

    /* "epr.pyx":2652
 *         dsd_ptr = epr_get_dsd_at(self._ptr, index)
 *         if dsd_ptr is NULL:
 *             pyepr_null_ptr_error('unable to get DSD at index "%d"' % index)             # <<<<<<<<<<<<<<
 * 
 *         return new_dsd(dsd_ptr, self)
 */
    __pyx_t_1 = __Pyx_PyInt_From_uint(__pyx_v_index); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2652; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_unable_to_get_DSD_at_index_d, __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2652; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_4.__pyx_n = 1;
    __pyx_t_4.msg = __pyx_t_3;
    __pyx_t_1 = __pyx_f_3epr_pyepr_null_ptr_error(&__pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2652; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "epr.pyx":2654
 *             pyepr_null_ptr_error('unable to get DSD at index "%d"' % index)
 * 
 *         return new_dsd(dsd_ptr, self)             # <<<<<<<<<<<<<<
 * 
 *     def get_mph(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_5.__pyx_n = 1;
  __pyx_t_5.parent = ((PyObject *)__pyx_v_self);
  __pyx_t_1 = __pyx_f_3epr_new_dsd(__pyx_v_dsd_ptr, &__pyx_t_5); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2654; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "epr.pyx":2630
 *         return new_dataset(dataset_id, self)
 * 
 *     def get_dsd_at(self, uint index):             # <<<<<<<<<<<<<<
 *         '''get_dsd_at(self, index)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("epr.Product.get_dsd_at", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":2656
 *         return new_dsd(dsd_ptr, self)
 * 
 *     def get_mph(self):             # <<<<<<<<<<<<<<
 *         '''get_mph(self)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_3epr_7Product_27get_mph(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_3epr_7Product_26get_mph[] = "get_mph(self)\n\n        The main product header (MPH) :class:`Record`\n\n        ";
static PyObject *__pyx_pw_3epr_7Product_27get_mph(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_mph (wrapper)", 0);
  __pyx_r = __pyx_pf_3epr_7Product_26get_mph(((struct __pyx_obj_3epr_Product *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_3epr_7Product_26get_mph(struct __pyx_obj_3epr_Product *__pyx_v_self) {
  EPR_SRecord *__pyx_v_record_ptr;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  struct __pyx_opt_args_3epr_pyepr_null_ptr_error __pyx_t_3;
  struct __pyx_opt_args_3epr_new_record __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_mph", 0);

  /* "epr.pyx":2664
 * 
 *         cdef EPR_SRecord* record_ptr
 *         record_ptr = epr_get_mph(self._ptr)             # <<<<<<<<<<<<<<
 *         if record_ptr is NULL:
 *             pyepr_null_ptr_error('unable to get MPH record')
 */
  __pyx_v_record_ptr = epr_get_mph(__pyx_v_self->_ptr);

  /* "epr.pyx":2665
 *         cdef EPR_SRecord* record_ptr
 *         record_ptr = epr_get_mph(self._ptr)
 *         if record_ptr is NULL:             # <<<<<<<<<<<<<<
 *             pyepr_null_ptr_error('unable to get MPH record')
 * 
 */
  __pyx_t_1 = ((__pyx_v_record_ptr == NULL) != 0);
  if (__pyx_t_1) {

    /* "epr.pyx":2666
 *         record_ptr = epr_get_mph(self._ptr)
 *         if record_ptr is NULL:
 *             pyepr_null_ptr_error('unable to get MPH record')             # <<<<<<<<<<<<<<
 * 
 *         return new_record(record_ptr, self, False)
 */
    __pyx_t_3.__pyx_n = 1;
    __pyx_t_3.msg = __pyx_kp_s_unable_to_get_MPH_record;
    __pyx_t_2 = __pyx_f_3epr_pyepr_null_ptr_error(&__pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2666; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "epr.pyx":2668
 *             pyepr_null_ptr_error('unable to get MPH record')
 * 
 *         return new_record(record_ptr, self, False)             # <<<<<<<<<<<<<<
 * 
 *     def get_sph(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_4.__pyx_n = 2;
  __pyx_t_4.parent = ((PyObject *)__pyx_v_self);
  __pyx_t_4.dealloc = 0;
  __pyx_t_2 = __pyx_f_3epr_new_record(__pyx_v_record_ptr, &__pyx_t_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2668; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "epr.pyx":2656
 *         return new_dsd(dsd_ptr, self)
 * 
 *     def get_mph(self):             # <<<<<<<<<<<<<<
 *         '''get_mph(self)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("epr.Product.get_mph", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":2670
 *         return new_record(record_ptr, self, False)
 * 
 *     def get_sph(self):             # <<<<<<<<<<<<<<
 *         '''get_sph(self)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_3epr_7Product_29get_sph(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_3epr_7Product_28get_sph[] = "get_sph(self)\n\n        The specific product header (SPH) :class:`Record`\n\n        ";
static PyObject *__pyx_pw_3epr_7Product_29get_sph(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_sph (wrapper)", 0);
  __pyx_r = __pyx_pf_3epr_7Product_28get_sph(((struct __pyx_obj_3epr_Product *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_3epr_7Product_28get_sph(struct __pyx_obj_3epr_Product *__pyx_v_self) {
  EPR_SRecord *__pyx_v_record_ptr;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  struct __pyx_opt_args_3epr_pyepr_null_ptr_error __pyx_t_3;
  struct __pyx_opt_args_3epr_new_record __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_sph", 0);

  /* "epr.pyx":2678
 * 
 *         cdef EPR_SRecord* record_ptr
 *         record_ptr = epr_get_sph(self._ptr)             # <<<<<<<<<<<<<<
 *         if record_ptr is NULL:
 *             pyepr_null_ptr_error('unable to get SPH record')
 */
  __pyx_v_record_ptr = epr_get_sph(__pyx_v_self->_ptr);

  /* "epr.pyx":2679
 *         cdef EPR_SRecord* record_ptr
 *         record_ptr = epr_get_sph(self._ptr)
 *         if record_ptr is NULL:             # <<<<<<<<<<<<<<
 *             pyepr_null_ptr_error('unable to get SPH record')
 * 
 */
  __pyx_t_1 = ((__pyx_v_record_ptr == NULL) != 0);
  if (__pyx_t_1) {

    /* "epr.pyx":2680
 *         record_ptr = epr_get_sph(self._ptr)
 *         if record_ptr is NULL:
 *             pyepr_null_ptr_error('unable to get SPH record')             # <<<<<<<<<<<<<<
 * 
 *         return new_record(record_ptr, self, False)
 */
    __pyx_t_3.__pyx_n = 1;
    __pyx_t_3.msg = __pyx_kp_s_unable_to_get_SPH_record;
    __pyx_t_2 = __pyx_f_3epr_pyepr_null_ptr_error(&__pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2680; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "epr.pyx":2682
 *             pyepr_null_ptr_error('unable to get SPH record')
 * 
 *         return new_record(record_ptr, self, False)             # <<<<<<<<<<<<<<
 * 
 *     def get_band(self, name):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_4.__pyx_n = 2;
  __pyx_t_4.parent = ((PyObject *)__pyx_v_self);
  __pyx_t_4.dealloc = 0;
  __pyx_t_2 = __pyx_f_3epr_new_record(__pyx_v_record_ptr, &__pyx_t_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2682; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "epr.pyx":2670
 *         return new_record(record_ptr, self, False)
 * 
 *     def get_sph(self):             # <<<<<<<<<<<<<<
 *         '''get_sph(self)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("epr.Product.get_sph", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":2684
 *         return new_record(record_ptr, self, False)
 * 
 *     def get_band(self, name):             # <<<<<<<<<<<<<<
 *         '''get_band(self, name)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_3epr_7Product_31get_band(PyObject *__pyx_v_self, PyObject *__pyx_v_name); /*proto*/
static char __pyx_doc_3epr_7Product_30get_band[] = "get_band(self, name)\n\n        Gets the band corresponding to the specified name.\n\n        :param name:\n            the name of the band\n        :returns:\n            the requested :class:`Band` instance, or raises a\n            :exc:`EPRValueError` if not found\n\n        ";
static PyObject *__pyx_pw_3epr_7Product_31get_band(PyObject *__pyx_v_self, PyObject *__pyx_v_name) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_band (wrapper)", 0);
  __pyx_r = __pyx_pf_3epr_7Product_30get_band(((struct __pyx_obj_3epr_Product *)__pyx_v_self), ((PyObject *)__pyx_v_name));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_3epr_7Product_30get_band(struct __pyx_obj_3epr_Product *__pyx_v_self, PyObject *__pyx_v_name) {
  EPR_SBandId *__pyx_v_band_id;
  PyObject *__pyx_v_cname = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  char *__pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  struct __pyx_opt_args_3epr_pyepr_null_ptr_error __pyx_t_5;
  struct __pyx_opt_args_3epr_new_band __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_band", 0);

  /* "epr.pyx":2698
 * 
 *         cdef EPR_SBandId* band_id
 *         cdef bytes cname = _to_bytes(name)             # <<<<<<<<<<<<<<
 *         band_id = epr_get_band_id(self._ptr, cname)
 *         if band_id is NULL:
 */
  __pyx_t_1 = __pyx_f_3epr__to_bytes(__pyx_v_name, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2698; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_cname = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "epr.pyx":2699
 *         cdef EPR_SBandId* band_id
 *         cdef bytes cname = _to_bytes(name)
 *         band_id = epr_get_band_id(self._ptr, cname)             # <<<<<<<<<<<<<<
 *         if band_id is NULL:
 *             pyepr_null_ptr_error('unable to get band "%s"' % name)
 */
  __pyx_t_2 = __Pyx_PyObject_AsString(__pyx_v_cname); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2699; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_band_id = epr_get_band_id(__pyx_v_self->_ptr, __pyx_t_2);

  /* "epr.pyx":2700
 *         cdef bytes cname = _to_bytes(name)
 *         band_id = epr_get_band_id(self._ptr, cname)
 *         if band_id is NULL:             # <<<<<<<<<<<<<<
 *             pyepr_null_ptr_error('unable to get band "%s"' % name)
 * 
 */
  __pyx_t_3 = ((__pyx_v_band_id == NULL) != 0);
  if (__pyx_t_3) {

    /* "epr.pyx":2701
 *         band_id = epr_get_band_id(self._ptr, cname)
 *         if band_id is NULL:
 *             pyepr_null_ptr_error('unable to get band "%s"' % name)             # <<<<<<<<<<<<<<
 * 
 *         return new_band(band_id, self)
 */
    __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_unable_to_get_band_s, __pyx_v_name); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2701; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5.__pyx_n = 1;
    __pyx_t_5.msg = __pyx_t_1;
    __pyx_t_4 = __pyx_f_3epr_pyepr_null_ptr_error(&__pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2701; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "epr.pyx":2703
 *             pyepr_null_ptr_error('unable to get band "%s"' % name)
 * 
 *         return new_band(band_id, self)             # <<<<<<<<<<<<<<
 * 
 *     def get_band_at(self, uint index):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_6.__pyx_n = 1;
  __pyx_t_6.parent = __pyx_v_self;
  __pyx_t_4 = __pyx_f_3epr_new_band(__pyx_v_band_id, &__pyx_t_6); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2703; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "epr.pyx":2684
 *         return new_record(record_ptr, self, False)
 * 
 *     def get_band(self, name):             # <<<<<<<<<<<<<<
 *         '''get_band(self, name)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("epr.Product.get_band", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_cname);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":2705
 *         return new_band(band_id, self)
 * 
 *     def get_band_at(self, uint index):             # <<<<<<<<<<<<<<
 *         '''get_band_at(self, index)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_3epr_7Product_33get_band_at(PyObject *__pyx_v_self, PyObject *__pyx_arg_index); /*proto*/
static char __pyx_doc_3epr_7Product_32get_band_at[] = "get_band_at(self, index)\n\n        Gets the band at the specified position within the product\n\n        :param index:\n            the index identifying the position of the band, starting\n            with 0, must not be negative\n        :returns:\n            the requested :class:`Band` instance, or raises a\n            :exc:`EPRValueError` if not found\n\n        ";
static PyObject *__pyx_pw_3epr_7Product_33get_band_at(PyObject *__pyx_v_self, PyObject *__pyx_arg_index) {
  uint __pyx_v_index;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_band_at (wrapper)", 0);
  assert(__pyx_arg_index); {
    __pyx_v_index = __Pyx_PyInt_As_uint(__pyx_arg_index); if (unlikely((__pyx_v_index == (uint)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2705; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("epr.Product.get_band_at", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_3epr_7Product_32get_band_at(((struct __pyx_obj_3epr_Product *)__pyx_v_self), ((uint)__pyx_v_index));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_3epr_7Product_32get_band_at(struct __pyx_obj_3epr_Product *__pyx_v_self, uint __pyx_v_index) {
  EPR_SBandId *__pyx_v_band_id;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  struct __pyx_opt_args_3epr_pyepr_null_ptr_error __pyx_t_4;
  struct __pyx_opt_args_3epr_new_band __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_band_at", 0);

  /* "epr.pyx":2720
 * 
 *         cdef EPR_SBandId* band_id
 *         band_id = epr_get_band_id_at(self._ptr, index)             # <<<<<<<<<<<<<<
 *         if band_id is NULL:
 *             pyepr_null_ptr_error('unable to get band at index "%d"' % index)
 */
  __pyx_v_band_id = epr_get_band_id_at(__pyx_v_self->_ptr, __pyx_v_index);

  /* "epr.pyx":2721
 *         cdef EPR_SBandId* band_id
 *         band_id = epr_get_band_id_at(self._ptr, index)
 *         if band_id is NULL:             # <<<<<<<<<<<<<<
 *             pyepr_null_ptr_error('unable to get band at index "%d"' % index)
 * 
 */
  __pyx_t_1 = ((__pyx_v_band_id == NULL) != 0);
  if (__pyx_t_1) {

    /* "epr.pyx":2722
 *         band_id = epr_get_band_id_at(self._ptr, index)
 *         if band_id is NULL:
 *             pyepr_null_ptr_error('unable to get band at index "%d"' % index)             # <<<<<<<<<<<<<<
 * 
 *         return new_band(band_id, self)
 */
    __pyx_t_2 = __Pyx_PyInt_From_uint(__pyx_v_index); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2722; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_unable_to_get_band_at_index_d, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2722; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_4.__pyx_n = 1;
    __pyx_t_4.msg = __pyx_t_3;
    __pyx_t_2 = __pyx_f_3epr_pyepr_null_ptr_error(&__pyx_t_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2722; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "epr.pyx":2724
 *             pyepr_null_ptr_error('unable to get band at index "%d"' % index)
 * 
 *         return new_band(band_id, self)             # <<<<<<<<<<<<<<
 * 
 *     def read_bitmask_raster(self, bm_expr, int xoffset, int yoffset,
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_5.__pyx_n = 1;
  __pyx_t_5.parent = __pyx_v_self;
  __pyx_t_2 = __pyx_f_3epr_new_band(__pyx_v_band_id, &__pyx_t_5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "epr.pyx":2705
 *         return new_band(band_id, self)
 * 
 *     def get_band_at(self, uint index):             # <<<<<<<<<<<<<<
 *         '''get_band_at(self, index)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("epr.Product.get_band_at", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":2726
 *         return new_band(band_id, self)
 * 
 *     def read_bitmask_raster(self, bm_expr, int xoffset, int yoffset,             # <<<<<<<<<<<<<<
 *                             Raster raster not None):
 *         '''read_bitmask_raster(self, bm_expr, xoffset, yoffset, raster)
 */

/* Python wrapper */
static PyObject *__pyx_pw_3epr_7Product_35read_bitmask_raster(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_3epr_7Product_34read_bitmask_raster[] = "read_bitmask_raster(self, bm_expr, xoffset, yoffset, raster)\n\n        Calculates a bit-mask raster\n\n        Calculates a bit-mask, composed of flags of the given product\n        and combined as described in the given bit-mask expression, for\n        the a certain dimension and sub-sampling as defined in the\n        given raster.\n\n        :param bm_expr:\n            a string holding the logical expression for the definition\n            of the bit-mask. In a bit-mask expression, any number of\n            the flag-names (found in the DDDB) can be composed with\n            \"(\", \")\", \"NOT\", \"AND\", \"OR\". Valid bit-mask expression are\n            for example ``flags.LAND OR flags.CLOUD`` or\n            ``NOT flags.WATER AND flags.TURBID_S``\n\n       :param xoffset:\n            across-track co-ordinate in pixel co-ordinates (zero-based)\n            of the upper right corner of the source-region\n       :param yoffset:\n            along-track co-ordinate in pixel co-ordinates (zero-based)\n            of the upper right corner of the source-region\n       :param raster:\n            the raster for the bit-mask. The data type of the raster\n            must be either e_tid_uchar or e_tid_char\n        :returns:\n            zero for success, an error code otherwise\n\n        .. seealso:: :func:`epr.create_bitmask_raster`\n\n        ";
static PyObject *__pyx_pw_3epr_7Product_35read_bitmask_raster(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_bm_expr = 0;
  int __pyx_v_xoffset;
  int __pyx_v_yoffset;
  struct __pyx_obj_3epr_Raster *__pyx_v_raster = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("read_bitmask_raster (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_bm_expr,&__pyx_n_s_xoffset,&__pyx_n_s_yoffset,&__pyx_n_s_raster,0};
    PyObject* values[4] = {0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_bm_expr)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_xoffset)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("read_bitmask_raster", 1, 4, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2726; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_yoffset)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("read_bitmask_raster", 1, 4, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2726; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_raster)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("read_bitmask_raster", 1, 4, 4, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2726; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "read_bitmask_raster") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2726; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
    }
    __pyx_v_bm_expr = values[0];
    __pyx_v_xoffset = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_xoffset == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2726; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_yoffset = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_yoffset == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2726; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_raster = ((struct __pyx_obj_3epr_Raster *)values[3]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("read_bitmask_raster", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2726; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("epr.Product.read_bitmask_raster", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_raster), __pyx_ptype_3epr_Raster, 0, "raster", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2727; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_3epr_7Product_34read_bitmask_raster(((struct __pyx_obj_3epr_Product *)__pyx_v_self), __pyx_v_bm_expr, __pyx_v_xoffset, __pyx_v_yoffset, __pyx_v_raster);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_3epr_7Product_34read_bitmask_raster(struct __pyx_obj_3epr_Product *__pyx_v_self, PyObject *__pyx_v_bm_expr, int __pyx_v_xoffset, int __pyx_v_yoffset, struct __pyx_obj_3epr_Raster *__pyx_v_raster) {
  PyObject *__pyx_v_c_bm_expr = 0;
  int __pyx_v_ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  char *__pyx_t_2;
  int __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("read_bitmask_raster", 0);

  /* "epr.pyx":2761
 *         '''
 * 
 *         cdef bytes c_bm_expr = _to_bytes(bm_expr)             # <<<<<<<<<<<<<<
 *         cdef int ret = 0
 * 
 */
  __pyx_t_1 = __pyx_f_3epr__to_bytes(__pyx_v_bm_expr, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2761; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_c_bm_expr = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "epr.pyx":2762
 * 
 *         cdef bytes c_bm_expr = _to_bytes(bm_expr)
 *         cdef int ret = 0             # <<<<<<<<<<<<<<
 * 
 *         self.check_closed_product()
 */
  __pyx_v_ret = 0;

  /* "epr.pyx":2764
 *         cdef int ret = 0
 * 
 *         self.check_closed_product()             # <<<<<<<<<<<<<<
 * 
 *         ret = epr_read_bitmask_raster(self._ptr, c_bm_expr,
 */
  __pyx_t_1 = __pyx_f_3epr_7Product_check_closed_product(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2764; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "epr.pyx":2766
 *         self.check_closed_product()
 * 
 *         ret = epr_read_bitmask_raster(self._ptr, c_bm_expr,             # <<<<<<<<<<<<<<
 *                                       xoffset, yoffset,
 *                                       (<Raster>raster)._ptr)
 */
  __pyx_t_2 = __Pyx_PyObject_AsString(__pyx_v_c_bm_expr); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2766; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "epr.pyx":2768
 *         ret = epr_read_bitmask_raster(self._ptr, c_bm_expr,
 *                                       xoffset, yoffset,
 *                                       (<Raster>raster)._ptr)             # <<<<<<<<<<<<<<
 *         if ret != 0:
 *             pyepr_check_errors()
 */
  __pyx_v_ret = epr_read_bitmask_raster(__pyx_v_self->_ptr, __pyx_t_2, __pyx_v_xoffset, __pyx_v_yoffset, __pyx_v_raster->_ptr);

  /* "epr.pyx":2769
 *                                       xoffset, yoffset,
 *                                       (<Raster>raster)._ptr)
 *         if ret != 0:             # <<<<<<<<<<<<<<
 *             pyepr_check_errors()
 * 
 */
  __pyx_t_3 = ((__pyx_v_ret != 0) != 0);
  if (__pyx_t_3) {

    /* "epr.pyx":2770
 *                                       (<Raster>raster)._ptr)
 *         if ret != 0:
 *             pyepr_check_errors()             # <<<<<<<<<<<<<<
 * 
 *         return raster
 */
    __pyx_t_1 = __pyx_f_3epr_pyepr_check_errors(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2770; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "epr.pyx":2772
 *             pyepr_check_errors()
 * 
 *         return raster             # <<<<<<<<<<<<<<
 * 
 *     # --- high level interface ------------------------------------------------
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_raster));
  __pyx_r = ((PyObject *)__pyx_v_raster);
  goto __pyx_L0;

  /* "epr.pyx":2726
 *         return new_band(band_id, self)
 * 
 *     def read_bitmask_raster(self, bm_expr, int xoffset, int yoffset,             # <<<<<<<<<<<<<<
 *                             Raster raster not None):
 *         '''read_bitmask_raster(self, bm_expr, xoffset, yoffset, raster)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("epr.Product.read_bitmask_raster", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_c_bm_expr);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":2778
 *         '''True if the :class:`epr.Product` is closed.'''
 * 
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self._ptr is NULL
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_3epr_7Product_6closed_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_3epr_7Product_6closed_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_3epr_7Product_6closed___get__(((struct __pyx_obj_3epr_Product *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_3epr_7Product_6closed___get__(struct __pyx_obj_3epr_Product *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "epr.pyx":2779
 * 
 *         def __get__(self):
 *             return self._ptr is NULL             # <<<<<<<<<<<<<<
 * 
 *     def get_dataset_names(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBool_FromLong((__pyx_v_self->_ptr == NULL)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2779; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "epr.pyx":2778
 *         '''True if the :class:`epr.Product` is closed.'''
 * 
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self._ptr is NULL
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("epr.Product.closed.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":2781
 *             return self._ptr is NULL
 * 
 *     def get_dataset_names(self):             # <<<<<<<<<<<<<<
 *         '''get_dataset_names(self)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_3epr_7Product_37get_dataset_names(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_3epr_7Product_36get_dataset_names[] = "get_dataset_names(self)\n\n        Return the list of names of the datasets in the product\n\n        .. note:: this method has no correspondent in the C API\n\n        ";
static PyObject *__pyx_pw_3epr_7Product_37get_dataset_names(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_dataset_names (wrapper)", 0);
  __pyx_r = __pyx_pf_3epr_7Product_36get_dataset_names(((struct __pyx_obj_3epr_Product *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_3epr_7Product_36get_dataset_names(struct __pyx_obj_3epr_Product *__pyx_v_self) {
  EPR_SDatasetId *__pyx_v_dataset_ptr;
  int __pyx_v_idx;
  char *__pyx_v_name;
  int __pyx_v_num_datasets;
  PyObject *__pyx_v_names = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  struct __pyx_opt_args_3epr__to_str __pyx_t_5;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_dataset_names", 0);

  /* "epr.pyx":2795
 *         cdef int num_datasets
 * 
 *         self.check_closed_product()             # <<<<<<<<<<<<<<
 * 
 *         num_datasets = epr_get_num_datasets(self._ptr)
 */
  __pyx_t_1 = __pyx_f_3epr_7Product_check_closed_product(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2795; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "epr.pyx":2797
 *         self.check_closed_product()
 * 
 *         num_datasets = epr_get_num_datasets(self._ptr)             # <<<<<<<<<<<<<<
 * 
 *         names = []
 */
  __pyx_v_num_datasets = epr_get_num_datasets(__pyx_v_self->_ptr);

  /* "epr.pyx":2799
 *         num_datasets = epr_get_num_datasets(self._ptr)
 * 
 *         names = []             # <<<<<<<<<<<<<<
 *         for idx in range(num_datasets):
 *             dataset_ptr = epr_get_dataset_id_at(self._ptr, idx)
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_names = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "epr.pyx":2800
 * 
 *         names = []
 *         for idx in range(num_datasets):             # <<<<<<<<<<<<<<
 *             dataset_ptr = epr_get_dataset_id_at(self._ptr, idx)
 *             name = <char*>epr_get_dataset_name(dataset_ptr)
 */
  __pyx_t_2 = __pyx_v_num_datasets;
  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
    __pyx_v_idx = __pyx_t_3;

    /* "epr.pyx":2801
 *         names = []
 *         for idx in range(num_datasets):
 *             dataset_ptr = epr_get_dataset_id_at(self._ptr, idx)             # <<<<<<<<<<<<<<
 *             name = <char*>epr_get_dataset_name(dataset_ptr)
 *             names.append(_to_str(name, 'ascii'))
 */
    __pyx_v_dataset_ptr = epr_get_dataset_id_at(__pyx_v_self->_ptr, __pyx_v_idx);

    /* "epr.pyx":2802
 *         for idx in range(num_datasets):
 *             dataset_ptr = epr_get_dataset_id_at(self._ptr, idx)
 *             name = <char*>epr_get_dataset_name(dataset_ptr)             # <<<<<<<<<<<<<<
 *             names.append(_to_str(name, 'ascii'))
 * 
 */
    __pyx_v_name = ((char *)epr_get_dataset_name(__pyx_v_dataset_ptr));

    /* "epr.pyx":2803
 *             dataset_ptr = epr_get_dataset_id_at(self._ptr, idx)
 *             name = <char*>epr_get_dataset_name(dataset_ptr)
 *             names.append(_to_str(name, 'ascii'))             # <<<<<<<<<<<<<<
 * 
 *         return names
 */
    __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_name); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5.__pyx_n = 1;
    __pyx_t_5.encoding = __pyx_n_s_ascii;
    __pyx_t_4 = __pyx_f_3epr__to_str(__pyx_t_1, &__pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_6 = __Pyx_PyList_Append(__pyx_v_names, __pyx_t_4); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }

  /* "epr.pyx":2805
 *             names.append(_to_str(name, 'ascii'))
 * 
 *         return names             # <<<<<<<<<<<<<<
 * 
 *     def get_band_names(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_names);
  __pyx_r = __pyx_v_names;
  goto __pyx_L0;

  /* "epr.pyx":2781
 *             return self._ptr is NULL
 * 
 *     def get_dataset_names(self):             # <<<<<<<<<<<<<<
 *         '''get_dataset_names(self)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("epr.Product.get_dataset_names", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_names);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":2807
 *         return names
 * 
 *     def get_band_names(self):             # <<<<<<<<<<<<<<
 *         '''get_band_names(self)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_3epr_7Product_39get_band_names(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_3epr_7Product_38get_band_names[] = "get_band_names(self)\n\n        Return the list of names of the bands in the product\n\n        .. note:: this method has no correspondent in the C API\n\n        ";
static PyObject *__pyx_pw_3epr_7Product_39get_band_names(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_band_names (wrapper)", 0);
  __pyx_r = __pyx_pf_3epr_7Product_38get_band_names(((struct __pyx_obj_3epr_Product *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_3epr_7Product_38get_band_names(struct __pyx_obj_3epr_Product *__pyx_v_self) {
  EPR_SBandId *__pyx_v_band_ptr;
  int __pyx_v_idx;
  char *__pyx_v_name;
  int __pyx_v_num_bands;
  PyObject *__pyx_v_names = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  struct __pyx_opt_args_3epr__to_str __pyx_t_5;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_band_names", 0);

  /* "epr.pyx":2821
 *         cdef int num_bands
 * 
 *         self.check_closed_product()             # <<<<<<<<<<<<<<
 * 
 *         num_bands = epr_get_num_bands(self._ptr)
 */
  __pyx_t_1 = __pyx_f_3epr_7Product_check_closed_product(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2821; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "epr.pyx":2823
 *         self.check_closed_product()
 * 
 *         num_bands = epr_get_num_bands(self._ptr)             # <<<<<<<<<<<<<<
 * 
 *         names = []
 */
  __pyx_v_num_bands = epr_get_num_bands(__pyx_v_self->_ptr);

  /* "epr.pyx":2825
 *         num_bands = epr_get_num_bands(self._ptr)
 * 
 *         names = []             # <<<<<<<<<<<<<<
 *         for idx in range(num_bands):
 *             band_ptr = epr_get_band_id_at(self._ptr, idx)
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2825; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_names = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "epr.pyx":2826
 * 
 *         names = []
 *         for idx in range(num_bands):             # <<<<<<<<<<<<<<
 *             band_ptr = epr_get_band_id_at(self._ptr, idx)
 *             name = <char*>epr_get_band_name(band_ptr)
 */
  __pyx_t_2 = __pyx_v_num_bands;
  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
    __pyx_v_idx = __pyx_t_3;

    /* "epr.pyx":2827
 *         names = []
 *         for idx in range(num_bands):
 *             band_ptr = epr_get_band_id_at(self._ptr, idx)             # <<<<<<<<<<<<<<
 *             name = <char*>epr_get_band_name(band_ptr)
 *             names.append(_to_str(name, 'ascii'))
 */
    __pyx_v_band_ptr = epr_get_band_id_at(__pyx_v_self->_ptr, __pyx_v_idx);

    /* "epr.pyx":2828
 *         for idx in range(num_bands):
 *             band_ptr = epr_get_band_id_at(self._ptr, idx)
 *             name = <char*>epr_get_band_name(band_ptr)             # <<<<<<<<<<<<<<
 *             names.append(_to_str(name, 'ascii'))
 * 
 */
    __pyx_v_name = ((char *)epr_get_band_name(__pyx_v_band_ptr));

    /* "epr.pyx":2829
 *             band_ptr = epr_get_band_id_at(self._ptr, idx)
 *             name = <char*>epr_get_band_name(band_ptr)
 *             names.append(_to_str(name, 'ascii'))             # <<<<<<<<<<<<<<
 * 
 *         return names
 */
    __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_name); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2829; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5.__pyx_n = 1;
    __pyx_t_5.encoding = __pyx_n_s_ascii;
    __pyx_t_4 = __pyx_f_3epr__to_str(__pyx_t_1, &__pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2829; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_6 = __Pyx_PyList_Append(__pyx_v_names, __pyx_t_4); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2829; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }

  /* "epr.pyx":2831
 *             names.append(_to_str(name, 'ascii'))
 * 
 *         return names             # <<<<<<<<<<<<<<
 * 
 *     def datasets(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_names);
  __pyx_r = __pyx_v_names;
  goto __pyx_L0;

  /* "epr.pyx":2807
 *         return names
 * 
 *     def get_band_names(self):             # <<<<<<<<<<<<<<
 *         '''get_band_names(self)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("epr.Product.get_band_names", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_names);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":2833
 *         return names
 * 
 *     def datasets(self):             # <<<<<<<<<<<<<<
 *         '''datasets(self)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_3epr_7Product_41datasets(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_3epr_7Product_40datasets[] = "datasets(self)\n\n        Return the list of dataset in the product\n\n        ";
static PyObject *__pyx_pw_3epr_7Product_41datasets(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("datasets (wrapper)", 0);
  __pyx_r = __pyx_pf_3epr_7Product_40datasets(((struct __pyx_obj_3epr_Product *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_3epr_7Product_40datasets(struct __pyx_obj_3epr_Product *__pyx_v_self) {
  int __pyx_v_idx;
  int __pyx_v_num_datasets;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("datasets", 0);

  /* "epr.pyx":2843
 *         cdef int num_datasets
 * 
 *         self.check_closed_product()             # <<<<<<<<<<<<<<
 * 
 *         num_datasets = epr_get_num_datasets(self._ptr)
 */
  __pyx_t_1 = __pyx_f_3epr_7Product_check_closed_product(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2843; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "epr.pyx":2845
 *         self.check_closed_product()
 * 
 *         num_datasets = epr_get_num_datasets(self._ptr)             # <<<<<<<<<<<<<<
 * 
 *         return [self.get_dataset_at(idx) for idx in range(num_datasets)]
 */
  __pyx_v_num_datasets = epr_get_num_datasets(__pyx_v_self->_ptr);

  /* "epr.pyx":2847
 *         num_datasets = epr_get_num_datasets(self._ptr)
 * 
 *         return [self.get_dataset_at(idx) for idx in range(num_datasets)]             # <<<<<<<<<<<<<<
 * 
 *     def bands(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2847; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_v_num_datasets;
  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
    __pyx_v_idx = __pyx_t_3;
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_get_dataset_at); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2847; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_idx); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2847; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2847; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_5);
    __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_6, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2847; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2847; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "epr.pyx":2833
 *         return names
 * 
 *     def datasets(self):             # <<<<<<<<<<<<<<
 *         '''datasets(self)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("epr.Product.datasets", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":2849
 *         return [self.get_dataset_at(idx) for idx in range(num_datasets)]
 * 
 *     def bands(self):             # <<<<<<<<<<<<<<
 *         '''bands(self)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_3epr_7Product_43bands(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_3epr_7Product_42bands[] = "bands(self)\n\n        Return the list of bands in the product\n\n        ";
static PyObject *__pyx_pw_3epr_7Product_43bands(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("bands (wrapper)", 0);
  __pyx_r = __pyx_pf_3epr_7Product_42bands(((struct __pyx_obj_3epr_Product *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_3epr_7Product_42bands(struct __pyx_obj_3epr_Product *__pyx_v_self) {
  int __pyx_v_num_bands;
  int __pyx_v_idx;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("bands", 0);

  /* "epr.pyx":2858
 *         cdef int num_bands
 * 
 *         self.check_closed_product()             # <<<<<<<<<<<<<<
 * 
 *         num_bands = epr_get_num_bands(self._ptr)
 */
  __pyx_t_1 = __pyx_f_3epr_7Product_check_closed_product(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2858; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "epr.pyx":2860
 *         self.check_closed_product()
 * 
 *         num_bands = epr_get_num_bands(self._ptr)             # <<<<<<<<<<<<<<
 * 
 *         return [self.get_band_at(idx) for idx in range(num_bands)]
 */
  __pyx_v_num_bands = epr_get_num_bands(__pyx_v_self->_ptr);

  /* "epr.pyx":2862
 *         num_bands = epr_get_num_bands(self._ptr)
 * 
 *         return [self.get_band_at(idx) for idx in range(num_bands)]             # <<<<<<<<<<<<<<
 * 
 *     # @TODO: iter on both datasets and bands (??)
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2862; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_v_num_bands;
  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
    __pyx_v_idx = __pyx_t_3;
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_get_band_at); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2862; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_idx); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2862; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2862; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_5);
    __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_6, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2862; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2862; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "epr.pyx":2849
 *         return [self.get_dataset_at(idx) for idx in range(num_datasets)]
 * 
 *     def bands(self):             # <<<<<<<<<<<<<<
 *         '''bands(self)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("epr.Product.bands", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":2868
 *     #    return itertools.chain((self.datasets(), self.bands()))
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return 'epr.Product(%s) %d datasets, %d bands' % (self.id_string,
 *                                 self.get_num_datasets(), self.get_num_bands())
 */

/* Python wrapper */
static PyObject *__pyx_pw_3epr_7Product_45__repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_3epr_7Product_45__repr__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
  __pyx_r = __pyx_pf_3epr_7Product_44__repr__(((struct __pyx_obj_3epr_Product *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_3epr_7Product_44__repr__(struct __pyx_obj_3epr_Product *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__repr__", 0);

  /* "epr.pyx":2869
 * 
 *     def __repr__(self):
 *         return 'epr.Product(%s) %d datasets, %d bands' % (self.id_string,             # <<<<<<<<<<<<<<
 *                                 self.get_num_datasets(), self.get_num_bands())
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_id_string); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2869; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);

  /* "epr.pyx":2870
 *     def __repr__(self):
 *         return 'epr.Product(%s) %d datasets, %d bands' % (self.id_string,
 *                                 self.get_num_datasets(), self.get_num_bands())             # <<<<<<<<<<<<<<
 * 
 *     def __str__(self):
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_get_num_datasets); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2870; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2870; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_get_num_bands); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2870; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2870; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "epr.pyx":2869
 * 
 *     def __repr__(self):
 *         return 'epr.Product(%s) %d datasets, %d bands' % (self.id_string,             # <<<<<<<<<<<<<<
 *                                 self.get_num_datasets(), self.get_num_bands())
 * 
 */
  __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2869; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  __pyx_t_1 = 0;
  __pyx_t_3 = 0;
  __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_epr_Product_s_d_datasets_d_bands, __pyx_t_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2869; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "epr.pyx":2868
 *     #    return itertools.chain((self.datasets(), self.bands()))
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return 'epr.Product(%s) %d datasets, %d bands' % (self.id_string,
 *                                 self.get_num_datasets(), self.get_num_bands())
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("epr.Product.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":2872
 *                                 self.get_num_datasets(), self.get_num_bands())
 * 
 *     def __str__(self):             # <<<<<<<<<<<<<<
 *         lines = [repr(self), '']
 *         lines.extend(map(repr, self.datasets()))
 */

/* Python wrapper */
static PyObject *__pyx_pw_3epr_7Product_47__str__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_3epr_7Product_47__str__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__str__ (wrapper)", 0);
  __pyx_r = __pyx_pf_3epr_7Product_46__str__(((struct __pyx_obj_3epr_Product *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_3epr_7Product_46__str__(struct __pyx_obj_3epr_Product *__pyx_v_self) {
  PyObject *__pyx_v_lines = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__str__", 0);

  /* "epr.pyx":2873
 * 
 *     def __str__(self):
 *         lines = [repr(self), '']             # <<<<<<<<<<<<<<
 *         lines.extend(map(repr, self.datasets()))
 *         lines.append('')
 */
  __pyx_t_1 = PyObject_Repr(((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2873; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyList_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2873; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  PyList_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_kp_s_);
  PyList_SET_ITEM(__pyx_t_2, 1, __pyx_kp_s_);
  __Pyx_GIVEREF(__pyx_kp_s_);
  __pyx_t_1 = 0;
  __pyx_v_lines = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "epr.pyx":2874
 *     def __str__(self):
 *         lines = [repr(self), '']
 *         lines.extend(map(repr, self.datasets()))             # <<<<<<<<<<<<<<
 *         lines.append('')
 *         lines.extend(map(repr, self.bands()))
 */
  __pyx_t_2 = __Pyx_GetBuiltinName(__pyx_n_s_repr_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2874; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_datasets); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2874; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2874; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2874; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_map, __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2874; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_4 = __Pyx_PyList_Extend(__pyx_v_lines, __pyx_t_3); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2874; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "epr.pyx":2875
 *         lines = [repr(self), '']
 *         lines.extend(map(repr, self.datasets()))
 *         lines.append('')             # <<<<<<<<<<<<<<
 *         lines.extend(map(repr, self.bands()))
 *         return '\n'.join(lines)
 */
  __pyx_t_4 = __Pyx_PyList_Append(__pyx_v_lines, __pyx_kp_s_); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2875; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "epr.pyx":2876
 *         lines.extend(map(repr, self.datasets()))
 *         lines.append('')
 *         lines.extend(map(repr, self.bands()))             # <<<<<<<<<<<<<<
 *         return '\n'.join(lines)
 * 
 */
  __pyx_t_3 = __Pyx_GetBuiltinName(__pyx_n_s_repr_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2876; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_bands); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2876; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2876; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2876; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_3 = 0;
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_map, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2876; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_4 = __Pyx_PyList_Extend(__pyx_v_lines, __pyx_t_2); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2876; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "epr.pyx":2877
 *         lines.append('')
 *         lines.extend(map(repr, self.bands()))
 *         return '\n'.join(lines)             # <<<<<<<<<<<<<<
 * 
 *     def __enter__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyString_Join(__pyx_kp_s__11, __pyx_v_lines); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2877; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "epr.pyx":2872
 *                                 self.get_num_datasets(), self.get_num_bands())
 * 
 *     def __str__(self):             # <<<<<<<<<<<<<<
 *         lines = [repr(self), '']
 *         lines.extend(map(repr, self.datasets()))
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("epr.Product.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_lines);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":2879
 *         return '\n'.join(lines)
 * 
 *     def __enter__(self):             # <<<<<<<<<<<<<<
 *         return self
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_3epr_7Product_49__enter__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_3epr_7Product_49__enter__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__enter__ (wrapper)", 0);
  __pyx_r = __pyx_pf_3epr_7Product_48__enter__(((struct __pyx_obj_3epr_Product *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_3epr_7Product_48__enter__(struct __pyx_obj_3epr_Product *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__enter__", 0);

  /* "epr.pyx":2880
 * 
 *     def __enter__(self):
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def __exit__(self, *exc_info):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "epr.pyx":2879
 *         return '\n'.join(lines)
 * 
 *     def __enter__(self):             # <<<<<<<<<<<<<<
 *         return self
 * 
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":2882
 *         return self
 * 
 *     def __exit__(self, *exc_info):             # <<<<<<<<<<<<<<
 *         self.close()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_3epr_7Product_51__exit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_3epr_7Product_51__exit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED PyObject *__pyx_v_exc_info = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__exit__ (wrapper)", 0);
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__exit__", 0))) return NULL;
  __Pyx_INCREF(__pyx_args);
  __pyx_v_exc_info = __pyx_args;
  __pyx_r = __pyx_pf_3epr_7Product_50__exit__(((struct __pyx_obj_3epr_Product *)__pyx_v_self), __pyx_v_exc_info);

  /* function exit code */
  __Pyx_XDECREF(__pyx_v_exc_info);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_3epr_7Product_50__exit__(struct __pyx_obj_3epr_Product *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_exc_info) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__exit__", 0);

  /* "epr.pyx":2883
 * 
 *     def __exit__(self, *exc_info):
 *         self.close()             # <<<<<<<<<<<<<<
 * 
 *     # --- low level interface -------------------------------------------------
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_close); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2883; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2883; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "epr.pyx":2882
 *         return self
 * 
 *     def __exit__(self, *exc_info):             # <<<<<<<<<<<<<<
 *         self.close()
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("epr.Product.__exit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":2889
 *         '''The magic number for internal C structure'''
 * 
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             self.check_closed_product()
 *             return self._ptr.magic
 */

/* Python wrapper */
static PyObject *__pyx_pw_3epr_7Product_6_magic_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_3epr_7Product_6_magic_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_3epr_7Product_6_magic___get__(((struct __pyx_obj_3epr_Product *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_3epr_7Product_6_magic___get__(struct __pyx_obj_3epr_Product *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "epr.pyx":2890
 * 
 *         def __get__(self):
 *             self.check_closed_product()             # <<<<<<<<<<<<<<
 *             return self._ptr.magic
 * 
 */
  __pyx_t_1 = __pyx_f_3epr_7Product_check_closed_product(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2890; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "epr.pyx":2891
 *         def __get__(self):
 *             self.check_closed_product()
 *             return self._ptr.magic             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_EPR_Magic(__pyx_v_self->_ptr->magic); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2891; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "epr.pyx":2889
 *         '''The magic number for internal C structure'''
 * 
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             self.check_closed_product()
 *             return self._ptr.magic
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("epr.Product._magic.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":2894
 * 
 * 
 * def open(filename, mode='rb'):             # <<<<<<<<<<<<<<
 *     '''open(filename)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_3epr_15open(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_3epr_14open[] = "open(filename)\n\n    Opens the ENVISAT product\n\n    Opens the ENVISAT product file with the given file path, reads MPH,\n    SPH and all DSDs, organized the table with parameter of line length\n    and tie points number.\n\n    :param product_file_path:\n        the path to the ENVISAT product file\n    :param mode:\n        string that specifies the mode in which the file is opened.\n        Allowed values: 'rb', 'rb+' for read-write mode.\n        Default: mode='rb'.\n    :returns:\n        the :class:`Product` instance representing the specified\n        product. An exception (:exc:`exceptions.ValueError`) is raised\n        if the file could not be opened.\n\n    .. seealso :class:`Product`\n\n    ";
static PyMethodDef __pyx_mdef_3epr_15open = {__Pyx_NAMESTR("open"), (PyCFunction)__pyx_pw_3epr_15open, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_3epr_14open)};
static PyObject *__pyx_pw_3epr_15open(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_filename = 0;
  PyObject *__pyx_v_mode = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("open (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_filename,&__pyx_n_s_mode,0};
    PyObject* values[2] = {0,0};
    values[1] = ((PyObject *)__pyx_n_s_rb);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_filename)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_mode);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "open") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2894; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_filename = values[0];
    __pyx_v_mode = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("open", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2894; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("epr.open", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_3epr_14open(__pyx_self, __pyx_v_filename, __pyx_v_mode);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_3epr_14open(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_filename, PyObject *__pyx_v_mode) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("open", 0);

  /* "epr.pyx":2918
 *     '''
 * 
 *     return Product(filename, mode)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2918; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_filename);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_filename);
  __Pyx_GIVEREF(__pyx_v_filename);
  __Pyx_INCREF(__pyx_v_mode);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_mode);
  __Pyx_GIVEREF(__pyx_v_mode);
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3epr_Product)), __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2918; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "epr.pyx":2894
 * 
 * 
 * def open(filename, mode='rb'):             # <<<<<<<<<<<<<<
 *     '''open(filename)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("epr.open", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "epr.pyx":2929
 * 
 * @atexit.register
 * def _close_api():             # <<<<<<<<<<<<<<
 *     # ensure that all EprObject(s) are collected before removing the last
 *     # reference to _EPR_C_LIB
 */

/* Python wrapper */
static PyObject *__pyx_pw_3epr_17_close_api(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyMethodDef __pyx_mdef_3epr_17_close_api = {__Pyx_NAMESTR("_close_api"), (PyCFunction)__pyx_pw_3epr_17_close_api, METH_NOARGS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_3epr_17_close_api(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_close_api (wrapper)", 0);
  __pyx_r = __pyx_pf_3epr_16_close_api(__pyx_self);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_3epr_16_close_api(CYTHON_UNUSED PyObject *__pyx_self) {
  PyObject *__pyx_v_gc = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_close_api", 0);

  /* "epr.pyx":2932
 *     # ensure that all EprObject(s) are collected before removing the last
 *     # reference to _EPR_C_LIB
 *     import gc             # <<<<<<<<<<<<<<
 *     gc.collect()
 * 
 */
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_gc, 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2932; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_gc = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "epr.pyx":2933
 *     # reference to _EPR_C_LIB
 *     import gc
 *     gc.collect()             # <<<<<<<<<<<<<<
 * 
 *     global _EPR_C_LIB
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_gc, __pyx_n_s_collect); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2933; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2933; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "epr.pyx":2936
 * 
 *     global _EPR_C_LIB
 *     _EPR_C_LIB = None             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_INCREF(Py_None);
  __Pyx_XGOTREF(((PyObject *)__pyx_v_3epr__EPR_C_LIB));
  __Pyx_DECREF_SET(__pyx_v_3epr__EPR_C_LIB, ((struct __pyx_obj_3epr__CLib *)Py_None));
  __Pyx_GIVEREF(Py_None);

  /* "epr.pyx":2929
 * 
 * @atexit.register
 * def _close_api():             # <<<<<<<<<<<<<<
 *     # ensure that all EprObject(s) are collected before removing the last
 *     # reference to _EPR_C_LIB
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("epr._close_api", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_gc);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":194
 *         # experimental exception made for __getbuffer__ and __releasebuffer__
 *         # -- the details of this may change.
 *         def __getbuffer__(ndarray self, Py_buffer* info, int flags):             # <<<<<<<<<<<<<<
 *             # This implementation of getbuffer is geared towards Cython
 *             # requirements, and does not yet fullfill the PEP.
 */

/* Python wrapper */
static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5numpy_7ndarray___getbuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
  int __pyx_v_copy_shape;
  int __pyx_v_i;
  int __pyx_v_ndim;
  int __pyx_v_endian_detector;
  int __pyx_v_little_endian;
  int __pyx_v_t;
  char *__pyx_v_f;
  PyArray_Descr *__pyx_v_descr = 0;
  int __pyx_v_offset;
  int __pyx_v_hasfields;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_t_6;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  char *__pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__getbuffer__", 0);
  if (__pyx_v_info != NULL) {
    __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(__pyx_v_info->obj);
  }

  /* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":200
 *             # of flags
 * 
 *             if info == NULL: return             # <<<<<<<<<<<<<<
 * 
 *             cdef int copy_shape, i, ndim
 */
  __pyx_t_1 = ((__pyx_v_info == NULL) != 0);
  if (__pyx_t_1) {
    __pyx_r = 0;
    goto __pyx_L0;
  }

  /* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":203
 * 
 *             cdef int copy_shape, i, ndim
 *             cdef int endian_detector = 1             # <<<<<<<<<<<<<<
 *             cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)
 * 
 */
  __pyx_v_endian_detector = 1;

  /* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":204
 *             cdef int copy_shape, i, ndim
 *             cdef int endian_detector = 1
 *             cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)             # <<<<<<<<<<<<<<
 * 
 *             ndim = PyArray_NDIM(self)
 */
  __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0);

  /* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":206
 *             cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)
 * 
 *             ndim = PyArray_NDIM(self)             # <<<<<<<<<<<<<<
 * 
 *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
 */
  __pyx_v_ndim = PyArray_NDIM(__pyx_v_self);

  /* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":208
 *             ndim = PyArray_NDIM(self)
 * 
 *             if sizeof(npy_intp) != sizeof(Py_ssize_t):             # <<<<<<<<<<<<<<
 *                 copy_shape = 1
 *             else:
 */
  __pyx_t_1 = (((sizeof(npy_intp)) != (sizeof(Py_ssize_t))) != 0);
  if (__pyx_t_1) {

    /* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":209
 * 
 *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
 *                 copy_shape = 1             # <<<<<<<<<<<<<<
 *             else:
 *                 copy_shape = 0
 */
    __pyx_v_copy_shape = 1;
    goto __pyx_L4;
  }
  /*else*/ {

    /* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":211
 *                 copy_shape = 1
 *             else:
 *                 copy_shape = 0             # <<<<<<<<<<<<<<
 * 
 *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
 */
    __pyx_v_copy_shape = 0;
  }
  __pyx_L4:;

  /* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":213
 *                 copy_shape = 0
 * 
 *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)             # <<<<<<<<<<<<<<
 *                 and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)):
 *                 raise ValueError(u"ndarray is not C contiguous")
 */
  __pyx_t_1 = (((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS) != 0);
  if (__pyx_t_1) {

    /* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":214
 * 
 *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
 *                 and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)):             # <<<<<<<<<<<<<<
 *                 raise ValueError(u"ndarray is not C contiguous")
 * 
 */
    __pyx_t_2 = ((!(PyArray_CHKFLAGS(__pyx_v_self, NPY_C_CONTIGUOUS) != 0)) != 0);
    __pyx_t_3 = __pyx_t_2;
  } else {
    __pyx_t_3 = __pyx_t_1;
  }
  if (__pyx_t_3) {

    /* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":215
 *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
 *                 and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)):
 *                 raise ValueError(u"ndarray is not C contiguous")             # <<<<<<<<<<<<<<
 * 
 *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
 */
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__21, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_Raise(__pyx_t_4, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":217
 *                 raise ValueError(u"ndarray is not C contiguous")
 * 
 *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)             # <<<<<<<<<<<<<<
 *                 and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)):
 *                 raise ValueError(u"ndarray is not Fortran contiguous")
 */
  __pyx_t_3 = (((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS) != 0);
  if (__pyx_t_3) {

    /* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":218
 * 
 *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
 *                 and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)):             # <<<<<<<<<<<<<<
 *                 raise ValueError(u"ndarray is not Fortran contiguous")
 * 
 */
    __pyx_t_1 = ((!(PyArray_CHKFLAGS(__pyx_v_self, NPY_F_CONTIGUOUS) != 0)) != 0);
    __pyx_t_2 = __pyx_t_1;
  } else {
    __pyx_t_2 = __pyx_t_3;
  }
  if (__pyx_t_2) {

    /* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":219
 *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
 *                 and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)):
 *                 raise ValueError(u"ndarray is not Fortran contiguous")             # <<<<<<<<<<<<<<
 * 
 *             info.buf = PyArray_DATA(self)
 */
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__22, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_Raise(__pyx_t_4, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":221
 *                 raise ValueError(u"ndarray is not Fortran contiguous")
 * 
 *             info.buf = PyArray_DATA(self)             # <<<<<<<<<<<<<<
 *             info.ndim = ndim
 *             if copy_shape:
 */
  __pyx_v_info->buf = PyArray_DATA(__pyx_v_self);

  /* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":222
 * 
 *             info.buf = PyArray_DATA(self)
 *             info.ndim = ndim             # <<<<<<<<<<<<<<
 *             if copy_shape:
 *                 # Allocate new buffer for strides and shape info.
 */
  __pyx_v_info->ndim = __pyx_v_ndim;

  /* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":223
 *             info.buf = PyArray_DATA(self)
 *             info.ndim = ndim
 *             if copy_shape:             # <<<<<<<<<<<<<<
 *                 # Allocate new buffer for strides and shape info.
 *                 # This is allocated as one block, strides first.
 */
  __pyx_t_2 = (__pyx_v_copy_shape != 0);
  if (__pyx_t_2) {

    /* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":226
 *                 # Allocate new buffer for strides and shape info.
 *                 # This is allocated as one block, strides first.
 *                 info.strides = <Py_ssize_t*>stdlib.malloc(sizeof(Py_ssize_t) * <size_t>ndim * 2)             # <<<<<<<<<<<<<<
 *                 info.shape = info.strides + ndim
 *                 for i in range(ndim):
 */
    __pyx_v_info->strides = ((Py_ssize_t *)malloc((((sizeof(Py_ssize_t)) * ((size_t)__pyx_v_ndim)) * 2)));

    /* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":227
 *                 # This is allocated as one block, strides first.
 *                 info.strides = <Py_ssize_t*>stdlib.malloc(sizeof(Py_ssize_t) * <size_t>ndim * 2)
 *                 info.shape = info.strides + ndim             # <<<<<<<<<<<<<<
 *                 for i in range(ndim):
 *                     info.strides[i] = PyArray_STRIDES(self)[i]
 */
    __pyx_v_info->shape = (__pyx_v_info->strides + __pyx_v_ndim);

    /* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":228
 *                 info.strides = <Py_ssize_t*>stdlib.malloc(sizeof(Py_ssize_t) * <size_t>ndim * 2)
 *                 info.shape = info.strides + ndim
 *                 for i in range(ndim):             # <<<<<<<<<<<<<<
 *                     info.strides[i] = PyArray_STRIDES(self)[i]
 *                     info.shape[i] = PyArray_DIMS(self)[i]
 */
    __pyx_t_5 = __pyx_v_ndim;
    for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
      __pyx_v_i = __pyx_t_6;

      /* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":229
 *                 info.shape = info.strides + ndim
 *                 for i in range(ndim):
 *                     info.strides[i] = PyArray_STRIDES(self)[i]             # <<<<<<<<<<<<<<
 *                     info.shape[i] = PyArray_DIMS(self)[i]
 *             else:
 */
      (__pyx_v_info->strides[__pyx_v_i]) = (PyArray_STRIDES(__pyx_v_self)[__pyx_v_i]);

      /* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":230
 *                 for i in range(ndim):
 *                     info.strides[i] = PyArray_STRIDES(self)[i]
 *                     info.shape[i] = PyArray_DIMS(self)[i]             # <<<<<<<<<<<<<<
 *             else:
 *                 info.strides = <Py_ssize_t*>PyArray_STRIDES(self)
 */
      (__pyx_v_info->shape[__pyx_v_i]) = (PyArray_DIMS(__pyx_v_self)[__pyx_v_i]);
    }
    goto __pyx_L7;
  }
  /*else*/ {

    /* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":232
 *                     info.shape[i] = PyArray_DIMS(self)[i]
 *             else:
 *                 info.strides = <Py_ssize_t*>PyArray_STRIDES(self)             # <<<<<<<<<<<<<<
 *                 info.shape = <Py_ssize_t*>PyArray_DIMS(self)
 *             info.suboffsets = NULL
 */
    __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(__pyx_v_self));

    /* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":233
 *             else:
 *                 info.strides = <Py_ssize_t*>PyArray_STRIDES(self)
 *                 info.shape = <Py_ssize_t*>PyArray_DIMS(self)             # <<<<<<<<<<<<<<
 *             info.suboffsets = NULL
 *             info.itemsize = PyArray_ITEMSIZE(self)
 */
    __pyx_v_info->shape = ((Py_ssize_t *)PyArray_DIMS(__pyx_v_self));
  }
  __pyx_L7:;

  /* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":234
 *                 info.strides = <Py_ssize_t*>PyArray_STRIDES(self)
 *                 info.shape = <Py_ssize_t*>PyArray_DIMS(self)
 *             info.suboffsets = NULL             # <<<<<<<<<<<<<<
 *             info.itemsize = PyArray_ITEMSIZE(self)
 *             info.readonly = not PyArray_ISWRITEABLE(self)
 */
  __pyx_v_info->suboffsets = NULL;

  /* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":235
 *                 info.shape = <Py_ssize_t*>PyArray_DIMS(self)
 *             info.suboffsets = NULL
 *             info.itemsize = PyArray_ITEMSIZE(self)             # <<<<<<<<<<<<<<
 *             info.readonly = not PyArray_ISWRITEABLE(self)
 * 
 */
  __pyx_v_info->itemsize = PyArray_ITEMSIZE(__pyx_v_self);

  /* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":236
 *             info.suboffsets = NULL
 *             info.itemsize = PyArray_ITEMSIZE(self)
 *             info.readonly = not PyArray_ISWRITEABLE(self)             # <<<<<<<<<<<<<<
 * 
 *             cdef int t
 */
  __pyx_v_info->readonly = (!(PyArray_ISWRITEABLE(__pyx_v_self) != 0));

  /* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":239
 * 
 *             cdef int t
 *             cdef char* f = NULL             # <<<<<<<<<<<<<<
 *             cdef dtype descr = self.descr
 *             cdef list stack
 */
  __pyx_v_f = NULL;

  /* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":240
 *             cdef int t
 *             cdef char* f = NULL
 *             cdef dtype descr = self.descr             # <<<<<<<<<<<<<<
 *             cdef list stack
 *             cdef int offset
 */
  __pyx_t_4 = ((PyObject *)__pyx_v_self->descr);
  __Pyx_INCREF(__pyx_t_4);
  __pyx_v_descr = ((PyArray_Descr *)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":244
 *             cdef int offset
 * 
 *             cdef bint hasfields = PyDataType_HASFIELDS(descr)             # <<<<<<<<<<<<<<
 * 
 *             if not hasfields and not copy_shape:
 */
  __pyx_v_hasfields = PyDataType_HASFIELDS(__pyx_v_descr);

  /* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":246
 *             cdef bint hasfields = PyDataType_HASFIELDS(descr)
 * 
 *             if not hasfields and not copy_shape:             # <<<<<<<<<<<<<<
 *                 # do not call releasebuffer
 *                 info.obj = None
 */
  __pyx_t_2 = ((!(__pyx_v_hasfields != 0)) != 0);
  if (__pyx_t_2) {
    __pyx_t_3 = ((!(__pyx_v_copy_shape != 0)) != 0);
    __pyx_t_1 = __pyx_t_3;
  } else {
    __pyx_t_1 = __pyx_t_2;
  }
  if (__pyx_t_1) {

    /* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":248
 *             if not hasfields and not copy_shape:
 *                 # do not call releasebuffer
 *                 info.obj = None             # <<<<<<<<<<<<<<
 *             else:
 *                 # need to call releasebuffer
 */
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    __Pyx_GOTREF(__pyx_v_info->obj);
    __Pyx_DECREF(__pyx_v_info->obj);
    __pyx_v_info->obj = Py_None;
    goto __pyx_L10;
  }
  /*else*/ {

    /* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":251
 *             else:
 *                 # need to call releasebuffer
 *                 info.obj = self             # <<<<<<<<<<<<<<
 * 
 *             if not hasfields:
 */
    __Pyx_INCREF(((PyObject *)__pyx_v_self));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
    __Pyx_GOTREF(__pyx_v_info->obj);
    __Pyx_DECREF(__pyx_v_info->obj);
    __pyx_v_info->obj = ((PyObject *)__pyx_v_self);
  }
  __pyx_L10:;

  /* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":253
 *                 info.obj = self
 * 
 *             if not hasfields:             # <<<<<<<<<<<<<<
 *                 t = descr.type_num
 *                 if ((descr.byteorder == c'>' and little_endian) or
 */
  __pyx_t_1 = ((!(__pyx_v_hasfields != 0)) != 0);
  if (__pyx_t_1) {

    /* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":254
 * 
 *             if not hasfields:
 *                 t = descr.type_num             # <<<<<<<<<<<<<<
 *                 if ((descr.byteorder == c'>' and little_endian) or
 *                     (descr.byteorder == c'<' and not little_endian)):
 */
    __pyx_t_5 = __pyx_v_descr->type_num;
    __pyx_v_t = __pyx_t_5;

    /* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":255
 *             if not hasfields:
 *                 t = descr.type_num
 *                 if ((descr.byteorder == c'>' and little_endian) or             # <<<<<<<<<<<<<<
 *                     (descr.byteorder == c'<' and not little_endian)):
 *                     raise ValueError(u"Non-native byte order not supported")
 */
    __pyx_t_1 = ((__pyx_v_descr->byteorder == '>') != 0);
    if (__pyx_t_1) {
      __pyx_t_2 = (__pyx_v_little_endian != 0);
    } else {
      __pyx_t_2 = __pyx_t_1;
    }
    if (!__pyx_t_2) {

      /* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":256
 *                 t = descr.type_num
 *                 if ((descr.byteorder == c'>' and little_endian) or
 *                     (descr.byteorder == c'<' and not little_endian)):             # <<<<<<<<<<<<<<
 *                     raise ValueError(u"Non-native byte order not supported")
 *                 if   t == NPY_BYTE:        f = "b"
 */
      __pyx_t_1 = ((__pyx_v_descr->byteorder == '<') != 0);
      if (__pyx_t_1) {
        __pyx_t_3 = ((!(__pyx_v_little_endian != 0)) != 0);
        __pyx_t_7 = __pyx_t_3;
      } else {
        __pyx_t_7 = __pyx_t_1;
      }
      __pyx_t_1 = __pyx_t_7;
    } else {
      __pyx_t_1 = __pyx_t_2;
    }
    if (__pyx_t_1) {

      /* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":257
 *                 if ((descr.byteorder == c'>' and little_endian) or
 *                     (descr.byteorder == c'<' and not little_endian)):
 *                     raise ValueError(u"Non-native byte order not supported")             # <<<<<<<<<<<<<<
 *                 if   t == NPY_BYTE:        f = "b"
 *                 elif t == NPY_UBYTE:       f = "B"
 */
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__23, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_Raise(__pyx_t_4, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }

    /* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":274
 *                 elif t == NPY_CDOUBLE:     f = "Zd"
 *                 elif t == NPY_CLONGDOUBLE: f = "Zg"
 *                 elif t == NPY_OBJECT:      f = "O"             # <<<<<<<<<<<<<<
 *                 else:
 *                     raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
 */
    switch (__pyx_v_t) {

      /* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":258
 *                     (descr.byteorder == c'<' and not little_endian)):
 *                     raise ValueError(u"Non-native byte order not supported")
 *                 if   t == NPY_BYTE:        f = "b"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_UBYTE:       f = "B"
 *                 elif t == NPY_SHORT:       f = "h"
 */
      case NPY_BYTE:
      __pyx_v_f = __pyx_k_b;
      break;

      /* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":259
 *                     raise ValueError(u"Non-native byte order not supported")
 *                 if   t == NPY_BYTE:        f = "b"
 *                 elif t == NPY_UBYTE:       f = "B"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_SHORT:       f = "h"
 *                 elif t == NPY_USHORT:      f = "H"
 */
      case NPY_UBYTE:
      __pyx_v_f = __pyx_k_B;
      break;

      /* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":260
 *                 if   t == NPY_BYTE:        f = "b"
 *                 elif t == NPY_UBYTE:       f = "B"
 *                 elif t == NPY_SHORT:       f = "h"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_USHORT:      f = "H"
 *                 elif t == NPY_INT:         f = "i"
 */
      case NPY_SHORT:
      __pyx_v_f = __pyx_k_h;
      break;

      /* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":261
 *                 elif t == NPY_UBYTE:       f = "B"
 *                 elif t == NPY_SHORT:       f = "h"
 *                 elif t == NPY_USHORT:      f = "H"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_INT:         f = "i"
 *                 elif t == NPY_UINT:        f = "I"
 */
      case NPY_USHORT:
      __pyx_v_f = __pyx_k_H;
      break;

      /* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":262
 *                 elif t == NPY_SHORT:       f = "h"
 *                 elif t == NPY_USHORT:      f = "H"
 *                 elif t == NPY_INT:         f = "i"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_UINT:        f = "I"
 *                 elif t == NPY_LONG:        f = "l"
 */
      case NPY_INT:
      __pyx_v_f = __pyx_k_i;
      break;

      /* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":263
 *                 elif t == NPY_USHORT:      f = "H"
 *                 elif t == NPY_INT:         f = "i"
 *                 elif t == NPY_UINT:        f = "I"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_LONG:        f = "l"
 *                 elif t == NPY_ULONG:       f = "L"
 */
      case NPY_UINT:
      __pyx_v_f = __pyx_k_I;
      break;

      /* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":264
 *                 elif t == NPY_INT:         f = "i"
 *                 elif t == NPY_UINT:        f = "I"
 *                 elif t == NPY_LONG:        f = "l"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_ULONG:       f = "L"
 *                 elif t == NPY_LONGLONG:    f = "q"
 */
      case NPY_LONG:
      __pyx_v_f = __pyx_k_l;
      break;

      /* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":265
 *                 elif t == NPY_UINT:        f = "I"
 *                 elif t == NPY_LONG:        f = "l"
 *                 elif t == NPY_ULONG:       f = "L"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_LONGLONG:    f = "q"
 *                 elif t == NPY_ULONGLONG:   f = "Q"
 */
      case NPY_ULONG:
      __pyx_v_f = __pyx_k_L;
      break;

      /* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":266
 *                 elif t == NPY_LONG:        f = "l"
 *                 elif t == NPY_ULONG:       f = "L"
 *                 elif t == NPY_LONGLONG:    f = "q"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_ULONGLONG:   f = "Q"
 *                 elif t == NPY_FLOAT:       f = "f"
 */
      case NPY_LONGLONG:
      __pyx_v_f = __pyx_k_q;
      break;

      /* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":267
 *                 elif t == NPY_ULONG:       f = "L"
 *                 elif t == NPY_LONGLONG:    f = "q"
 *                 elif t == NPY_ULONGLONG:   f = "Q"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_FLOAT:       f = "f"
 *                 elif t == NPY_DOUBLE:      f = "d"
 */
      case NPY_ULONGLONG:
      __pyx_v_f = __pyx_k_Q;
      break;

      /* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":268
 *                 elif t == NPY_LONGLONG:    f = "q"
 *                 elif t == NPY_ULONGLONG:   f = "Q"
 *                 elif t == NPY_FLOAT:       f = "f"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_DOUBLE:      f = "d"
 *                 elif t == NPY_LONGDOUBLE:  f = "g"
 */
      case NPY_FLOAT:
      __pyx_v_f = __pyx_k_f_2;
      break;

      /* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":269
 *                 elif t == NPY_ULONGLONG:   f = "Q"
 *                 elif t == NPY_FLOAT:       f = "f"
 *                 elif t == NPY_DOUBLE:      f = "d"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_LONGDOUBLE:  f = "g"
 *                 elif t == NPY_CFLOAT:      f = "Zf"
 */
      case NPY_DOUBLE:
      __pyx_v_f = __pyx_k_d_2;
      break;

      /* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":270
 *                 elif t == NPY_FLOAT:       f = "f"
 *                 elif t == NPY_DOUBLE:      f = "d"
 *                 elif t == NPY_LONGDOUBLE:  f = "g"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_CFLOAT:      f = "Zf"
 *                 elif t == NPY_CDOUBLE:     f = "Zd"
 */
      case NPY_LONGDOUBLE:
      __pyx_v_f = __pyx_k_g;
      break;

      /* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":271
 *                 elif t == NPY_DOUBLE:      f = "d"
 *                 elif t == NPY_LONGDOUBLE:  f = "g"
 *                 elif t == NPY_CFLOAT:      f = "Zf"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_CDOUBLE:     f = "Zd"
 *                 elif t == NPY_CLONGDOUBLE: f = "Zg"
 */
      case NPY_CFLOAT:
      __pyx_v_f = __pyx_k_Zf;
      break;

      /* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":272
 *                 elif t == NPY_LONGDOUBLE:  f = "g"
 *                 elif t == NPY_CFLOAT:      f = "Zf"
 *                 elif t == NPY_CDOUBLE:     f = "Zd"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_CLONGDOUBLE: f = "Zg"
 *                 elif t == NPY_OBJECT:      f = "O"
 */
      case NPY_CDOUBLE:
      __pyx_v_f = __pyx_k_Zd;
      break;

      /* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":273
 *                 elif t == NPY_CFLOAT:      f = "Zf"
 *                 elif t == NPY_CDOUBLE:     f = "Zd"
 *                 elif t == NPY_CLONGDOUBLE: f = "Zg"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_OBJECT:      f = "O"
 *                 else:
 */
      case NPY_CLONGDOUBLE:
      __pyx_v_f = __pyx_k_Zg;
      break;

      /* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":274
 *                 elif t == NPY_CDOUBLE:     f = "Zd"
 *                 elif t == NPY_CLONGDOUBLE: f = "Zg"
 *                 elif t == NPY_OBJECT:      f = "O"             # <<<<<<<<<<<<<<
 *                 else:
 *                     raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
 */
      case NPY_OBJECT:
      __pyx_v_f = __pyx_k_O;
      break;
      default:

      /* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":276
 *                 elif t == NPY_OBJECT:      f = "O"
 *                 else:
 *                     raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)             # <<<<<<<<<<<<<<
 *                 info.format = f
 *                 return
 */
      __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_t); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_8 = PyUnicode_Format(__pyx_kp_u_unknown_dtype_code_in_numpy_pxd, __pyx_t_4); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_8);
      __Pyx_GIVEREF(__pyx_t_8);
      __pyx_t_8 = 0;
      __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_Raise(__pyx_t_8, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      break;
    }

    /* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":277
 *                 else:
 *                     raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
 *                 info.format = f             # <<<<<<<<<<<<<<
 *                 return
 *             else:
 */
    __pyx_v_info->format = __pyx_v_f;

    /* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":278
 *                     raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
 *                 info.format = f
 *                 return             # <<<<<<<<<<<<<<
 *             else:
 *                 info.format = <char*>stdlib.malloc(_buffer_format_string_len)
 */
    __pyx_r = 0;
    goto __pyx_L0;
  }
  /*else*/ {

    /* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":280
 *                 return
 *             else:
 *                 info.format = <char*>stdlib.malloc(_buffer_format_string_len)             # <<<<<<<<<<<<<<
 *                 info.format[0] = c'^' # Native data types, manual alignment
 *                 offset = 0
 */
    __pyx_v_info->format = ((char *)malloc(255));

    /* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":281
 *             else:
 *                 info.format = <char*>stdlib.malloc(_buffer_format_string_len)
 *                 info.format[0] = c'^' # Native data types, manual alignment             # <<<<<<<<<<<<<<
 *                 offset = 0
 *                 f = _util_dtypestring(descr, info.format + 1,
 */
    (__pyx_v_info->format[0]) = '^';

    /* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":282
 *                 info.format = <char*>stdlib.malloc(_buffer_format_string_len)
 *                 info.format[0] = c'^' # Native data types, manual alignment
 *                 offset = 0             # <<<<<<<<<<<<<<
 *                 f = _util_dtypestring(descr, info.format + 1,
 *                                       info.format + _buffer_format_string_len,
 */
    __pyx_v_offset = 0;

    /* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":283
 *                 info.format[0] = c'^' # Native data types, manual alignment
 *                 offset = 0
 *                 f = _util_dtypestring(descr, info.format + 1,             # <<<<<<<<<<<<<<
 *                                       info.format + _buffer_format_string_len,
 *                                       &offset)
 */
    __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_descr, (__pyx_v_info->format + 1), (__pyx_v_info->format + 255), (&__pyx_v_offset)); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_f = __pyx_t_9;

    /* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":286
 *                                       info.format + _buffer_format_string_len,
 *                                       &offset)
 *                 f[0] = c'\0' # Terminate format string             # <<<<<<<<<<<<<<
 * 
 *         def __releasebuffer__(ndarray self, Py_buffer* info):
 */
    (__pyx_v_f[0]) = '\x00';
  }

  /* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":194
 *         # experimental exception made for __getbuffer__ and __releasebuffer__
 *         # -- the details of this may change.
 *         def __getbuffer__(ndarray self, Py_buffer* info, int flags):             # <<<<<<<<<<<<<<
 *             # This implementation of getbuffer is geared towards Cython
 *             # requirements, and does not yet fullfill the PEP.
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("numpy.ndarray.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  if (__pyx_v_info != NULL && __pyx_v_info->obj != NULL) {
    __Pyx_GOTREF(__pyx_v_info->obj);
    __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = NULL;
  }
  goto __pyx_L2;
  __pyx_L0:;
  if (__pyx_v_info != NULL && __pyx_v_info->obj == Py_None) {
    __Pyx_GOTREF(Py_None);
    __Pyx_DECREF(Py_None); __pyx_v_info->obj = NULL;
  }
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_descr);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":288
 *                 f[0] = c'\0' # Terminate format string
 * 
 *         def __releasebuffer__(ndarray self, Py_buffer* info):             # <<<<<<<<<<<<<<
 *             if PyArray_HASFIELDS(self):
 *                 stdlib.free(info.format)
 */

/* Python wrapper */
static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/
static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__releasebuffer__ (wrapper)", 0);
  __pyx_pf_5numpy_7ndarray_2__releasebuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info) {
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("__releasebuffer__", 0);

  /* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":289
 * 
 *         def __releasebuffer__(ndarray self, Py_buffer* info):
 *             if PyArray_HASFIELDS(self):             # <<<<<<<<<<<<<<
 *                 stdlib.free(info.format)
 *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
 */
  __pyx_t_1 = (PyArray_HASFIELDS(__pyx_v_self) != 0);
  if (__pyx_t_1) {

    /* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":290
 *         def __releasebuffer__(ndarray self, Py_buffer* info):
 *             if PyArray_HASFIELDS(self):
 *                 stdlib.free(info.format)             # <<<<<<<<<<<<<<
 *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
 *                 stdlib.free(info.strides)
 */
    free(__pyx_v_info->format);
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":291
 *             if PyArray_HASFIELDS(self):
 *                 stdlib.free(info.format)
 *             if sizeof(npy_intp) != sizeof(Py_ssize_t):             # <<<<<<<<<<<<<<
 *                 stdlib.free(info.strides)
 *                 # info.shape was stored after info.strides in the same block
 */
  __pyx_t_1 = (((sizeof(npy_intp)) != (sizeof(Py_ssize_t))) != 0);
  if (__pyx_t_1) {

    /* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":292
 *                 stdlib.free(info.format)
 *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
 *                 stdlib.free(info.strides)             # <<<<<<<<<<<<<<
 *                 # info.shape was stored after info.strides in the same block
 * 
 */
    free(__pyx_v_info->strides);
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":288
 *                 f[0] = c'\0' # Terminate format string
 * 
 *         def __releasebuffer__(ndarray self, Py_buffer* info):             # <<<<<<<<<<<<<<
 *             if PyArray_HASFIELDS(self):
 *                 stdlib.free(info.format)
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

/* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":768
 * ctypedef npy_cdouble     complex_t
 * 
 * cdef inline object PyArray_MultiIterNew1(a):             # <<<<<<<<<<<<<<
 *     return PyArray_MultiIterNew(1, <void*>a)
 * 
 */

static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("PyArray_MultiIterNew1", 0);

  /* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":769
 * 
 * cdef inline object PyArray_MultiIterNew1(a):
 *     return PyArray_MultiIterNew(1, <void*>a)             # <<<<<<<<<<<<<<
 * 
 * cdef inline object PyArray_MultiIterNew2(a, b):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 769; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":768
 * ctypedef npy_cdouble     complex_t
 * 
 * cdef inline object PyArray_MultiIterNew1(a):             # <<<<<<<<<<<<<<
 *     return PyArray_MultiIterNew(1, <void*>a)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("numpy.PyArray_MultiIterNew1", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":771
 *     return PyArray_MultiIterNew(1, <void*>a)
 * 
 * cdef inline object PyArray_MultiIterNew2(a, b):             # <<<<<<<<<<<<<<
 *     return PyArray_MultiIterNew(2, <void*>a, <void*>b)
 * 
 */

static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__pyx_v_a, PyObject *__pyx_v_b) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("PyArray_MultiIterNew2", 0);

  /* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":772
 * 
 * cdef inline object PyArray_MultiIterNew2(a, b):
 *     return PyArray_MultiIterNew(2, <void*>a, <void*>b)             # <<<<<<<<<<<<<<
 * 
 * cdef inline object PyArray_MultiIterNew3(a, b, c):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":771
 *     return PyArray_MultiIterNew(1, <void*>a)
 * 
 * cdef inline object PyArray_MultiIterNew2(a, b):             # <<<<<<<<<<<<<<
 *     return PyArray_MultiIterNew(2, <void*>a, <void*>b)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("numpy.PyArray_MultiIterNew2", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":774
 *     return PyArray_MultiIterNew(2, <void*>a, <void*>b)
 * 
 * cdef inline object PyArray_MultiIterNew3(a, b, c):             # <<<<<<<<<<<<<<
 *     return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
 * 
 */

static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("PyArray_MultiIterNew3", 0);

  /* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":775
 * 
 * cdef inline object PyArray_MultiIterNew3(a, b, c):
 *     return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)             # <<<<<<<<<<<<<<
 * 
 * cdef inline object PyArray_MultiIterNew4(a, b, c, d):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 775; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":774
 *     return PyArray_MultiIterNew(2, <void*>a, <void*>b)
 * 
 * cdef inline object PyArray_MultiIterNew3(a, b, c):             # <<<<<<<<<<<<<<
 *     return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("numpy.PyArray_MultiIterNew3", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":777
 *     return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
 * 
 * cdef inline object PyArray_MultiIterNew4(a, b, c, d):             # <<<<<<<<<<<<<<
 *     return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
 * 
 */

static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("PyArray_MultiIterNew4", 0);

  /* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":778
 * 
 * cdef inline object PyArray_MultiIterNew4(a, b, c, d):
 *     return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)             # <<<<<<<<<<<<<<
 * 
 * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":777
 *     return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
 * 
 * cdef inline object PyArray_MultiIterNew4(a, b, c, d):             # <<<<<<<<<<<<<<
 *     return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("numpy.PyArray_MultiIterNew4", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":780
 *     return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
 * 
 * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):             # <<<<<<<<<<<<<<
 *     return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
 * 
 */

static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d, PyObject *__pyx_v_e) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("PyArray_MultiIterNew5", 0);

  /* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":781
 * 
 * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):
 *     return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)             # <<<<<<<<<<<<<<
 * 
 * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 781; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":780
 *     return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
 * 
 * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):             # <<<<<<<<<<<<<<
 *     return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("numpy.PyArray_MultiIterNew5", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":783
 *     return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
 * 
 * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL:             # <<<<<<<<<<<<<<
 *     # Recursive utility function used in __getbuffer__ to get format
 *     # string. The new location in the format string is returned.
 */

static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx_v_descr, char *__pyx_v_f, char *__pyx_v_end, int *__pyx_v_offset) {
  PyArray_Descr *__pyx_v_child = 0;
  int __pyx_v_endian_detector;
  int __pyx_v_little_endian;
  PyObject *__pyx_v_fields = 0;
  PyObject *__pyx_v_childname = NULL;
  PyObject *__pyx_v_new_offset = NULL;
  PyObject *__pyx_v_t = NULL;
  char *__pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_t_6;
  int __pyx_t_7;
  int __pyx_t_8;
  int __pyx_t_9;
  long __pyx_t_10;
  char *__pyx_t_11;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_util_dtypestring", 0);

  /* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":790
 *     cdef int delta_offset
 *     cdef tuple i
 *     cdef int endian_detector = 1             # <<<<<<<<<<<<<<
 *     cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)
 *     cdef tuple fields
 */
  __pyx_v_endian_detector = 1;

  /* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":791
 *     cdef tuple i
 *     cdef int endian_detector = 1
 *     cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)             # <<<<<<<<<<<<<<
 *     cdef tuple fields
 * 
 */
  __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0);

  /* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":794
 *     cdef tuple fields
 * 
 *     for childname in descr.names:             # <<<<<<<<<<<<<<
 *         fields = descr.fields[childname]
 *         child, new_offset = fields
 */
  if (unlikely(__pyx_v_descr->names == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
    {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_1 = __pyx_v_descr->names; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
  for (;;) {
    if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
    #if CYTHON_COMPILING_IN_CPYTHON
    __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    #else
    __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    #endif
    __Pyx_XDECREF_SET(__pyx_v_childname, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":795
 * 
 *     for childname in descr.names:
 *         fields = descr.fields[childname]             # <<<<<<<<<<<<<<
 *         child, new_offset = fields
 * 
 */
    __pyx_t_3 = PyObject_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_3);
    if (!(likely(PyTuple_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_XDECREF_SET(__pyx_v_fields, ((PyObject*)__pyx_t_3));
    __pyx_t_3 = 0;

    /* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":796
 *     for childname in descr.names:
 *         fields = descr.fields[childname]
 *         child, new_offset = fields             # <<<<<<<<<<<<<<
 * 
 *         if (end - f) - <int>(new_offset - offset[0]) < 15:
 */
    if (likely(__pyx_v_fields != Py_None)) {
      PyObject* sequence = __pyx_v_fields;
      #if CYTHON_COMPILING_IN_CPYTHON
      Py_ssize_t size = Py_SIZE(sequence);
      #else
      Py_ssize_t size = PySequence_Size(sequence);
      #endif
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      #if CYTHON_COMPILING_IN_CPYTHON
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); 
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      #else
      __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      #endif
    } else {
      __Pyx_RaiseNoneNotIterableError(); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_XDECREF_SET(__pyx_v_child, ((PyArray_Descr *)__pyx_t_3));
    __pyx_t_3 = 0;
    __Pyx_XDECREF_SET(__pyx_v_new_offset, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":798
 *         child, new_offset = fields
 * 
 *         if (end - f) - <int>(new_offset - offset[0]) < 15:             # <<<<<<<<<<<<<<
 *             raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
 * 
 */
    __pyx_t_4 = __Pyx_PyInt_From_int((__pyx_v_offset[0])); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = PyNumber_Subtract(__pyx_v_new_offset, __pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_6 = ((((__pyx_v_end - __pyx_v_f) - ((int)__pyx_t_5)) < 15) != 0);
    if (__pyx_t_6) {

      /* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":799
 * 
 *         if (end - f) - <int>(new_offset - offset[0]) < 15:
 *             raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")             # <<<<<<<<<<<<<<
 * 
 *         if ((child.byteorder == c'>' and little_endian) or
 */
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__24, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_Raise(__pyx_t_3, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }

    /* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":801
 *             raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
 * 
 *         if ((child.byteorder == c'>' and little_endian) or             # <<<<<<<<<<<<<<
 *             (child.byteorder == c'<' and not little_endian)):
 *             raise ValueError(u"Non-native byte order not supported")
 */
    __pyx_t_6 = ((__pyx_v_child->byteorder == '>') != 0);
    if (__pyx_t_6) {
      __pyx_t_7 = (__pyx_v_little_endian != 0);
    } else {
      __pyx_t_7 = __pyx_t_6;
    }
    if (!__pyx_t_7) {

      /* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":802
 * 
 *         if ((child.byteorder == c'>' and little_endian) or
 *             (child.byteorder == c'<' and not little_endian)):             # <<<<<<<<<<<<<<
 *             raise ValueError(u"Non-native byte order not supported")
 *             # One could encode it in the format string and have Cython
 */
      __pyx_t_6 = ((__pyx_v_child->byteorder == '<') != 0);
      if (__pyx_t_6) {
        __pyx_t_8 = ((!(__pyx_v_little_endian != 0)) != 0);
        __pyx_t_9 = __pyx_t_8;
      } else {
        __pyx_t_9 = __pyx_t_6;
      }
      __pyx_t_6 = __pyx_t_9;
    } else {
      __pyx_t_6 = __pyx_t_7;
    }
    if (__pyx_t_6) {

      /* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":803
 *         if ((child.byteorder == c'>' and little_endian) or
 *             (child.byteorder == c'<' and not little_endian)):
 *             raise ValueError(u"Non-native byte order not supported")             # <<<<<<<<<<<<<<
 *             # One could encode it in the format string and have Cython
 *             # complain instead, BUT: < and > in format strings also imply
 */
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__25, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_Raise(__pyx_t_3, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }

    /* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":813
 * 
 *         # Output padding bytes
 *         while offset[0] < new_offset:             # <<<<<<<<<<<<<<
 *             f[0] = 120 # "x"; pad byte
 *             f += 1
 */
    while (1) {
      __pyx_t_3 = __Pyx_PyInt_From_int((__pyx_v_offset[0])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PyObject_RichCompare(__pyx_t_3, __pyx_v_new_offset, Py_LT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (!__pyx_t_6) break;

      /* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":814
 *         # Output padding bytes
 *         while offset[0] < new_offset:
 *             f[0] = 120 # "x"; pad byte             # <<<<<<<<<<<<<<
 *             f += 1
 *             offset[0] += 1
 */
      (__pyx_v_f[0]) = 120;

      /* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":815
 *         while offset[0] < new_offset:
 *             f[0] = 120 # "x"; pad byte
 *             f += 1             # <<<<<<<<<<<<<<
 *             offset[0] += 1
 * 
 */
      __pyx_v_f = (__pyx_v_f + 1);

      /* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":816
 *             f[0] = 120 # "x"; pad byte
 *             f += 1
 *             offset[0] += 1             # <<<<<<<<<<<<<<
 * 
 *         offset[0] += child.itemsize
 */
      __pyx_t_10 = 0;
      (__pyx_v_offset[__pyx_t_10]) = ((__pyx_v_offset[__pyx_t_10]) + 1);
    }

    /* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":818
 *             offset[0] += 1
 * 
 *         offset[0] += child.itemsize             # <<<<<<<<<<<<<<
 * 
 *         if not PyDataType_HASFIELDS(child):
 */
    __pyx_t_10 = 0;
    (__pyx_v_offset[__pyx_t_10]) = ((__pyx_v_offset[__pyx_t_10]) + __pyx_v_child->elsize);

    /* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":820
 *         offset[0] += child.itemsize
 * 
 *         if not PyDataType_HASFIELDS(child):             # <<<<<<<<<<<<<<
 *             t = child.type_num
 *             if end - f < 5:
 */
    __pyx_t_6 = ((!(PyDataType_HASFIELDS(__pyx_v_child) != 0)) != 0);
    if (__pyx_t_6) {

      /* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":821
 * 
 *         if not PyDataType_HASFIELDS(child):
 *             t = child.type_num             # <<<<<<<<<<<<<<
 *             if end - f < 5:
 *                 raise RuntimeError(u"Format string allocated too short.")
 */
      __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_child->type_num); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_XDECREF_SET(__pyx_v_t, __pyx_t_4);
      __pyx_t_4 = 0;

      /* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":822
 *         if not PyDataType_HASFIELDS(child):
 *             t = child.type_num
 *             if end - f < 5:             # <<<<<<<<<<<<<<
 *                 raise RuntimeError(u"Format string allocated too short.")
 * 
 */
      __pyx_t_6 = (((__pyx_v_end - __pyx_v_f) < 5) != 0);
      if (__pyx_t_6) {

        /* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":823
 *             t = child.type_num
 *             if end - f < 5:
 *                 raise RuntimeError(u"Format string allocated too short.")             # <<<<<<<<<<<<<<
 * 
 *             # Until ticket #99 is fixed, use integers to avoid warnings
 */
        __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__26, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_Raise(__pyx_t_4, 0, 0, 0);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }

      /* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":826
 * 
 *             # Until ticket #99 is fixed, use integers to avoid warnings
 *             if   t == NPY_BYTE:        f[0] =  98 #"b"             # <<<<<<<<<<<<<<
 *             elif t == NPY_UBYTE:       f[0] =  66 #"B"
 *             elif t == NPY_SHORT:       f[0] = 104 #"h"
 */
      __pyx_t_4 = PyInt_FromLong(NPY_BYTE); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 98;
        goto __pyx_L11;
      }

      /* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":827
 *             # Until ticket #99 is fixed, use integers to avoid warnings
 *             if   t == NPY_BYTE:        f[0] =  98 #"b"
 *             elif t == NPY_UBYTE:       f[0] =  66 #"B"             # <<<<<<<<<<<<<<
 *             elif t == NPY_SHORT:       f[0] = 104 #"h"
 *             elif t == NPY_USHORT:      f[0] =  72 #"H"
 */
      __pyx_t_3 = PyInt_FromLong(NPY_UBYTE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 66;
        goto __pyx_L11;
      }

      /* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":828
 *             if   t == NPY_BYTE:        f[0] =  98 #"b"
 *             elif t == NPY_UBYTE:       f[0] =  66 #"B"
 *             elif t == NPY_SHORT:       f[0] = 104 #"h"             # <<<<<<<<<<<<<<
 *             elif t == NPY_USHORT:      f[0] =  72 #"H"
 *             elif t == NPY_INT:         f[0] = 105 #"i"
 */
      __pyx_t_4 = PyInt_FromLong(NPY_SHORT); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 104;
        goto __pyx_L11;
      }

      /* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":829
 *             elif t == NPY_UBYTE:       f[0] =  66 #"B"
 *             elif t == NPY_SHORT:       f[0] = 104 #"h"
 *             elif t == NPY_USHORT:      f[0] =  72 #"H"             # <<<<<<<<<<<<<<
 *             elif t == NPY_INT:         f[0] = 105 #"i"
 *             elif t == NPY_UINT:        f[0] =  73 #"I"
 */
      __pyx_t_3 = PyInt_FromLong(NPY_USHORT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 72;
        goto __pyx_L11;
      }

      /* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":830
 *             elif t == NPY_SHORT:       f[0] = 104 #"h"
 *             elif t == NPY_USHORT:      f[0] =  72 #"H"
 *             elif t == NPY_INT:         f[0] = 105 #"i"             # <<<<<<<<<<<<<<
 *             elif t == NPY_UINT:        f[0] =  73 #"I"
 *             elif t == NPY_LONG:        f[0] = 108 #"l"
 */
      __pyx_t_4 = PyInt_FromLong(NPY_INT); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 105;
        goto __pyx_L11;
      }

      /* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":831
 *             elif t == NPY_USHORT:      f[0] =  72 #"H"
 *             elif t == NPY_INT:         f[0] = 105 #"i"
 *             elif t == NPY_UINT:        f[0] =  73 #"I"             # <<<<<<<<<<<<<<
 *             elif t == NPY_LONG:        f[0] = 108 #"l"
 *             elif t == NPY_ULONG:       f[0] = 76  #"L"
 */
      __pyx_t_3 = PyInt_FromLong(NPY_UINT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 73;
        goto __pyx_L11;
      }

      /* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":832
 *             elif t == NPY_INT:         f[0] = 105 #"i"
 *             elif t == NPY_UINT:        f[0] =  73 #"I"
 *             elif t == NPY_LONG:        f[0] = 108 #"l"             # <<<<<<<<<<<<<<
 *             elif t == NPY_ULONG:       f[0] = 76  #"L"
 *             elif t == NPY_LONGLONG:    f[0] = 113 #"q"
 */
      __pyx_t_4 = PyInt_FromLong(NPY_LONG); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 108;
        goto __pyx_L11;
      }

      /* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":833
 *             elif t == NPY_UINT:        f[0] =  73 #"I"
 *             elif t == NPY_LONG:        f[0] = 108 #"l"
 *             elif t == NPY_ULONG:       f[0] = 76  #"L"             # <<<<<<<<<<<<<<
 *             elif t == NPY_LONGLONG:    f[0] = 113 #"q"
 *             elif t == NPY_ULONGLONG:   f[0] = 81  #"Q"
 */
      __pyx_t_3 = PyInt_FromLong(NPY_ULONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 76;
        goto __pyx_L11;
      }

      /* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":834
 *             elif t == NPY_LONG:        f[0] = 108 #"l"
 *             elif t == NPY_ULONG:       f[0] = 76  #"L"
 *             elif t == NPY_LONGLONG:    f[0] = 113 #"q"             # <<<<<<<<<<<<<<
 *             elif t == NPY_ULONGLONG:   f[0] = 81  #"Q"
 *             elif t == NPY_FLOAT:       f[0] = 102 #"f"
 */
      __pyx_t_4 = PyInt_FromLong(NPY_LONGLONG); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 113;
        goto __pyx_L11;
      }

      /* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":835
 *             elif t == NPY_ULONG:       f[0] = 76  #"L"
 *             elif t == NPY_LONGLONG:    f[0] = 113 #"q"
 *             elif t == NPY_ULONGLONG:   f[0] = 81  #"Q"             # <<<<<<<<<<<<<<
 *             elif t == NPY_FLOAT:       f[0] = 102 #"f"
 *             elif t == NPY_DOUBLE:      f[0] = 100 #"d"
 */
      __pyx_t_3 = PyInt_FromLong(NPY_ULONGLONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 81;
        goto __pyx_L11;
      }

      /* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":836
 *             elif t == NPY_LONGLONG:    f[0] = 113 #"q"
 *             elif t == NPY_ULONGLONG:   f[0] = 81  #"Q"
 *             elif t == NPY_FLOAT:       f[0] = 102 #"f"             # <<<<<<<<<<<<<<
 *             elif t == NPY_DOUBLE:      f[0] = 100 #"d"
 *             elif t == NPY_LONGDOUBLE:  f[0] = 103 #"g"
 */
      __pyx_t_4 = PyInt_FromLong(NPY_FLOAT); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 102;
        goto __pyx_L11;
      }

      /* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":837
 *             elif t == NPY_ULONGLONG:   f[0] = 81  #"Q"
 *             elif t == NPY_FLOAT:       f[0] = 102 #"f"
 *             elif t == NPY_DOUBLE:      f[0] = 100 #"d"             # <<<<<<<<<<<<<<
 *             elif t == NPY_LONGDOUBLE:  f[0] = 103 #"g"
 *             elif t == NPY_CFLOAT:      f[0] = 90; f[1] = 102; f += 1 # Zf
 */
      __pyx_t_3 = PyInt_FromLong(NPY_DOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 100;
        goto __pyx_L11;
      }

      /* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":838
 *             elif t == NPY_FLOAT:       f[0] = 102 #"f"
 *             elif t == NPY_DOUBLE:      f[0] = 100 #"d"
 *             elif t == NPY_LONGDOUBLE:  f[0] = 103 #"g"             # <<<<<<<<<<<<<<
 *             elif t == NPY_CFLOAT:      f[0] = 90; f[1] = 102; f += 1 # Zf
 *             elif t == NPY_CDOUBLE:     f[0] = 90; f[1] = 100; f += 1 # Zd
 */
      __pyx_t_4 = PyInt_FromLong(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 103;
        goto __pyx_L11;
      }

      /* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":839
 *             elif t == NPY_DOUBLE:      f[0] = 100 #"d"
 *             elif t == NPY_LONGDOUBLE:  f[0] = 103 #"g"
 *             elif t == NPY_CFLOAT:      f[0] = 90; f[1] = 102; f += 1 # Zf             # <<<<<<<<<<<<<<
 *             elif t == NPY_CDOUBLE:     f[0] = 90; f[1] = 100; f += 1 # Zd
 *             elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg
 */
      __pyx_t_3 = PyInt_FromLong(NPY_CFLOAT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 90;
        (__pyx_v_f[1]) = 102;
        __pyx_v_f = (__pyx_v_f + 1);
        goto __pyx_L11;
      }

      /* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":840
 *             elif t == NPY_LONGDOUBLE:  f[0] = 103 #"g"
 *             elif t == NPY_CFLOAT:      f[0] = 90; f[1] = 102; f += 1 # Zf
 *             elif t == NPY_CDOUBLE:     f[0] = 90; f[1] = 100; f += 1 # Zd             # <<<<<<<<<<<<<<
 *             elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg
 *             elif t == NPY_OBJECT:      f[0] = 79 #"O"
 */
      __pyx_t_4 = PyInt_FromLong(NPY_CDOUBLE); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 90;
        (__pyx_v_f[1]) = 100;
        __pyx_v_f = (__pyx_v_f + 1);
        goto __pyx_L11;
      }

      /* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":841
 *             elif t == NPY_CFLOAT:      f[0] = 90; f[1] = 102; f += 1 # Zf
 *             elif t == NPY_CDOUBLE:     f[0] = 90; f[1] = 100; f += 1 # Zd
 *             elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg             # <<<<<<<<<<<<<<
 *             elif t == NPY_OBJECT:      f[0] = 79 #"O"
 *             else:
 */
      __pyx_t_3 = PyInt_FromLong(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 90;
        (__pyx_v_f[1]) = 103;
        __pyx_v_f = (__pyx_v_f + 1);
        goto __pyx_L11;
      }

      /* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":842
 *             elif t == NPY_CDOUBLE:     f[0] = 90; f[1] = 100; f += 1 # Zd
 *             elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg
 *             elif t == NPY_OBJECT:      f[0] = 79 #"O"             # <<<<<<<<<<<<<<
 *             else:
 *                 raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
 */
      __pyx_t_4 = PyInt_FromLong(NPY_OBJECT); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 79;
        goto __pyx_L11;
      }
      /*else*/ {

        /* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":844
 *             elif t == NPY_OBJECT:      f[0] = 79 #"O"
 *             else:
 *                 raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)             # <<<<<<<<<<<<<<
 *             f += 1
 *         else:
 */
        __pyx_t_3 = PyUnicode_Format(__pyx_kp_u_unknown_dtype_code_in_numpy_pxd, __pyx_v_t); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_4);
        PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
        __Pyx_GIVEREF(__pyx_t_3);
        __pyx_t_3 = 0;
        __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_Raise(__pyx_t_3, 0, 0, 0);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_L11:;

      /* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":845
 *             else:
 *                 raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
 *             f += 1             # <<<<<<<<<<<<<<
 *         else:
 *             # Cython ignores struct boundary information ("T{...}"),
 */
      __pyx_v_f = (__pyx_v_f + 1);
      goto __pyx_L9;
    }
    /*else*/ {

      /* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":849
 *             # Cython ignores struct boundary information ("T{...}"),
 *             # so don't output it
 *             f = _util_dtypestring(child, f, end, offset)             # <<<<<<<<<<<<<<
 *     return f
 * 
 */
      __pyx_t_11 = __pyx_f_5numpy__util_dtypestring(__pyx_v_child, __pyx_v_f, __pyx_v_end, __pyx_v_offset); if (unlikely(__pyx_t_11 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 849; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_v_f = __pyx_t_11;
    }
    __pyx_L9:;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":850
 *             # so don't output it
 *             f = _util_dtypestring(child, f, end, offset)
 *     return f             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = __pyx_v_f;
  goto __pyx_L0;

  /* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":783
 *     return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
 * 
 * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL:             # <<<<<<<<<<<<<<
 *     # Recursive utility function used in __getbuffer__ to get format
 *     # string. The new location in the format string is returned.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("numpy._util_dtypestring", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_child);
  __Pyx_XDECREF(__pyx_v_fields);
  __Pyx_XDECREF(__pyx_v_childname);
  __Pyx_XDECREF(__pyx_v_new_offset);
  __Pyx_XDECREF(__pyx_v_t);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":966
 * 
 * 
 * cdef inline void set_array_base(ndarray arr, object base):             # <<<<<<<<<<<<<<
 *      cdef PyObject* baseptr
 *      if base is None:
 */

static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) {
  PyObject *__pyx_v_baseptr;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("set_array_base", 0);

  /* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":968
 * cdef inline void set_array_base(ndarray arr, object base):
 *      cdef PyObject* baseptr
 *      if base is None:             # <<<<<<<<<<<<<<
 *          baseptr = NULL
 *      else:
 */
  __pyx_t_1 = (__pyx_v_base == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":969
 *      cdef PyObject* baseptr
 *      if base is None:
 *          baseptr = NULL             # <<<<<<<<<<<<<<
 *      else:
 *          Py_INCREF(base) # important to do this before decref below!
 */
    __pyx_v_baseptr = NULL;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":971
 *          baseptr = NULL
 *      else:
 *          Py_INCREF(base) # important to do this before decref below!             # <<<<<<<<<<<<<<
 *          baseptr = <PyObject*>base
 *      Py_XDECREF(arr.base)
 */
    Py_INCREF(__pyx_v_base);

    /* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":972
 *      else:
 *          Py_INCREF(base) # important to do this before decref below!
 *          baseptr = <PyObject*>base             # <<<<<<<<<<<<<<
 *      Py_XDECREF(arr.base)
 *      arr.base = baseptr
 */
    __pyx_v_baseptr = ((PyObject *)__pyx_v_base);
  }
  __pyx_L3:;

  /* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":973
 *          Py_INCREF(base) # important to do this before decref below!
 *          baseptr = <PyObject*>base
 *      Py_XDECREF(arr.base)             # <<<<<<<<<<<<<<
 *      arr.base = baseptr
 * 
 */
  Py_XDECREF(__pyx_v_arr->base);

  /* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":974
 *          baseptr = <PyObject*>base
 *      Py_XDECREF(arr.base)
 *      arr.base = baseptr             # <<<<<<<<<<<<<<
 * 
 * cdef inline object get_array_base(ndarray arr):
 */
  __pyx_v_arr->base = __pyx_v_baseptr;

  /* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":966
 * 
 * 
 * cdef inline void set_array_base(ndarray arr, object base):             # <<<<<<<<<<<<<<
 *      cdef PyObject* baseptr
 *      if base is None:
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

/* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":976
 *      arr.base = baseptr
 * 
 * cdef inline object get_array_base(ndarray arr):             # <<<<<<<<<<<<<<
 *     if arr.base is NULL:
 *         return None
 */

static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("get_array_base", 0);

  /* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":977
 * 
 * cdef inline object get_array_base(ndarray arr):
 *     if arr.base is NULL:             # <<<<<<<<<<<<<<
 *         return None
 *     else:
 */
  __pyx_t_1 = ((__pyx_v_arr->base == NULL) != 0);
  if (__pyx_t_1) {

    /* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":978
 * cdef inline object get_array_base(ndarray arr):
 *     if arr.base is NULL:
 *         return None             # <<<<<<<<<<<<<<
 *     else:
 *         return <object>arr.base
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_None);
    __pyx_r = Py_None;
    goto __pyx_L0;
  }
  /*else*/ {

    /* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":980
 *         return None
 *     else:
 *         return <object>arr.base             # <<<<<<<<<<<<<<
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)__pyx_v_arr->base));
    __pyx_r = ((PyObject *)__pyx_v_arr->base);
    goto __pyx_L0;
  }

  /* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":976
 *      arr.base = baseptr
 * 
 * cdef inline object get_array_base(ndarray arr):             # <<<<<<<<<<<<<<
 *     if arr.base is NULL:
 *         return None
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_tp_new_3epr__CLib(PyTypeObject *t, PyObject *a, PyObject *k) {
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  if (unlikely(__pyx_pw_3epr_5_CLib_1__cinit__(o, a, k) < 0)) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_3epr__CLib(PyObject *o) {
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    ++Py_REFCNT(o);
    __pyx_pw_3epr_5_CLib_3__dealloc__(o);
    --Py_REFCNT(o);
    PyErr_Restore(etype, eval, etb);
  }
  (*Py_TYPE(o)->tp_free)(o);
}

static PyMethodDef __pyx_methods_3epr__CLib[] = {
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_3epr__CLib = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("epr._CLib"), /*tp_name*/
  sizeof(struct __pyx_obj_3epr__CLib), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_3epr__CLib, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
  __Pyx_DOCSTR("Library object to handle C API initialization/finalization\n\n    .. warning:: this is meant for internal use only. **Do not use it**.\n\n    "), /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_3epr__CLib, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pw_3epr_5_CLib_5__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_3epr__CLib, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};

static PyObject *__pyx_tp_new_3epr_EprObject(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_3epr_EprObject *p;
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_3epr_EprObject *)o);
  p->epr_c_lib = Py_None; Py_INCREF(Py_None);
  if (unlikely(__pyx_pw_3epr_9EprObject_1__cinit__(o, a, k) < 0)) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_3epr_EprObject(PyObject *o) {
  struct __pyx_obj_3epr_EprObject *p = (struct __pyx_obj_3epr_EprObject *)o;
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    ++Py_REFCNT(o);
    __pyx_pw_3epr_9EprObject_3__dealloc__(o);
    --Py_REFCNT(o);
    PyErr_Restore(etype, eval, etb);
  }
  Py_CLEAR(p->epr_c_lib);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_3epr_EprObject(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_3epr_EprObject *p = (struct __pyx_obj_3epr_EprObject *)o;
  if (p->epr_c_lib) {
    e = (*v)(p->epr_c_lib, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_3epr_EprObject(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_3epr_EprObject *p = (struct __pyx_obj_3epr_EprObject *)o;
  tmp = ((PyObject*)p->epr_c_lib);
  p->epr_c_lib = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyMethodDef __pyx_methods_3epr_EprObject[] = {
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_3epr_EprObject = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("epr.EprObject"), /*tp_name*/
  sizeof(struct __pyx_obj_3epr_EprObject), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_3epr_EprObject, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_3epr_EprObject, /*tp_traverse*/
  __pyx_tp_clear_3epr_EprObject, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_3epr_EprObject, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pw_3epr_9EprObject_5__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_3epr_EprObject, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_3epr_DSD __pyx_vtable_3epr_DSD;

static PyObject *__pyx_tp_new_3epr_DSD(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_3epr_DSD *p;
  PyObject *o = __pyx_tp_new_3epr_EprObject(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_3epr_DSD *)o);
  p->__pyx_vtab = __pyx_vtabptr_3epr_DSD;
  p->_parent = Py_None; Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_3epr_DSD(PyObject *o) {
  struct __pyx_obj_3epr_DSD *p = (struct __pyx_obj_3epr_DSD *)o;
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->_parent);
  PyObject_GC_Track(o);
  __pyx_tp_dealloc_3epr_EprObject(o);
}

static int __pyx_tp_traverse_3epr_DSD(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_3epr_DSD *p = (struct __pyx_obj_3epr_DSD *)o;
  e = __pyx_tp_traverse_3epr_EprObject(o, v, a); if (e) return e;
  if (p->_parent) {
    e = (*v)(p->_parent, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_3epr_DSD(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_3epr_DSD *p = (struct __pyx_obj_3epr_DSD *)o;
  __pyx_tp_clear_3epr_EprObject(o);
  tmp = ((PyObject*)p->_parent);
  p->_parent = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_getprop_3epr_3DSD_index(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_3epr_3DSD_5index_1__get__(o);
}

static PyObject *__pyx_getprop_3epr_3DSD_ds_name(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_3epr_3DSD_7ds_name_1__get__(o);
}

static PyObject *__pyx_getprop_3epr_3DSD_ds_type(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_3epr_3DSD_7ds_type_1__get__(o);
}

static PyObject *__pyx_getprop_3epr_3DSD_filename(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_3epr_3DSD_8filename_1__get__(o);
}

static PyObject *__pyx_getprop_3epr_3DSD_ds_offset(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_3epr_3DSD_9ds_offset_1__get__(o);
}

static PyObject *__pyx_getprop_3epr_3DSD_ds_size(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_3epr_3DSD_7ds_size_1__get__(o);
}

static PyObject *__pyx_getprop_3epr_3DSD_num_dsr(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_3epr_3DSD_7num_dsr_1__get__(o);
}

static PyObject *__pyx_getprop_3epr_3DSD_dsr_size(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_3epr_3DSD_8dsr_size_1__get__(o);
}

static PyObject *__pyx_getprop_3epr_3DSD__magic(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_3epr_3DSD_6_magic_1__get__(o);
}

static PyMethodDef __pyx_methods_3epr_DSD[] = {
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_3epr_DSD[] = {
  {(char *)"index", __pyx_getprop_3epr_3DSD_index, 0, __Pyx_DOCSTR(__pyx_k_The_index_of_this_DSD_zero_based), 0},
  {(char *)"ds_name", __pyx_getprop_3epr_3DSD_ds_name, 0, __Pyx_DOCSTR(__pyx_k_The_dataset_name), 0},
  {(char *)"ds_type", __pyx_getprop_3epr_3DSD_ds_type, 0, __Pyx_DOCSTR(__pyx_k_The_dataset_type_descriptor), 0},
  {(char *)"filename", __pyx_getprop_3epr_3DSD_filename, 0, __Pyx_DOCSTR(__pyx_k_The_filename_in_the_DDDB_with_th), 0},
  {(char *)"ds_offset", __pyx_getprop_3epr_3DSD_ds_offset, 0, __Pyx_DOCSTR(__pyx_k_The_offset_of_dataset_informatio), 0},
  {(char *)"ds_size", __pyx_getprop_3epr_3DSD_ds_size, 0, __Pyx_DOCSTR(__pyx_k_The_size_of_dataset_information), 0},
  {(char *)"num_dsr", __pyx_getprop_3epr_3DSD_num_dsr, 0, __Pyx_DOCSTR(__pyx_k_The_number_of_dataset_records_fo), 0},
  {(char *)"dsr_size", __pyx_getprop_3epr_3DSD_dsr_size, 0, __Pyx_DOCSTR(__pyx_k_The_size_of_dataset_record_for_t), 0},
  {(char *)"_magic", __pyx_getprop_3epr_3DSD__magic, 0, __Pyx_DOCSTR(__pyx_k_The_magic_number_for_internal_C), 0},
  {0, 0, 0, 0, 0}
};

static PyTypeObject __pyx_type_3epr_DSD = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("epr.DSD"), /*tp_name*/
  sizeof(struct __pyx_obj_3epr_DSD), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_3epr_DSD, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  __pyx_pw_3epr_3DSD_1__repr__, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("Dataset descriptor\n\n    The DSD class contains information about the properties of a\n    dataset and its location within an ENVISAT product file\n\n    "), /*tp_doc*/
  __pyx_tp_traverse_3epr_DSD, /*tp_traverse*/
  __pyx_tp_clear_3epr_DSD, /*tp_clear*/
  __pyx_pw_3epr_3DSD_3__richcmp__, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_3epr_DSD, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_3epr_DSD, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  #if CYTHON_COMPILING_IN_PYPY
  __pyx_pw_3epr_9EprObject_5__init__, /*tp_init*/
  #else
  0, /*tp_init*/
  #endif
  0, /*tp_alloc*/
  __pyx_tp_new_3epr_DSD, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_3epr_Field __pyx_vtable_3epr_Field;

static PyObject *__pyx_tp_new_3epr_Field(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_3epr_Field *p;
  PyObject *o = __pyx_tp_new_3epr_EprObject(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_3epr_Field *)o);
  p->__pyx_vtab = __pyx_vtabptr_3epr_Field;
  p->_parent = ((struct __pyx_obj_3epr_Record *)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_3epr_Field(PyObject *o) {
  struct __pyx_obj_3epr_Field *p = (struct __pyx_obj_3epr_Field *)o;
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->_parent);
  PyObject_GC_Track(o);
  __pyx_tp_dealloc_3epr_EprObject(o);
}

static int __pyx_tp_traverse_3epr_Field(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_3epr_Field *p = (struct __pyx_obj_3epr_Field *)o;
  e = __pyx_tp_traverse_3epr_EprObject(o, v, a); if (e) return e;
  if (p->_parent) {
    e = (*v)(((PyObject*)p->_parent), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_3epr_Field(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_3epr_Field *p = (struct __pyx_obj_3epr_Field *)o;
  __pyx_tp_clear_3epr_EprObject(o);
  tmp = ((PyObject*)p->_parent);
  p->_parent = ((struct __pyx_obj_3epr_Record *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_getprop_3epr_5Field_tot_size(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_3epr_5Field_8tot_size_1__get__(o);
}

static PyObject *__pyx_getprop_3epr_5Field__magic(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_3epr_5Field_6_magic_1__get__(o);
}

static PyMethodDef __pyx_methods_3epr_Field[] = {
  {__Pyx_NAMESTR("print_"), (PyCFunction)__pyx_pw_3epr_5Field_1print_, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_3epr_5Field_print_)},
  {__Pyx_NAMESTR("get_unit"), (PyCFunction)__pyx_pw_3epr_5Field_3get_unit, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_3epr_5Field_2get_unit)},
  {__Pyx_NAMESTR("get_description"), (PyCFunction)__pyx_pw_3epr_5Field_5get_description, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_3epr_5Field_4get_description)},
  {__Pyx_NAMESTR("get_num_elems"), (PyCFunction)__pyx_pw_3epr_5Field_7get_num_elems, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_3epr_5Field_6get_num_elems)},
  {__Pyx_NAMESTR("get_name"), (PyCFunction)__pyx_pw_3epr_5Field_9get_name, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_3epr_5Field_8get_name)},
  {__Pyx_NAMESTR("get_type"), (PyCFunction)__pyx_pw_3epr_5Field_11get_type, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_3epr_5Field_10get_type)},
  {__Pyx_NAMESTR("get_elem"), (PyCFunction)__pyx_pw_3epr_5Field_13get_elem, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_3epr_5Field_12get_elem)},
  {__Pyx_NAMESTR("get_elems"), (PyCFunction)__pyx_pw_3epr_5Field_15get_elems, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_3epr_5Field_14get_elems)},
  {__Pyx_NAMESTR("set_elem"), (PyCFunction)__pyx_pw_3epr_5Field_17set_elem, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_3epr_5Field_16set_elem)},
  {__Pyx_NAMESTR("set_elems"), (PyCFunction)__pyx_pw_3epr_5Field_19set_elems, METH_O, __Pyx_DOCSTR(__pyx_doc_3epr_5Field_18set_elems)},
  {__Pyx_NAMESTR("get_offset"), (PyCFunction)__pyx_pw_3epr_5Field_29get_offset, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_3epr_5Field_28get_offset)},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_3epr_Field[] = {
  {(char *)"tot_size", __pyx_getprop_3epr_5Field_tot_size, 0, __Pyx_DOCSTR(__pyx_k_The_total_size_in_bytes_of_all_d), 0},
  {(char *)"_magic", __pyx_getprop_3epr_5Field__magic, 0, __Pyx_DOCSTR(__pyx_k_The_magic_number_for_internal_C), 0},
  {0, 0, 0, 0, 0}
};

static PySequenceMethods __pyx_tp_as_sequence_Field = {
  __pyx_pw_3epr_5Field_27__len__, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_Field = {
  __pyx_pw_3epr_5Field_27__len__, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyTypeObject __pyx_type_3epr_Field = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("epr.Field"), /*tp_name*/
  sizeof(struct __pyx_obj_3epr_Field), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_3epr_Field, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  __pyx_pw_3epr_5Field_21__repr__, /*tp_repr*/
  0, /*tp_as_number*/
  &__pyx_tp_as_sequence_Field, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_Field, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  __pyx_pw_3epr_5Field_23__str__, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("Represents a field within a record\n\n    A field is composed of one or more data elements of one of the\n    types defined in the internal ``field_info`` structure.\n\n    .. seealso:: :class:`Record`\n\n    "), /*tp_doc*/
  __pyx_tp_traverse_3epr_Field, /*tp_traverse*/
  __pyx_tp_clear_3epr_Field, /*tp_clear*/
  __pyx_pw_3epr_5Field_25__richcmp__, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_3epr_Field, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_3epr_Field, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  #if CYTHON_COMPILING_IN_PYPY
  __pyx_pw_3epr_9EprObject_5__init__, /*tp_init*/
  #else
  0, /*tp_init*/
  #endif
  0, /*tp_alloc*/
  __pyx_tp_new_3epr_Field, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_3epr_Record __pyx_vtable_3epr_Record;

static PyObject *__pyx_tp_new_3epr_Record(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_3epr_Record *p;
  PyObject *o = __pyx_tp_new_3epr_EprObject(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_3epr_Record *)o);
  p->__pyx_vtab = __pyx_vtabptr_3epr_Record;
  p->_parent = Py_None; Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_3epr_Record(PyObject *o) {
  struct __pyx_obj_3epr_Record *p = (struct __pyx_obj_3epr_Record *)o;
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    ++Py_REFCNT(o);
    __pyx_pw_3epr_6Record_1__dealloc__(o);
    --Py_REFCNT(o);
    PyErr_Restore(etype, eval, etb);
  }
  Py_CLEAR(p->_parent);
  PyObject_GC_Track(o);
  __pyx_tp_dealloc_3epr_EprObject(o);
}

static int __pyx_tp_traverse_3epr_Record(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_3epr_Record *p = (struct __pyx_obj_3epr_Record *)o;
  e = __pyx_tp_traverse_3epr_EprObject(o, v, a); if (e) return e;
  if (p->_parent) {
    e = (*v)(p->_parent, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_3epr_Record(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_3epr_Record *p = (struct __pyx_obj_3epr_Record *)o;
  __pyx_tp_clear_3epr_EprObject(o);
  tmp = ((PyObject*)p->_parent);
  p->_parent = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_getprop_3epr_6Record_dataset_name(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_3epr_6Record_12dataset_name_1__get__(o);
}

static PyObject *__pyx_getprop_3epr_6Record_tot_size(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_3epr_6Record_8tot_size_1__get__(o);
}

static PyObject *__pyx_getprop_3epr_6Record_index(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_3epr_6Record_5index_1__get__(o);
}

static PyObject *__pyx_getprop_3epr_6Record__magic(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_3epr_6Record_6_magic_1__get__(o);
}

static PyMethodDef __pyx_methods_3epr_Record[] = {
  {__Pyx_NAMESTR("get_num_fields"), (PyCFunction)__pyx_pw_3epr_6Record_3get_num_fields, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_3epr_6Record_2get_num_fields)},
  {__Pyx_NAMESTR("print_"), (PyCFunction)__pyx_pw_3epr_6Record_5print_, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_3epr_6Record_4print_)},
  {__Pyx_NAMESTR("print_element"), (PyCFunction)__pyx_pw_3epr_6Record_7print_element, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_3epr_6Record_6print_element)},
  {__Pyx_NAMESTR("get_field"), (PyCFunction)__pyx_pw_3epr_6Record_9get_field, METH_O, __Pyx_DOCSTR(__pyx_doc_3epr_6Record_8get_field)},
  {__Pyx_NAMESTR("get_field_at"), (PyCFunction)__pyx_pw_3epr_6Record_11get_field_at, METH_O, __Pyx_DOCSTR(__pyx_doc_3epr_6Record_10get_field_at)},
  {__Pyx_NAMESTR("get_field_names"), (PyCFunction)__pyx_pw_3epr_6Record_13get_field_names, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_3epr_6Record_12get_field_names)},
  {__Pyx_NAMESTR("fields"), (PyCFunction)__pyx_pw_3epr_6Record_15fields, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_3epr_6Record_14fields)},
  {__Pyx_NAMESTR("get_offset"), (PyCFunction)__pyx_pw_3epr_6Record_23get_offset, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_3epr_6Record_22get_offset)},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_3epr_Record[] = {
  {(char *)"dataset_name", __pyx_getprop_3epr_6Record_dataset_name, 0, __Pyx_DOCSTR(__pyx_k_The_name_of_the_dataset_to_which), 0},
  {(char *)"tot_size", __pyx_getprop_3epr_6Record_tot_size, 0, __Pyx_DOCSTR(__pyx_k_The_total_size_in_bytes_of_the_r), 0},
  {(char *)"index", __pyx_getprop_3epr_6Record_index, 0, __Pyx_DOCSTR(__pyx_k_Index_of_the_record_within_the_d), 0},
  {(char *)"_magic", __pyx_getprop_3epr_6Record__magic, 0, __Pyx_DOCSTR(__pyx_k_The_magic_number_for_internal_C), 0},
  {0, 0, 0, 0, 0}
};

static PyTypeObject __pyx_type_3epr_Record = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("epr.Record"), /*tp_name*/
  sizeof(struct __pyx_obj_3epr_Record), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_3epr_Record, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  __pyx_pw_3epr_6Record_21__repr__, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  __pyx_pw_3epr_6Record_19__str__, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("Represents a record read from an ENVISAT dataset\n\n    A record is composed of multiple fields.\n\n    .. seealso:: :class:`Field`\n\n    "), /*tp_doc*/
  __pyx_tp_traverse_3epr_Record, /*tp_traverse*/
  __pyx_tp_clear_3epr_Record, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  __pyx_pw_3epr_6Record_17__iter__, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_3epr_Record, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_3epr_Record, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  #if CYTHON_COMPILING_IN_PYPY
  __pyx_pw_3epr_9EprObject_5__init__, /*tp_init*/
  #else
  0, /*tp_init*/
  #endif
  0, /*tp_alloc*/
  __pyx_tp_new_3epr_Record, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_3epr_Raster __pyx_vtable_3epr_Raster;

static PyObject *__pyx_tp_new_3epr_Raster(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_3epr_Raster *p;
  PyObject *o = __pyx_tp_new_3epr_EprObject(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_3epr_Raster *)o);
  p->__pyx_vtab = __pyx_vtabptr_3epr_Raster;
  p->_parent = ((struct __pyx_obj_3epr_Band *)Py_None); Py_INCREF(Py_None);
  p->_data = Py_None; Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_3epr_Raster(PyObject *o) {
  struct __pyx_obj_3epr_Raster *p = (struct __pyx_obj_3epr_Raster *)o;
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    ++Py_REFCNT(o);
    __pyx_pw_3epr_6Raster_1__dealloc__(o);
    --Py_REFCNT(o);
    PyErr_Restore(etype, eval, etb);
  }
  Py_CLEAR(p->_parent);
  Py_CLEAR(p->_data);
  PyObject_GC_Track(o);
  __pyx_tp_dealloc_3epr_EprObject(o);
}

static int __pyx_tp_traverse_3epr_Raster(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_3epr_Raster *p = (struct __pyx_obj_3epr_Raster *)o;
  e = __pyx_tp_traverse_3epr_EprObject(o, v, a); if (e) return e;
  if (p->_parent) {
    e = (*v)(((PyObject*)p->_parent), a); if (e) return e;
  }
  if (p->_data) {
    e = (*v)(p->_data, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_3epr_Raster(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_3epr_Raster *p = (struct __pyx_obj_3epr_Raster *)o;
  __pyx_tp_clear_3epr_EprObject(o);
  tmp = ((PyObject*)p->_parent);
  p->_parent = ((struct __pyx_obj_3epr_Band *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_data);
  p->_data = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_getprop_3epr_6Raster_data_type(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_3epr_6Raster_9data_type_1__get__(o);
}

static PyObject *__pyx_getprop_3epr_6Raster_source_width(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_3epr_6Raster_12source_width_1__get__(o);
}

static PyObject *__pyx_getprop_3epr_6Raster_source_height(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_3epr_6Raster_13source_height_1__get__(o);
}

static PyObject *__pyx_getprop_3epr_6Raster_source_step_x(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_3epr_6Raster_13source_step_x_1__get__(o);
}

static PyObject *__pyx_getprop_3epr_6Raster_source_step_y(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_3epr_6Raster_13source_step_y_1__get__(o);
}

static PyObject *__pyx_getprop_3epr_6Raster_data(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_3epr_6Raster_4data_1__get__(o);
}

static PyObject *__pyx_getprop_3epr_6Raster__magic(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_3epr_6Raster_6_magic_1__get__(o);
}

static PyMethodDef __pyx_methods_3epr_Raster[] = {
  {__Pyx_NAMESTR("get_width"), (PyCFunction)__pyx_pw_3epr_6Raster_3get_width, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_3epr_6Raster_2get_width)},
  {__Pyx_NAMESTR("get_height"), (PyCFunction)__pyx_pw_3epr_6Raster_5get_height, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_3epr_6Raster_4get_height)},
  {__Pyx_NAMESTR("get_elem_size"), (PyCFunction)__pyx_pw_3epr_6Raster_7get_elem_size, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_3epr_6Raster_6get_elem_size)},
  {__Pyx_NAMESTR("get_pixel"), (PyCFunction)__pyx_pw_3epr_6Raster_9get_pixel, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_3epr_6Raster_8get_pixel)},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_3epr_Raster[] = {
  {(char *)"data_type", __pyx_getprop_3epr_6Raster_data_type, 0, __Pyx_DOCSTR(__pyx_k_The_data_type_of_the_band_s_pixe), 0},
  {(char *)"source_width", __pyx_getprop_3epr_6Raster_source_width, 0, __Pyx_DOCSTR(__pyx_k_The_width_of_the_source), 0},
  {(char *)"source_height", __pyx_getprop_3epr_6Raster_source_height, 0, __Pyx_DOCSTR(__pyx_k_The_height_of_the_source), 0},
  {(char *)"source_step_x", __pyx_getprop_3epr_6Raster_source_step_x, 0, __Pyx_DOCSTR(__pyx_k_The_sub_sampling_for_the_across), 0},
  {(char *)"source_step_y", __pyx_getprop_3epr_6Raster_source_step_y, 0, __Pyx_DOCSTR(__pyx_k_The_sub_sampling_for_the_along_t), 0},
  {(char *)"data", __pyx_getprop_3epr_6Raster_data, 0, __Pyx_DOCSTR(__pyx_k_Raster_data_exposed_as_class_num), 0},
  {(char *)"_magic", __pyx_getprop_3epr_6Raster__magic, 0, __Pyx_DOCSTR(__pyx_k_The_magic_number_for_internal_C), 0},
  {0, 0, 0, 0, 0}
};

static PyTypeObject __pyx_type_3epr_Raster = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("epr.Raster"), /*tp_name*/
  sizeof(struct __pyx_obj_3epr_Raster), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_3epr_Raster, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  __pyx_pw_3epr_6Raster_11__repr__, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("Represents a raster in which data will be stored\n\n    All 'size' parameter are in PIXEL.\n\n    "), /*tp_doc*/
  __pyx_tp_traverse_3epr_Raster, /*tp_traverse*/
  __pyx_tp_clear_3epr_Raster, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_3epr_Raster, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_3epr_Raster, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  #if CYTHON_COMPILING_IN_PYPY
  __pyx_pw_3epr_9EprObject_5__init__, /*tp_init*/
  #else
  0, /*tp_init*/
  #endif
  0, /*tp_alloc*/
  __pyx_tp_new_3epr_Raster, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_3epr_Band __pyx_vtable_3epr_Band;

static PyObject *__pyx_tp_new_3epr_Band(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_3epr_Band *p;
  PyObject *o = __pyx_tp_new_3epr_EprObject(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_3epr_Band *)o);
  p->__pyx_vtab = __pyx_vtabptr_3epr_Band;
  p->_parent = ((struct __pyx_obj_3epr_Product *)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_3epr_Band(PyObject *o) {
  struct __pyx_obj_3epr_Band *p = (struct __pyx_obj_3epr_Band *)o;
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->_parent);
  PyObject_GC_Track(o);
  __pyx_tp_dealloc_3epr_EprObject(o);
}

static int __pyx_tp_traverse_3epr_Band(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_3epr_Band *p = (struct __pyx_obj_3epr_Band *)o;
  e = __pyx_tp_traverse_3epr_EprObject(o, v, a); if (e) return e;
  if (p->_parent) {
    e = (*v)(((PyObject*)p->_parent), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_3epr_Band(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_3epr_Band *p = (struct __pyx_obj_3epr_Band *)o;
  __pyx_tp_clear_3epr_EprObject(o);
  tmp = ((PyObject*)p->_parent);
  p->_parent = ((struct __pyx_obj_3epr_Product *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_getprop_3epr_4Band_product(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_3epr_4Band_7product_1__get__(o);
}

static PyObject *__pyx_getprop_3epr_4Band_spectr_band_index(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_3epr_4Band_17spectr_band_index_1__get__(o);
}

static PyObject *__pyx_getprop_3epr_4Band_sample_model(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_3epr_4Band_12sample_model_1__get__(o);
}

static PyObject *__pyx_getprop_3epr_4Band_data_type(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_3epr_4Band_9data_type_1__get__(o);
}

static PyObject *__pyx_getprop_3epr_4Band_scaling_method(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_3epr_4Band_14scaling_method_1__get__(o);
}

static PyObject *__pyx_getprop_3epr_4Band_scaling_offset(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_3epr_4Band_14scaling_offset_1__get__(o);
}

static PyObject *__pyx_getprop_3epr_4Band_scaling_factor(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_3epr_4Band_14scaling_factor_1__get__(o);
}

static PyObject *__pyx_getprop_3epr_4Band_bm_expr(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_3epr_4Band_7bm_expr_1__get__(o);
}

static PyObject *__pyx_getprop_3epr_4Band_unit(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_3epr_4Band_4unit_1__get__(o);
}

static PyObject *__pyx_getprop_3epr_4Band_description(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_3epr_4Band_11description_1__get__(o);
}

static PyObject *__pyx_getprop_3epr_4Band_lines_mirrored(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_3epr_4Band_14lines_mirrored_1__get__(o);
}

static PyObject *__pyx_getprop_3epr_4Band_dataset(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_3epr_4Band_7dataset_1__get__(o);
}

static PyObject *__pyx_getprop_3epr_4Band__magic(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_3epr_4Band_6_magic_1__get__(o);
}

static PyObject *__pyx_getprop_3epr_4Band__field_index(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_3epr_4Band_12_field_index_1__get__(o);
}

static PyObject *__pyx_getprop_3epr_4Band__elem_index(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_3epr_4Band_11_elem_index_1__get__(o);
}

static PyMethodDef __pyx_methods_3epr_Band[] = {
  {__Pyx_NAMESTR("get_name"), (PyCFunction)__pyx_pw_3epr_4Band_1get_name, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_3epr_4Band_get_name)},
  {__Pyx_NAMESTR("create_compatible_raster"), (PyCFunction)__pyx_pw_3epr_4Band_3create_compatible_raster, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_3epr_4Band_2create_compatible_raster)},
  {__Pyx_NAMESTR("read_raster"), (PyCFunction)__pyx_pw_3epr_4Band_5read_raster, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_3epr_4Band_4read_raster)},
  {__Pyx_NAMESTR("read_as_array"), (PyCFunction)__pyx_pw_3epr_4Band_7read_as_array, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_3epr_4Band_6read_as_array)},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_3epr_Band[] = {
  {(char *)"product", __pyx_getprop_3epr_4Band_product, 0, __Pyx_DOCSTR(__pyx_k_The_class_Product_instance_to_wh), 0},
  {(char *)"spectr_band_index", __pyx_getprop_3epr_4Band_spectr_band_index, 0, __Pyx_DOCSTR(__pyx_k_The_zero_based_spectral_band_ind), 0},
  {(char *)"sample_model", __pyx_getprop_3epr_4Band_sample_model, 0, __Pyx_DOCSTR(__pyx_k_The_sample_model_operation_The_s), 0},
  {(char *)"data_type", __pyx_getprop_3epr_4Band_data_type, 0, __Pyx_DOCSTR(__pyx_k_The_data_type_of_the_band_s_pixe_2), 0},
  {(char *)"scaling_method", __pyx_getprop_3epr_4Band_scaling_method, 0, __Pyx_DOCSTR(__pyx_k_Scaling_method_The_scaling_metho), 0},
  {(char *)"scaling_offset", __pyx_getprop_3epr_4Band_scaling_offset, 0, __Pyx_DOCSTR(__pyx_k_The_scaling_offset_Possible_valu), 0},
  {(char *)"scaling_factor", __pyx_getprop_3epr_4Band_scaling_factor, 0, __Pyx_DOCSTR(__pyx_k_The_scaling_factor_Possible_valu), 0},
  {(char *)"bm_expr", __pyx_getprop_3epr_4Band_bm_expr, 0, __Pyx_DOCSTR(__pyx_k_A_bit_mask_expression_used_to_fi), 0},
  {(char *)"unit", __pyx_getprop_3epr_4Band_unit, 0, __Pyx_DOCSTR(__pyx_k_The_geophysical_unit_for_the_ban), 0},
  {(char *)"description", __pyx_getprop_3epr_4Band_description, 0, __Pyx_DOCSTR(__pyx_k_A_short_description_of_the_band), 0},
  {(char *)"lines_mirrored", __pyx_getprop_3epr_4Band_lines_mirrored, 0, __Pyx_DOCSTR(__pyx_k_Mirrored_lines_flag_If_true_1_li), 0},
  {(char *)"dataset", __pyx_getprop_3epr_4Band_dataset, 0, __Pyx_DOCSTR(__pyx_k_The_source_dataset_The_source_da), 0},
  {(char *)"_magic", __pyx_getprop_3epr_4Band__magic, 0, __Pyx_DOCSTR(__pyx_k_The_magic_number_for_internal_C), 0},
  {(char *)"_field_index", __pyx_getprop_3epr_4Band__field_index, 0, __Pyx_DOCSTR(__pyx_k_Index_or_the_field_within_the_da), 0},
  {(char *)"_elem_index", __pyx_getprop_3epr_4Band__elem_index, 0, __Pyx_DOCSTR(__pyx_k_Index_or_the_element_within_the), 0},
  {0, 0, 0, 0, 0}
};

static PyTypeObject __pyx_type_3epr_Band = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("epr.Band"), /*tp_name*/
  sizeof(struct __pyx_obj_3epr_Band), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_3epr_Band, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  __pyx_pw_3epr_4Band_9__repr__, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("The band of an ENVISAT product\n\n    The Band class contains information about a band within an ENVISAT\n    product file which has been opened with the :func:`open` function.\n\n    A new Band instance can be obtained with the\n    :meth:`Product.get_band` method.\n\n    "), /*tp_doc*/
  __pyx_tp_traverse_3epr_Band, /*tp_traverse*/
  __pyx_tp_clear_3epr_Band, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_3epr_Band, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_3epr_Band, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  #if CYTHON_COMPILING_IN_PYPY
  __pyx_pw_3epr_9EprObject_5__init__, /*tp_init*/
  #else
  0, /*tp_init*/
  #endif
  0, /*tp_alloc*/
  __pyx_tp_new_3epr_Band, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_3epr_Dataset __pyx_vtable_3epr_Dataset;

static PyObject *__pyx_tp_new_3epr_Dataset(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_3epr_Dataset *p;
  PyObject *o = __pyx_tp_new_3epr_EprObject(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_3epr_Dataset *)o);
  p->__pyx_vtab = __pyx_vtabptr_3epr_Dataset;
  p->_parent = ((struct __pyx_obj_3epr_Product *)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_3epr_Dataset(PyObject *o) {
  struct __pyx_obj_3epr_Dataset *p = (struct __pyx_obj_3epr_Dataset *)o;
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->_parent);
  PyObject_GC_Track(o);
  __pyx_tp_dealloc_3epr_EprObject(o);
}

static int __pyx_tp_traverse_3epr_Dataset(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_3epr_Dataset *p = (struct __pyx_obj_3epr_Dataset *)o;
  e = __pyx_tp_traverse_3epr_EprObject(o, v, a); if (e) return e;
  if (p->_parent) {
    e = (*v)(((PyObject*)p->_parent), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_3epr_Dataset(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_3epr_Dataset *p = (struct __pyx_obj_3epr_Dataset *)o;
  __pyx_tp_clear_3epr_EprObject(o);
  tmp = ((PyObject*)p->_parent);
  p->_parent = ((struct __pyx_obj_3epr_Product *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_getprop_3epr_7Dataset_product(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_3epr_7Dataset_7product_1__get__(o);
}

static PyObject *__pyx_getprop_3epr_7Dataset_description(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_3epr_7Dataset_11description_1__get__(o);
}

static PyObject *__pyx_getprop_3epr_7Dataset__magic(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_3epr_7Dataset_6_magic_1__get__(o);
}

static PyMethodDef __pyx_methods_3epr_Dataset[] = {
  {__Pyx_NAMESTR("get_name"), (PyCFunction)__pyx_pw_3epr_7Dataset_1get_name, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_3epr_7Dataset_get_name)},
  {__Pyx_NAMESTR("get_dsd_name"), (PyCFunction)__pyx_pw_3epr_7Dataset_3get_dsd_name, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_3epr_7Dataset_2get_dsd_name)},
  {__Pyx_NAMESTR("get_num_records"), (PyCFunction)__pyx_pw_3epr_7Dataset_5get_num_records, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_3epr_7Dataset_4get_num_records)},
  {__Pyx_NAMESTR("get_dsd"), (PyCFunction)__pyx_pw_3epr_7Dataset_7get_dsd, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_3epr_7Dataset_6get_dsd)},
  {__Pyx_NAMESTR("create_record"), (PyCFunction)__pyx_pw_3epr_7Dataset_9create_record, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_3epr_7Dataset_8create_record)},
  {__Pyx_NAMESTR("read_record"), (PyCFunction)__pyx_pw_3epr_7Dataset_11read_record, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_3epr_7Dataset_10read_record)},
  {__Pyx_NAMESTR("records"), (PyCFunction)__pyx_pw_3epr_7Dataset_13records, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_3epr_7Dataset_12records)},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_3epr_Dataset[] = {
  {(char *)"product", __pyx_getprop_3epr_7Dataset_product, 0, __Pyx_DOCSTR(__pyx_k_The_class_Product_instance_to_wh_2), 0},
  {(char *)"description", __pyx_getprop_3epr_7Dataset_description, 0, __Pyx_DOCSTR(__pyx_k_A_short_description_of_the_band), 0},
  {(char *)"_magic", __pyx_getprop_3epr_7Dataset__magic, 0, __Pyx_DOCSTR(__pyx_k_The_magic_number_for_internal_C), 0},
  {0, 0, 0, 0, 0}
};

static PyTypeObject __pyx_type_3epr_Dataset = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("epr.Dataset"), /*tp_name*/
  sizeof(struct __pyx_obj_3epr_Dataset), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_3epr_Dataset, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  __pyx_pw_3epr_7Dataset_19__repr__, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  __pyx_pw_3epr_7Dataset_17__str__, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("ENVISAT dataset\n\n    The Dataset class contains information about a dataset within an\n    ENVISAT product file which has been opened with the :func:`open`\n    function.\n\n    A new Dataset instance can be obtained with the\n    :meth:`Product.get_dataset` or :meth:`Product.get_dataset_at`\n    methods.\n\n    "), /*tp_doc*/
  __pyx_tp_traverse_3epr_Dataset, /*tp_traverse*/
  __pyx_tp_clear_3epr_Dataset, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  __pyx_pw_3epr_7Dataset_15__iter__, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_3epr_Dataset, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_3epr_Dataset, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  #if CYTHON_COMPILING_IN_PYPY
  __pyx_pw_3epr_9EprObject_5__init__, /*tp_init*/
  #else
  0, /*tp_init*/
  #endif
  0, /*tp_alloc*/
  __pyx_tp_new_3epr_Dataset, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_3epr_Product __pyx_vtable_3epr_Product;

static PyObject *__pyx_tp_new_3epr_Product(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_3epr_Product *p;
  PyObject *o = __pyx_tp_new_3epr_EprObject(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_3epr_Product *)o);
  p->__pyx_vtab = __pyx_vtabptr_3epr_Product;
  p->_mode = ((PyObject*)Py_None); Py_INCREF(Py_None);
  if (unlikely(__pyx_pw_3epr_7Product_1__cinit__(o, a, k) < 0)) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_3epr_Product(PyObject *o) {
  struct __pyx_obj_3epr_Product *p = (struct __pyx_obj_3epr_Product *)o;
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    ++Py_REFCNT(o);
    __pyx_pw_3epr_7Product_3__dealloc__(o);
    --Py_REFCNT(o);
    PyErr_Restore(etype, eval, etb);
  }
  Py_CLEAR(p->_mode);
  PyObject_GC_Track(o);
  __pyx_tp_dealloc_3epr_EprObject(o);
}

static PyObject *__pyx_getprop_3epr_7Product_file_path(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_3epr_7Product_9file_path_1__get__(o);
}

static PyObject *__pyx_getprop_3epr_7Product__fileno(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_3epr_7Product_7_fileno_1__get__(o);
}

static PyObject *__pyx_getprop_3epr_7Product_mode(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_3epr_7Product_4mode_1__get__(o);
}

static PyObject *__pyx_getprop_3epr_7Product_tot_size(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_3epr_7Product_8tot_size_1__get__(o);
}

static PyObject *__pyx_getprop_3epr_7Product_id_string(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_3epr_7Product_9id_string_1__get__(o);
}

static PyObject *__pyx_getprop_3epr_7Product_meris_iodd_version(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_3epr_7Product_18meris_iodd_version_1__get__(o);
}

static PyObject *__pyx_getprop_3epr_7Product_closed(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_3epr_7Product_6closed_1__get__(o);
}

static PyObject *__pyx_getprop_3epr_7Product__magic(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_3epr_7Product_6_magic_1__get__(o);
}

static PyMethodDef __pyx_methods_3epr_Product[] = {
  {__Pyx_NAMESTR("close"), (PyCFunction)__pyx_pw_3epr_7Product_7close, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_3epr_7Product_6close)},
  {__Pyx_NAMESTR("flush"), (PyCFunction)__pyx_pw_3epr_7Product_9flush, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_3epr_7Product_8flush)},
  {__Pyx_NAMESTR("get_scene_width"), (PyCFunction)__pyx_pw_3epr_7Product_11get_scene_width, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_3epr_7Product_10get_scene_width)},
  {__Pyx_NAMESTR("get_scene_height"), (PyCFunction)__pyx_pw_3epr_7Product_13get_scene_height, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_3epr_7Product_12get_scene_height)},
  {__Pyx_NAMESTR("get_num_datasets"), (PyCFunction)__pyx_pw_3epr_7Product_15get_num_datasets, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_3epr_7Product_14get_num_datasets)},
  {__Pyx_NAMESTR("get_num_dsds"), (PyCFunction)__pyx_pw_3epr_7Product_17get_num_dsds, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_3epr_7Product_16get_num_dsds)},
  {__Pyx_NAMESTR("get_num_bands"), (PyCFunction)__pyx_pw_3epr_7Product_19get_num_bands, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_3epr_7Product_18get_num_bands)},
  {__Pyx_NAMESTR("get_dataset_at"), (PyCFunction)__pyx_pw_3epr_7Product_21get_dataset_at, METH_O, __Pyx_DOCSTR(__pyx_doc_3epr_7Product_20get_dataset_at)},
  {__Pyx_NAMESTR("get_dataset"), (PyCFunction)__pyx_pw_3epr_7Product_23get_dataset, METH_O, __Pyx_DOCSTR(__pyx_doc_3epr_7Product_22get_dataset)},
  {__Pyx_NAMESTR("get_dsd_at"), (PyCFunction)__pyx_pw_3epr_7Product_25get_dsd_at, METH_O, __Pyx_DOCSTR(__pyx_doc_3epr_7Product_24get_dsd_at)},
  {__Pyx_NAMESTR("get_mph"), (PyCFunction)__pyx_pw_3epr_7Product_27get_mph, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_3epr_7Product_26get_mph)},
  {__Pyx_NAMESTR("get_sph"), (PyCFunction)__pyx_pw_3epr_7Product_29get_sph, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_3epr_7Product_28get_sph)},
  {__Pyx_NAMESTR("get_band"), (PyCFunction)__pyx_pw_3epr_7Product_31get_band, METH_O, __Pyx_DOCSTR(__pyx_doc_3epr_7Product_30get_band)},
  {__Pyx_NAMESTR("get_band_at"), (PyCFunction)__pyx_pw_3epr_7Product_33get_band_at, METH_O, __Pyx_DOCSTR(__pyx_doc_3epr_7Product_32get_band_at)},
  {__Pyx_NAMESTR("read_bitmask_raster"), (PyCFunction)__pyx_pw_3epr_7Product_35read_bitmask_raster, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_3epr_7Product_34read_bitmask_raster)},
  {__Pyx_NAMESTR("get_dataset_names"), (PyCFunction)__pyx_pw_3epr_7Product_37get_dataset_names, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_3epr_7Product_36get_dataset_names)},
  {__Pyx_NAMESTR("get_band_names"), (PyCFunction)__pyx_pw_3epr_7Product_39get_band_names, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_3epr_7Product_38get_band_names)},
  {__Pyx_NAMESTR("datasets"), (PyCFunction)__pyx_pw_3epr_7Product_41datasets, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_3epr_7Product_40datasets)},
  {__Pyx_NAMESTR("bands"), (PyCFunction)__pyx_pw_3epr_7Product_43bands, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_3epr_7Product_42bands)},
  {__Pyx_NAMESTR("__enter__"), (PyCFunction)__pyx_pw_3epr_7Product_49__enter__, METH_NOARGS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("__exit__"), (PyCFunction)__pyx_pw_3epr_7Product_51__exit__, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_3epr_Product[] = {
  {(char *)"file_path", __pyx_getprop_3epr_7Product_file_path, 0, __Pyx_DOCSTR(__pyx_k_The_file_s_path_including_the_fi), 0},
  {(char *)"_fileno", __pyx_getprop_3epr_7Product__fileno, 0, __Pyx_DOCSTR(__pyx_k_The_fileno_of_the_class_epr_Prod), 0},
  {(char *)"mode", __pyx_getprop_3epr_7Product_mode, 0, 0, 0},
  {(char *)"tot_size", __pyx_getprop_3epr_7Product_tot_size, 0, __Pyx_DOCSTR(__pyx_k_The_total_size_in_bytes_of_the_p), 0},
  {(char *)"id_string", __pyx_getprop_3epr_7Product_id_string, 0, __Pyx_DOCSTR(__pyx_k_The_product_identifier_string_ob), 0},
  {(char *)"meris_iodd_version", __pyx_getprop_3epr_7Product_meris_iodd_version, 0, __Pyx_DOCSTR(__pyx_k_For_MERIS_L1b_and_RR_and_FR_to_p), 0},
  {(char *)"closed", __pyx_getprop_3epr_7Product_closed, 0, __Pyx_DOCSTR(__pyx_k_True_if_the_class_epr_Product_is), 0},
  {(char *)"_magic", __pyx_getprop_3epr_7Product__magic, 0, __Pyx_DOCSTR(__pyx_k_The_magic_number_for_internal_C), 0},
  {0, 0, 0, 0, 0}
};

static PyTypeObject __pyx_type_3epr_Product = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("epr.Product"), /*tp_name*/
  sizeof(struct __pyx_obj_3epr_Product), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_3epr_Product, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  __pyx_pw_3epr_7Product_45__repr__, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  __pyx_pw_3epr_7Product_47__str__, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("ENVISAT product\n\n    The Product class provides methods and properties to get\n    information about an ENVISAT product file.\n\n    .. seealso:: :func:`open`\n\n    "), /*tp_doc*/
  __pyx_tp_traverse_3epr_EprObject, /*tp_traverse*/
  __pyx_tp_clear_3epr_EprObject, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_3epr_Product, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_3epr_Product, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pw_3epr_7Product_5__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_3epr_Product, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};

static struct __pyx_obj_3epr___pyx_scope_struct____iter__ *__pyx_freelist_3epr___pyx_scope_struct____iter__[8];
static int __pyx_freecount_3epr___pyx_scope_struct____iter__ = 0;

static PyObject *__pyx_tp_new_3epr___pyx_scope_struct____iter__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_3epr___pyx_scope_struct____iter__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_3epr___pyx_scope_struct____iter__)))) {
    o = (PyObject*)__pyx_freelist_3epr___pyx_scope_struct____iter__[--__pyx_freecount_3epr___pyx_scope_struct____iter__];
    memset(o, 0, sizeof(struct __pyx_obj_3epr___pyx_scope_struct____iter__));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_3epr___pyx_scope_struct____iter__(PyObject *o) {
  struct __pyx_obj_3epr___pyx_scope_struct____iter__ *p = (struct __pyx_obj_3epr___pyx_scope_struct____iter__ *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_self);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_3epr___pyx_scope_struct____iter__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_3epr___pyx_scope_struct____iter__)))) {
    __pyx_freelist_3epr___pyx_scope_struct____iter__[__pyx_freecount_3epr___pyx_scope_struct____iter__++] = ((struct __pyx_obj_3epr___pyx_scope_struct____iter__ *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_3epr___pyx_scope_struct____iter__(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_3epr___pyx_scope_struct____iter__ *p = (struct __pyx_obj_3epr___pyx_scope_struct____iter__ *)o;
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject*)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_3epr___pyx_scope_struct____iter__(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_3epr___pyx_scope_struct____iter__ *p = (struct __pyx_obj_3epr___pyx_scope_struct____iter__ *)o;
  tmp = ((PyObject*)p->__pyx_v_self);
  p->__pyx_v_self = ((struct __pyx_obj_3epr_Record *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyTypeObject __pyx_type_3epr___pyx_scope_struct____iter__ = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("epr.__pyx_scope_struct____iter__"), /*tp_name*/
  sizeof(struct __pyx_obj_3epr___pyx_scope_struct____iter__), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_3epr___pyx_scope_struct____iter__, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_3epr___pyx_scope_struct____iter__, /*tp_traverse*/
  __pyx_tp_clear_3epr___pyx_scope_struct____iter__, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_3epr___pyx_scope_struct____iter__, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};

static struct __pyx_obj_3epr___pyx_scope_struct_1_genexpr *__pyx_freelist_3epr___pyx_scope_struct_1_genexpr[8];
static int __pyx_freecount_3epr___pyx_scope_struct_1_genexpr = 0;

static PyObject *__pyx_tp_new_3epr___pyx_scope_struct_1_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_3epr___pyx_scope_struct_1_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_3epr___pyx_scope_struct_1_genexpr)))) {
    o = (PyObject*)__pyx_freelist_3epr___pyx_scope_struct_1_genexpr[--__pyx_freecount_3epr___pyx_scope_struct_1_genexpr];
    memset(o, 0, sizeof(struct __pyx_obj_3epr___pyx_scope_struct_1_genexpr));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_3epr___pyx_scope_struct_1_genexpr(PyObject *o) {
  struct __pyx_obj_3epr___pyx_scope_struct_1_genexpr *p = (struct __pyx_obj_3epr___pyx_scope_struct_1_genexpr *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_outer_scope);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_3epr___pyx_scope_struct_1_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_3epr___pyx_scope_struct_1_genexpr)))) {
    __pyx_freelist_3epr___pyx_scope_struct_1_genexpr[__pyx_freecount_3epr___pyx_scope_struct_1_genexpr++] = ((struct __pyx_obj_3epr___pyx_scope_struct_1_genexpr *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_3epr___pyx_scope_struct_1_genexpr(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_3epr___pyx_scope_struct_1_genexpr *p = (struct __pyx_obj_3epr___pyx_scope_struct_1_genexpr *)o;
  if (p->__pyx_outer_scope) {
    e = (*v)(((PyObject*)p->__pyx_outer_scope), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_3epr___pyx_scope_struct_1_genexpr(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_3epr___pyx_scope_struct_1_genexpr *p = (struct __pyx_obj_3epr___pyx_scope_struct_1_genexpr *)o;
  tmp = ((PyObject*)p->__pyx_outer_scope);
  p->__pyx_outer_scope = ((struct __pyx_obj_3epr___pyx_scope_struct____iter__ *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyTypeObject __pyx_type_3epr___pyx_scope_struct_1_genexpr = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("epr.__pyx_scope_struct_1_genexpr"), /*tp_name*/
  sizeof(struct __pyx_obj_3epr___pyx_scope_struct_1_genexpr), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_3epr___pyx_scope_struct_1_genexpr, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_3epr___pyx_scope_struct_1_genexpr, /*tp_traverse*/
  __pyx_tp_clear_3epr___pyx_scope_struct_1_genexpr, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_3epr___pyx_scope_struct_1_genexpr, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};

static struct __pyx_obj_3epr___pyx_scope_struct_2___iter__ *__pyx_freelist_3epr___pyx_scope_struct_2___iter__[8];
static int __pyx_freecount_3epr___pyx_scope_struct_2___iter__ = 0;

static PyObject *__pyx_tp_new_3epr___pyx_scope_struct_2___iter__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_3epr___pyx_scope_struct_2___iter__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_3epr___pyx_scope_struct_2___iter__)))) {
    o = (PyObject*)__pyx_freelist_3epr___pyx_scope_struct_2___iter__[--__pyx_freecount_3epr___pyx_scope_struct_2___iter__];
    memset(o, 0, sizeof(struct __pyx_obj_3epr___pyx_scope_struct_2___iter__));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_3epr___pyx_scope_struct_2___iter__(PyObject *o) {
  struct __pyx_obj_3epr___pyx_scope_struct_2___iter__ *p = (struct __pyx_obj_3epr___pyx_scope_struct_2___iter__ *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_self);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_3epr___pyx_scope_struct_2___iter__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_3epr___pyx_scope_struct_2___iter__)))) {
    __pyx_freelist_3epr___pyx_scope_struct_2___iter__[__pyx_freecount_3epr___pyx_scope_struct_2___iter__++] = ((struct __pyx_obj_3epr___pyx_scope_struct_2___iter__ *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_3epr___pyx_scope_struct_2___iter__(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_3epr___pyx_scope_struct_2___iter__ *p = (struct __pyx_obj_3epr___pyx_scope_struct_2___iter__ *)o;
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject*)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_3epr___pyx_scope_struct_2___iter__(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_3epr___pyx_scope_struct_2___iter__ *p = (struct __pyx_obj_3epr___pyx_scope_struct_2___iter__ *)o;
  tmp = ((PyObject*)p->__pyx_v_self);
  p->__pyx_v_self = ((struct __pyx_obj_3epr_Dataset *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyTypeObject __pyx_type_3epr___pyx_scope_struct_2___iter__ = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("epr.__pyx_scope_struct_2___iter__"), /*tp_name*/
  sizeof(struct __pyx_obj_3epr___pyx_scope_struct_2___iter__), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_3epr___pyx_scope_struct_2___iter__, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_3epr___pyx_scope_struct_2___iter__, /*tp_traverse*/
  __pyx_tp_clear_3epr___pyx_scope_struct_2___iter__, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_3epr___pyx_scope_struct_2___iter__, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};

static struct __pyx_obj_3epr___pyx_scope_struct_3_genexpr *__pyx_freelist_3epr___pyx_scope_struct_3_genexpr[8];
static int __pyx_freecount_3epr___pyx_scope_struct_3_genexpr = 0;

static PyObject *__pyx_tp_new_3epr___pyx_scope_struct_3_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_3epr___pyx_scope_struct_3_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_3epr___pyx_scope_struct_3_genexpr)))) {
    o = (PyObject*)__pyx_freelist_3epr___pyx_scope_struct_3_genexpr[--__pyx_freecount_3epr___pyx_scope_struct_3_genexpr];
    memset(o, 0, sizeof(struct __pyx_obj_3epr___pyx_scope_struct_3_genexpr));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_3epr___pyx_scope_struct_3_genexpr(PyObject *o) {
  struct __pyx_obj_3epr___pyx_scope_struct_3_genexpr *p = (struct __pyx_obj_3epr___pyx_scope_struct_3_genexpr *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_outer_scope);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_3epr___pyx_scope_struct_3_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_3epr___pyx_scope_struct_3_genexpr)))) {
    __pyx_freelist_3epr___pyx_scope_struct_3_genexpr[__pyx_freecount_3epr___pyx_scope_struct_3_genexpr++] = ((struct __pyx_obj_3epr___pyx_scope_struct_3_genexpr *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_3epr___pyx_scope_struct_3_genexpr(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_3epr___pyx_scope_struct_3_genexpr *p = (struct __pyx_obj_3epr___pyx_scope_struct_3_genexpr *)o;
  if (p->__pyx_outer_scope) {
    e = (*v)(((PyObject*)p->__pyx_outer_scope), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_3epr___pyx_scope_struct_3_genexpr(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_3epr___pyx_scope_struct_3_genexpr *p = (struct __pyx_obj_3epr___pyx_scope_struct_3_genexpr *)o;
  tmp = ((PyObject*)p->__pyx_outer_scope);
  p->__pyx_outer_scope = ((struct __pyx_obj_3epr___pyx_scope_struct_2___iter__ *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyTypeObject __pyx_type_3epr___pyx_scope_struct_3_genexpr = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("epr.__pyx_scope_struct_3_genexpr"), /*tp_name*/
  sizeof(struct __pyx_obj_3epr___pyx_scope_struct_3_genexpr), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_3epr___pyx_scope_struct_3_genexpr, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_3epr___pyx_scope_struct_3_genexpr, /*tp_traverse*/
  __pyx_tp_clear_3epr___pyx_scope_struct_3_genexpr, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_3epr___pyx_scope_struct_3_genexpr, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};

static PyMethodDef __pyx_methods[] = {
  {__Pyx_NAMESTR("get_numpy_dtype"), (PyCFunction)__pyx_pw_3epr_1get_numpy_dtype, METH_O, __Pyx_DOCSTR(__pyx_doc_3epr_get_numpy_dtype)},
  {__Pyx_NAMESTR("get_data_type_size"), (PyCFunction)__pyx_pw_3epr_3get_data_type_size, METH_O, __Pyx_DOCSTR(__pyx_doc_3epr_2get_data_type_size)},
  {__Pyx_NAMESTR("data_type_id_to_str"), (PyCFunction)__pyx_pw_3epr_5data_type_id_to_str, METH_O, __Pyx_DOCSTR(__pyx_doc_3epr_4data_type_id_to_str)},
  {__Pyx_NAMESTR("get_scaling_method_name"), (PyCFunction)__pyx_pw_3epr_7get_scaling_method_name, METH_O, __Pyx_DOCSTR(__pyx_doc_3epr_6get_scaling_method_name)},
  {__Pyx_NAMESTR("get_sample_model_name"), (PyCFunction)__pyx_pw_3epr_9get_sample_model_name, METH_O, __Pyx_DOCSTR(__pyx_doc_3epr_8get_sample_model_name)},
  {0, 0, 0, 0}
};

#if PY_MAJOR_VERSION >= 3
static struct PyModuleDef __pyx_moduledef = {
  #if PY_VERSION_HEX < 0x03020000
    { PyObject_HEAD_INIT(NULL) NULL, 0, NULL },
  #else
    PyModuleDef_HEAD_INIT,
  #endif
    __Pyx_NAMESTR("epr"),
    __Pyx_DOCSTR(__pyx_k_Python_bindings_for_ENVISAT_Prod), /* m_doc */
    -1, /* m_size */
    __pyx_methods /* m_methods */,
    NULL, /* m_reload */
    NULL, /* m_traverse */
    NULL, /* m_clear */
    NULL /* m_free */
};
#endif

static __Pyx_StringTabEntry __pyx_string_tab[] = {
  {&__pyx_kp_s_, __pyx_k_, sizeof(__pyx_k_), 0, 0, 1, 0},
  {&__pyx_kp_s_0_9_1, __pyx_k_0_9_1, sizeof(__pyx_k_0_9_1), 0, 0, 1, 0},
  {&__pyx_kp_s_1OF1, __pyx_k_1OF1, sizeof(__pyx_k_1OF1), 0, 0, 1, 0},
  {&__pyx_kp_s_1OF2, __pyx_k_1OF2, sizeof(__pyx_k_1OF2), 0, 0, 1, 0},
  {&__pyx_kp_s_2OF2, __pyx_k_2OF2, sizeof(__pyx_k_2OF2), 0, 0, 1, 0},
  {&__pyx_kp_s_2TOF, __pyx_k_2TOF, sizeof(__pyx_k_2TOF), 0, 0, 1, 0},
  {&__pyx_kp_s_3TOI, __pyx_k_3TOI, sizeof(__pyx_k_3TOI), 0, 0, 1, 0},
  {&__pyx_n_s_AttributeError, __pyx_k_AttributeError, sizeof(__pyx_k_AttributeError), 0, 0, 1, 1},
  {&__pyx_n_s_DEFAULT_FS_ENCODING, __pyx_k_DEFAULT_FS_ENCODING, sizeof(__pyx_k_DEFAULT_FS_ENCODING), 0, 0, 1, 1},
  {&__pyx_kp_s_DSD_only_implements_and_operator, __pyx_k_DSD_only_implements_and_operator, sizeof(__pyx_k_DSD_only_implements_and_operator), 0, 0, 1, 0},
  {&__pyx_n_s_DTYPE_MAP, __pyx_k_DTYPE_MAP, sizeof(__pyx_k_DTYPE_MAP), 0, 0, 1, 1},
  {&__pyx_n_s_EPRError, __pyx_k_EPRError, sizeof(__pyx_k_EPRError), 0, 0, 1, 1},
  {&__pyx_n_s_EPRError___init, __pyx_k_EPRError___init, sizeof(__pyx_k_EPRError___init), 0, 0, 1, 1},
  {&__pyx_n_s_EPRTime, __pyx_k_EPRTime, sizeof(__pyx_k_EPRTime), 0, 0, 1, 1},
  {&__pyx_n_s_EPRValueError, __pyx_k_EPRValueError, sizeof(__pyx_k_EPRValueError), 0, 0, 1, 1},
  {&__pyx_kp_s_EPR_API_error, __pyx_k_EPR_API_error, sizeof(__pyx_k_EPR_API_error), 0, 0, 1, 0},
  {&__pyx_n_s_EPR_C_API_VERSION, __pyx_k_EPR_C_API_VERSION, sizeof(__pyx_k_EPR_C_API_VERSION), 0, 0, 1, 1},
  {&__pyx_n_s_EPR_MAGIC_BAND_ID, __pyx_k_EPR_MAGIC_BAND_ID, sizeof(__pyx_k_EPR_MAGIC_BAND_ID), 0, 0, 1, 1},
  {&__pyx_n_s_EPR_MAGIC_DATASET_ID, __pyx_k_EPR_MAGIC_DATASET_ID, sizeof(__pyx_k_EPR_MAGIC_DATASET_ID), 0, 0, 1, 1},
  {&__pyx_n_s_EPR_MAGIC_FIELD, __pyx_k_EPR_MAGIC_FIELD, sizeof(__pyx_k_EPR_MAGIC_FIELD), 0, 0, 1, 1},
  {&__pyx_n_s_EPR_MAGIC_FLAG_DEF, __pyx_k_EPR_MAGIC_FLAG_DEF, sizeof(__pyx_k_EPR_MAGIC_FLAG_DEF), 0, 0, 1, 1},
  {&__pyx_n_s_EPR_MAGIC_PRODUCT_ID, __pyx_k_EPR_MAGIC_PRODUCT_ID, sizeof(__pyx_k_EPR_MAGIC_PRODUCT_ID), 0, 0, 1, 1},
  {&__pyx_n_s_EPR_MAGIC_RASTER, __pyx_k_EPR_MAGIC_RASTER, sizeof(__pyx_k_EPR_MAGIC_RASTER), 0, 0, 1, 1},
  {&__pyx_n_s_EPR_MAGIC_RECORD, __pyx_k_EPR_MAGIC_RECORD, sizeof(__pyx_k_EPR_MAGIC_RECORD), 0, 0, 1, 1},
  {&__pyx_n_s_E_SMID_LIN, __pyx_k_E_SMID_LIN, sizeof(__pyx_k_E_SMID_LIN), 0, 0, 1, 1},
  {&__pyx_n_s_E_SMID_LOG, __pyx_k_E_SMID_LOG, sizeof(__pyx_k_E_SMID_LOG), 0, 0, 1, 1},
  {&__pyx_n_s_E_SMID_NON, __pyx_k_E_SMID_NON, sizeof(__pyx_k_E_SMID_NON), 0, 0, 1, 1},
  {&__pyx_n_s_E_SMOD_1OF1, __pyx_k_E_SMOD_1OF1, sizeof(__pyx_k_E_SMOD_1OF1), 0, 0, 1, 1},
  {&__pyx_n_s_E_SMOD_1OF2, __pyx_k_E_SMOD_1OF2, sizeof(__pyx_k_E_SMOD_1OF2), 0, 0, 1, 1},
  {&__pyx_n_s_E_SMOD_2OF2, __pyx_k_E_SMOD_2OF2, sizeof(__pyx_k_E_SMOD_2OF2), 0, 0, 1, 1},
  {&__pyx_n_s_E_SMOD_2TOF, __pyx_k_E_SMOD_2TOF, sizeof(__pyx_k_E_SMOD_2TOF), 0, 0, 1, 1},
  {&__pyx_n_s_E_SMOD_3TOI, __pyx_k_E_SMOD_3TOI, sizeof(__pyx_k_E_SMOD_3TOI), 0, 0, 1, 1},
  {&__pyx_n_s_E_TID_CHAR, __pyx_k_E_TID_CHAR, sizeof(__pyx_k_E_TID_CHAR), 0, 0, 1, 1},
  {&__pyx_n_s_E_TID_DOUBLE, __pyx_k_E_TID_DOUBLE, sizeof(__pyx_k_E_TID_DOUBLE), 0, 0, 1, 1},
  {&__pyx_n_s_E_TID_FLOAT, __pyx_k_E_TID_FLOAT, sizeof(__pyx_k_E_TID_FLOAT), 0, 0, 1, 1},
  {&__pyx_n_s_E_TID_INT, __pyx_k_E_TID_INT, sizeof(__pyx_k_E_TID_INT), 0, 0, 1, 1},
  {&__pyx_n_s_E_TID_SHORT, __pyx_k_E_TID_SHORT, sizeof(__pyx_k_E_TID_SHORT), 0, 0, 1, 1},
  {&__pyx_n_s_E_TID_SPARE, __pyx_k_E_TID_SPARE, sizeof(__pyx_k_E_TID_SPARE), 0, 0, 1, 1},
  {&__pyx_n_s_E_TID_STRING, __pyx_k_E_TID_STRING, sizeof(__pyx_k_E_TID_STRING), 0, 0, 1, 1},
  {&__pyx_n_s_E_TID_TIME, __pyx_k_E_TID_TIME, sizeof(__pyx_k_E_TID_TIME), 0, 0, 1, 1},
  {&__pyx_n_s_E_TID_UCHAR, __pyx_k_E_TID_UCHAR, sizeof(__pyx_k_E_TID_UCHAR), 0, 0, 1, 1},
  {&__pyx_n_s_E_TID_UINT, __pyx_k_E_TID_UINT, sizeof(__pyx_k_E_TID_UINT), 0, 0, 1, 1},
  {&__pyx_n_s_E_TID_UNKNOWN, __pyx_k_E_TID_UNKNOWN, sizeof(__pyx_k_E_TID_UNKNOWN), 0, 0, 1, 1},
  {&__pyx_n_s_E_TID_USHORT, __pyx_k_E_TID_USHORT, sizeof(__pyx_k_E_TID_USHORT), 0, 0, 1, 1},
  {&__pyx_n_s_Exception, __pyx_k_Exception, sizeof(__pyx_k_Exception), 0, 0, 1, 1},
  {&__pyx_kp_s_Field_only_implements_and_operat, __pyx_k_Field_only_implements_and_operat, sizeof(__pyx_k_Field_only_implements_and_operat), 0, 0, 1, 0},
  {&__pyx_kp_s_Filed_s_elems_pointer_is_null, __pyx_k_Filed_s_elems_pointer_is_null, sizeof(__pyx_k_Filed_s_elems_pointer_is_null), 0, 0, 1, 0},
  {&__pyx_kp_u_Format_string_allocated_too_shor, __pyx_k_Format_string_allocated_too_shor, sizeof(__pyx_k_Format_string_allocated_too_shor), 0, 1, 0, 0},
  {&__pyx_kp_u_Format_string_allocated_too_shor_2, __pyx_k_Format_string_allocated_too_shor_2, sizeof(__pyx_k_Format_string_allocated_too_shor_2), 0, 1, 0, 0},
  {&__pyx_n_s_IOError, __pyx_k_IOError, sizeof(__pyx_k_IOError), 0, 0, 1, 1},
  {&__pyx_kp_s_I_O_operation_on_closed_file, __pyx_k_I_O_operation_on_closed_file, sizeof(__pyx_k_I_O_operation_on_closed_file), 0, 0, 1, 0},
  {&__pyx_n_s_ImportError, __pyx_k_ImportError, sizeof(__pyx_k_ImportError), 0, 0, 1, 1},
  {&__pyx_n_s_KeyError, __pyx_k_KeyError, sizeof(__pyx_k_KeyError), 0, 0, 1, 1},
  {&__pyx_n_s_LIN, __pyx_k_LIN, sizeof(__pyx_k_LIN), 0, 0, 1, 1},
  {&__pyx_n_s_LOG, __pyx_k_LOG, sizeof(__pyx_k_LOG), 0, 0, 1, 1},
  {&__pyx_n_s_METHOD_MAP, __pyx_k_METHOD_MAP, sizeof(__pyx_k_METHOD_MAP), 0, 0, 1, 1},
  {&__pyx_n_s_MJD, __pyx_k_MJD, sizeof(__pyx_k_MJD), 0, 0, 1, 1},
  {&__pyx_n_s_MODEL_MAP, __pyx_k_MODEL_MAP, sizeof(__pyx_k_MODEL_MAP), 0, 0, 1, 1},
  {&__pyx_n_s_NONE, __pyx_k_NONE, sizeof(__pyx_k_NONE), 0, 0, 1, 1},
  {&__pyx_kp_u_Non_native_byte_order_not_suppor, __pyx_k_Non_native_byte_order_not_suppor, sizeof(__pyx_k_Non_native_byte_order_not_suppor), 0, 1, 0, 0},
  {&__pyx_n_s_NotImplemented, __pyx_k_NotImplemented, sizeof(__pyx_k_NotImplemented), 0, 0, 1, 1},
  {&__pyx_n_s_NotImplementedError, __pyx_k_NotImplementedError, sizeof(__pyx_k_NotImplementedError), 0, 0, 1, 1},
  {&__pyx_n_s_RuntimeError, __pyx_k_RuntimeError, sizeof(__pyx_k_RuntimeError), 0, 0, 1, 1},
  {&__pyx_n_s_TypeError, __pyx_k_TypeError, sizeof(__pyx_k_TypeError), 0, 0, 1, 1},
  {&__pyx_kp_s_UTF_8, __pyx_k_UTF_8, sizeof(__pyx_k_UTF_8), 0, 0, 1, 0},
  {&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1},
  {&__pyx_kp_s__11, __pyx_k__11, sizeof(__pyx_k__11), 0, 0, 1, 0},
  {&__pyx_kp_s__17, __pyx_k__17, sizeof(__pyx_k__17), 0, 0, 1, 0},
  {&__pyx_kp_s__9, __pyx_k__9, sizeof(__pyx_k__9), 0, 0, 1, 0},
  {&__pyx_n_s_args, __pyx_k_args, sizeof(__pyx_k_args), 0, 0, 1, 1},
  {&__pyx_n_s_asarray, __pyx_k_asarray, sizeof(__pyx_k_asarray), 0, 0, 1, 1},
  {&__pyx_n_s_ascii, __pyx_k_ascii, sizeof(__pyx_k_ascii), 0, 0, 1, 1},
  {&__pyx_n_s_ascontiguousarray, __pyx_k_ascontiguousarray, sizeof(__pyx_k_ascontiguousarray), 0, 0, 1, 1},
  {&__pyx_n_s_astype, __pyx_k_astype, sizeof(__pyx_k_astype), 0, 0, 1, 1},
  {&__pyx_kp_s_at_lease_part_of_the_requested_a, __pyx_k_at_lease_part_of_the_requested_a, sizeof(__pyx_k_at_lease_part_of_the_requested_a), 0, 0, 1, 0},
  {&__pyx_n_s_atexit, __pyx_k_atexit, sizeof(__pyx_k_atexit), 0, 0, 1, 1},
  {&__pyx_kp_s_bad_output_stream, __pyx_k_bad_output_stream, sizeof(__pyx_k_bad_output_stream), 0, 0, 1, 0},
  {&__pyx_n_s_bands, __pyx_k_bands, sizeof(__pyx_k_bands), 0, 0, 1, 1},
  {&__pyx_n_s_bm_expr, __pyx_k_bm_expr, sizeof(__pyx_k_bm_expr), 0, 0, 1, 1},
  {&__pyx_n_s_byteorder, __pyx_k_byteorder, sizeof(__pyx_k_byteorder), 0, 0, 1, 1},
  {&__pyx_n_s_bytes, __pyx_k_bytes, sizeof(__pyx_k_bytes), 0, 0, 1, 1},
  {&__pyx_n_s_byteswap, __pyx_k_byteswap, sizeof(__pyx_k_byteswap), 0, 0, 1, 1},
  {&__pyx_n_s_class, __pyx_k_class, sizeof(__pyx_k_class), 0, 0, 1, 1},
  {&__pyx_n_s_close, __pyx_k_close, sizeof(__pyx_k_close), 0, 0, 1, 1},
  {&__pyx_n_s_close_api, __pyx_k_close_api, sizeof(__pyx_k_close_api), 0, 0, 1, 1},
  {&__pyx_n_s_code, __pyx_k_code, sizeof(__pyx_k_code), 0, 0, 1, 1},
  {&__pyx_n_s_collect, __pyx_k_collect, sizeof(__pyx_k_collect), 0, 0, 1, 1},
  {&__pyx_n_s_collections, __pyx_k_collections, sizeof(__pyx_k_collections), 0, 0, 1, 1},
  {&__pyx_n_s_create_bitmask_raster, __pyx_k_create_bitmask_raster, sizeof(__pyx_k_create_bitmask_raster), 0, 0, 1, 1},
  {&__pyx_n_s_create_compatible_raster, __pyx_k_create_compatible_raster, sizeof(__pyx_k_create_compatible_raster), 0, 0, 1, 1},
  {&__pyx_n_s_create_raster, __pyx_k_create_raster, sizeof(__pyx_k_create_raster), 0, 0, 1, 1},
  {&__pyx_kp_s_d, __pyx_k_d, sizeof(__pyx_k_d), 0, 0, 1, 0},
  {&__pyx_n_s_data, __pyx_k_data, sizeof(__pyx_k_data), 0, 0, 1, 1},
  {&__pyx_n_s_data_type, __pyx_k_data_type, sizeof(__pyx_k_data_type), 0, 0, 1, 1},
  {&__pyx_n_s_datasets, __pyx_k_datasets, sizeof(__pyx_k_datasets), 0, 0, 1, 1},
  {&__pyx_n_s_days, __pyx_k_days, sizeof(__pyx_k_days), 0, 0, 1, 1},
  {&__pyx_n_s_decode, __pyx_k_decode, sizeof(__pyx_k_decode), 0, 0, 1, 1},
  {&__pyx_n_s_doc, __pyx_k_doc, sizeof(__pyx_k_doc), 0, 0, 1, 1},
  {&__pyx_n_s_ds_name, __pyx_k_ds_name, sizeof(__pyx_k_ds_name), 0, 0, 1, 1},
  {&__pyx_n_s_elem, __pyx_k_elem, sizeof(__pyx_k_elem), 0, 0, 1, 1},
  {&__pyx_n_s_element_index, __pyx_k_element_index, sizeof(__pyx_k_element_index), 0, 0, 1, 1},
  {&__pyx_n_s_encode, __pyx_k_encode, sizeof(__pyx_k_encode), 0, 0, 1, 1},
  {&__pyx_n_s_epr, __pyx_k_epr, sizeof(__pyx_k_epr), 0, 0, 1, 1},
  {&__pyx_kp_s_epr_Band_s_of_epr_Product_s, __pyx_k_epr_Band_s_of_epr_Product_s, sizeof(__pyx_k_epr_Band_s_of_epr_Product_s), 0, 0, 1, 0},
  {&__pyx_kp_s_epr_DSD_s, __pyx_k_epr_DSD_s, sizeof(__pyx_k_epr_DSD_s), 0, 0, 1, 0},
  {&__pyx_kp_s_epr_Dataset_s_d_records, __pyx_k_epr_Dataset_s_d_records, sizeof(__pyx_k_epr_Dataset_s_d_records), 0, 0, 1, 0},
  {&__pyx_kp_s_epr_Field_s_d_s_elements, __pyx_k_epr_Field_s_d_s_elements, sizeof(__pyx_k_epr_Field_s_d_s_elements), 0, 0, 1, 0},
  {&__pyx_kp_s_epr_Product_s_d_datasets_d_bands, __pyx_k_epr_Product_s_d_datasets_d_bands, sizeof(__pyx_k_epr_Product_s_d_datasets_d_bands), 0, 0, 1, 0},
  {&__pyx_kp_s_f, __pyx_k_f, sizeof(__pyx_k_f), 0, 0, 1, 0},
  {&__pyx_n_s_field_index, __pyx_k_field_index, sizeof(__pyx_k_field_index), 0, 0, 1, 1},
  {&__pyx_n_s_filename, __pyx_k_filename, sizeof(__pyx_k_filename), 0, 0, 1, 1},
  {&__pyx_n_s_float32, __pyx_k_float32, sizeof(__pyx_k_float32), 0, 0, 1, 1},
  {&__pyx_n_s_float64, __pyx_k_float64, sizeof(__pyx_k_float64), 0, 0, 1, 1},
  {&__pyx_n_s_flush, __pyx_k_flush, sizeof(__pyx_k_flush), 0, 0, 1, 1},
  {&__pyx_kp_s_flush_error, __pyx_k_flush_error, sizeof(__pyx_k_flush_error), 0, 0, 1, 0},
  {&__pyx_n_s_gc, __pyx_k_gc, sizeof(__pyx_k_gc), 0, 0, 1, 1},
  {&__pyx_n_s_get_band_at, __pyx_k_get_band_at, sizeof(__pyx_k_get_band_at), 0, 0, 1, 1},
  {&__pyx_n_s_get_dataset, __pyx_k_get_dataset, sizeof(__pyx_k_get_dataset), 0, 0, 1, 1},
  {&__pyx_n_s_get_dataset_at, __pyx_k_get_dataset_at, sizeof(__pyx_k_get_dataset_at), 0, 0, 1, 1},
  {&__pyx_n_s_get_elem, __pyx_k_get_elem, sizeof(__pyx_k_get_elem), 0, 0, 1, 1},
  {&__pyx_n_s_get_elems, __pyx_k_get_elems, sizeof(__pyx_k_get_elems), 0, 0, 1, 1},
  {&__pyx_n_s_get_field_at, __pyx_k_get_field_at, sizeof(__pyx_k_get_field_at), 0, 0, 1, 1},
  {&__pyx_n_s_get_height, __pyx_k_get_height, sizeof(__pyx_k_get_height), 0, 0, 1, 1},
  {&__pyx_n_s_get_name, __pyx_k_get_name, sizeof(__pyx_k_get_name), 0, 0, 1, 1},
  {&__pyx_n_s_get_num_bands, __pyx_k_get_num_bands, sizeof(__pyx_k_get_num_bands), 0, 0, 1, 1},
  {&__pyx_n_s_get_num_datasets, __pyx_k_get_num_datasets, sizeof(__pyx_k_get_num_datasets), 0, 0, 1, 1},
  {&__pyx_n_s_get_num_elems, __pyx_k_get_num_elems, sizeof(__pyx_k_get_num_elems), 0, 0, 1, 1},
  {&__pyx_n_s_get_num_fields, __pyx_k_get_num_fields, sizeof(__pyx_k_get_num_fields), 0, 0, 1, 1},
  {&__pyx_n_s_get_num_records, __pyx_k_get_num_records, sizeof(__pyx_k_get_num_records), 0, 0, 1, 1},
  {&__pyx_n_s_get_type, __pyx_k_get_type, sizeof(__pyx_k_get_type), 0, 0, 1, 1},
  {&__pyx_n_s_get_width, __pyx_k_get_width, sizeof(__pyx_k_get_width), 0, 0, 1, 1},
  {&__pyx_n_s_getfilesystemencoding, __pyx_k_getfilesystemencoding, sizeof(__pyx_k_getfilesystemencoding), 0, 0, 1, 1},
  {&__pyx_n_s_height, __pyx_k_height, sizeof(__pyx_k_height), 0, 0, 1, 1},
  {&__pyx_kp_s_home_antonio_projects_pyepr_src, __pyx_k_home_antonio_projects_pyepr_src, sizeof(__pyx_k_home_antonio_projects_pyepr_src), 0, 0, 1, 0},
  {&__pyx_kp_s_i_d, __pyx_k_i_d, sizeof(__pyx_k_i_d), 0, 0, 1, 0},
  {&__pyx_n_s_id_string, __pyx_k_id_string, sizeof(__pyx_k_id_string), 0, 0, 1, 1},
  {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
  {&__pyx_n_s_index, __pyx_k_index, sizeof(__pyx_k_index), 0, 0, 1, 1},
  {&__pyx_kp_s_index_out_of_range_x_d_y_d, __pyx_k_index_out_of_range_x_d_y_d, sizeof(__pyx_k_index_out_of_range_x_d_y_d), 0, 0, 1, 0},
  {&__pyx_n_s_init, __pyx_k_init, sizeof(__pyx_k_init), 0, 0, 1, 1},
  {&__pyx_n_s_int16, __pyx_k_int16, sizeof(__pyx_k_int16), 0, 0, 1, 1},
  {&__pyx_n_s_int32, __pyx_k_int32, sizeof(__pyx_k_int32), 0, 0, 1, 1},
  {&__pyx_n_s_int8, __pyx_k_int8, sizeof(__pyx_k_int8), 0, 0, 1, 1},
  {&__pyx_kp_s_invalid_EPR_type_ID_d, __pyx_k_invalid_EPR_type_ID_d, sizeof(__pyx_k_invalid_EPR_type_ID_d), 0, 0, 1, 0},
  {&__pyx_kp_s_invalid_data_type, __pyx_k_invalid_data_type, sizeof(__pyx_k_invalid_data_type), 0, 0, 1, 0},
  {&__pyx_kp_s_invalid_data_type_s, __pyx_k_invalid_data_type_s, sizeof(__pyx_k_invalid_data_type_s), 0, 0, 1, 0},
  {&__pyx_kp_s_invalid_field_type, __pyx_k_invalid_field_type, sizeof(__pyx_k_invalid_field_type), 0, 0, 1, 0},
  {&__pyx_kp_s_invalid_index_d, __pyx_k_invalid_index_d, sizeof(__pyx_k_invalid_index_d), 0, 0, 1, 0},
  {&__pyx_kp_s_invalid_open_mode_s, __pyx_k_invalid_open_mode_s, sizeof(__pyx_k_invalid_open_mode_s), 0, 0, 1, 0},
  {&__pyx_kp_s_invalid_ostream, __pyx_k_invalid_ostream, sizeof(__pyx_k_invalid_ostream), 0, 0, 1, 0},
  {&__pyx_kp_s_invalid_sample_model_s, __pyx_k_invalid_sample_model_s, sizeof(__pyx_k_invalid_sample_model_s), 0, 0, 1, 0},
  {&__pyx_kp_s_invalid_scaling_method_s, __pyx_k_invalid_scaling_method_s, sizeof(__pyx_k_invalid_scaling_method_s), 0, 0, 1, 0},
  {&__pyx_kp_s_invalid_shape_s_s_value_expected, __pyx_k_invalid_shape_s_s_value_expected, sizeof(__pyx_k_invalid_shape_s_s_value_expected), 0, 0, 1, 0},
  {&__pyx_kp_s_invalid_shape_s_scalar_value_exp, __pyx_k_invalid_shape_s_scalar_value_exp, sizeof(__pyx_k_invalid_shape_s_scalar_value_exp), 0, 0, 1, 0},
  {&__pyx_kp_s_invalid_step_xspet_d_ystep_d, __pyx_k_invalid_step_xspet_d_ystep_d, sizeof(__pyx_k_invalid_step_xspet_d_ystep_d), 0, 0, 1, 0},
  {&__pyx_n_s_join, __pyx_k_join, sizeof(__pyx_k_join), 0, 0, 1, 1},
  {&__pyx_n_s_kargs, __pyx_k_kargs, sizeof(__pyx_k_kargs), 0, 0, 1, 1},
  {&__pyx_n_s_little, __pyx_k_little, sizeof(__pyx_k_little), 0, 0, 1, 1},
  {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
  {&__pyx_n_s_map, __pyx_k_map, sizeof(__pyx_k_map), 0, 0, 1, 1},
  {&__pyx_n_s_message, __pyx_k_message, sizeof(__pyx_k_message), 0, 0, 1, 1},
  {&__pyx_n_s_metaclass, __pyx_k_metaclass, sizeof(__pyx_k_metaclass), 0, 0, 1, 1},
  {&__pyx_n_s_microseconds, __pyx_k_microseconds, sizeof(__pyx_k_microseconds), 0, 0, 1, 1},
  {&__pyx_n_s_mode, __pyx_k_mode, sizeof(__pyx_k_mode), 0, 0, 1, 1},
  {&__pyx_n_s_module, __pyx_k_module, sizeof(__pyx_k_module), 0, 0, 1, 1},
  {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1},
  {&__pyx_n_s_namedtuple, __pyx_k_namedtuple, sizeof(__pyx_k_namedtuple), 0, 0, 1, 1},
  {&__pyx_kp_u_ndarray_is_not_C_contiguous, __pyx_k_ndarray_is_not_C_contiguous, sizeof(__pyx_k_ndarray_is_not_C_contiguous), 0, 1, 0, 0},
  {&__pyx_kp_u_ndarray_is_not_Fortran_contiguou, __pyx_k_ndarray_is_not_Fortran_contiguou, sizeof(__pyx_k_ndarray_is_not_Fortran_contiguou), 0, 1, 0, 0},
  {&__pyx_n_s_ndim, __pyx_k_ndim, sizeof(__pyx_k_ndim), 0, 0, 1, 1},
  {&__pyx_n_s_np, __pyx_k_np, sizeof(__pyx_k_np), 0, 0, 1, 1},
  {&__pyx_kp_s_null_pointer, __pyx_k_null_pointer, sizeof(__pyx_k_null_pointer), 0, 0, 1, 0},
  {&__pyx_n_s_numpy, __pyx_k_numpy, sizeof(__pyx_k_numpy), 0, 0, 1, 1},
  {&__pyx_n_s_open, __pyx_k_open, sizeof(__pyx_k_open), 0, 0, 1, 1},
  {&__pyx_n_s_os, __pyx_k_os, sizeof(__pyx_k_os), 0, 0, 1, 1},
  {&__pyx_n_s_ostream, __pyx_k_ostream, sizeof(__pyx_k_ostream), 0, 0, 1, 1},
  {&__pyx_n_s_prepare, __pyx_k_prepare, sizeof(__pyx_k_prepare), 0, 0, 1, 1},
  {&__pyx_n_s_product, __pyx_k_product, sizeof(__pyx_k_product), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_vtable, __pyx_k_pyx_vtable, sizeof(__pyx_k_pyx_vtable), 0, 0, 1, 1},
  {&__pyx_n_s_qualname, __pyx_k_qualname, sizeof(__pyx_k_qualname), 0, 0, 1, 1},
  {&__pyx_kp_s_r_b, __pyx_k_r_b, sizeof(__pyx_k_r_b), 0, 0, 1, 0},
  {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1},
  {&__pyx_n_s_raster, __pyx_k_raster, sizeof(__pyx_k_raster), 0, 0, 1, 1},
  {&__pyx_n_s_raster_ptr, __pyx_k_raster_ptr, sizeof(__pyx_k_raster_ptr), 0, 0, 1, 1},
  {&__pyx_n_s_rb, __pyx_k_rb, sizeof(__pyx_k_rb), 0, 0, 1, 1},
  {&__pyx_kp_s_rb_2, __pyx_k_rb_2, sizeof(__pyx_k_rb_2), 0, 0, 1, 0},
  {&__pyx_n_s_read_raster, __pyx_k_read_raster, sizeof(__pyx_k_read_raster), 0, 0, 1, 1},
  {&__pyx_n_s_read_record, __pyx_k_read_record, sizeof(__pyx_k_read_record), 0, 0, 1, 1},
  {&__pyx_n_s_record, __pyx_k_record, sizeof(__pyx_k_record), 0, 0, 1, 1},
  {&__pyx_n_s_register, __pyx_k_register, sizeof(__pyx_k_register), 0, 0, 1, 1},
  {&__pyx_n_s_repr, __pyx_k_repr, sizeof(__pyx_k_repr), 0, 0, 1, 1},
  {&__pyx_n_s_repr_2, __pyx_k_repr_2, sizeof(__pyx_k_repr_2), 0, 0, 1, 1},
  {&__pyx_kp_s_requeted_raster_height_d_is_too, __pyx_k_requeted_raster_height_d_is_too, sizeof(__pyx_k_requeted_raster_height_d_is_too), 0, 0, 1, 0},
  {&__pyx_kp_s_requeted_raster_width_d_is_too_l, __pyx_k_requeted_raster_width_d_is_too_l, sizeof(__pyx_k_requeted_raster_width_d_is_too_l), 0, 0, 1, 0},
  {&__pyx_kp_s_s_class_cannot_be_instantiated, __pyx_k_s_class_cannot_be_instantiated, sizeof(__pyx_k_s_class_cannot_be_instantiated), 0, 0, 1, 0},
  {&__pyx_kp_s_s_d_d_j_d_m_d, __pyx_k_s_d_d_j_d_m_d, sizeof(__pyx_k_s_d_d_j_d_m_d), 0, 0, 1, 0},
  {&__pyx_kp_s_s_d_fields, __pyx_k_s_d_fields, sizeof(__pyx_k_s_d_fields), 0, 0, 1, 0},
  {&__pyx_kp_s_s_s, __pyx_k_s_s, sizeof(__pyx_k_s_s), 0, 0, 1, 0},
  {&__pyx_kp_s_s_s_2, __pyx_k_s_s_2, sizeof(__pyx_k_s_s_2), 0, 0, 1, 0},
  {&__pyx_kp_s_s_s_3, __pyx_k_s_s_3, sizeof(__pyx_k_s_s_3), 0, 0, 1, 0},
  {&__pyx_kp_s_s_s_4, __pyx_k_s_s_4, sizeof(__pyx_k_s_s_4), 0, 0, 1, 0},
  {&__pyx_kp_s_s_s_dL_x_dP, __pyx_k_s_s_dL_x_dP, sizeof(__pyx_k_s_s_dL_x_dP), 0, 0, 1, 0},
  {&__pyx_kp_s_s_unknown_data_type, __pyx_k_s_unknown_data_type, sizeof(__pyx_k_s_unknown_data_type), 0, 0, 1, 0},
  {&__pyx_n_s_seconds, __pyx_k_seconds, sizeof(__pyx_k_seconds), 0, 0, 1, 1},
  {&__pyx_n_s_self, __pyx_k_self, sizeof(__pyx_k_self), 0, 0, 1, 1},
  {&__pyx_n_s_send, __pyx_k_send, sizeof(__pyx_k_send), 0, 0, 1, 1},
  {&__pyx_kp_s_setting_elements_is_not_implemen, __pyx_k_setting_elements_is_not_implemen, sizeof(__pyx_k_setting_elements_is_not_implemen), 0, 0, 1, 0},
  {&__pyx_n_s_shape, __pyx_k_shape, sizeof(__pyx_k_shape), 0, 0, 1, 1},
  {&__pyx_n_s_size, __pyx_k_size, sizeof(__pyx_k_size), 0, 0, 1, 1},
  {&__pyx_n_s_src_height, __pyx_k_src_height, sizeof(__pyx_k_src_height), 0, 0, 1, 1},
  {&__pyx_n_s_src_width, __pyx_k_src_width, sizeof(__pyx_k_src_width), 0, 0, 1, 1},
  {&__pyx_n_s_stdout, __pyx_k_stdout, sizeof(__pyx_k_stdout), 0, 0, 1, 1},
  {&__pyx_n_s_super, __pyx_k_super, sizeof(__pyx_k_super), 0, 0, 1, 1},
  {&__pyx_n_s_sys, __pyx_k_sys, sizeof(__pyx_k_sys), 0, 0, 1, 1},
  {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
  {&__pyx_n_s_throw, __pyx_k_throw, sizeof(__pyx_k_throw), 0, 0, 1, 1},
  {&__pyx_kp_s_u, __pyx_k_u, sizeof(__pyx_k_u), 0, 0, 1, 0},
  {&__pyx_kp_s_u_d, __pyx_k_u_d, sizeof(__pyx_k_u_d), 0, 0, 1, 0},
  {&__pyx_n_s_uint16, __pyx_k_uint16, sizeof(__pyx_k_uint16), 0, 0, 1, 1},
  {&__pyx_n_s_uint32, __pyx_k_uint32, sizeof(__pyx_k_uint32), 0, 0, 1, 1},
  {&__pyx_n_s_uint8, __pyx_k_uint8, sizeof(__pyx_k_uint8), 0, 0, 1, 1},
  {&__pyx_kp_s_unable_to_create_a_new_raster, __pyx_k_unable_to_create_a_new_raster, sizeof(__pyx_k_unable_to_create_a_new_raster), 0, 0, 1, 0},
  {&__pyx_kp_s_unable_to_create_compatible_rast, __pyx_k_unable_to_create_compatible_rast, sizeof(__pyx_k_unable_to_create_compatible_rast), 0, 0, 1, 0},
  {&__pyx_kp_s_unable_to_get_DSD_at_index_d, __pyx_k_unable_to_get_DSD_at_index_d, sizeof(__pyx_k_unable_to_get_DSD_at_index_d), 0, 0, 1, 0},
  {&__pyx_kp_s_unable_to_get_MPH_record, __pyx_k_unable_to_get_MPH_record, sizeof(__pyx_k_unable_to_get_MPH_record), 0, 0, 1, 0},
  {&__pyx_kp_s_unable_to_get_SPH_record, __pyx_k_unable_to_get_SPH_record, sizeof(__pyx_k_unable_to_get_SPH_record), 0, 0, 1, 0},
  {&__pyx_kp_s_unable_to_get_band_at_index_d, __pyx_k_unable_to_get_band_at_index_d, sizeof(__pyx_k_unable_to_get_band_at_index_d), 0, 0, 1, 0},
  {&__pyx_kp_s_unable_to_get_band_s, __pyx_k_unable_to_get_band_s, sizeof(__pyx_k_unable_to_get_band_s), 0, 0, 1, 0},
  {&__pyx_kp_s_unable_to_get_dataset_at_index_d, __pyx_k_unable_to_get_dataset_at_index_d, sizeof(__pyx_k_unable_to_get_dataset_at_index_d), 0, 0, 1, 0},
  {&__pyx_kp_s_unable_to_get_dataset_s, __pyx_k_unable_to_get_dataset_s, sizeof(__pyx_k_unable_to_get_dataset_s), 0, 0, 1, 0},
  {&__pyx_kp_s_unable_to_get_field_at_index_d, __pyx_k_unable_to_get_field_at_index_d, sizeof(__pyx_k_unable_to_get_field_at_index_d), 0, 0, 1, 0},
  {&__pyx_kp_s_unable_to_get_field_s, __pyx_k_unable_to_get_field_s, sizeof(__pyx_k_unable_to_get_field_s), 0, 0, 1, 0},
  {&__pyx_kp_s_unable_to_inizialize_EPR_API_lib, __pyx_k_unable_to_inizialize_EPR_API_lib, sizeof(__pyx_k_unable_to_inizialize_EPR_API_lib), 0, 0, 1, 0},
  {&__pyx_kp_s_unable_to_open_file_s_in_s_mode, __pyx_k_unable_to_open_file_s_in_s_mode, sizeof(__pyx_k_unable_to_open_file_s_in_s_mode), 0, 0, 1, 0},
  {&__pyx_kp_s_unable_to_open_s, __pyx_k_unable_to_open_s, sizeof(__pyx_k_unable_to_open_s), 0, 0, 1, 0},
  {&__pyx_kp_s_unable_to_read_record_at_index_d, __pyx_k_unable_to_read_record_at_index_d, sizeof(__pyx_k_unable_to_read_record_at_index_d), 0, 0, 1, 0},
  {&__pyx_kp_s_unexpected_number_of_elements_d, __pyx_k_unexpected_number_of_elements_d, sizeof(__pyx_k_unexpected_number_of_elements_d), 0, 0, 1, 0},
  {&__pyx_kp_s_unknown_data_type, __pyx_k_unknown_data_type, sizeof(__pyx_k_unknown_data_type), 0, 0, 1, 0},
  {&__pyx_kp_u_unknown_dtype_code_in_numpy_pxd, __pyx_k_unknown_dtype_code_in_numpy_pxd, sizeof(__pyx_k_unknown_dtype_code_in_numpy_pxd), 0, 1, 0, 0},
  {&__pyx_n_s_version, __pyx_k_version, sizeof(__pyx_k_version), 0, 0, 1, 1},
  {&__pyx_n_s_width, __pyx_k_width, sizeof(__pyx_k_width), 0, 0, 1, 1},
  {&__pyx_kp_s_write_error_d_of_d_bytes_written, __pyx_k_write_error_d_of_d_bytes_written, sizeof(__pyx_k_write_error_d_of_d_bytes_written), 0, 0, 1, 0},
  {&__pyx_kp_s_write_operation_on_read_only_fil, __pyx_k_write_operation_on_read_only_fil, sizeof(__pyx_k_write_operation_on_read_only_fil), 0, 0, 1, 0},
  {&__pyx_n_s_x, __pyx_k_x, sizeof(__pyx_k_x), 0, 0, 1, 1},
  {&__pyx_n_s_xoffset, __pyx_k_xoffset, sizeof(__pyx_k_xoffset), 0, 0, 1, 1},
  {&__pyx_kp_s_xoffset_os_larger_that_he_scene, __pyx_k_xoffset_os_larger_that_he_scene, sizeof(__pyx_k_xoffset_os_larger_that_he_scene), 0, 0, 1, 0},
  {&__pyx_n_s_xstep, __pyx_k_xstep, sizeof(__pyx_k_xstep), 0, 0, 1, 1},
  {&__pyx_kp_s_xstep_d_too_large_for_the_reques, __pyx_k_xstep_d_too_large_for_the_reques, sizeof(__pyx_k_xstep_d_too_large_for_the_reques), 0, 0, 1, 0},
  {&__pyx_n_s_y, __pyx_k_y, sizeof(__pyx_k_y), 0, 0, 1, 1},
  {&__pyx_n_s_yoffset, __pyx_k_yoffset, sizeof(__pyx_k_yoffset), 0, 0, 1, 1},
  {&__pyx_kp_s_yoffset_os_larger_that_he_scene, __pyx_k_yoffset_os_larger_that_he_scene, sizeof(__pyx_k_yoffset_os_larger_that_he_scene), 0, 0, 1, 0},
  {&__pyx_n_s_ystep, __pyx_k_ystep, sizeof(__pyx_k_ystep), 0, 0, 1, 1},
  {&__pyx_kp_s_ystep_d_too_large_for_the_reques, __pyx_k_ystep_d_too_large_for_the_reques, sizeof(__pyx_k_ystep_d_too_large_for_the_reques), 0, 0, 1, 0},
  {0, 0, 0, 0, 0, 0, 0}
};
static int __Pyx_InitCachedBuiltins(void) {
  __pyx_builtin_Exception = __Pyx_GetBuiltinName(__pyx_n_s_Exception); if (!__pyx_builtin_Exception) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_super = __Pyx_GetBuiltinName(__pyx_n_s_super); if (!__pyx_builtin_super) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_AttributeError = __Pyx_GetBuiltinName(__pyx_n_s_AttributeError); if (!__pyx_builtin_AttributeError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 254; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_ImportError = __Pyx_GetBuiltinName(__pyx_n_s_ImportError); if (!__pyx_builtin_ImportError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_KeyError = __Pyx_GetBuiltinName(__pyx_n_s_KeyError); if (!__pyx_builtin_KeyError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_NotImplemented = __Pyx_GetBuiltinName(__pyx_n_s_NotImplemented); if (!__pyx_builtin_NotImplemented) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 494; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 550; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_IOError = __Pyx_GetBuiltinName(__pyx_n_s_IOError); if (!__pyx_builtin_IOError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 869; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_NotImplementedError = __Pyx_GetBuiltinName(__pyx_n_s_NotImplementedError); if (!__pyx_builtin_NotImplementedError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 892; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_map = __Pyx_GetBuiltinName(__pyx_n_s_map); if (!__pyx_builtin_map) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1362; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_n_s_RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  return 0;
  __pyx_L1_error:;
  return -1;
}

static int __Pyx_InitCachedConstants(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);

  /* "epr.pyx":259
 *         fileno = PyObject_AsFileDescriptor(ostream)
 *         if fileno == -1:
 *             raise TypeError('bad output stream')             # <<<<<<<<<<<<<<
 *         else:
 *             fstream = stdio.fdopen(fileno, 'w')
 */
  __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_s_bad_output_stream); if (unlikely(!__pyx_tuple__2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__2);
  __Pyx_GIVEREF(__pyx_tuple__2);

  /* "epr.pyx":264
 *             if fstream is NULL:
 *                 errno.errno = 0
 *                 raise TypeError('invalid ostream')             # <<<<<<<<<<<<<<
 * 
 *     return fstream
 */
  __pyx_tuple__3 = PyTuple_Pack(1, __pyx_kp_s_invalid_ostream); if (unlikely(!__pyx_tuple__3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 264; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__3);
  __Pyx_GIVEREF(__pyx_tuple__3);

  /* "epr.pyx":492
 * 
 *             else:
 *                 raise TypeError('DSD only implements "==" and "!=" operators')             # <<<<<<<<<<<<<<
 *         else:
 *             return NotImplemented
 */
  __pyx_tuple__4 = PyTuple_Pack(1, __pyx_kp_s_DSD_only_implements_and_operator); if (unlikely(!__pyx_tuple__4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 492; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__4);
  __Pyx_GIVEREF(__pyx_tuple__4);

  /* "epr.pyx":719
 *             val = EPRTime(eprtime.days, eprtime.seconds, eprtime.microseconds)
 *         else:
 *             raise ValueError('invalid field type')             # <<<<<<<<<<<<<<
 * 
 *         pyepr_check_errors()
 */
  __pyx_tuple__5 = PyTuple_Pack(1, __pyx_kp_s_invalid_field_type); if (unlikely(!__pyx_tuple__5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 719; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__5);
  __Pyx_GIVEREF(__pyx_tuple__5);

  /* "epr.pyx":820
 *         #    pass
 *         else:
 *             raise ValueError('invalid field type')             # <<<<<<<<<<<<<<
 * 
 *         out = np.PyArray_SimpleNewFromData(nd, shape, dtype, <void*>buf)
 */
  __pyx_tuple__6 = PyTuple_Pack(1, __pyx_kp_s_invalid_field_type); if (unlikely(!__pyx_tuple__6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__6);
  __Pyx_GIVEREF(__pyx_tuple__6);

  /* "epr.pyx":892
 * 
 *         if self._parent.index is None:
 *             raise NotImplementedError(             # <<<<<<<<<<<<<<
 *                 'setting elements is not implemented on MPH/SPH records')
 * 
 */
  __pyx_tuple__7 = PyTuple_Pack(1, __pyx_kp_s_setting_elements_is_not_implemen); if (unlikely(!__pyx_tuple__7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 892; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__7);
  __Pyx_GIVEREF(__pyx_tuple__7);

  /* "epr.pyx":921
 * 
 *         if self._parent._index is None:
 *             raise NotImplementedError(             # <<<<<<<<<<<<<<
 *                 'setting elements is not implemented on MPH/SPH records')
 * 
 */
  __pyx_tuple__8 = PyTuple_Pack(1, __pyx_kp_s_setting_elements_is_not_implemen); if (unlikely(!__pyx_tuple__8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 921; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__8);
  __Pyx_GIVEREF(__pyx_tuple__8);

  /* "epr.pyx":1066
 * 
 *             else:
 *                 raise TypeError(             # <<<<<<<<<<<<<<
 *                     'Field only implements "==" and "!=" operators')
 *         else:
 */
  __pyx_tuple__10 = PyTuple_Pack(1, __pyx_kp_s_Field_only_implements_and_operat); if (unlikely(!__pyx_tuple__10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1066; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__10);
  __Pyx_GIVEREF(__pyx_tuple__10);

  /* "epr.pyx":1524
 * 
 *         if dtype == np.NPY_NOTYPE:
 *             raise TypeError('invalid data type')             # <<<<<<<<<<<<<<
 *         else:
 *             shape[0] = self._ptr.raster_height
 */
  __pyx_tuple__12 = PyTuple_Pack(1, __pyx_kp_s_invalid_data_type); if (unlikely(!__pyx_tuple__12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1524; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__12);
  __Pyx_GIVEREF(__pyx_tuple__12);

  /* "epr.pyx":1555
 * 
 *             if self._ptr.buffer is NULL:
 *                 return np.ndarray(())             # <<<<<<<<<<<<<<
 * 
 *             data = self.toarray()
 */
  __pyx_tuple__13 = PyTuple_Pack(1, __pyx_empty_tuple); if (unlikely(!__pyx_tuple__13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1555; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__13);
  __Pyx_GIVEREF(__pyx_tuple__13);

  /* "epr.pyx":2023
 *         if (xoffset + raster._ptr.source_width > scene_width or
 *                 yoffset + raster._ptr.source_height > scene_height):
 *             raise ValueError(             # <<<<<<<<<<<<<<
 *                 'at lease part of the requested area is outside the scene')
 * 
 */
  __pyx_tuple__14 = PyTuple_Pack(1, __pyx_kp_s_at_lease_part_of_the_requested_a); if (unlikely(!__pyx_tuple__14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2023; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__14);
  __Pyx_GIVEREF(__pyx_tuple__14);

  /* "epr.pyx":2093
 *                 width = w - xoffset
 *             else:
 *                 raise ValueError('xoffset os larger that he scene width')             # <<<<<<<<<<<<<<
 * 
 *         if height is None:
 */
  __pyx_tuple__15 = PyTuple_Pack(1, __pyx_kp_s_xoffset_os_larger_that_he_scene); if (unlikely(!__pyx_tuple__15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2093; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__15);
  __Pyx_GIVEREF(__pyx_tuple__15);

  /* "epr.pyx":2100
 *                 height = h - yoffset
 *             else:
 *                 raise ValueError('yoffset os larger that he scene height')             # <<<<<<<<<<<<<<
 * 
 *         raster = self.create_compatible_raster(width, height, xstep, ystep)
 */
  __pyx_tuple__16 = PyTuple_Pack(1, __pyx_kp_s_yoffset_os_larger_that_he_scene); if (unlikely(!__pyx_tuple__16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__16);
  __Pyx_GIVEREF(__pyx_tuple__16);

  /* "epr.pyx":2425
 *     cdef inline check_closed_product(self):
 *         if self._ptr is NULL:
 *             raise ValueError('I/O operation on closed file')             # <<<<<<<<<<<<<<
 * 
 *     cdef inline _check_write_mode(self):
 */
  __pyx_tuple__18 = PyTuple_Pack(1, __pyx_kp_s_I_O_operation_on_closed_file); if (unlikely(!__pyx_tuple__18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2425; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__18);
  __Pyx_GIVEREF(__pyx_tuple__18);

  /* "epr.pyx":2429
 *     cdef inline _check_write_mode(self):
 *         if '+' not in self._mode:
 *             raise TypeError('write operation on read-only file')             # <<<<<<<<<<<<<<
 * 
 *     def __init__(self, filename, mode='rb'):
 */
  __pyx_tuple__19 = PyTuple_Pack(1, __pyx_kp_s_write_operation_on_read_only_fil); if (unlikely(!__pyx_tuple__19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2429; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__19);
  __Pyx_GIVEREF(__pyx_tuple__19);

  /* "epr.pyx":2469
 *             if ret != 0:
 *                 errno.errno = 0
 *                 raise IOError('flush error')             # <<<<<<<<<<<<<<
 * 
 *     property file_path:
 */
  __pyx_tuple__20 = PyTuple_Pack(1, __pyx_kp_s_flush_error); if (unlikely(!__pyx_tuple__20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__20);
  __Pyx_GIVEREF(__pyx_tuple__20);

  /* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":215
 *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
 *                 and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)):
 *                 raise ValueError(u"ndarray is not C contiguous")             # <<<<<<<<<<<<<<
 * 
 *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
 */
  __pyx_tuple__21 = PyTuple_Pack(1, __pyx_kp_u_ndarray_is_not_C_contiguous); if (unlikely(!__pyx_tuple__21)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__21);
  __Pyx_GIVEREF(__pyx_tuple__21);

  /* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":219
 *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
 *                 and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)):
 *                 raise ValueError(u"ndarray is not Fortran contiguous")             # <<<<<<<<<<<<<<
 * 
 *             info.buf = PyArray_DATA(self)
 */
  __pyx_tuple__22 = PyTuple_Pack(1, __pyx_kp_u_ndarray_is_not_Fortran_contiguou); if (unlikely(!__pyx_tuple__22)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__22);
  __Pyx_GIVEREF(__pyx_tuple__22);

  /* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":257
 *                 if ((descr.byteorder == c'>' and little_endian) or
 *                     (descr.byteorder == c'<' and not little_endian)):
 *                     raise ValueError(u"Non-native byte order not supported")             # <<<<<<<<<<<<<<
 *                 if   t == NPY_BYTE:        f = "b"
 *                 elif t == NPY_UBYTE:       f = "B"
 */
  __pyx_tuple__23 = PyTuple_Pack(1, __pyx_kp_u_Non_native_byte_order_not_suppor); if (unlikely(!__pyx_tuple__23)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__23);
  __Pyx_GIVEREF(__pyx_tuple__23);

  /* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":799
 * 
 *         if (end - f) - <int>(new_offset - offset[0]) < 15:
 *             raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")             # <<<<<<<<<<<<<<
 * 
 *         if ((child.byteorder == c'>' and little_endian) or
 */
  __pyx_tuple__24 = PyTuple_Pack(1, __pyx_kp_u_Format_string_allocated_too_shor); if (unlikely(!__pyx_tuple__24)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__24);
  __Pyx_GIVEREF(__pyx_tuple__24);

  /* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":803
 *         if ((child.byteorder == c'>' and little_endian) or
 *             (child.byteorder == c'<' and not little_endian)):
 *             raise ValueError(u"Non-native byte order not supported")             # <<<<<<<<<<<<<<
 *             # One could encode it in the format string and have Cython
 *             # complain instead, BUT: < and > in format strings also imply
 */
  __pyx_tuple__25 = PyTuple_Pack(1, __pyx_kp_u_Non_native_byte_order_not_suppor); if (unlikely(!__pyx_tuple__25)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__25);
  __Pyx_GIVEREF(__pyx_tuple__25);

  /* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":823
 *             t = child.type_num
 *             if end - f < 5:
 *                 raise RuntimeError(u"Format string allocated too short.")             # <<<<<<<<<<<<<<
 * 
 *             # Until ticket #99 is fixed, use integers to avoid warnings
 */
  __pyx_tuple__26 = PyTuple_Pack(1, __pyx_kp_u_Format_string_allocated_too_shor_2); if (unlikely(!__pyx_tuple__26)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__26);
  __Pyx_GIVEREF(__pyx_tuple__26);

  /* "epr.pyx":98
 * 
 * # utils
 * EPRTime = namedtuple('EPRTime', ('days', 'seconds', 'microseconds'))             # <<<<<<<<<<<<<<
 * MJD = np.dtype([
 *     ('days', 'i%d' % sizeof(int)),
 */
  __pyx_tuple__27 = PyTuple_Pack(3, __pyx_n_s_days, __pyx_n_s_seconds, __pyx_n_s_microseconds); if (unlikely(!__pyx_tuple__27)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__27);
  __Pyx_GIVEREF(__pyx_tuple__27);
  __pyx_tuple__28 = PyTuple_Pack(2, __pyx_n_s_EPRTime, __pyx_tuple__27); if (unlikely(!__pyx_tuple__28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__28);
  __Pyx_GIVEREF(__pyx_tuple__28);

  /* "epr.pyx":201
 *     '''EPR API error'''
 * 
 *     def __init__(self, message='', code=None, *args, **kargs):             # <<<<<<<<<<<<<<
 *         '''__init__(self, message='', code=None, *args, **kargs)'''
 * 
 */
  __pyx_tuple__29 = PyTuple_Pack(5, __pyx_n_s_self, __pyx_n_s_message, __pyx_n_s_code, __pyx_n_s_args, __pyx_n_s_kargs); if (unlikely(!__pyx_tuple__29)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__29);
  __Pyx_GIVEREF(__pyx_tuple__29);
  __pyx_codeobj__30 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_VARARGS|CO_VARKEYWORDS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__29, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_antonio_projects_pyepr_src, __pyx_n_s_init, 201, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__30)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_tuple__31 = PyTuple_Pack(2, ((PyObject*)__pyx_kp_s_), ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__31)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__31);
  __Pyx_GIVEREF(__pyx_tuple__31);

  /* "epr.pyx":1588
 * 
 * 
 * def create_raster(EPR_EDataTypeId data_type, uint src_width, uint src_height,             # <<<<<<<<<<<<<<
 *                   uint xstep=1, uint ystep=1):
 *     '''create_raster(data_type, src_width, src_height, xstep=1, ystep=1)
 */
  __pyx_tuple__32 = PyTuple_Pack(6, __pyx_n_s_data_type, __pyx_n_s_src_width, __pyx_n_s_src_height, __pyx_n_s_xstep, __pyx_n_s_ystep, __pyx_n_s_raster_ptr); if (unlikely(!__pyx_tuple__32)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1588; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__32);
  __Pyx_GIVEREF(__pyx_tuple__32);
  __pyx_codeobj__33 = (PyObject*)__Pyx_PyCode_New(5, 0, 6, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__32, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_antonio_projects_pyepr_src, __pyx_n_s_create_raster, 1588, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__33)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1588; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "epr.pyx":1633
 * 
 * 
 * def create_bitmask_raster(uint src_width, uint src_height,             # <<<<<<<<<<<<<<
 *                           uint xstep=1, uint ystep=1):
 *     '''create_bitmask_raster(src_width, src_height, xstep=1, ystep=1)
 */
  __pyx_tuple__34 = PyTuple_Pack(5, __pyx_n_s_src_width, __pyx_n_s_src_height, __pyx_n_s_xstep, __pyx_n_s_ystep, __pyx_n_s_raster_ptr); if (unlikely(!__pyx_tuple__34)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1633; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__34);
  __Pyx_GIVEREF(__pyx_tuple__34);
  __pyx_codeobj__35 = (PyObject*)__Pyx_PyCode_New(4, 0, 5, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__34, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_antonio_projects_pyepr_src, __pyx_n_s_create_bitmask_raster, 1633, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__35)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1633; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "epr.pyx":2894
 * 
 * 
 * def open(filename, mode='rb'):             # <<<<<<<<<<<<<<
 *     '''open(filename)
 * 
 */
  __pyx_tuple__36 = PyTuple_Pack(2, __pyx_n_s_filename, __pyx_n_s_mode); if (unlikely(!__pyx_tuple__36)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2894; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__36);
  __Pyx_GIVEREF(__pyx_tuple__36);
  __pyx_codeobj__37 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__36, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_antonio_projects_pyepr_src, __pyx_n_s_open, 2894, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__37)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2894; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "epr.pyx":2929
 * 
 * @atexit.register
 * def _close_api():             # <<<<<<<<<<<<<<
 *     # ensure that all EprObject(s) are collected before removing the last
 *     # reference to _EPR_C_LIB
 */
  __pyx_tuple__38 = PyTuple_Pack(1, __pyx_n_s_gc); if (unlikely(!__pyx_tuple__38)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2929; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__38);
  __Pyx_GIVEREF(__pyx_tuple__38);
  __pyx_codeobj__39 = (PyObject*)__Pyx_PyCode_New(0, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__38, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_antonio_projects_pyepr_src, __pyx_n_s_close_api, 2929, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__39)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2929; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_RefNannyFinishContext();
  return -1;
}

static int __Pyx_InitGlobals(void) {
  if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  return 0;
  __pyx_L1_error:;
  return -1;
}

#if PY_MAJOR_VERSION < 3
PyMODINIT_FUNC initepr(void); /*proto*/
PyMODINIT_FUNC initepr(void)
#else
PyMODINIT_FUNC PyInit_epr(void); /*proto*/
PyMODINIT_FUNC PyInit_epr(void)
#endif
{
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  struct __pyx_opt_args_3epr__to_str __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  #if CYTHON_REFNANNY
  __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
  if (!__Pyx_RefNanny) {
      PyErr_Clear();
      __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
      if (!__Pyx_RefNanny)
          Py_FatalError("failed to import 'refnanny' module");
  }
  #endif
  __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit_epr(void)", 0);
  if ( __Pyx_check_binary_version() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #ifdef __Pyx_CyFunction_USED
  if (__Pyx_CyFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #endif
  #ifdef __Pyx_FusedFunction_USED
  if (__pyx_FusedFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #endif
  #ifdef __Pyx_Generator_USED
  if (__pyx_Generator_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #endif
  /*--- Library function declarations ---*/
  /*--- Threads initialization code ---*/
  #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
  #ifdef WITH_THREAD /* Python build with threading support? */
  PyEval_InitThreads();
  #endif
  #endif
  /*--- Module creation code ---*/
  #if PY_MAJOR_VERSION < 3
  __pyx_m = Py_InitModule4(__Pyx_NAMESTR("epr"), __pyx_methods, __Pyx_DOCSTR(__pyx_k_Python_bindings_for_ENVISAT_Prod), 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
  #else
  __pyx_m = PyModule_Create(&__pyx_moduledef);
  #endif
  if (unlikely(!__pyx_m)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  Py_INCREF(__pyx_d);
  __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); if (unlikely(!__pyx_b)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #if CYTHON_COMPILING_IN_PYPY
  Py_INCREF(__pyx_b);
  #endif
  if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  /*--- Initialize various global constants etc. ---*/
  if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
  if (__Pyx_init_sys_getdefaultencoding_params() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #endif
  if (__pyx_module_is_main_epr) {
    if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_n_s_main) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  }
  #if PY_MAJOR_VERSION >= 3
  {
    PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (!PyDict_GetItemString(modules, "epr")) {
      if (unlikely(PyDict_SetItemString(modules, "epr", __pyx_m) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
  }
  #endif
  /*--- Builtin init code ---*/
  if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  /*--- Constants init code ---*/
  if (unlikely(__Pyx_InitCachedConstants() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  /*--- Global init code ---*/
  __pyx_v_3epr__EPR_C_LIB = ((struct __pyx_obj_3epr__CLib *)Py_None); Py_INCREF(Py_None);
  /*--- Variable export code ---*/
  /*--- Function export code ---*/
  /*--- Type init code ---*/
  if (PyType_Ready(&__pyx_type_3epr__CLib) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_3epr__CLib.tp_print = 0;
  if (__Pyx_SetAttrString(__pyx_m, "_CLib", (PyObject *)&__pyx_type_3epr__CLib) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_3epr__CLib = &__pyx_type_3epr__CLib;
  if (PyType_Ready(&__pyx_type_3epr_EprObject) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 303; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_3epr_EprObject.tp_print = 0;
  if (__Pyx_SetAttrString(__pyx_m, "EprObject", (PyObject *)&__pyx_type_3epr_EprObject) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 303; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_3epr_EprObject = &__pyx_type_3epr_EprObject;
  __pyx_vtabptr_3epr_DSD = &__pyx_vtable_3epr_DSD;
  __pyx_vtable_3epr_DSD.check_closed_product = (PyObject *(*)(struct __pyx_obj_3epr_DSD *))__pyx_f_3epr_3DSD_check_closed_product;
  __pyx_type_3epr_DSD.tp_base = __pyx_ptype_3epr_EprObject;
  if (PyType_Ready(&__pyx_type_3epr_DSD) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 378; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_3epr_DSD.tp_print = 0;
  if (__Pyx_SetVtable(__pyx_type_3epr_DSD.tp_dict, __pyx_vtabptr_3epr_DSD) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 378; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "DSD", (PyObject *)&__pyx_type_3epr_DSD) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 378; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_3epr_DSD = &__pyx_type_3epr_DSD;
  __pyx_vtabptr_3epr_Field = &__pyx_vtable_3epr_Field;
  __pyx_vtable_3epr_Field.check_closed_product = (PyObject *(*)(struct __pyx_obj_3epr_Field *))__pyx_f_3epr_5Field_check_closed_product;
  __pyx_vtable_3epr_Field._check_write_mode = (PyObject *(*)(struct __pyx_obj_3epr_Field *))__pyx_f_3epr_5Field__check_write_mode;
  __pyx_vtable_3epr_Field._get_offset = (long (*)(struct __pyx_obj_3epr_Field *, struct __pyx_opt_args_3epr_5Field__get_offset *__pyx_optional_args))__pyx_f_3epr_5Field__get_offset;
  __pyx_vtable_3epr_Field._set_elems = (PyObject *(*)(struct __pyx_obj_3epr_Field *, PyArrayObject *, struct __pyx_opt_args_3epr_5Field__set_elems *__pyx_optional_args))__pyx_f_3epr_5Field__set_elems;
  __pyx_type_3epr_Field.tp_base = __pyx_ptype_3epr_EprObject;
  if (PyType_Ready(&__pyx_type_3epr_Field) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 517; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_3epr_Field.tp_print = 0;
  if (__Pyx_SetVtable(__pyx_type_3epr_Field.tp_dict, __pyx_vtabptr_3epr_Field) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 517; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "Field", (PyObject *)&__pyx_type_3epr_Field) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 517; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_3epr_Field = &__pyx_type_3epr_Field;
  __pyx_vtabptr_3epr_Record = &__pyx_vtable_3epr_Record;
  __pyx_vtable_3epr_Record.check_closed_product = (PyObject *(*)(struct __pyx_obj_3epr_Record *))__pyx_f_3epr_6Record_check_closed_product;
  __pyx_vtable_3epr_Record._check_write_mode = (PyObject *(*)(struct __pyx_obj_3epr_Record *))__pyx_f_3epr_6Record__check_write_mode;
  __pyx_vtable_3epr_Record._get_offset = (uint (*)(struct __pyx_obj_3epr_Record *, struct __pyx_opt_args_3epr_6Record__get_offset *__pyx_optional_args))__pyx_f_3epr_6Record__get_offset;
  __pyx_type_3epr_Record.tp_base = __pyx_ptype_3epr_EprObject;
  if (PyType_Ready(&__pyx_type_3epr_Record) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_3epr_Record.tp_print = 0;
  if (__Pyx_SetVtable(__pyx_type_3epr_Record.tp_dict, __pyx_vtabptr_3epr_Record) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "Record", (PyObject *)&__pyx_type_3epr_Record) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_3epr_Record = &__pyx_type_3epr_Record;
  __pyx_vtabptr_3epr_Raster = &__pyx_vtable_3epr_Raster;
  __pyx_vtable_3epr_Raster.toarray = (PyArrayObject *(*)(struct __pyx_obj_3epr_Raster *))__pyx_f_3epr_6Raster_toarray;
  __pyx_type_3epr_Raster.tp_base = __pyx_ptype_3epr_EprObject;
  if (PyType_Ready(&__pyx_type_3epr_Raster) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1401; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_3epr_Raster.tp_print = 0;
  if (__Pyx_SetVtable(__pyx_type_3epr_Raster.tp_dict, __pyx_vtabptr_3epr_Raster) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1401; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "Raster", (PyObject *)&__pyx_type_3epr_Raster) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1401; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_3epr_Raster = &__pyx_type_3epr_Raster;
  __pyx_vtabptr_3epr_Band = &__pyx_vtable_3epr_Band;
  __pyx_vtable_3epr_Band.check_closed_product = (PyObject *(*)(struct __pyx_obj_3epr_Band *))__pyx_f_3epr_4Band_check_closed_product;
  __pyx_vtable_3epr_Band.read_raster = (PyObject *(*)(struct __pyx_obj_3epr_Band *, int __pyx_skip_dispatch, struct __pyx_opt_args_3epr_4Band_read_raster *__pyx_optional_args))__pyx_f_3epr_4Band_read_raster;
  __pyx_type_3epr_Band.tp_base = __pyx_ptype_3epr_EprObject;
  if (PyType_Ready(&__pyx_type_3epr_Band) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1673; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_3epr_Band.tp_print = 0;
  if (__Pyx_SetVtable(__pyx_type_3epr_Band.tp_dict, __pyx_vtabptr_3epr_Band) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1673; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "Band", (PyObject *)&__pyx_type_3epr_Band) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1673; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_3epr_Band = &__pyx_type_3epr_Band;
  __pyx_vtabptr_3epr_Dataset = &__pyx_vtable_3epr_Dataset;
  __pyx_vtable_3epr_Dataset.check_closed_product = (PyObject *(*)(struct __pyx_obj_3epr_Dataset *))__pyx_f_3epr_7Dataset_check_closed_product;
  __pyx_vtable_3epr_Dataset._check_write_mode = (PyObject *(*)(struct __pyx_obj_3epr_Dataset *))__pyx_f_3epr_7Dataset__check_write_mode;
  __pyx_vtable_3epr_Dataset._get_offset = (uint (*)(struct __pyx_obj_3epr_Dataset *))__pyx_f_3epr_7Dataset__get_offset;
  __pyx_type_3epr_Dataset.tp_base = __pyx_ptype_3epr_EprObject;
  if (PyType_Ready(&__pyx_type_3epr_Dataset) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_3epr_Dataset.tp_print = 0;
  if (__Pyx_SetVtable(__pyx_type_3epr_Dataset.tp_dict, __pyx_vtabptr_3epr_Dataset) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "Dataset", (PyObject *)&__pyx_type_3epr_Dataset) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_3epr_Dataset = &__pyx_type_3epr_Dataset;
  __pyx_vtabptr_3epr_Product = &__pyx_vtable_3epr_Product;
  __pyx_vtable_3epr_Product.check_closed_product = (PyObject *(*)(struct __pyx_obj_3epr_Product *))__pyx_f_3epr_7Product_check_closed_product;
  __pyx_vtable_3epr_Product._check_write_mode = (PyObject *(*)(struct __pyx_obj_3epr_Product *))__pyx_f_3epr_7Product__check_write_mode;
  __pyx_type_3epr_Product.tp_base = __pyx_ptype_3epr_EprObject;
  if (PyType_Ready(&__pyx_type_3epr_Product) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2367; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_3epr_Product.tp_print = 0;
  if (__Pyx_SetVtable(__pyx_type_3epr_Product.tp_dict, __pyx_vtabptr_3epr_Product) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2367; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "Product", (PyObject *)&__pyx_type_3epr_Product) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2367; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_3epr_Product = &__pyx_type_3epr_Product;
  if (PyType_Ready(&__pyx_type_3epr___pyx_scope_struct____iter__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1350; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_3epr___pyx_scope_struct____iter__.tp_print = 0;
  __pyx_ptype_3epr___pyx_scope_struct____iter__ = &__pyx_type_3epr___pyx_scope_struct____iter__;
  if (PyType_Ready(&__pyx_type_3epr___pyx_scope_struct_1_genexpr) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_3epr___pyx_scope_struct_1_genexpr.tp_print = 0;
  __pyx_ptype_3epr___pyx_scope_struct_1_genexpr = &__pyx_type_3epr___pyx_scope_struct_1_genexpr;
  if (PyType_Ready(&__pyx_type_3epr___pyx_scope_struct_2___iter__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2331; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_3epr___pyx_scope_struct_2___iter__.tp_print = 0;
  __pyx_ptype_3epr___pyx_scope_struct_2___iter__ = &__pyx_type_3epr___pyx_scope_struct_2___iter__;
  if (PyType_Ready(&__pyx_type_3epr___pyx_scope_struct_3_genexpr) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2334; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_3epr___pyx_scope_struct_3_genexpr.tp_print = 0;
  __pyx_ptype_3epr___pyx_scope_struct_3_genexpr = &__pyx_type_3epr___pyx_scope_struct_3_genexpr;
  /*--- Type import code ---*/
  __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "type", 
  #if CYTHON_COMPILING_IN_PYPY
  sizeof(PyTypeObject),
  #else
  sizeof(PyHeapTypeObject),
  #endif
  0); if (unlikely(!__pyx_ptype_7cpython_4type_type)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_5numpy_dtype = __Pyx_ImportType("numpy", "dtype", sizeof(PyArray_Descr), 0); if (unlikely(!__pyx_ptype_5numpy_dtype)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_5numpy_flatiter = __Pyx_ImportType("numpy", "flatiter", sizeof(PyArrayIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_flatiter)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_5numpy_broadcast = __Pyx_ImportType("numpy", "broadcast", sizeof(PyArrayMultiIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_broadcast)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_5numpy_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject), 0); if (unlikely(!__pyx_ptype_5numpy_ndarray)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_5numpy_ufunc = __Pyx_ImportType("numpy", "ufunc", sizeof(PyUFuncObject), 0); if (unlikely(!__pyx_ptype_5numpy_ufunc)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 861; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  /*--- Variable import code ---*/
  /*--- Function import code ---*/
  /*--- Execution code ---*/

  /* "epr.pyx":44
 * '''
 * 
 * __version__ = '0.9.1'             # <<<<<<<<<<<<<<
 * 
 * from libc cimport errno
 */
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_version, __pyx_kp_s_0_9_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "epr.pyx":68
 * 
 * cimport numpy as np
 * np.import_array()             # <<<<<<<<<<<<<<
 * 
 * import os
 */
  import_array();

  /* "epr.pyx":70
 * np.import_array()
 * 
 * import os             # <<<<<<<<<<<<<<
 * import sys
 * from collections import namedtuple
 */
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_os, 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_os, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "epr.pyx":71
 * 
 * import os
 * import sys             # <<<<<<<<<<<<<<
 * from collections import namedtuple
 * 
 */
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_sys, 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_sys, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "epr.pyx":72
 * import os
 * import sys
 * from collections import namedtuple             # <<<<<<<<<<<<<<
 * 
 * import numpy as np
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_namedtuple);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_namedtuple);
  __Pyx_GIVEREF(__pyx_n_s_namedtuple);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_collections, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_namedtuple); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_namedtuple, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "epr.pyx":74
 * from collections import namedtuple
 * 
 * import numpy as np             # <<<<<<<<<<<<<<
 * 
 * cdef bint PY3 = (PY_MAJOR_VERSION >= 3)
 */
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_numpy, 0, -1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_np, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "epr.pyx":76
 * import numpy as np
 * 
 * cdef bint PY3 = (PY_MAJOR_VERSION >= 3)             # <<<<<<<<<<<<<<
 * cdef bint SWAP_BYTES = (sys.byteorder == 'little')
 * 
 */
  __pyx_v_3epr_PY3 = (PY_MAJOR_VERSION >= 3);

  /* "epr.pyx":77
 * 
 * cdef bint PY3 = (PY_MAJOR_VERSION >= 3)
 * cdef bint SWAP_BYTES = (sys.byteorder == 'little')             # <<<<<<<<<<<<<<
 * 
 * # internal utils
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_sys); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_byteorder); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_n_s_little, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_3epr_SWAP_BYTES = __pyx_t_3;

  /* "epr.pyx":80
 * 
 * # internal utils
 * _DEFAULT_FS_ENCODING = sys.getfilesystemencoding()             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_sys); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_getfilesystemencoding); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_DEFAULT_FS_ENCODING, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "epr.pyx":98
 * 
 * # utils
 * EPRTime = namedtuple('EPRTime', ('days', 'seconds', 'microseconds'))             # <<<<<<<<<<<<<<
 * MJD = np.dtype([
 *     ('days', 'i%d' % sizeof(int)),
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_namedtuple); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__28, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_EPRTime, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "epr.pyx":100
 * EPRTime = namedtuple('EPRTime', ('days', 'seconds', 'microseconds'))
 * MJD = np.dtype([
 *     ('days', 'i%d' % sizeof(int)),             # <<<<<<<<<<<<<<
 *     ('seconds', 'u%d' % sizeof(uint)),
 *     ('microseconds', 'u%d' % sizeof(uint)),
 */
  __pyx_t_1 = __Pyx_PyInt_FromSize_t((sizeof(int))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_i_d, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_days);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_days);
  __Pyx_GIVEREF(__pyx_n_s_days);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;

  /* "epr.pyx":101
 * MJD = np.dtype([
 *     ('days', 'i%d' % sizeof(int)),
 *     ('seconds', 'u%d' % sizeof(uint)),             # <<<<<<<<<<<<<<
 *     ('microseconds', 'u%d' % sizeof(uint)),
 * ])
 */
  __pyx_t_2 = __Pyx_PyInt_FromSize_t((sizeof(unsigned int))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_u_d, __pyx_t_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_n_s_seconds);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_seconds);
  __Pyx_GIVEREF(__pyx_n_s_seconds);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  __pyx_t_4 = 0;

  /* "epr.pyx":102
 *     ('days', 'i%d' % sizeof(int)),
 *     ('seconds', 'u%d' % sizeof(uint)),
 *     ('microseconds', 'u%d' % sizeof(uint)),             # <<<<<<<<<<<<<<
 * ])
 * 
 */
  __pyx_t_4 = __Pyx_PyInt_FromSize_t((sizeof(unsigned int))); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyString_Format(__pyx_kp_s_u_d, __pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF(__pyx_n_s_microseconds);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_n_s_microseconds);
  __Pyx_GIVEREF(__pyx_n_s_microseconds);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_5);
  __pyx_t_5 = 0;

  /* "epr.pyx":99
 * # utils
 * EPRTime = namedtuple('EPRTime', ('days', 'seconds', 'microseconds'))
 * MJD = np.dtype([             # <<<<<<<<<<<<<<
 *     ('days', 'i%d' % sizeof(int)),
 *     ('seconds', 'u%d' % sizeof(uint)),
 */
  __pyx_t_5 = PyList_New(3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  PyList_SET_ITEM(__pyx_t_5, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  PyList_SET_ITEM(__pyx_t_5, 1, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  PyList_SET_ITEM(__pyx_t_5, 2, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_t_4 = 0;
  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_5);
  __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5numpy_dtype)), __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_MJD, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "epr.pyx":105
 * ])
 * 
 * EPR_C_API_VERSION = _to_str(EPR_PRODUCT_API_VERSION_STR, 'ascii')             # <<<<<<<<<<<<<<
 * 
 * # EPR_DataTypeId
 */
  __pyx_t_5 = __Pyx_PyBytes_FromString(EPR_PRODUCT_API_VERSION_STR); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6.__pyx_n = 1;
  __pyx_t_6.encoding = __pyx_n_s_ascii;
  __pyx_t_4 = __pyx_f_3epr__to_str(__pyx_t_5, &__pyx_t_6); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_EPR_C_API_VERSION, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "epr.pyx":108
 * 
 * # EPR_DataTypeId
 * E_TID_UNKNOWN = e_tid_unknown             # <<<<<<<<<<<<<<
 * E_TID_UCHAR = e_tid_uchar
 * E_TID_CHAR = e_tid_char
 */
  __pyx_t_4 = PyInt_FromLong(e_tid_unknown); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_E_TID_UNKNOWN, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "epr.pyx":109
 * # EPR_DataTypeId
 * E_TID_UNKNOWN = e_tid_unknown
 * E_TID_UCHAR = e_tid_uchar             # <<<<<<<<<<<<<<
 * E_TID_CHAR = e_tid_char
 * E_TID_USHORT = e_tid_ushort
 */
  __pyx_t_4 = PyInt_FromLong(e_tid_uchar); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_E_TID_UCHAR, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "epr.pyx":110
 * E_TID_UNKNOWN = e_tid_unknown
 * E_TID_UCHAR = e_tid_uchar
 * E_TID_CHAR = e_tid_char             # <<<<<<<<<<<<<<
 * E_TID_USHORT = e_tid_ushort
 * E_TID_SHORT = e_tid_short
 */
  __pyx_t_4 = PyInt_FromLong(e_tid_char); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_E_TID_CHAR, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "epr.pyx":111
 * E_TID_UCHAR = e_tid_uchar
 * E_TID_CHAR = e_tid_char
 * E_TID_USHORT = e_tid_ushort             # <<<<<<<<<<<<<<
 * E_TID_SHORT = e_tid_short
 * E_TID_UINT = e_tid_uint
 */
  __pyx_t_4 = PyInt_FromLong(e_tid_ushort); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_E_TID_USHORT, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "epr.pyx":112
 * E_TID_CHAR = e_tid_char
 * E_TID_USHORT = e_tid_ushort
 * E_TID_SHORT = e_tid_short             # <<<<<<<<<<<<<<
 * E_TID_UINT = e_tid_uint
 * E_TID_INT = e_tid_int
 */
  __pyx_t_4 = PyInt_FromLong(e_tid_short); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_E_TID_SHORT, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "epr.pyx":113
 * E_TID_USHORT = e_tid_ushort
 * E_TID_SHORT = e_tid_short
 * E_TID_UINT = e_tid_uint             # <<<<<<<<<<<<<<
 * E_TID_INT = e_tid_int
 * E_TID_FLOAT = e_tid_float
 */
  __pyx_t_4 = PyInt_FromLong(e_tid_uint); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_E_TID_UINT, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "epr.pyx":114
 * E_TID_SHORT = e_tid_short
 * E_TID_UINT = e_tid_uint
 * E_TID_INT = e_tid_int             # <<<<<<<<<<<<<<
 * E_TID_FLOAT = e_tid_float
 * E_TID_DOUBLE = e_tid_double
 */
  __pyx_t_4 = PyInt_FromLong(e_tid_int); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_E_TID_INT, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "epr.pyx":115
 * E_TID_UINT = e_tid_uint
 * E_TID_INT = e_tid_int
 * E_TID_FLOAT = e_tid_float             # <<<<<<<<<<<<<<
 * E_TID_DOUBLE = e_tid_double
 * E_TID_STRING = e_tid_string
 */
  __pyx_t_4 = PyInt_FromLong(e_tid_float); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_E_TID_FLOAT, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "epr.pyx":116
 * E_TID_INT = e_tid_int
 * E_TID_FLOAT = e_tid_float
 * E_TID_DOUBLE = e_tid_double             # <<<<<<<<<<<<<<
 * E_TID_STRING = e_tid_string
 * E_TID_SPARE = e_tid_spare
 */
  __pyx_t_4 = PyInt_FromLong(e_tid_double); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_E_TID_DOUBLE, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "epr.pyx":117
 * E_TID_FLOAT = e_tid_float
 * E_TID_DOUBLE = e_tid_double
 * E_TID_STRING = e_tid_string             # <<<<<<<<<<<<<<
 * E_TID_SPARE = e_tid_spare
 * E_TID_TIME = e_tid_time
 */
  __pyx_t_4 = PyInt_FromLong(e_tid_string); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_E_TID_STRING, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "epr.pyx":118
 * E_TID_DOUBLE = e_tid_double
 * E_TID_STRING = e_tid_string
 * E_TID_SPARE = e_tid_spare             # <<<<<<<<<<<<<<
 * E_TID_TIME = e_tid_time
 * 
 */
  __pyx_t_4 = PyInt_FromLong(e_tid_spare); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_E_TID_SPARE, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "epr.pyx":119
 * E_TID_STRING = e_tid_string
 * E_TID_SPARE = e_tid_spare
 * E_TID_TIME = e_tid_time             # <<<<<<<<<<<<<<
 * 
 * # EPR_SampleModel
 */
  __pyx_t_4 = PyInt_FromLong(e_tid_time); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_E_TID_TIME, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "epr.pyx":122
 * 
 * # EPR_SampleModel
 * E_SMOD_1OF1 = e_smod_1OF1             # <<<<<<<<<<<<<<
 * E_SMOD_1OF2 = e_smod_1OF2
 * E_SMOD_2OF2 = e_smod_2OF2
 */
  __pyx_t_4 = PyInt_FromLong(e_smod_1OF1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_E_SMOD_1OF1, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "epr.pyx":123
 * # EPR_SampleModel
 * E_SMOD_1OF1 = e_smod_1OF1
 * E_SMOD_1OF2 = e_smod_1OF2             # <<<<<<<<<<<<<<
 * E_SMOD_2OF2 = e_smod_2OF2
 * E_SMOD_3TOI = e_smod_3TOI
 */
  __pyx_t_4 = PyInt_FromLong(e_smod_1OF2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_E_SMOD_1OF2, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "epr.pyx":124
 * E_SMOD_1OF1 = e_smod_1OF1
 * E_SMOD_1OF2 = e_smod_1OF2
 * E_SMOD_2OF2 = e_smod_2OF2             # <<<<<<<<<<<<<<
 * E_SMOD_3TOI = e_smod_3TOI
 * E_SMOD_2TOF = e_smod_2TOF
 */
  __pyx_t_4 = PyInt_FromLong(e_smod_2OF2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_E_SMOD_2OF2, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "epr.pyx":125
 * E_SMOD_1OF2 = e_smod_1OF2
 * E_SMOD_2OF2 = e_smod_2OF2
 * E_SMOD_3TOI = e_smod_3TOI             # <<<<<<<<<<<<<<
 * E_SMOD_2TOF = e_smod_2TOF
 * 
 */
  __pyx_t_4 = PyInt_FromLong(e_smod_3TOI); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_E_SMOD_3TOI, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "epr.pyx":126
 * E_SMOD_2OF2 = e_smod_2OF2
 * E_SMOD_3TOI = e_smod_3TOI
 * E_SMOD_2TOF = e_smod_2TOF             # <<<<<<<<<<<<<<
 * 
 * # EPR_ScalingMethod
 */
  __pyx_t_4 = PyInt_FromLong(e_smod_2TOF); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_E_SMOD_2TOF, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "epr.pyx":129
 * 
 * # EPR_ScalingMethod
 * E_SMID_NON = e_smid_non             # <<<<<<<<<<<<<<
 * E_SMID_LIN = e_smid_lin
 * E_SMID_LOG = e_smid_log
 */
  __pyx_t_4 = PyInt_FromLong(e_smid_non); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_E_SMID_NON, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "epr.pyx":130
 * # EPR_ScalingMethod
 * E_SMID_NON = e_smid_non
 * E_SMID_LIN = e_smid_lin             # <<<<<<<<<<<<<<
 * E_SMID_LOG = e_smid_log
 * 
 */
  __pyx_t_4 = PyInt_FromLong(e_smid_lin); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_E_SMID_LIN, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "epr.pyx":131
 * E_SMID_NON = e_smid_non
 * E_SMID_LIN = e_smid_lin
 * E_SMID_LOG = e_smid_log             # <<<<<<<<<<<<<<
 * 
 * # EPR magic IDs
 */
  __pyx_t_4 = PyInt_FromLong(e_smid_log); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_E_SMID_LOG, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "epr.pyx":134
 * 
 * # EPR magic IDs
 * _EPR_MAGIC_PRODUCT_ID = EPR_MAGIC_PRODUCT_ID             # <<<<<<<<<<<<<<
 * _EPR_MAGIC_DATASET_ID = EPR_MAGIC_DATASET_ID
 * _EPR_MAGIC_BAND_ID = EPR_MAGIC_BAND_ID
 */
  __pyx_t_4 = __Pyx_PyInt_From_int(EPR_MAGIC_PRODUCT_ID); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_EPR_MAGIC_PRODUCT_ID, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "epr.pyx":135
 * # EPR magic IDs
 * _EPR_MAGIC_PRODUCT_ID = EPR_MAGIC_PRODUCT_ID
 * _EPR_MAGIC_DATASET_ID = EPR_MAGIC_DATASET_ID             # <<<<<<<<<<<<<<
 * _EPR_MAGIC_BAND_ID = EPR_MAGIC_BAND_ID
 * _EPR_MAGIC_RECORD = EPR_MAGIC_RECORD
 */
  __pyx_t_4 = __Pyx_PyInt_From_int(EPR_MAGIC_DATASET_ID); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_EPR_MAGIC_DATASET_ID, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "epr.pyx":136
 * _EPR_MAGIC_PRODUCT_ID = EPR_MAGIC_PRODUCT_ID
 * _EPR_MAGIC_DATASET_ID = EPR_MAGIC_DATASET_ID
 * _EPR_MAGIC_BAND_ID = EPR_MAGIC_BAND_ID             # <<<<<<<<<<<<<<
 * _EPR_MAGIC_RECORD = EPR_MAGIC_RECORD
 * _EPR_MAGIC_FIELD = EPR_MAGIC_FIELD
 */
  __pyx_t_4 = __Pyx_PyInt_From_int(EPR_MAGIC_BAND_ID); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_EPR_MAGIC_BAND_ID, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "epr.pyx":137
 * _EPR_MAGIC_DATASET_ID = EPR_MAGIC_DATASET_ID
 * _EPR_MAGIC_BAND_ID = EPR_MAGIC_BAND_ID
 * _EPR_MAGIC_RECORD = EPR_MAGIC_RECORD             # <<<<<<<<<<<<<<
 * _EPR_MAGIC_FIELD = EPR_MAGIC_FIELD
 * _EPR_MAGIC_RASTER = EPR_MAGIC_RASTER
 */
  __pyx_t_4 = __Pyx_PyInt_From_int(EPR_MAGIC_RECORD); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_EPR_MAGIC_RECORD, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "epr.pyx":138
 * _EPR_MAGIC_BAND_ID = EPR_MAGIC_BAND_ID
 * _EPR_MAGIC_RECORD = EPR_MAGIC_RECORD
 * _EPR_MAGIC_FIELD = EPR_MAGIC_FIELD             # <<<<<<<<<<<<<<
 * _EPR_MAGIC_RASTER = EPR_MAGIC_RASTER
 * _EPR_MAGIC_FLAG_DEF = EPR_MAGIC_FLAG_DEF
 */
  __pyx_t_4 = __Pyx_PyInt_From_int(EPR_MAGIC_FIELD); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_EPR_MAGIC_FIELD, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "epr.pyx":139
 * _EPR_MAGIC_RECORD = EPR_MAGIC_RECORD
 * _EPR_MAGIC_FIELD = EPR_MAGIC_FIELD
 * _EPR_MAGIC_RASTER = EPR_MAGIC_RASTER             # <<<<<<<<<<<<<<
 * _EPR_MAGIC_FLAG_DEF = EPR_MAGIC_FLAG_DEF
 * 
 */
  __pyx_t_4 = __Pyx_PyInt_From_int(EPR_MAGIC_RASTER); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_EPR_MAGIC_RASTER, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "epr.pyx":140
 * _EPR_MAGIC_FIELD = EPR_MAGIC_FIELD
 * _EPR_MAGIC_RASTER = EPR_MAGIC_RASTER
 * _EPR_MAGIC_FLAG_DEF = EPR_MAGIC_FLAG_DEF             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_4 = __Pyx_PyInt_From_int(EPR_MAGIC_FLAG_DEF); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_EPR_MAGIC_FLAG_DEF, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "epr.pyx":166
 * 
 * 
 * _DTYPE_MAP = {             # <<<<<<<<<<<<<<
 *     E_TID_UCHAR:   np.uint8,
 *     E_TID_CHAR:    np.int8,
 */
  __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);

  /* "epr.pyx":167
 * 
 * _DTYPE_MAP = {
 *     E_TID_UCHAR:   np.uint8,             # <<<<<<<<<<<<<<
 *     E_TID_CHAR:    np.int8,
 *     E_TID_USHORT:  np.uint16,
 */
  __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_E_TID_UCHAR); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_uint8); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem(__pyx_t_4, __pyx_t_5, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "epr.pyx":168
 * _DTYPE_MAP = {
 *     E_TID_UCHAR:   np.uint8,
 *     E_TID_CHAR:    np.int8,             # <<<<<<<<<<<<<<
 *     E_TID_USHORT:  np.uint16,
 *     E_TID_SHORT:   np.int16,
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_E_TID_CHAR); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_int8); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (PyDict_SetItem(__pyx_t_4, __pyx_t_1, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "epr.pyx":169
 *     E_TID_UCHAR:   np.uint8,
 *     E_TID_CHAR:    np.int8,
 *     E_TID_USHORT:  np.uint16,             # <<<<<<<<<<<<<<
 *     E_TID_SHORT:   np.int16,
 *     E_TID_UINT:    np.uint32,
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_E_TID_USHORT); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_uint16); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (PyDict_SetItem(__pyx_t_4, __pyx_t_2, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "epr.pyx":170
 *     E_TID_CHAR:    np.int8,
 *     E_TID_USHORT:  np.uint16,
 *     E_TID_SHORT:   np.int16,             # <<<<<<<<<<<<<<
 *     E_TID_UINT:    np.uint32,
 *     E_TID_INT:     np.int32,
 */
  __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_E_TID_SHORT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_int16); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem(__pyx_t_4, __pyx_t_5, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "epr.pyx":171
 *     E_TID_USHORT:  np.uint16,
 *     E_TID_SHORT:   np.int16,
 *     E_TID_UINT:    np.uint32,             # <<<<<<<<<<<<<<
 *     E_TID_INT:     np.int32,
 *     E_TID_FLOAT:   np.float32,
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_E_TID_UINT); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_uint32); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (PyDict_SetItem(__pyx_t_4, __pyx_t_1, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "epr.pyx":172
 *     E_TID_SHORT:   np.int16,
 *     E_TID_UINT:    np.uint32,
 *     E_TID_INT:     np.int32,             # <<<<<<<<<<<<<<
 *     E_TID_FLOAT:   np.float32,
 *     E_TID_DOUBLE:  np.float64,
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_E_TID_INT); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_int32); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (PyDict_SetItem(__pyx_t_4, __pyx_t_2, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "epr.pyx":173
 *     E_TID_UINT:    np.uint32,
 *     E_TID_INT:     np.int32,
 *     E_TID_FLOAT:   np.float32,             # <<<<<<<<<<<<<<
 *     E_TID_DOUBLE:  np.float64,
 *     E_TID_STRING:  np.bytes_,
 */
  __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_E_TID_FLOAT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_float32); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem(__pyx_t_4, __pyx_t_5, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "epr.pyx":174
 *     E_TID_INT:     np.int32,
 *     E_TID_FLOAT:   np.float32,
 *     E_TID_DOUBLE:  np.float64,             # <<<<<<<<<<<<<<
 *     E_TID_STRING:  np.bytes_,
 *     E_TID_TIME:    MJD,
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_E_TID_DOUBLE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_float64); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (PyDict_SetItem(__pyx_t_4, __pyx_t_1, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "epr.pyx":175
 *     E_TID_FLOAT:   np.float32,
 *     E_TID_DOUBLE:  np.float64,
 *     E_TID_STRING:  np.bytes_,             # <<<<<<<<<<<<<<
 *     E_TID_TIME:    MJD,
 *     E_TID_SPARE:   None,
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_E_TID_STRING); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_bytes); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (PyDict_SetItem(__pyx_t_4, __pyx_t_2, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "epr.pyx":176
 *     E_TID_DOUBLE:  np.float64,
 *     E_TID_STRING:  np.bytes_,
 *     E_TID_TIME:    MJD,             # <<<<<<<<<<<<<<
 *     E_TID_SPARE:   None,
 *     E_TID_UNKNOWN: None,
 */
  __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_E_TID_TIME); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_MJD); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_4, __pyx_t_5, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "epr.pyx":177
 *     E_TID_STRING:  np.bytes_,
 *     E_TID_TIME:    MJD,
 *     E_TID_SPARE:   None,             # <<<<<<<<<<<<<<
 *     E_TID_UNKNOWN: None,
 * }
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_E_TID_SPARE); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_4, __pyx_t_2, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "epr.pyx":178
 *     E_TID_TIME:    MJD,
 *     E_TID_SPARE:   None,
 *     E_TID_UNKNOWN: None,             # <<<<<<<<<<<<<<
 * }
 * 
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_E_TID_UNKNOWN); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_4, __pyx_t_2, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_DTYPE_MAP, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "epr.pyx":182
 * 
 * 
 * _METHOD_MAP = {             # <<<<<<<<<<<<<<
 *     E_SMID_NON: 'NONE',
 *     E_SMID_LIN: 'LIN',
 */
  __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);

  /* "epr.pyx":183
 * 
 * _METHOD_MAP = {
 *     E_SMID_NON: 'NONE',             # <<<<<<<<<<<<<<
 *     E_SMID_LIN: 'LIN',
 *     E_SMID_LOG: 'LOG',
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_E_SMID_NON); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_4, __pyx_t_2, __pyx_n_s_NONE) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "epr.pyx":184
 * _METHOD_MAP = {
 *     E_SMID_NON: 'NONE',
 *     E_SMID_LIN: 'LIN',             # <<<<<<<<<<<<<<
 *     E_SMID_LOG: 'LOG',
 * }
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_E_SMID_LIN); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_4, __pyx_t_2, __pyx_n_s_LIN) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "epr.pyx":185
 *     E_SMID_NON: 'NONE',
 *     E_SMID_LIN: 'LIN',
 *     E_SMID_LOG: 'LOG',             # <<<<<<<<<<<<<<
 * }
 * 
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_E_SMID_LOG); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_4, __pyx_t_2, __pyx_n_s_LOG) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_METHOD_MAP, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "epr.pyx":189
 * 
 * 
 * _MODEL_MAP = {             # <<<<<<<<<<<<<<
 *     E_SMOD_1OF1: '1OF1',
 *     E_SMOD_1OF2: '1OF2',
 */
  __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);

  /* "epr.pyx":190
 * 
 * _MODEL_MAP = {
 *     E_SMOD_1OF1: '1OF1',             # <<<<<<<<<<<<<<
 *     E_SMOD_1OF2: '1OF2',
 *     E_SMOD_2OF2: '2OF2',
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_E_SMOD_1OF1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_4, __pyx_t_2, __pyx_kp_s_1OF1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "epr.pyx":191
 * _MODEL_MAP = {
 *     E_SMOD_1OF1: '1OF1',
 *     E_SMOD_1OF2: '1OF2',             # <<<<<<<<<<<<<<
 *     E_SMOD_2OF2: '2OF2',
 *     E_SMOD_3TOI: '3TOI',
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_E_SMOD_1OF2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_4, __pyx_t_2, __pyx_kp_s_1OF2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "epr.pyx":192
 *     E_SMOD_1OF1: '1OF1',
 *     E_SMOD_1OF2: '1OF2',
 *     E_SMOD_2OF2: '2OF2',             # <<<<<<<<<<<<<<
 *     E_SMOD_3TOI: '3TOI',
 *     E_SMOD_2TOF: '2TOF',
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_E_SMOD_2OF2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_4, __pyx_t_2, __pyx_kp_s_2OF2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "epr.pyx":193
 *     E_SMOD_1OF2: '1OF2',
 *     E_SMOD_2OF2: '2OF2',
 *     E_SMOD_3TOI: '3TOI',             # <<<<<<<<<<<<<<
 *     E_SMOD_2TOF: '2TOF',
 * }
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_E_SMOD_3TOI); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_4, __pyx_t_2, __pyx_kp_s_3TOI) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "epr.pyx":194
 *     E_SMOD_2OF2: '2OF2',
 *     E_SMOD_3TOI: '3TOI',
 *     E_SMOD_2TOF: '2TOF',             # <<<<<<<<<<<<<<
 * }
 * 
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_E_SMOD_2TOF); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_4, __pyx_t_2, __pyx_kp_s_2TOF) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_MODEL_MAP, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "epr.pyx":198
 * 
 * 
 * class EPRError(Exception):             # <<<<<<<<<<<<<<
 *     '''EPR API error'''
 * 
 */
  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF(__pyx_builtin_Exception);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_builtin_Exception);
  __Pyx_GIVEREF(__pyx_builtin_Exception);
  __pyx_t_2 = __Pyx_CalculateMetaclass(NULL, __pyx_t_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = __Pyx_Py3MetaclassPrepare(__pyx_t_2, __pyx_t_4, __pyx_n_s_EPRError, __pyx_n_s_EPRError, (PyObject *) NULL, __pyx_n_s_epr, __pyx_kp_s_EPR_API_error); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);

  /* "epr.pyx":201
 *     '''EPR API error'''
 * 
 *     def __init__(self, message='', code=None, *args, **kargs):             # <<<<<<<<<<<<<<
 *         '''__init__(self, message='', code=None, *args, **kargs)'''
 * 
 */
  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_3epr_8EPRError_1__init__, 0, __pyx_n_s_EPRError___init, NULL, __pyx_n_s_epr, PyModule_GetDict(__pyx_m), ((PyObject *)__pyx_codeobj__30)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_1, __pyx_tuple__31);
  if (PyObject_SetItem(__pyx_t_5, __pyx_n_s_init, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "epr.pyx":198
 * 
 * 
 * class EPRError(Exception):             # <<<<<<<<<<<<<<
 *     '''EPR API error'''
 * 
 */
  __pyx_t_1 = __Pyx_Py3ClassCreate(__pyx_t_2, __pyx_n_s_EPRError, __pyx_t_4, __pyx_t_5, NULL, 0, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_EPRError, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "epr.pyx":210
 * 
 * 
 * class EPRValueError(EPRError, ValueError):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */
  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_EPRError); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  __Pyx_INCREF(__pyx_builtin_ValueError);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_builtin_ValueError);
  __Pyx_GIVEREF(__pyx_builtin_ValueError);
  __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_CalculateMetaclass(NULL, __pyx_t_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_Py3MetaclassPrepare(__pyx_t_4, __pyx_t_2, __pyx_n_s_EPRValueError, __pyx_n_s_EPRValueError, (PyObject *) NULL, __pyx_n_s_epr, (PyObject *) NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_1 = __Pyx_Py3ClassCreate(__pyx_t_4, __pyx_n_s_EPRValueError, __pyx_t_2, __pyx_t_5, NULL, 0, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_EPRValueError, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "epr.pyx":300
 * 
 * # global _CLib instance
 * cdef _CLib _EPR_C_LIB = None             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_INCREF(Py_None);
  __Pyx_XGOTREF(((PyObject *)__pyx_v_3epr__EPR_C_LIB));
  __Pyx_DECREF_SET(__pyx_v_3epr__EPR_C_LIB, ((struct __pyx_obj_3epr__CLib *)Py_None));
  __Pyx_GIVEREF(Py_None);

  /* "epr.pyx":1588
 * 
 * 
 * def create_raster(EPR_EDataTypeId data_type, uint src_width, uint src_height,             # <<<<<<<<<<<<<<
 *                   uint xstep=1, uint ystep=1):
 *     '''create_raster(data_type, src_width, src_height, xstep=1, ystep=1)
 */
  __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_3epr_11create_raster, NULL, __pyx_n_s_epr); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1588; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_create_raster, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1588; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "epr.pyx":1633
 * 
 * 
 * def create_bitmask_raster(uint src_width, uint src_height,             # <<<<<<<<<<<<<<
 *                           uint xstep=1, uint ystep=1):
 *     '''create_bitmask_raster(src_width, src_height, xstep=1, ystep=1)
 */
  __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_3epr_13create_bitmask_raster, NULL, __pyx_n_s_epr); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1633; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_create_bitmask_raster, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1633; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "epr.pyx":2894
 * 
 * 
 * def open(filename, mode='rb'):             # <<<<<<<<<<<<<<
 *     '''open(filename)
 * 
 */
  __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_3epr_15open, NULL, __pyx_n_s_epr); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2894; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_open, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2894; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "epr.pyx":2922
 * 
 * # library initialization/finalization
 * _EPR_C_LIB = _CLib.__new__(_CLib)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_2 = __pyx_tp_new_3epr__CLib(((PyTypeObject *)((PyObject*)__pyx_ptype_3epr__CLib)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2922; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (!(likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_3epr__CLib)))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2922; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_XGOTREF(((PyObject *)__pyx_v_3epr__EPR_C_LIB));
  __Pyx_DECREF_SET(__pyx_v_3epr__EPR_C_LIB, ((struct __pyx_obj_3epr__CLib *)__pyx_t_2));
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;

  /* "epr.pyx":2925
 * 
 * 
 * import atexit             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_atexit, 0, -1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2925; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_atexit, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2925; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "epr.pyx":2928
 * 
 * 
 * @atexit.register             # <<<<<<<<<<<<<<
 * def _close_api():
 *     # ensure that all EprObject(s) are collected before removing the last
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_atexit); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2928; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_register); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2928; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "epr.pyx":2929
 * 
 * @atexit.register
 * def _close_api():             # <<<<<<<<<<<<<<
 *     # ensure that all EprObject(s) are collected before removing the last
 *     # reference to _EPR_C_LIB
 */
  __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_3epr_17_close_api, NULL, __pyx_n_s_epr); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2929; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);

  /* "epr.pyx":2928
 * 
 * 
 * @atexit.register             # <<<<<<<<<<<<<<
 * def _close_api():
 *     # ensure that all EprObject(s) are collected before removing the last
 */
  __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2928; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2928; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_close_api, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2929; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "epr.pyx":2940
 * 
 * # clean namespace
 * del atexit, namedtuple             # <<<<<<<<<<<<<<
 */
  if (__Pyx_PyObject_DelAttrStr(__pyx_m, __pyx_n_s_atexit) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2940; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_PyObject_DelAttrStr(__pyx_m, __pyx_n_s_namedtuple) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2940; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "epr.pyx":1
 * # -*- coding: utf-8 -*-             # <<<<<<<<<<<<<<
 * 
 * # PyEPR - Python bindings for ENVISAT Product Reader API
 */
  __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "/usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":976
 *      arr.base = baseptr
 * 
 * cdef inline object get_array_base(ndarray arr):             # <<<<<<<<<<<<<<
 *     if arr.base is NULL:
 *         return None
 */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  if (__pyx_m) {
    __Pyx_AddTraceback("init epr", __pyx_clineno, __pyx_lineno, __pyx_filename);
    Py_DECREF(__pyx_m); __pyx_m = 0;
  } else if (!PyErr_Occurred()) {
    PyErr_SetString(PyExc_ImportError, "init epr");
  }
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  #if PY_MAJOR_VERSION < 3
  return;
  #else
  return __pyx_m;
  #endif
}

/* Runtime support code */
#if CYTHON_REFNANNY
static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
    PyObject *m = NULL, *p = NULL;
    void *r = NULL;
    m = PyImport_ImportModule((char *)modname);
    if (!m) goto end;
    p = PyObject_GetAttrString(m, (char *)"RefNannyAPI");
    if (!p) goto end;
    r = PyLong_AsVoidPtr(p);
end:
    Py_XDECREF(p);
    Py_XDECREF(m);
    return (__Pyx_RefNannyAPIStruct *)r;
}
#endif /* CYTHON_REFNANNY */

static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
    PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
    if (unlikely(!result)) {
        PyErr_Format(PyExc_NameError,
#if PY_MAJOR_VERSION >= 3
            "name '%U' is not defined", name);
#else
            "name '%.200s' is not defined", PyString_AS_STRING(name));
#endif
    }
    return result;
}

#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
    PyObject *result;
    ternaryfunc call = func->ob_type->tp_call;
    if (unlikely(!call))
        return PyObject_Call(func, arg, kw);
#if PY_VERSION_HEX >= 0x02060000
    if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
        return NULL;
#endif
    result = (*call)(func, arg, kw);
#if PY_VERSION_HEX >= 0x02060000
    Py_LeaveRecursiveCall();
#endif
    if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
        PyErr_SetString(
            PyExc_SystemError,
            "NULL result without error in PyObject_Call");
    }
    return result;
}
#endif

static void __Pyx_RaiseDoubleKeywordsError(
    const char* func_name,
    PyObject* kw_name)
{
    PyErr_Format(PyExc_TypeError,
        #if PY_MAJOR_VERSION >= 3
        "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
        #else
        "%s() got multiple values for keyword argument '%s'", func_name,
        PyString_AsString(kw_name));
        #endif
}

static int __Pyx_ParseOptionalKeywords(
    PyObject *kwds,
    PyObject **argnames[],
    PyObject *kwds2,
    PyObject *values[],
    Py_ssize_t num_pos_args,
    const char* function_name)
{
    PyObject *key = 0, *value = 0;
    Py_ssize_t pos = 0;
    PyObject*** name;
    PyObject*** first_kw_arg = argnames + num_pos_args;
    while (PyDict_Next(kwds, &pos, &key, &value)) {
        name = first_kw_arg;
        while (*name && (**name != key)) name++;
        if (*name) {
            values[name-argnames] = value;
            continue;
        }
        name = first_kw_arg;
        #if PY_MAJOR_VERSION < 3
        if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) {
            while (*name) {
                if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
                        && _PyString_Eq(**name, key)) {
                    values[name-argnames] = value;
                    break;
                }
                name++;
            }
            if (*name) continue;
            else {
                PyObject*** argname = argnames;
                while (argname != first_kw_arg) {
                    if ((**argname == key) || (
                            (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
                             && _PyString_Eq(**argname, key))) {
                        goto arg_passed_twice;
                    }
                    argname++;
                }
            }
        } else
        #endif
        if (likely(PyUnicode_Check(key))) {
            while (*name) {
                int cmp = (**name == key) ? 0 :
                #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
                    (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 :
                #endif
                    PyUnicode_Compare(**name, key);
                if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
                if (cmp == 0) {
                    values[name-argnames] = value;
                    break;
                }
                name++;
            }
            if (*name) continue;
            else {
                PyObject*** argname = argnames;
                while (argname != first_kw_arg) {
                    int cmp = (**argname == key) ? 0 :
                    #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
                        (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
                    #endif
                        PyUnicode_Compare(**argname, key);
                    if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
                    if (cmp == 0) goto arg_passed_twice;
                    argname++;
                }
            }
        } else
            goto invalid_keyword_type;
        if (kwds2) {
            if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
        } else {
            goto invalid_keyword;
        }
    }
    return 0;
arg_passed_twice:
    __Pyx_RaiseDoubleKeywordsError(function_name, key);
    goto bad;
invalid_keyword_type:
    PyErr_Format(PyExc_TypeError,
        "%.200s() keywords must be strings", function_name);
    goto bad;
invalid_keyword:
    PyErr_Format(PyExc_TypeError,
    #if PY_MAJOR_VERSION < 3
        "%.200s() got an unexpected keyword argument '%.200s'",
        function_name, PyString_AsString(key));
    #else
        "%s() got an unexpected keyword argument '%U'",
        function_name, key);
    #endif
bad:
    return -1;
}

static void __Pyx_RaiseArgtupleInvalid(
    const char* func_name,
    int exact,
    Py_ssize_t num_min,
    Py_ssize_t num_max,
    Py_ssize_t num_found)
{
    Py_ssize_t num_expected;
    const char *more_or_less;
    if (num_found < num_min) {
        num_expected = num_min;
        more_or_less = "at least";
    } else {
        num_expected = num_max;
        more_or_less = "at most";
    }
    if (exact) {
        more_or_less = "exactly";
    }
    PyErr_Format(PyExc_TypeError,
                 "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)",
                 func_name, more_or_less, num_expected,
                 (num_expected == 1) ? "" : "s", num_found);
}

static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name) {
    PyObject *result;
#if CYTHON_COMPILING_IN_CPYTHON
    result = PyDict_GetItem(__pyx_d, name);
    if (result) {
        Py_INCREF(result);
    } else {
#else
    result = PyObject_GetItem(__pyx_d, name);
    if (!result) {
        PyErr_Clear();
#endif
        result = __Pyx_GetBuiltinName(name);
    }
    return result;
}

static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) {
#if CYTHON_COMPILING_IN_CPYTHON
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    PyThreadState *tstate = PyThreadState_GET();
    tmp_type = tstate->curexc_type;
    tmp_value = tstate->curexc_value;
    tmp_tb = tstate->curexc_traceback;
    tstate->curexc_type = type;
    tstate->curexc_value = value;
    tstate->curexc_traceback = tb;
    Py_XDECREF(tmp_type);
    Py_XDECREF(tmp_value);
    Py_XDECREF(tmp_tb);
#else
    PyErr_Restore(type, value, tb);
#endif
}
static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) {
#if CYTHON_COMPILING_IN_CPYTHON
    PyThreadState *tstate = PyThreadState_GET();
    *type = tstate->curexc_type;
    *value = tstate->curexc_value;
    *tb = tstate->curexc_traceback;
    tstate->curexc_type = 0;
    tstate->curexc_value = 0;
    tstate->curexc_traceback = 0;
#else
    PyErr_Fetch(type, value, tb);
#endif
}

#if PY_MAJOR_VERSION < 3
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
                        CYTHON_UNUSED PyObject *cause) {
    Py_XINCREF(type);
    if (!value || value == Py_None)
        value = NULL;
    else
        Py_INCREF(value);
    if (!tb || tb == Py_None)
        tb = NULL;
    else {
        Py_INCREF(tb);
        if (!PyTraceBack_Check(tb)) {
            PyErr_SetString(PyExc_TypeError,
                "raise: arg 3 must be a traceback or None");
            goto raise_error;
        }
    }
    #if PY_VERSION_HEX < 0x02050000
    if (PyClass_Check(type)) {
    #else
    if (PyType_Check(type)) {
    #endif
#if CYTHON_COMPILING_IN_PYPY
        if (!value) {
            Py_INCREF(Py_None);
            value = Py_None;
        }
#endif
        PyErr_NormalizeException(&type, &value, &tb);
    } else {
        if (value) {
            PyErr_SetString(PyExc_TypeError,
                "instance exception may not have a separate value");
            goto raise_error;
        }
        value = type;
        #if PY_VERSION_HEX < 0x02050000
        if (PyInstance_Check(type)) {
            type = (PyObject*) ((PyInstanceObject*)type)->in_class;
            Py_INCREF(type);
        } else {
            type = 0;
            PyErr_SetString(PyExc_TypeError,
                "raise: exception must be an old-style class or instance");
            goto raise_error;
        }
        #else
        type = (PyObject*) Py_TYPE(type);
        Py_INCREF(type);
        if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
            PyErr_SetString(PyExc_TypeError,
                "raise: exception class must be a subclass of BaseException");
            goto raise_error;
        }
        #endif
    }
    __Pyx_ErrRestore(type, value, tb);
    return;
raise_error:
    Py_XDECREF(value);
    Py_XDECREF(type);
    Py_XDECREF(tb);
    return;
}
#else /* Python 3+ */
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
    PyObject* owned_instance = NULL;
    if (tb == Py_None) {
        tb = 0;
    } else if (tb && !PyTraceBack_Check(tb)) {
        PyErr_SetString(PyExc_TypeError,
            "raise: arg 3 must be a traceback or None");
        goto bad;
    }
    if (value == Py_None)
        value = 0;
    if (PyExceptionInstance_Check(type)) {
        if (value) {
            PyErr_SetString(PyExc_TypeError,
                "instance exception may not have a separate value");
            goto bad;
        }
        value = type;
        type = (PyObject*) Py_TYPE(value);
    } else if (PyExceptionClass_Check(type)) {
        PyObject *instance_class = NULL;
        if (value && PyExceptionInstance_Check(value)) {
            instance_class = (PyObject*) Py_TYPE(value);
            if (instance_class != type) {
                if (PyObject_IsSubclass(instance_class, type)) {
                    type = instance_class;
                } else {
                    instance_class = NULL;
                }
            }
        }
        if (!instance_class) {
            PyObject *args;
            if (!value)
                args = PyTuple_New(0);
            else if (PyTuple_Check(value)) {
                Py_INCREF(value);
                args = value;
            } else
                args = PyTuple_Pack(1, value);
            if (!args)
                goto bad;
            owned_instance = PyObject_Call(type, args, NULL);
            Py_DECREF(args);
            if (!owned_instance)
                goto bad;
            value = owned_instance;
            if (!PyExceptionInstance_Check(value)) {
                PyErr_Format(PyExc_TypeError,
                             "calling %R should have returned an instance of "
                             "BaseException, not %R",
                             type, Py_TYPE(value));
                goto bad;
            }
        }
    } else {
        PyErr_SetString(PyExc_TypeError,
            "raise: exception class must be a subclass of BaseException");
        goto bad;
    }
#if PY_VERSION_HEX >= 0x03030000
    if (cause) {
#else
    if (cause && cause != Py_None) {
#endif
        PyObject *fixed_cause;
        if (cause == Py_None) {
            fixed_cause = NULL;
        } else if (PyExceptionClass_Check(cause)) {
            fixed_cause = PyObject_CallObject(cause, NULL);
            if (fixed_cause == NULL)
                goto bad;
        } else if (PyExceptionInstance_Check(cause)) {
            fixed_cause = cause;
            Py_INCREF(fixed_cause);
        } else {
            PyErr_SetString(PyExc_TypeError,
                            "exception causes must derive from "
                            "BaseException");
            goto bad;
        }
        PyException_SetCause(value, fixed_cause);
    }
    PyErr_SetObject(type, value);
    if (tb) {
        PyThreadState *tstate = PyThreadState_GET();
        PyObject* tmp_tb = tstate->curexc_traceback;
        if (tb != tmp_tb) {
            Py_INCREF(tb);
            tstate->curexc_traceback = tb;
            Py_XDECREF(tmp_tb);
        }
    }
bad:
    Py_XDECREF(owned_instance);
    return;
}
#endif

static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb) {
#if CYTHON_COMPILING_IN_CPYTHON
    PyThreadState *tstate = PyThreadState_GET();
    *type = tstate->exc_type;
    *value = tstate->exc_value;
    *tb = tstate->exc_traceback;
    Py_XINCREF(*type);
    Py_XINCREF(*value);
    Py_XINCREF(*tb);
#else
    PyErr_GetExcInfo(type, value, tb);
#endif
}
static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb) {
#if CYTHON_COMPILING_IN_CPYTHON
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    PyThreadState *tstate = PyThreadState_GET();
    tmp_type = tstate->exc_type;
    tmp_value = tstate->exc_value;
    tmp_tb = tstate->exc_traceback;
    tstate->exc_type = type;
    tstate->exc_value = value;
    tstate->exc_traceback = tb;
    Py_XDECREF(tmp_type);
    Py_XDECREF(tmp_value);
    Py_XDECREF(tmp_tb);
#else
    PyErr_SetExcInfo(type, value, tb);
#endif
}

static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) {
    PyObject *local_type, *local_value, *local_tb;
#if CYTHON_COMPILING_IN_CPYTHON
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    PyThreadState *tstate = PyThreadState_GET();
    local_type = tstate->curexc_type;
    local_value = tstate->curexc_value;
    local_tb = tstate->curexc_traceback;
    tstate->curexc_type = 0;
    tstate->curexc_value = 0;
    tstate->curexc_traceback = 0;
#else
    PyErr_Fetch(&local_type, &local_value, &local_tb);
#endif
    PyErr_NormalizeException(&local_type, &local_value, &local_tb);
#if CYTHON_COMPILING_IN_CPYTHON
    if (unlikely(tstate->curexc_type))
#else
    if (unlikely(PyErr_Occurred()))
#endif
        goto bad;
    #if PY_MAJOR_VERSION >= 3
    if (local_tb) {
        if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
            goto bad;
    }
    #endif
    Py_XINCREF(local_tb);
    Py_XINCREF(local_type);
    Py_XINCREF(local_value);
    *type = local_type;
    *value = local_value;
    *tb = local_tb;
#if CYTHON_COMPILING_IN_CPYTHON
    tmp_type = tstate->exc_type;
    tmp_value = tstate->exc_value;
    tmp_tb = tstate->exc_traceback;
    tstate->exc_type = local_type;
    tstate->exc_value = local_value;
    tstate->exc_traceback = local_tb;
    Py_XDECREF(tmp_type);
    Py_XDECREF(tmp_value);
    Py_XDECREF(tmp_tb);
#else
    PyErr_SetExcInfo(local_type, local_value, local_tb);
#endif
    return 0;
bad:
    *type = 0;
    *value = 0;
    *tb = 0;
    Py_XDECREF(local_type);
    Py_XDECREF(local_value);
    Py_XDECREF(local_tb);
    return -1;
}

static CYTHON_INLINE int __Pyx_CheckKeywordStrings(
    PyObject *kwdict,
    const char* function_name,
    int kw_allowed)
{
    PyObject* key = 0;
    Py_ssize_t pos = 0;
#if CYTHON_COMPILING_IN_PYPY
    if (!kw_allowed && PyDict_Next(kwdict, &pos, &key, 0))
        goto invalid_keyword;
    return 1;
#else
    while (PyDict_Next(kwdict, &pos, &key, 0)) {
        #if PY_MAJOR_VERSION < 3
        if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key)))
        #endif
            if (unlikely(!PyUnicode_Check(key)))
                goto invalid_keyword_type;
    }
    if ((!kw_allowed) && unlikely(key))
        goto invalid_keyword;
    return 1;
invalid_keyword_type:
    PyErr_Format(PyExc_TypeError,
        "%.200s() keywords must be strings", function_name);
    return 0;
#endif
invalid_keyword:
    PyErr_Format(PyExc_TypeError,
    #if PY_MAJOR_VERSION < 3
        "%.200s() got an unexpected keyword argument '%.200s'",
        function_name, PyString_AsString(key));
    #else
        "%s() got an unexpected keyword argument '%U'",
        function_name, key);
    #endif
    return 0;
}

static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
    if (unlikely(!type)) {
        PyErr_SetString(PyExc_SystemError, "Missing type object");
        return 0;
    }
    if (likely(PyObject_TypeCheck(obj, type)))
        return 1;
    PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s",
                 Py_TYPE(obj)->tp_name, type->tp_name);
    return 0;
}

static void __Pyx_WriteUnraisable(const char *name, CYTHON_UNUSED int clineno,
                                  CYTHON_UNUSED int lineno, CYTHON_UNUSED const char *filename,
                                  int full_traceback) {
    PyObject *old_exc, *old_val, *old_tb;
    PyObject *ctx;
    __Pyx_ErrFetch(&old_exc, &old_val, &old_tb);
    if (full_traceback) {
        Py_XINCREF(old_exc);
        Py_XINCREF(old_val);
        Py_XINCREF(old_tb);
        __Pyx_ErrRestore(old_exc, old_val, old_tb);
        PyErr_PrintEx(1);
    }
    #if PY_MAJOR_VERSION < 3
    ctx = PyString_FromString(name);
    #else
    ctx = PyUnicode_FromString(name);
    #endif
    __Pyx_ErrRestore(old_exc, old_val, old_tb);
    if (!ctx) {
        PyErr_WriteUnraisable(Py_None);
    } else {
        PyErr_WriteUnraisable(ctx);
        Py_DECREF(ctx);
    }
}

static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
    PyObject *r;
    if (!j) return NULL;
    r = PyObject_GetItem(o, j);
    Py_DECREF(j);
    return r;
}
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
                                                              int wraparound, int boundscheck) {
#if CYTHON_COMPILING_IN_CPYTHON
    if (wraparound & unlikely(i < 0)) i += PyList_GET_SIZE(o);
    if ((!boundscheck) || likely((0 <= i) & (i < PyList_GET_SIZE(o)))) {
        PyObject *r = PyList_GET_ITEM(o, i);
        Py_INCREF(r);
        return r;
    }
    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
#else
    return PySequence_GetItem(o, i);
#endif
}
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
                                                              int wraparound, int boundscheck) {
#if CYTHON_COMPILING_IN_CPYTHON
    if (wraparound & unlikely(i < 0)) i += PyTuple_GET_SIZE(o);
    if ((!boundscheck) || likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) {
        PyObject *r = PyTuple_GET_ITEM(o, i);
        Py_INCREF(r);
        return r;
    }
    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
#else
    return PySequence_GetItem(o, i);
#endif
}
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
                                                     int is_list, int wraparound, int boundscheck) {
#if CYTHON_COMPILING_IN_CPYTHON
    if (is_list || PyList_CheckExact(o)) {
        Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
        if ((!boundscheck) || (likely((n >= 0) & (n < PyList_GET_SIZE(o))))) {
            PyObject *r = PyList_GET_ITEM(o, n);
            Py_INCREF(r);
            return r;
        }
    }
    else if (PyTuple_CheckExact(o)) {
        Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
        if ((!boundscheck) || likely((n >= 0) & (n < PyTuple_GET_SIZE(o)))) {
            PyObject *r = PyTuple_GET_ITEM(o, n);
            Py_INCREF(r);
            return r;
        }
    } else {
        PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
        if (likely(m && m->sq_item)) {
            if (wraparound && unlikely(i < 0) && likely(m->sq_length)) {
                Py_ssize_t l = m->sq_length(o);
                if (likely(l >= 0)) {
                    i += l;
                } else {
                    if (PyErr_ExceptionMatches(PyExc_OverflowError))
                        PyErr_Clear();
                    else
                        return NULL;
                }
            }
            return m->sq_item(o, i);
        }
    }
#else
    if (is_list || PySequence_Check(o)) {
        return PySequence_GetItem(o, i);
    }
#endif
    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
}

static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
    PyErr_Format(PyExc_ValueError,
                 "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected);
}

static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
    PyErr_Format(PyExc_ValueError,
                 "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack",
                 index, (index == 1) ? "" : "s");
}

static CYTHON_INLINE int __Pyx_IterFinish(void) {
#if CYTHON_COMPILING_IN_CPYTHON
    PyThreadState *tstate = PyThreadState_GET();
    PyObject* exc_type = tstate->curexc_type;
    if (unlikely(exc_type)) {
        if (likely(exc_type == PyExc_StopIteration) || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)) {
            PyObject *exc_value, *exc_tb;
            exc_value = tstate->curexc_value;
            exc_tb = tstate->curexc_traceback;
            tstate->curexc_type = 0;
            tstate->curexc_value = 0;
            tstate->curexc_traceback = 0;
            Py_DECREF(exc_type);
            Py_XDECREF(exc_value);
            Py_XDECREF(exc_tb);
            return 0;
        } else {
            return -1;
        }
    }
    return 0;
#else
    if (unlikely(PyErr_Occurred())) {
        if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) {
            PyErr_Clear();
            return 0;
        } else {
            return -1;
        }
    }
    return 0;
#endif
}

static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) {
    if (unlikely(retval)) {
        Py_DECREF(retval);
        __Pyx_RaiseTooManyValuesError(expected);
        return -1;
    } else {
        return __Pyx_IterFinish();
    }
    return 0;
}

#if !CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyBytes_Join(PyObject* sep, PyObject* values) {
    return PyObject_CallMethodObjArgs(sep, __pyx_n_s_join, values, NULL);
}
#endif

static CYTHON_INLINE void __Pyx_RaiseClosureNameError(const char *varname) {
    PyErr_Format(PyExc_NameError, "free variable '%s' referenced before assignment in enclosing scope", varname);
}

static void __Pyx_RaiseArgumentTypeInvalid(const char* name, PyObject *obj, PyTypeObject *type) {
    PyErr_Format(PyExc_TypeError,
        "Argument '%.200s' has incorrect type (expected %.200s, got %.200s)",
        name, type->tp_name, Py_TYPE(obj)->tp_name);
}
static CYTHON_INLINE int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed,
    const char *name, int exact)
{
    if (unlikely(!type)) {
        PyErr_SetString(PyExc_SystemError, "Missing type object");
        return 0;
    }
    if (none_allowed && obj == Py_None) return 1;
    else if (exact) {
        if (likely(Py_TYPE(obj) == type)) return 1;
        #if PY_MAJOR_VERSION == 2
        else if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1;
        #endif
    }
    else {
        if (likely(PyObject_TypeCheck(obj, type))) return 1;
    }
    __Pyx_RaiseArgumentTypeInvalid(name, obj, type);
    return 0;
}

static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) {
#if CYTHON_COMPILING_IN_PYPY
    return PyObject_RichCompareBool(s1, s2, equals);
#else
    if (s1 == s2) {
        return (equals == Py_EQ);
    } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) {
        const char *ps1, *ps2;
        Py_ssize_t length = PyBytes_GET_SIZE(s1);
        if (length != PyBytes_GET_SIZE(s2))
            return (equals == Py_NE);
        ps1 = PyBytes_AS_STRING(s1);
        ps2 = PyBytes_AS_STRING(s2);
        if (ps1[0] != ps2[0]) {
            return (equals == Py_NE);
        } else if (length == 1) {
            return (equals == Py_EQ);
        } else {
            int result = memcmp(ps1, ps2, (size_t)length);
            return (equals == Py_EQ) ? (result == 0) : (result != 0);
        }
    } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) {
        return (equals == Py_NE);
    } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) {
        return (equals == Py_NE);
    } else {
        int result;
        PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
        if (!py_result)
            return -1;
        result = __Pyx_PyObject_IsTrue(py_result);
        Py_DECREF(py_result);
        return result;
    }
#endif
}

static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) {
#if CYTHON_COMPILING_IN_PYPY
    return PyObject_RichCompareBool(s1, s2, equals);
#else
#if PY_MAJOR_VERSION < 3
    PyObject* owned_ref = NULL;
#endif
    int s1_is_unicode, s2_is_unicode;
    if (s1 == s2) {
        goto return_eq;
    }
    s1_is_unicode = PyUnicode_CheckExact(s1);
    s2_is_unicode = PyUnicode_CheckExact(s2);
#if PY_MAJOR_VERSION < 3
    if ((s1_is_unicode & (!s2_is_unicode)) && PyString_CheckExact(s2)) {
        owned_ref = PyUnicode_FromObject(s2);
        if (unlikely(!owned_ref))
            return -1;
        s2 = owned_ref;
        s2_is_unicode = 1;
    } else if ((s2_is_unicode & (!s1_is_unicode)) && PyString_CheckExact(s1)) {
        owned_ref = PyUnicode_FromObject(s1);
        if (unlikely(!owned_ref))
            return -1;
        s1 = owned_ref;
        s1_is_unicode = 1;
    } else if (((!s2_is_unicode) & (!s1_is_unicode))) {
        return __Pyx_PyBytes_Equals(s1, s2, equals);
    }
#endif
    if (s1_is_unicode & s2_is_unicode) {
        Py_ssize_t length;
        int kind;
        void *data1, *data2;
        #if CYTHON_PEP393_ENABLED
        if (unlikely(PyUnicode_READY(s1) < 0) || unlikely(PyUnicode_READY(s2) < 0))
            return -1;
        #endif
        length = __Pyx_PyUnicode_GET_LENGTH(s1);
        if (length != __Pyx_PyUnicode_GET_LENGTH(s2)) {
            goto return_ne;
        }
        kind = __Pyx_PyUnicode_KIND(s1);
        if (kind != __Pyx_PyUnicode_KIND(s2)) {
            goto return_ne;
        }
        data1 = __Pyx_PyUnicode_DATA(s1);
        data2 = __Pyx_PyUnicode_DATA(s2);
        if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) {
            goto return_ne;
        } else if (length == 1) {
            goto return_eq;
        } else {
            int result = memcmp(data1, data2, (size_t)(length * kind));
            #if PY_MAJOR_VERSION < 3
            Py_XDECREF(owned_ref);
            #endif
            return (equals == Py_EQ) ? (result == 0) : (result != 0);
        }
    } else if ((s1 == Py_None) & s2_is_unicode) {
        goto return_ne;
    } else if ((s2 == Py_None) & s1_is_unicode) {
        goto return_ne;
    } else {
        int result;
        PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
        if (!py_result)
            return -1;
        result = __Pyx_PyObject_IsTrue(py_result);
        Py_DECREF(py_result);
        return result;
    }
return_eq:
    #if PY_MAJOR_VERSION < 3
    Py_XDECREF(owned_ref);
    #endif
    return (equals == Py_EQ);
return_ne:
    #if PY_MAJOR_VERSION < 3
    Py_XDECREF(owned_ref);
    #endif
    return (equals == Py_NE);
#endif
}

static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
}

static int __Pyx_SetVtable(PyObject *dict, void *vtable) {
#if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION==3&&PY_MINOR_VERSION==0)
    PyObject *ob = PyCapsule_New(vtable, 0, 0);
#else
    PyObject *ob = PyCObject_FromVoidPtr(vtable, 0);
#endif
    if (!ob)
        goto bad;
    if (PyDict_SetItem(dict, __pyx_n_s_pyx_vtable, ob) < 0)
        goto bad;
    Py_DECREF(ob);
    return 0;
bad:
    Py_XDECREF(ob);
    return -1;
}

static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) {
    PyObject* value = __Pyx_PyObject_GetAttrStr(module, name);
    if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) {
        PyErr_Format(PyExc_ImportError,
        #if PY_MAJOR_VERSION < 3
            "cannot import name %.230s", PyString_AS_STRING(name));
        #else
            "cannot import name %S", name);
        #endif
    }
    return value;
}

static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases) {
    Py_ssize_t i, nbases = PyTuple_GET_SIZE(bases);
    for (i=0; i < nbases; i++) {
        PyTypeObject *tmptype;
        PyObject *tmp = PyTuple_GET_ITEM(bases, i);
        tmptype = Py_TYPE(tmp);
#if PY_MAJOR_VERSION < 3
        if (tmptype == &PyClass_Type)
            continue;
#endif
        if (!metaclass) {
            metaclass = tmptype;
            continue;
        }
        if (PyType_IsSubtype(metaclass, tmptype))
            continue;
        if (PyType_IsSubtype(tmptype, metaclass)) {
            metaclass = tmptype;
            continue;
        }
        PyErr_SetString(PyExc_TypeError,
                        "metaclass conflict: "
                        "the metaclass of a derived class "
                        "must be a (non-strict) subclass "
                        "of the metaclasses of all its bases");
        return NULL;
    }
    if (!metaclass) {
#if PY_MAJOR_VERSION < 3
        metaclass = &PyClass_Type;
#else
        metaclass = &PyType_Type;
#endif
    }
    Py_INCREF((PyObject*) metaclass);
    return (PyObject*) metaclass;
}

static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type) {
    PyObject* fake_module;
    PyTypeObject* cached_type = NULL;
    fake_module = PyImport_AddModule((char*) "_cython_" CYTHON_ABI);
    if (!fake_module) return NULL;
    Py_INCREF(fake_module);
    cached_type = (PyTypeObject*) PyObject_GetAttrString(fake_module, type->tp_name);
    if (cached_type) {
        if (!PyType_Check((PyObject*)cached_type)) {
            PyErr_Format(PyExc_TypeError,
                "Shared Cython type %.200s is not a type object",
                type->tp_name);
            goto bad;
        }
        if (cached_type->tp_basicsize != type->tp_basicsize) {
            PyErr_Format(PyExc_TypeError,
                "Shared Cython type %.200s has the wrong size, try recompiling",
                type->tp_name);
            goto bad;
        }
    } else {
        if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad;
        PyErr_Clear();
        if (PyType_Ready(type) < 0) goto bad;
        if (PyObject_SetAttrString(fake_module, type->tp_name, (PyObject*) type) < 0)
            goto bad;
        Py_INCREF(type);
        cached_type = type;
    }
done:
    Py_DECREF(fake_module);
    return cached_type;
bad:
    Py_XDECREF(cached_type);
    cached_type = NULL;
    goto done;
}

static PyObject *
__Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *closure)
{
    if (unlikely(op->func_doc == NULL)) {
        if (op->func.m_ml->ml_doc) {
#if PY_MAJOR_VERSION >= 3
            op->func_doc = PyUnicode_FromString(op->func.m_ml->ml_doc);
#else
            op->func_doc = PyString_FromString(op->func.m_ml->ml_doc);
#endif
            if (unlikely(op->func_doc == NULL))
                return NULL;
        } else {
            Py_INCREF(Py_None);
            return Py_None;
        }
    }
    Py_INCREF(op->func_doc);
    return op->func_doc;
}
static int
__Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value)
{
    PyObject *tmp = op->func_doc;
    if (value == NULL)
        value = Py_None; /* Mark as deleted */
    Py_INCREF(value);
    op->func_doc = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op)
{
    if (unlikely(op->func_name == NULL)) {
#if PY_MAJOR_VERSION >= 3
        op->func_name = PyUnicode_InternFromString(op->func.m_ml->ml_name);
#else
        op->func_name = PyString_InternFromString(op->func.m_ml->ml_name);
#endif
        if (unlikely(op->func_name == NULL))
            return NULL;
    }
    Py_INCREF(op->func_name);
    return op->func_name;
}
static int
__Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value)
{
    PyObject *tmp;
#if PY_MAJOR_VERSION >= 3
    if (unlikely(value == NULL || !PyUnicode_Check(value))) {
#else
    if (unlikely(value == NULL || !PyString_Check(value))) {
#endif
        PyErr_SetString(PyExc_TypeError,
                        "__name__ must be set to a string object");
        return -1;
    }
    tmp = op->func_name;
    Py_INCREF(value);
    op->func_name = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject *op)
{
    Py_INCREF(op->func_qualname);
    return op->func_qualname;
}
static int
__Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value)
{
    PyObject *tmp;
#if PY_MAJOR_VERSION >= 3
    if (unlikely(value == NULL || !PyUnicode_Check(value))) {
#else
    if (unlikely(value == NULL || !PyString_Check(value))) {
#endif
        PyErr_SetString(PyExc_TypeError,
                        "__qualname__ must be set to a string object");
        return -1;
    }
    tmp = op->func_qualname;
    Py_INCREF(value);
    op->func_qualname = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_self(__pyx_CyFunctionObject *m, CYTHON_UNUSED void *closure)
{
    PyObject *self;
    self = m->func_closure;
    if (self == NULL)
        self = Py_None;
    Py_INCREF(self);
    return self;
}
static PyObject *
__Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op)
{
    if (unlikely(op->func_dict == NULL)) {
        op->func_dict = PyDict_New();
        if (unlikely(op->func_dict == NULL))
            return NULL;
    }
    Py_INCREF(op->func_dict);
    return op->func_dict;
}
static int
__Pyx_CyFunction_set_dict(__pyx_CyFunctionObject *op, PyObject *value)
{
    PyObject *tmp;
    if (unlikely(value == NULL)) {
        PyErr_SetString(PyExc_TypeError,
               "function's dictionary may not be deleted");
        return -1;
    }
    if (unlikely(!PyDict_Check(value))) {
        PyErr_SetString(PyExc_TypeError,
               "setting function's dictionary to a non-dict");
        return -1;
    }
    tmp = op->func_dict;
    Py_INCREF(value);
    op->func_dict = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_globals(__pyx_CyFunctionObject *op)
{
    Py_INCREF(op->func_globals);
    return op->func_globals;
}
static PyObject *
__Pyx_CyFunction_get_closure(CYTHON_UNUSED __pyx_CyFunctionObject *op)
{
    Py_INCREF(Py_None);
    return Py_None;
}
static PyObject *
__Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op)
{
    PyObject* result = (op->func_code) ? op->func_code : Py_None;
    Py_INCREF(result);
    return result;
}
static int
__Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject *op) {
    PyObject *res = op->defaults_getter((PyObject *) op);
    if (unlikely(!res))
        return -1;
    op->defaults_tuple = PyTuple_GET_ITEM(res, 0);
    Py_INCREF(op->defaults_tuple);
    op->defaults_kwdict = PyTuple_GET_ITEM(res, 1);
    Py_INCREF(op->defaults_kwdict);
    Py_DECREF(res);
    return 0;
}
static int
__Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value) {
    PyObject* tmp;
    if (!value) {
        value = Py_None;
    } else if (value != Py_None && !PyTuple_Check(value)) {
        PyErr_SetString(PyExc_TypeError,
                        "__defaults__ must be set to a tuple object");
        return -1;
    }
    Py_INCREF(value);
    tmp = op->defaults_tuple;
    op->defaults_tuple = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op) {
    PyObject* result = op->defaults_tuple;
    if (unlikely(!result)) {
        if (op->defaults_getter) {
            if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL;
            result = op->defaults_tuple;
        } else {
            result = Py_None;
        }
    }
    Py_INCREF(result);
    return result;
}
static int
__Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject *op, PyObject* value) {
    PyObject* tmp;
    if (!value) {
        value = Py_None;
    } else if (value != Py_None && !PyDict_Check(value)) {
        PyErr_SetString(PyExc_TypeError,
                        "__kwdefaults__ must be set to a dict object");
        return -1;
    }
    Py_INCREF(value);
    tmp = op->defaults_kwdict;
    op->defaults_kwdict = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op) {
    PyObject* result = op->defaults_kwdict;
    if (unlikely(!result)) {
        if (op->defaults_getter) {
            if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL;
            result = op->defaults_kwdict;
        } else {
            result = Py_None;
        }
    }
    Py_INCREF(result);
    return result;
}
static int
__Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject *op, PyObject* value) {
    PyObject* tmp;
    if (!value || value == Py_None) {
        value = NULL;
    } else if (!PyDict_Check(value)) {
        PyErr_SetString(PyExc_TypeError,
                        "__annotations__ must be set to a dict object");
        return -1;
    }
    Py_XINCREF(value);
    tmp = op->func_annotations;
    op->func_annotations = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op) {
    PyObject* result = op->func_annotations;
    if (unlikely(!result)) {
        result = PyDict_New();
        if (unlikely(!result)) return NULL;
        op->func_annotations = result;
    }
    Py_INCREF(result);
    return result;
}
static PyGetSetDef __pyx_CyFunction_getsets[] = {
    {(char *) "func_doc", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
    {(char *) "__doc__",  (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
    {(char *) "func_name", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
    {(char *) "__name__", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
    {(char *) "__qualname__", (getter)__Pyx_CyFunction_get_qualname, (setter)__Pyx_CyFunction_set_qualname, 0, 0},
    {(char *) "__self__", (getter)__Pyx_CyFunction_get_self, 0, 0, 0},
    {(char *) "func_dict", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
    {(char *) "__dict__", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
    {(char *) "func_globals", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
    {(char *) "__globals__", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
    {(char *) "func_closure", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
    {(char *) "__closure__", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
    {(char *) "func_code", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
    {(char *) "__code__", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
    {(char *) "func_defaults", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
    {(char *) "__defaults__", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
    {(char *) "__kwdefaults__", (getter)__Pyx_CyFunction_get_kwdefaults, (setter)__Pyx_CyFunction_set_kwdefaults, 0, 0},
    {(char *) "__annotations__", (getter)__Pyx_CyFunction_get_annotations, (setter)__Pyx_CyFunction_set_annotations, 0, 0},
    {0, 0, 0, 0, 0}
};
#ifndef PY_WRITE_RESTRICTED /* < Py2.5 */
#define PY_WRITE_RESTRICTED WRITE_RESTRICTED
#endif
static PyMemberDef __pyx_CyFunction_members[] = {
    {(char *) "__module__", T_OBJECT, offsetof(__pyx_CyFunctionObject, func.m_module), PY_WRITE_RESTRICTED, 0},
    {0, 0, 0,  0, 0}
};
static PyObject *
__Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, CYTHON_UNUSED PyObject *args)
{
#if PY_MAJOR_VERSION >= 3
    return PyUnicode_FromString(m->func.m_ml->ml_name);
#else
    return PyString_FromString(m->func.m_ml->ml_name);
#endif
}
static PyMethodDef __pyx_CyFunction_methods[] = {
    {__Pyx_NAMESTR("__reduce__"), (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0},
    {0, 0, 0, 0}
};
static PyObject *__Pyx_CyFunction_New(PyTypeObject *type, PyMethodDef *ml, int flags, PyObject* qualname,
                                      PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) {
    __pyx_CyFunctionObject *op = PyObject_GC_New(__pyx_CyFunctionObject, type);
    if (op == NULL)
        return NULL;
    op->flags = flags;
    op->func_weakreflist = NULL;
    op->func.m_ml = ml;
    op->func.m_self = (PyObject *) op;
    Py_XINCREF(closure);
    op->func_closure = closure;
    Py_XINCREF(module);
    op->func.m_module = module;
    op->func_dict = NULL;
    op->func_name = NULL;
    Py_INCREF(qualname);
    op->func_qualname = qualname;
    op->func_doc = NULL;
    op->func_classobj = NULL;
    op->func_globals = globals;
    Py_INCREF(op->func_globals);
    Py_XINCREF(code);
    op->func_code = code;
    op->defaults_pyobjects = 0;
    op->defaults = NULL;
    op->defaults_tuple = NULL;
    op->defaults_kwdict = NULL;
    op->defaults_getter = NULL;
    op->func_annotations = NULL;
    PyObject_GC_Track(op);
    return (PyObject *) op;
}
static int
__Pyx_CyFunction_clear(__pyx_CyFunctionObject *m)
{
    Py_CLEAR(m->func_closure);
    Py_CLEAR(m->func.m_module);
    Py_CLEAR(m->func_dict);
    Py_CLEAR(m->func_name);
    Py_CLEAR(m->func_qualname);
    Py_CLEAR(m->func_doc);
    Py_CLEAR(m->func_globals);
    Py_CLEAR(m->func_code);
    Py_CLEAR(m->func_classobj);
    Py_CLEAR(m->defaults_tuple);
    Py_CLEAR(m->defaults_kwdict);
    Py_CLEAR(m->func_annotations);
    if (m->defaults) {
        PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
        int i;
        for (i = 0; i < m->defaults_pyobjects; i++)
            Py_XDECREF(pydefaults[i]);
        PyMem_Free(m->defaults);
        m->defaults = NULL;
    }
    return 0;
}
static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m)
{
    PyObject_GC_UnTrack(m);
    if (m->func_weakreflist != NULL)
        PyObject_ClearWeakRefs((PyObject *) m);
    __Pyx_CyFunction_clear(m);
    PyObject_GC_Del(m);
}
static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit, void *arg)
{
    Py_VISIT(m->func_closure);
    Py_VISIT(m->func.m_module);
    Py_VISIT(m->func_dict);
    Py_VISIT(m->func_name);
    Py_VISIT(m->func_qualname);
    Py_VISIT(m->func_doc);
    Py_VISIT(m->func_globals);
    Py_VISIT(m->func_code);
    Py_VISIT(m->func_classobj);
    Py_VISIT(m->defaults_tuple);
    Py_VISIT(m->defaults_kwdict);
    if (m->defaults) {
        PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
        int i;
        for (i = 0; i < m->defaults_pyobjects; i++)
            Py_VISIT(pydefaults[i]);
    }
    return 0;
}
static PyObject *__Pyx_CyFunction_descr_get(PyObject *func, PyObject *obj, PyObject *type)
{
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    if (m->flags & __Pyx_CYFUNCTION_STATICMETHOD) {
        Py_INCREF(func);
        return func;
    }
    if (m->flags & __Pyx_CYFUNCTION_CLASSMETHOD) {
        if (type == NULL)
            type = (PyObject *)(Py_TYPE(obj));
        return PyMethod_New(func,
                            type, (PyObject *)(Py_TYPE(type)));
    }
    if (obj == Py_None)
        obj = NULL;
    return PyMethod_New(func, obj, type);
}
static PyObject*
__Pyx_CyFunction_repr(__pyx_CyFunctionObject *op)
{
#if PY_MAJOR_VERSION >= 3
    return PyUnicode_FromFormat("<cyfunction %U at %p>",
                                op->func_qualname, (void *)op);
#else
    return PyString_FromFormat("<cyfunction %s at %p>",
                               PyString_AsString(op->func_qualname), (void *)op);
#endif
}
#if CYTHON_COMPILING_IN_PYPY
static PyObject * __Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) {
    PyCFunctionObject* f = (PyCFunctionObject*)func;
    PyCFunction meth = PyCFunction_GET_FUNCTION(func);
    PyObject *self = PyCFunction_GET_SELF(func);
    Py_ssize_t size;
    switch (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST)) {
    case METH_VARARGS:
        if (likely(kw == NULL) || PyDict_Size(kw) == 0)
            return (*meth)(self, arg);
        break;
    case METH_VARARGS | METH_KEYWORDS:
        return (*(PyCFunctionWithKeywords)meth)(self, arg, kw);
    case METH_NOARGS:
        if (likely(kw == NULL) || PyDict_Size(kw) == 0) {
            size = PyTuple_GET_SIZE(arg);
            if (size == 0)
                return (*meth)(self, NULL);
            PyErr_Format(PyExc_TypeError,
                "%.200s() takes no arguments (%zd given)",
                f->m_ml->ml_name, size);
            return NULL;
        }
        break;
    case METH_O:
        if (likely(kw == NULL) || PyDict_Size(kw) == 0) {
            size = PyTuple_GET_SIZE(arg);
            if (size == 1)
                return (*meth)(self, PyTuple_GET_ITEM(arg, 0));
            PyErr_Format(PyExc_TypeError,
                "%.200s() takes exactly one argument (%zd given)",
                f->m_ml->ml_name, size);
            return NULL;
        }
        break;
    default:
        PyErr_SetString(PyExc_SystemError, "Bad call flags in "
                        "__Pyx_CyFunction_Call. METH_OLDARGS is no "
                        "longer supported!");
        return NULL;
    }
    PyErr_Format(PyExc_TypeError, "%.200s() takes no keyword arguments",
                 f->m_ml->ml_name);
    return NULL;
}
#else
static PyObject * __Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) {
	return PyCFunction_Call(func, arg, kw);
}
#endif
static PyTypeObject __pyx_CyFunctionType_type = {
    PyVarObject_HEAD_INIT(0, 0)
    __Pyx_NAMESTR("cython_function_or_method"), /*tp_name*/
    sizeof(__pyx_CyFunctionObject),   /*tp_basicsize*/
    0,                                  /*tp_itemsize*/
    (destructor) __Pyx_CyFunction_dealloc, /*tp_dealloc*/
    0,                                  /*tp_print*/
    0,                                  /*tp_getattr*/
    0,                                  /*tp_setattr*/
#if PY_MAJOR_VERSION < 3
    0,                                  /*tp_compare*/
#else
    0,                                  /*reserved*/
#endif
    (reprfunc) __Pyx_CyFunction_repr,   /*tp_repr*/
    0,                                  /*tp_as_number*/
    0,                                  /*tp_as_sequence*/
    0,                                  /*tp_as_mapping*/
    0,                                  /*tp_hash*/
    __Pyx_CyFunction_Call,              /*tp_call*/
    0,                                  /*tp_str*/
    0,                                  /*tp_getattro*/
    0,                                  /*tp_setattro*/
    0,                                  /*tp_as_buffer*/
    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, /* tp_flags*/
    0,                                  /*tp_doc*/
    (traverseproc) __Pyx_CyFunction_traverse,   /*tp_traverse*/
    (inquiry) __Pyx_CyFunction_clear,   /*tp_clear*/
    0,                                  /*tp_richcompare*/
    offsetof(__pyx_CyFunctionObject, func_weakreflist), /* tp_weaklistoffse */
    0,                                  /*tp_iter*/
    0,                                  /*tp_iternext*/
    __pyx_CyFunction_methods,           /*tp_methods*/
    __pyx_CyFunction_members,           /*tp_members*/
    __pyx_CyFunction_getsets,           /*tp_getset*/
    0,                                  /*tp_base*/
    0,                                  /*tp_dict*/
    __Pyx_CyFunction_descr_get,         /*tp_descr_get*/
    0,                                  /*tp_descr_set*/
    offsetof(__pyx_CyFunctionObject, func_dict),/*tp_dictoffset*/
    0,                                  /*tp_init*/
    0,                                  /*tp_alloc*/
    0,                                  /*tp_new*/
    0,                                  /*tp_free*/
    0,                                  /*tp_is_gc*/
    0,                                  /*tp_bases*/
    0,                                  /*tp_mro*/
    0,                                  /*tp_cache*/
    0,                                  /*tp_subclasses*/
    0,                                  /*tp_weaklist*/
    0,                                  /*tp_del*/
#if PY_VERSION_HEX >= 0x02060000
    0,                                  /*tp_version_tag*/
#endif
#if PY_VERSION_HEX >= 0x030400a1
    0,                                  /*tp_finalize*/
#endif
};
static int __Pyx_CyFunction_init(void) {
#if !CYTHON_COMPILING_IN_PYPY
    __pyx_CyFunctionType_type.tp_call = PyCFunction_Call;
#endif
    __pyx_CyFunctionType = __Pyx_FetchCommonType(&__pyx_CyFunctionType_type);
    if (__pyx_CyFunctionType == NULL) {
        return -1;
    }
    return 0;
}
static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *func, size_t size, int pyobjects) {
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    m->defaults = PyMem_Malloc(size);
    if (!m->defaults)
        return PyErr_NoMemory();
    memset(m->defaults, 0, size);
    m->defaults_pyobjects = pyobjects;
    return m->defaults;
}
static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) {
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    m->defaults_tuple = tuple;
    Py_INCREF(tuple);
}
static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *func, PyObject *dict) {
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    m->defaults_kwdict = dict;
    Py_INCREF(dict);
}
static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, PyObject *dict) {
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    m->func_annotations = dict;
    Py_INCREF(dict);
}

static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name,
                                           PyObject *qualname, PyObject *mkw, PyObject *modname, PyObject *doc) {
    PyObject *ns;
    if (metaclass) {
        PyObject *prep = __Pyx_PyObject_GetAttrStr(metaclass, __pyx_n_s_prepare);
        if (prep) {
            PyObject *pargs = PyTuple_Pack(2, name, bases);
            if (unlikely(!pargs)) {
                Py_DECREF(prep);
                return NULL;
            }
            ns = PyObject_Call(prep, pargs, mkw);
            Py_DECREF(prep);
            Py_DECREF(pargs);
        } else {
            if (unlikely(!PyErr_ExceptionMatches(PyExc_AttributeError)))
                return NULL;
            PyErr_Clear();
            ns = PyDict_New();
        }
    } else {
        ns = PyDict_New();
    }
    if (unlikely(!ns))
        return NULL;
    if (unlikely(PyObject_SetItem(ns, __pyx_n_s_module, modname) < 0)) goto bad;
    if (unlikely(PyObject_SetItem(ns, __pyx_n_s_qualname, qualname) < 0)) goto bad;
    if (unlikely(doc && PyObject_SetItem(ns, __pyx_n_s_doc, doc) < 0)) goto bad;
    return ns;
bad:
    Py_DECREF(ns);
    return NULL;
}
static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObject *bases,
                                      PyObject *dict, PyObject *mkw,
                                      int calculate_metaclass, int allow_py2_metaclass) {
    PyObject *result, *margs;
    PyObject *owned_metaclass = NULL;
    if (allow_py2_metaclass) {
        owned_metaclass = PyObject_GetItem(dict, __pyx_n_s_metaclass);
        if (owned_metaclass) {
            metaclass = owned_metaclass;
        } else if (likely(PyErr_ExceptionMatches(PyExc_KeyError))) {
            PyErr_Clear();
        } else {
            return NULL;
        }
    }
    if (calculate_metaclass && (!metaclass || PyType_Check(metaclass))) {
        metaclass = __Pyx_CalculateMetaclass((PyTypeObject*) metaclass, bases);
        Py_XDECREF(owned_metaclass);
        if (unlikely(!metaclass))
            return NULL;
        owned_metaclass = metaclass;
    }
    margs = PyTuple_Pack(3, name, bases, dict);
    if (unlikely(!margs)) {
        result = NULL;
    } else {
        result = PyObject_Call(metaclass, margs, mkw);
        Py_DECREF(margs);
    }
    Py_XDECREF(owned_metaclass);
    return result;
}

static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
    PyObject *empty_list = 0;
    PyObject *module = 0;
    PyObject *global_dict = 0;
    PyObject *empty_dict = 0;
    PyObject *list;
    #if PY_VERSION_HEX < 0x03030000
    PyObject *py_import;
    py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
    if (!py_import)
        goto bad;
    #endif
    if (from_list)
        list = from_list;
    else {
        empty_list = PyList_New(0);
        if (!empty_list)
            goto bad;
        list = empty_list;
    }
    global_dict = PyModule_GetDict(__pyx_m);
    if (!global_dict)
        goto bad;
    empty_dict = PyDict_New();
    if (!empty_dict)
        goto bad;
    #if PY_VERSION_HEX >= 0x02050000
    {
        #if PY_MAJOR_VERSION >= 3
        if (level == -1) {
            if (strchr(__Pyx_MODULE_NAME, '.')) {
                #if PY_VERSION_HEX < 0x03030000
                PyObject *py_level = PyInt_FromLong(1);
                if (!py_level)
                    goto bad;
                module = PyObject_CallFunctionObjArgs(py_import,
                    name, global_dict, empty_dict, list, py_level, NULL);
                Py_DECREF(py_level);
                #else
                module = PyImport_ImportModuleLevelObject(
                    name, global_dict, empty_dict, list, 1);
                #endif
                if (!module) {
                    if (!PyErr_ExceptionMatches(PyExc_ImportError))
                        goto bad;
                    PyErr_Clear();
                }
            }
            level = 0; /* try absolute import on failure */
        }
        #endif
        if (!module) {
            #if PY_VERSION_HEX < 0x03030000
            PyObject *py_level = PyInt_FromLong(level);
            if (!py_level)
                goto bad;
            module = PyObject_CallFunctionObjArgs(py_import,
                name, global_dict, empty_dict, list, py_level, NULL);
            Py_DECREF(py_level);
            #else
            module = PyImport_ImportModuleLevelObject(
                name, global_dict, empty_dict, list, level);
            #endif
        }
    }
    #else
    if (level>0) {
        PyErr_SetString(PyExc_RuntimeError, "Relative import is not supported for Python <=2.4.");
        goto bad;
    }
    module = PyObject_CallFunctionObjArgs(py_import,
        name, global_dict, empty_dict, list, NULL);
    #endif
bad:
    #if PY_VERSION_HEX < 0x03030000
    Py_XDECREF(py_import);
    #endif
    Py_XDECREF(empty_list);
    Py_XDECREF(empty_dict);
    return module;
}

static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) {
    const int neg_one = (int) -1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(int) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(int) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
        } else if (sizeof(int) <= sizeof(unsigned long long)) {
            return PyLong_FromUnsignedLongLong((unsigned long long) value);
        }
    } else {
        if (sizeof(int) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(int) <= sizeof(long long)) {
            return PyLong_FromLongLong((long long) value);
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(int),
                                     little, !is_unsigned);
    }
}

#define __PYX_VERIFY_RETURN_INT(target_type, func_type, func)             \
    {                                                                     \
        func_type value = func(x);                                        \
        if (sizeof(target_type) < sizeof(func_type)) {                    \
            if (unlikely(value != (func_type) (target_type) value)) {     \
                func_type zero = 0;                                       \
                PyErr_SetString(PyExc_OverflowError,                      \
                    (is_unsigned && unlikely(value < zero)) ?             \
                    "can't convert negative value to " #target_type :     \
                    "value too large to convert to " #target_type);       \
                return (target_type) -1;                                  \
            }                                                             \
        }                                                                 \
        return (target_type) value;                                       \
    }

#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
 #if CYTHON_USE_PYLONG_INTERNALS
  #include "longintrepr.h"
 #endif
#endif
static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
    const int neg_one = (int) -1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(int) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG)
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                PyErr_SetString(PyExc_OverflowError,
                                "can't convert negative value to int");
                return (int) -1;
            }
            return (int) val;
        }
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
 #if CYTHON_USE_PYLONG_INTERNALS
            if (sizeof(digit) <= sizeof(int)) {
                switch (Py_SIZE(x)) {
                    case  0: return 0;
                    case  1: return (int) ((PyLongObject*)x)->ob_digit[0];
                }
            }
 #endif
#endif
            if (unlikely(Py_SIZE(x) < 0)) {
                PyErr_SetString(PyExc_OverflowError,
                                "can't convert negative value to int");
                return (int) -1;
            }
            if (sizeof(int) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT(int, unsigned long, PyLong_AsUnsignedLong)
            } else if (sizeof(int) <= sizeof(unsigned long long)) {
                __PYX_VERIFY_RETURN_INT(int, unsigned long long, PyLong_AsUnsignedLongLong)
            }
        } else {
#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
 #if CYTHON_USE_PYLONG_INTERNALS
            if (sizeof(digit) <= sizeof(int)) {
                switch (Py_SIZE(x)) {
                    case  0: return 0;
                    case  1: return +(int) ((PyLongObject*)x)->ob_digit[0];
                    case -1: return -(int) ((PyLongObject*)x)->ob_digit[0];
                }
            }
 #endif
#endif
            if (sizeof(int) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT(int, long, PyLong_AsLong)
            } else if (sizeof(int) <= sizeof(long long)) {
                __PYX_VERIFY_RETURN_INT(int, long long, PyLong_AsLongLong)
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            int val;
            PyObject *v = __Pyx_PyNumber_Int(x);
 #if PY_MAJOR_VERSION < 3
            if (likely(v) && !PyLong_Check(v)) {
                PyObject *tmp = v;
                v = PyNumber_Long(tmp);
                Py_DECREF(tmp);
            }
 #endif
            if (likely(v)) {
                int one = 1; int is_little = (int)*(unsigned char *)&one;
                unsigned char *bytes = (unsigned char *)&val;
                int ret = _PyLong_AsByteArray((PyLongObject *)v,
                                              bytes, sizeof(val),
                                              is_little, !is_unsigned);
                Py_DECREF(v);
                if (likely(!ret))
                    return val;
            }
#endif
            return (int) -1;
        }
    } else {
        int val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (int) -1;
        val = __Pyx_PyInt_As_int(tmp);
        Py_DECREF(tmp);
        return val;
    }
}

#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
 #if CYTHON_USE_PYLONG_INTERNALS
  #include "longintrepr.h"
 #endif
#endif
static CYTHON_INLINE uint __Pyx_PyInt_As_uint(PyObject *x) {
    const uint neg_one = (uint) -1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(uint) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(uint, long, PyInt_AS_LONG)
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                PyErr_SetString(PyExc_OverflowError,
                                "can't convert negative value to uint");
                return (uint) -1;
            }
            return (uint) val;
        }
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
 #if CYTHON_USE_PYLONG_INTERNALS
            if (sizeof(digit) <= sizeof(uint)) {
                switch (Py_SIZE(x)) {
                    case  0: return 0;
                    case  1: return (uint) ((PyLongObject*)x)->ob_digit[0];
                }
            }
 #endif
#endif
            if (unlikely(Py_SIZE(x) < 0)) {
                PyErr_SetString(PyExc_OverflowError,
                                "can't convert negative value to uint");
                return (uint) -1;
            }
            if (sizeof(uint) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT(uint, unsigned long, PyLong_AsUnsignedLong)
            } else if (sizeof(uint) <= sizeof(unsigned long long)) {
                __PYX_VERIFY_RETURN_INT(uint, unsigned long long, PyLong_AsUnsignedLongLong)
            }
        } else {
#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
 #if CYTHON_USE_PYLONG_INTERNALS
            if (sizeof(digit) <= sizeof(uint)) {
                switch (Py_SIZE(x)) {
                    case  0: return 0;
                    case  1: return +(uint) ((PyLongObject*)x)->ob_digit[0];
                    case -1: return -(uint) ((PyLongObject*)x)->ob_digit[0];
                }
            }
 #endif
#endif
            if (sizeof(uint) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT(uint, long, PyLong_AsLong)
            } else if (sizeof(uint) <= sizeof(long long)) {
                __PYX_VERIFY_RETURN_INT(uint, long long, PyLong_AsLongLong)
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            uint val;
            PyObject *v = __Pyx_PyNumber_Int(x);
 #if PY_MAJOR_VERSION < 3
            if (likely(v) && !PyLong_Check(v)) {
                PyObject *tmp = v;
                v = PyNumber_Long(tmp);
                Py_DECREF(tmp);
            }
 #endif
            if (likely(v)) {
                int one = 1; int is_little = (int)*(unsigned char *)&one;
                unsigned char *bytes = (unsigned char *)&val;
                int ret = _PyLong_AsByteArray((PyLongObject *)v,
                                              bytes, sizeof(val),
                                              is_little, !is_unsigned);
                Py_DECREF(v);
                if (likely(!ret))
                    return val;
            }
#endif
            return (uint) -1;
        }
    } else {
        uint val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (uint) -1;
        val = __Pyx_PyInt_As_uint(tmp);
        Py_DECREF(tmp);
        return val;
    }
}

static CYTHON_INLINE PyObject* __Pyx_PyInt_From_uint(uint value) {
    const uint neg_one = (uint) -1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(uint) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(uint) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
        } else if (sizeof(uint) <= sizeof(unsigned long long)) {
            return PyLong_FromUnsignedLongLong((unsigned long long) value);
        }
    } else {
        if (sizeof(uint) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(uint) <= sizeof(long long)) {
            return PyLong_FromLongLong((long long) value);
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(uint),
                                     little, !is_unsigned);
    }
}

static CYTHON_INLINE PyObject* __Pyx_PyInt_From_EPR_Magic(EPR_Magic value) {
    const EPR_Magic neg_one = (EPR_Magic) -1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(EPR_Magic) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(EPR_Magic) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
        } else if (sizeof(EPR_Magic) <= sizeof(unsigned long long)) {
            return PyLong_FromUnsignedLongLong((unsigned long long) value);
        }
    } else {
        if (sizeof(EPR_Magic) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(EPR_Magic) <= sizeof(long long)) {
            return PyLong_FromLongLong((long long) value);
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(EPR_Magic),
                                     little, !is_unsigned);
    }
}

#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
 #if CYTHON_USE_PYLONG_INTERNALS
  #include "longintrepr.h"
 #endif
#endif
static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
    const long neg_one = (long) -1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(long) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG)
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                PyErr_SetString(PyExc_OverflowError,
                                "can't convert negative value to long");
                return (long) -1;
            }
            return (long) val;
        }
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
 #if CYTHON_USE_PYLONG_INTERNALS
            if (sizeof(digit) <= sizeof(long)) {
                switch (Py_SIZE(x)) {
                    case  0: return 0;
                    case  1: return (long) ((PyLongObject*)x)->ob_digit[0];
                }
            }
 #endif
#endif
            if (unlikely(Py_SIZE(x) < 0)) {
                PyErr_SetString(PyExc_OverflowError,
                                "can't convert negative value to long");
                return (long) -1;
            }
            if (sizeof(long) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT(long, unsigned long, PyLong_AsUnsignedLong)
            } else if (sizeof(long) <= sizeof(unsigned long long)) {
                __PYX_VERIFY_RETURN_INT(long, unsigned long long, PyLong_AsUnsignedLongLong)
            }
        } else {
#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
 #if CYTHON_USE_PYLONG_INTERNALS
            if (sizeof(digit) <= sizeof(long)) {
                switch (Py_SIZE(x)) {
                    case  0: return 0;
                    case  1: return +(long) ((PyLongObject*)x)->ob_digit[0];
                    case -1: return -(long) ((PyLongObject*)x)->ob_digit[0];
                }
            }
 #endif
#endif
            if (sizeof(long) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT(long, long, PyLong_AsLong)
            } else if (sizeof(long) <= sizeof(long long)) {
                __PYX_VERIFY_RETURN_INT(long, long long, PyLong_AsLongLong)
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            long val;
            PyObject *v = __Pyx_PyNumber_Int(x);
 #if PY_MAJOR_VERSION < 3
            if (likely(v) && !PyLong_Check(v)) {
                PyObject *tmp = v;
                v = PyNumber_Long(tmp);
                Py_DECREF(tmp);
            }
 #endif
            if (likely(v)) {
                int one = 1; int is_little = (int)*(unsigned char *)&one;
                unsigned char *bytes = (unsigned char *)&val;
                int ret = _PyLong_AsByteArray((PyLongObject *)v,
                                              bytes, sizeof(val),
                                              is_little, !is_unsigned);
                Py_DECREF(v);
                if (likely(!ret))
                    return val;
            }
#endif
            return (long) -1;
        }
    } else {
        long val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (long) -1;
        val = __Pyx_PyInt_As_long(tmp);
        Py_DECREF(tmp);
        return val;
    }
}

static CYTHON_INLINE PyObject* __Pyx_PyInt_From_uchar(uchar value) {
    const uchar neg_one = (uchar) -1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(uchar) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(uchar) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
        } else if (sizeof(uchar) <= sizeof(unsigned long long)) {
            return PyLong_FromUnsignedLongLong((unsigned long long) value);
        }
    } else {
        if (sizeof(uchar) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(uchar) <= sizeof(long long)) {
            return PyLong_FromLongLong((long long) value);
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(uchar),
                                     little, !is_unsigned);
    }
}

static CYTHON_INLINE PyObject* __Pyx_PyInt_From_char(char value) {
    const char neg_one = (char) -1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(char) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(char) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
        } else if (sizeof(char) <= sizeof(unsigned long long)) {
            return PyLong_FromUnsignedLongLong((unsigned long long) value);
        }
    } else {
        if (sizeof(char) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(char) <= sizeof(long long)) {
            return PyLong_FromLongLong((long long) value);
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(char),
                                     little, !is_unsigned);
    }
}

static CYTHON_INLINE PyObject* __Pyx_PyInt_From_ushort(ushort value) {
    const ushort neg_one = (ushort) -1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(ushort) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(ushort) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
        } else if (sizeof(ushort) <= sizeof(unsigned long long)) {
            return PyLong_FromUnsignedLongLong((unsigned long long) value);
        }
    } else {
        if (sizeof(ushort) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(ushort) <= sizeof(long long)) {
            return PyLong_FromLongLong((long long) value);
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(ushort),
                                     little, !is_unsigned);
    }
}

static CYTHON_INLINE PyObject* __Pyx_PyInt_From_short(short value) {
    const short neg_one = (short) -1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(short) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(short) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
        } else if (sizeof(short) <= sizeof(unsigned long long)) {
            return PyLong_FromUnsignedLongLong((unsigned long long) value);
        }
    } else {
        if (sizeof(short) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(short) <= sizeof(long long)) {
            return PyLong_FromLongLong((long long) value);
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(short),
                                     little, !is_unsigned);
    }
}

static CYTHON_INLINE PyObject* __Pyx_PyInt_From_Py_intptr_t(Py_intptr_t value) {
    const Py_intptr_t neg_one = (Py_intptr_t) -1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(Py_intptr_t) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(Py_intptr_t) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
        } else if (sizeof(Py_intptr_t) <= sizeof(unsigned long long)) {
            return PyLong_FromUnsignedLongLong((unsigned long long) value);
        }
    } else {
        if (sizeof(Py_intptr_t) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(Py_intptr_t) <= sizeof(long long)) {
            return PyLong_FromLongLong((long long) value);
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(Py_intptr_t),
                                     little, !is_unsigned);
    }
}

static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
    const long neg_one = (long) -1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(long) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(long) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
        } else if (sizeof(long) <= sizeof(unsigned long long)) {
            return PyLong_FromUnsignedLongLong((unsigned long long) value);
        }
    } else {
        if (sizeof(long) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(long) <= sizeof(long long)) {
            return PyLong_FromLongLong((long long) value);
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(long),
                                     little, !is_unsigned);
    }
}

#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
 #if CYTHON_USE_PYLONG_INTERNALS
  #include "longintrepr.h"
 #endif
#endif
static CYTHON_INLINE size_t __Pyx_PyInt_As_size_t(PyObject *x) {
    const size_t neg_one = (size_t) -1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(size_t) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(size_t, long, PyInt_AS_LONG)
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                PyErr_SetString(PyExc_OverflowError,
                                "can't convert negative value to size_t");
                return (size_t) -1;
            }
            return (size_t) val;
        }
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
 #if CYTHON_USE_PYLONG_INTERNALS
            if (sizeof(digit) <= sizeof(size_t)) {
                switch (Py_SIZE(x)) {
                    case  0: return 0;
                    case  1: return (size_t) ((PyLongObject*)x)->ob_digit[0];
                }
            }
 #endif
#endif
            if (unlikely(Py_SIZE(x) < 0)) {
                PyErr_SetString(PyExc_OverflowError,
                                "can't convert negative value to size_t");
                return (size_t) -1;
            }
            if (sizeof(size_t) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT(size_t, unsigned long, PyLong_AsUnsignedLong)
            } else if (sizeof(size_t) <= sizeof(unsigned long long)) {
                __PYX_VERIFY_RETURN_INT(size_t, unsigned long long, PyLong_AsUnsignedLongLong)
            }
        } else {
#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
 #if CYTHON_USE_PYLONG_INTERNALS
            if (sizeof(digit) <= sizeof(size_t)) {
                switch (Py_SIZE(x)) {
                    case  0: return 0;
                    case  1: return +(size_t) ((PyLongObject*)x)->ob_digit[0];
                    case -1: return -(size_t) ((PyLongObject*)x)->ob_digit[0];
                }
            }
 #endif
#endif
            if (sizeof(size_t) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT(size_t, long, PyLong_AsLong)
            } else if (sizeof(size_t) <= sizeof(long long)) {
                __PYX_VERIFY_RETURN_INT(size_t, long long, PyLong_AsLongLong)
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            size_t val;
            PyObject *v = __Pyx_PyNumber_Int(x);
 #if PY_MAJOR_VERSION < 3
            if (likely(v) && !PyLong_Check(v)) {
                PyObject *tmp = v;
                v = PyNumber_Long(tmp);
                Py_DECREF(tmp);
            }
 #endif
            if (likely(v)) {
                int one = 1; int is_little = (int)*(unsigned char *)&one;
                unsigned char *bytes = (unsigned char *)&val;
                int ret = _PyLong_AsByteArray((PyLongObject *)v,
                                              bytes, sizeof(val),
                                              is_little, !is_unsigned);
                Py_DECREF(v);
                if (likely(!ret))
                    return val;
            }
#endif
            return (size_t) -1;
        }
    } else {
        size_t val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (size_t) -1;
        val = __Pyx_PyInt_As_size_t(tmp);
        Py_DECREF(tmp);
        return val;
    }
}

#if CYTHON_CCOMPLEX
  #ifdef __cplusplus
    static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
      return ::std::complex< float >(x, y);
    }
  #else
    static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
      return x + y*(__pyx_t_float_complex)_Complex_I;
    }
  #endif
#else
    static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
      __pyx_t_float_complex z;
      z.real = x;
      z.imag = y;
      return z;
    }
#endif

#if CYTHON_CCOMPLEX
#else
    static CYTHON_INLINE int __Pyx_c_eqf(__pyx_t_float_complex a, __pyx_t_float_complex b) {
       return (a.real == b.real) && (a.imag == b.imag);
    }
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sumf(__pyx_t_float_complex a, __pyx_t_float_complex b) {
        __pyx_t_float_complex z;
        z.real = a.real + b.real;
        z.imag = a.imag + b.imag;
        return z;
    }
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_difff(__pyx_t_float_complex a, __pyx_t_float_complex b) {
        __pyx_t_float_complex z;
        z.real = a.real - b.real;
        z.imag = a.imag - b.imag;
        return z;
    }
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prodf(__pyx_t_float_complex a, __pyx_t_float_complex b) {
        __pyx_t_float_complex z;
        z.real = a.real * b.real - a.imag * b.imag;
        z.imag = a.real * b.imag + a.imag * b.real;
        return z;
    }
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quotf(__pyx_t_float_complex a, __pyx_t_float_complex b) {
        __pyx_t_float_complex z;
        float denom = b.real * b.real + b.imag * b.imag;
        z.real = (a.real * b.real + a.imag * b.imag) / denom;
        z.imag = (a.imag * b.real - a.real * b.imag) / denom;
        return z;
    }
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_negf(__pyx_t_float_complex a) {
        __pyx_t_float_complex z;
        z.real = -a.real;
        z.imag = -a.imag;
        return z;
    }
    static CYTHON_INLINE int __Pyx_c_is_zerof(__pyx_t_float_complex a) {
       return (a.real == 0) && (a.imag == 0);
    }
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conjf(__pyx_t_float_complex a) {
        __pyx_t_float_complex z;
        z.real =  a.real;
        z.imag = -a.imag;
        return z;
    }
    #if 1
        static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex z) {
          #if !defined(HAVE_HYPOT) || defined(_MSC_VER)
            return sqrtf(z.real*z.real + z.imag*z.imag);
          #else
            return hypotf(z.real, z.imag);
          #endif
        }
        static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_powf(__pyx_t_float_complex a, __pyx_t_float_complex b) {
            __pyx_t_float_complex z;
            float r, lnr, theta, z_r, z_theta;
            if (b.imag == 0 && b.real == (int)b.real) {
                if (b.real < 0) {
                    float denom = a.real * a.real + a.imag * a.imag;
                    a.real = a.real / denom;
                    a.imag = -a.imag / denom;
                    b.real = -b.real;
                }
                switch ((int)b.real) {
                    case 0:
                        z.real = 1;
                        z.imag = 0;
                        return z;
                    case 1:
                        return a;
                    case 2:
                        z = __Pyx_c_prodf(a, a);
                        return __Pyx_c_prodf(a, a);
                    case 3:
                        z = __Pyx_c_prodf(a, a);
                        return __Pyx_c_prodf(z, a);
                    case 4:
                        z = __Pyx_c_prodf(a, a);
                        return __Pyx_c_prodf(z, z);
                }
            }
            if (a.imag == 0) {
                if (a.real == 0) {
                    return a;
                }
                r = a.real;
                theta = 0;
            } else {
                r = __Pyx_c_absf(a);
                theta = atan2f(a.imag, a.real);
            }
            lnr = logf(r);
            z_r = expf(lnr * b.real - theta * b.imag);
            z_theta = theta * b.real + lnr * b.imag;
            z.real = z_r * cosf(z_theta);
            z.imag = z_r * sinf(z_theta);
            return z;
        }
    #endif
#endif

#if CYTHON_CCOMPLEX
  #ifdef __cplusplus
    static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
      return ::std::complex< double >(x, y);
    }
  #else
    static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
      return x + y*(__pyx_t_double_complex)_Complex_I;
    }
  #endif
#else
    static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
      __pyx_t_double_complex z;
      z.real = x;
      z.imag = y;
      return z;
    }
#endif

#if CYTHON_CCOMPLEX
#else
    static CYTHON_INLINE int __Pyx_c_eq(__pyx_t_double_complex a, __pyx_t_double_complex b) {
       return (a.real == b.real) && (a.imag == b.imag);
    }
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum(__pyx_t_double_complex a, __pyx_t_double_complex b) {
        __pyx_t_double_complex z;
        z.real = a.real + b.real;
        z.imag = a.imag + b.imag;
        return z;
    }
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff(__pyx_t_double_complex a, __pyx_t_double_complex b) {
        __pyx_t_double_complex z;
        z.real = a.real - b.real;
        z.imag = a.imag - b.imag;
        return z;
    }
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod(__pyx_t_double_complex a, __pyx_t_double_complex b) {
        __pyx_t_double_complex z;
        z.real = a.real * b.real - a.imag * b.imag;
        z.imag = a.real * b.imag + a.imag * b.real;
        return z;
    }
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot(__pyx_t_double_complex a, __pyx_t_double_complex b) {
        __pyx_t_double_complex z;
        double denom = b.real * b.real + b.imag * b.imag;
        z.real = (a.real * b.real + a.imag * b.imag) / denom;
        z.imag = (a.imag * b.real - a.real * b.imag) / denom;
        return z;
    }
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg(__pyx_t_double_complex a) {
        __pyx_t_double_complex z;
        z.real = -a.real;
        z.imag = -a.imag;
        return z;
    }
    static CYTHON_INLINE int __Pyx_c_is_zero(__pyx_t_double_complex a) {
       return (a.real == 0) && (a.imag == 0);
    }
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj(__pyx_t_double_complex a) {
        __pyx_t_double_complex z;
        z.real =  a.real;
        z.imag = -a.imag;
        return z;
    }
    #if 1
        static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex z) {
          #if !defined(HAVE_HYPOT) || defined(_MSC_VER)
            return sqrt(z.real*z.real + z.imag*z.imag);
          #else
            return hypot(z.real, z.imag);
          #endif
        }
        static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow(__pyx_t_double_complex a, __pyx_t_double_complex b) {
            __pyx_t_double_complex z;
            double r, lnr, theta, z_r, z_theta;
            if (b.imag == 0 && b.real == (int)b.real) {
                if (b.real < 0) {
                    double denom = a.real * a.real + a.imag * a.imag;
                    a.real = a.real / denom;
                    a.imag = -a.imag / denom;
                    b.real = -b.real;
                }
                switch ((int)b.real) {
                    case 0:
                        z.real = 1;
                        z.imag = 0;
                        return z;
                    case 1:
                        return a;
                    case 2:
                        z = __Pyx_c_prod(a, a);
                        return __Pyx_c_prod(a, a);
                    case 3:
                        z = __Pyx_c_prod(a, a);
                        return __Pyx_c_prod(z, a);
                    case 4:
                        z = __Pyx_c_prod(a, a);
                        return __Pyx_c_prod(z, z);
                }
            }
            if (a.imag == 0) {
                if (a.real == 0) {
                    return a;
                }
                r = a.real;
                theta = 0;
            } else {
                r = __Pyx_c_abs(a);
                theta = atan2(a.imag, a.real);
            }
            lnr = log(r);
            z_r = exp(lnr * b.real - theta * b.imag);
            z_theta = theta * b.real + lnr * b.imag;
            z.real = z_r * cos(z_theta);
            z.imag = z_r * sin(z_theta);
            return z;
        }
    #endif
#endif

static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb) {
    PyObject *tmp_type, *tmp_value, *tmp_tb;
#if CYTHON_COMPILING_IN_CPYTHON
    PyThreadState *tstate = PyThreadState_GET();
    tmp_type = tstate->exc_type;
    tmp_value = tstate->exc_value;
    tmp_tb = tstate->exc_traceback;
    tstate->exc_type = *type;
    tstate->exc_value = *value;
    tstate->exc_traceback = *tb;
#else
    PyErr_GetExcInfo(&tmp_type, &tmp_value, &tmp_tb);
    PyErr_SetExcInfo(*type, *value, *tb);
#endif
    *type = tmp_type;
    *value = tmp_value;
    *tb = tmp_tb;
}

static PyObject *__Pyx_Generator_Next(PyObject *self);
static PyObject *__Pyx_Generator_Send(PyObject *self, PyObject *value);
static PyObject *__Pyx_Generator_Close(PyObject *self);
static PyObject *__Pyx_Generator_Throw(PyObject *gen, PyObject *args);
static PyTypeObject *__pyx_GeneratorType = 0;
#define __Pyx_Generator_CheckExact(obj) (Py_TYPE(obj) == __pyx_GeneratorType)
#define __Pyx_Generator_Undelegate(gen) Py_CLEAR((gen)->yieldfrom)
#if 1 || PY_VERSION_HEX < 0x030300B0
static int __Pyx_PyGen_FetchStopIterationValue(PyObject **pvalue) {
    PyObject *et, *ev, *tb;
    PyObject *value = NULL;
    __Pyx_ErrFetch(&et, &ev, &tb);
    if (!et) {
        Py_XDECREF(tb);
        Py_XDECREF(ev);
        Py_INCREF(Py_None);
        *pvalue = Py_None;
        return 0;
    }
    if (unlikely(et != PyExc_StopIteration) &&
            unlikely(!PyErr_GivenExceptionMatches(et, PyExc_StopIteration))) {
        __Pyx_ErrRestore(et, ev, tb);
        return -1;
    }
    if (likely(et == PyExc_StopIteration)) {
        if (likely(!ev) || !PyObject_IsInstance(ev, PyExc_StopIteration)) {
            if (!ev) {
                Py_INCREF(Py_None);
                ev = Py_None;
            }
            Py_XDECREF(tb);
            Py_DECREF(et);
            *pvalue = ev;
            return 0;
        }
    }
    PyErr_NormalizeException(&et, &ev, &tb);
    if (unlikely(!PyObject_IsInstance(ev, PyExc_StopIteration))) {
        __Pyx_ErrRestore(et, ev, tb);
        return -1;
    }
    Py_XDECREF(tb);
    Py_DECREF(et);
#if PY_VERSION_HEX >= 0x030300A0
    value = ((PyStopIterationObject *)ev)->value;
    Py_INCREF(value);
    Py_DECREF(ev);
#else
    {
        PyObject* args = PyObject_GetAttr(ev, __pyx_n_s_args);
        Py_DECREF(ev);
        if (likely(args)) {
            value = PyObject_GetItem(args, 0);
            Py_DECREF(args);
        }
        if (unlikely(!value)) {
            __Pyx_ErrRestore(NULL, NULL, NULL);
            Py_INCREF(Py_None);
            value = Py_None;
        }
    }
#endif
    *pvalue = value;
    return 0;
}
#endif
static CYTHON_INLINE
void __Pyx_Generator_ExceptionClear(__pyx_GeneratorObject *self) {
    PyObject *exc_type = self->exc_type;
    PyObject *exc_value = self->exc_value;
    PyObject *exc_traceback = self->exc_traceback;
    self->exc_type = NULL;
    self->exc_value = NULL;
    self->exc_traceback = NULL;
    Py_XDECREF(exc_type);
    Py_XDECREF(exc_value);
    Py_XDECREF(exc_traceback);
}
static CYTHON_INLINE
int __Pyx_Generator_CheckRunning(__pyx_GeneratorObject *gen) {
    if (unlikely(gen->is_running)) {
        PyErr_SetString(PyExc_ValueError,
                        "generator already executing");
        return 1;
    }
    return 0;
}
static CYTHON_INLINE
PyObject *__Pyx_Generator_SendEx(__pyx_GeneratorObject *self, PyObject *value) {
    PyObject *retval;
    assert(!self->is_running);
    if (unlikely(self->resume_label == 0)) {
        if (unlikely(value && value != Py_None)) {
            PyErr_SetString(PyExc_TypeError,
                            "can't send non-None value to a "
                            "just-started generator");
            return NULL;
        }
    }
    if (unlikely(self->resume_label == -1)) {
        PyErr_SetNone(PyExc_StopIteration);
        return NULL;
    }
    if (value) {
#if CYTHON_COMPILING_IN_PYPY
#else
        /* Generators always return to their most recent caller, not
         * necessarily their creator. */
        if (self->exc_traceback) {
            PyThreadState *tstate = PyThreadState_GET();
            PyTracebackObject *tb = (PyTracebackObject *) self->exc_traceback;
            PyFrameObject *f = tb->tb_frame;
            Py_XINCREF(tstate->frame);
            assert(f->f_back == NULL);
            f->f_back = tstate->frame;
        }
#endif
        __Pyx_ExceptionSwap(&self->exc_type, &self->exc_value,
                            &self->exc_traceback);
    } else {
        __Pyx_Generator_ExceptionClear(self);
    }
    self->is_running = 1;
    retval = self->body((PyObject *) self, value);
    self->is_running = 0;
    if (retval) {
        __Pyx_ExceptionSwap(&self->exc_type, &self->exc_value,
                            &self->exc_traceback);
#if CYTHON_COMPILING_IN_PYPY
#else
        /* Don't keep the reference to f_back any longer than necessary.  It
         * may keep a chain of frames alive or it could create a reference
         * cycle. */
        if (self->exc_traceback) {
            PyTracebackObject *tb = (PyTracebackObject *) self->exc_traceback;
            PyFrameObject *f = tb->tb_frame;
            Py_CLEAR(f->f_back);
        }
#endif
    } else {
        __Pyx_Generator_ExceptionClear(self);
    }
    return retval;
}
static CYTHON_INLINE
PyObject *__Pyx_Generator_FinishDelegation(__pyx_GeneratorObject *gen) {
    PyObject *ret;
    PyObject *val = NULL;
    __Pyx_Generator_Undelegate(gen);
    __Pyx_PyGen_FetchStopIterationValue(&val);
    ret = __Pyx_Generator_SendEx(gen, val);
    Py_XDECREF(val);
    return ret;
}
static PyObject *__Pyx_Generator_Next(PyObject *self) {
    __pyx_GeneratorObject *gen = (__pyx_GeneratorObject*) self;
    PyObject *yf = gen->yieldfrom;
    if (unlikely(__Pyx_Generator_CheckRunning(gen)))
        return NULL;
    if (yf) {
        PyObject *ret;
        gen->is_running = 1;
        ret = Py_TYPE(yf)->tp_iternext(yf);
        gen->is_running = 0;
        if (likely(ret)) {
            return ret;
        }
        return __Pyx_Generator_FinishDelegation(gen);
    }
    return __Pyx_Generator_SendEx(gen, Py_None);
}
static PyObject *__Pyx_Generator_Send(PyObject *self, PyObject *value) {
    __pyx_GeneratorObject *gen = (__pyx_GeneratorObject*) self;
    PyObject *yf = gen->yieldfrom;
    if (unlikely(__Pyx_Generator_CheckRunning(gen)))
        return NULL;
    if (yf) {
        PyObject *ret;
        gen->is_running = 1;
        if (__Pyx_Generator_CheckExact(yf)) {
            ret = __Pyx_Generator_Send(yf, value);
        } else {
            if (value == Py_None)
                ret = PyIter_Next(yf);
            else
                ret = __Pyx_PyObject_CallMethod1(yf, __pyx_n_s_send, value);
        }
        gen->is_running = 0;
        if (likely(ret)) {
            return ret;
        }
        return __Pyx_Generator_FinishDelegation(gen);
    }
    return __Pyx_Generator_SendEx(gen, value);
}
static int __Pyx_Generator_CloseIter(__pyx_GeneratorObject *gen, PyObject *yf) {
    PyObject *retval = NULL;
    int err = 0;
    if (__Pyx_Generator_CheckExact(yf)) {
        retval = __Pyx_Generator_Close(yf);
        if (!retval)
            return -1;
    } else {
        PyObject *meth;
        gen->is_running = 1;
        meth = PyObject_GetAttr(yf, __pyx_n_s_close);
        if (unlikely(!meth)) {
            if (!PyErr_ExceptionMatches(PyExc_AttributeError)) {
                PyErr_WriteUnraisable(yf);
            }
            PyErr_Clear();
        } else {
            retval = PyObject_CallFunction(meth, NULL);
            Py_DECREF(meth);
            if (!retval)
                err = -1;
        }
        gen->is_running = 0;
    }
    Py_XDECREF(retval);
    return err;
}
static PyObject *__Pyx_Generator_Close(PyObject *self) {
    __pyx_GeneratorObject *gen = (__pyx_GeneratorObject *) self;
    PyObject *retval, *raised_exception;
    PyObject *yf = gen->yieldfrom;
    int err = 0;
    if (unlikely(__Pyx_Generator_CheckRunning(gen)))
        return NULL;
    if (yf) {
        Py_INCREF(yf);
        err = __Pyx_Generator_CloseIter(gen, yf);
        __Pyx_Generator_Undelegate(gen);
        Py_DECREF(yf);
    }
    if (err == 0)
#if PY_VERSION_HEX < 0x02050000
        PyErr_SetNone(PyExc_StopIteration);
#else
        PyErr_SetNone(PyExc_GeneratorExit);
#endif
    retval = __Pyx_Generator_SendEx(gen, NULL);
    if (retval) {
        Py_DECREF(retval);
        PyErr_SetString(PyExc_RuntimeError,
                        "generator ignored GeneratorExit");
        return NULL;
    }
    raised_exception = PyErr_Occurred();
    if (!raised_exception
        || raised_exception == PyExc_StopIteration
#if PY_VERSION_HEX >= 0x02050000
        || raised_exception == PyExc_GeneratorExit
        || PyErr_GivenExceptionMatches(raised_exception, PyExc_GeneratorExit)
#endif
        || PyErr_GivenExceptionMatches(raised_exception, PyExc_StopIteration))
    {
        if (raised_exception) PyErr_Clear();      /* ignore these errors */
        Py_INCREF(Py_None);
        return Py_None;
    }
    return NULL;
}
static PyObject *__Pyx_Generator_Throw(PyObject *self, PyObject *args) {
    __pyx_GeneratorObject *gen = (__pyx_GeneratorObject *) self;
    PyObject *typ;
    PyObject *tb = NULL;
    PyObject *val = NULL;
    PyObject *yf = gen->yieldfrom;
    if (!PyArg_UnpackTuple(args, (char *)"throw", 1, 3, &typ, &val, &tb))
        return NULL;
    if (unlikely(__Pyx_Generator_CheckRunning(gen)))
        return NULL;
    if (yf) {
        PyObject *ret;
        Py_INCREF(yf);
#if PY_VERSION_HEX >= 0x02050000
        if (PyErr_GivenExceptionMatches(typ, PyExc_GeneratorExit)) {
            int err = __Pyx_Generator_CloseIter(gen, yf);
            Py_DECREF(yf);
            __Pyx_Generator_Undelegate(gen);
            if (err < 0)
                return __Pyx_Generator_SendEx(gen, NULL);
            goto throw_here;
        }
#endif
        gen->is_running = 1;
        if (__Pyx_Generator_CheckExact(yf)) {
            ret = __Pyx_Generator_Throw(yf, args);
        } else {
            PyObject *meth = PyObject_GetAttr(yf, __pyx_n_s_throw);
            if (unlikely(!meth)) {
                Py_DECREF(yf);
                if (!PyErr_ExceptionMatches(PyExc_AttributeError)) {
                    gen->is_running = 0;
                    return NULL;
                }
                PyErr_Clear();
                __Pyx_Generator_Undelegate(gen);
                gen->is_running = 0;
                goto throw_here;
            }
            ret = PyObject_CallObject(meth, args);
            Py_DECREF(meth);
        }
        gen->is_running = 0;
        Py_DECREF(yf);
        if (!ret) {
            ret = __Pyx_Generator_FinishDelegation(gen);
        }
        return ret;
    }
throw_here:
    __Pyx_Raise(typ, val, tb, NULL);
    return __Pyx_Generator_SendEx(gen, NULL);
}
static int __Pyx_Generator_traverse(PyObject *self, visitproc visit, void *arg) {
    __pyx_GeneratorObject *gen = (__pyx_GeneratorObject *) self;
    Py_VISIT(gen->closure);
    Py_VISIT(gen->classobj);
    Py_VISIT(gen->yieldfrom);
    Py_VISIT(gen->exc_type);
    Py_VISIT(gen->exc_value);
    Py_VISIT(gen->exc_traceback);
    return 0;
}
static int __Pyx_Generator_clear(PyObject *self) {
    __pyx_GeneratorObject *gen = (__pyx_GeneratorObject *) self;
    Py_CLEAR(gen->closure);
    Py_CLEAR(gen->classobj);
    Py_CLEAR(gen->yieldfrom);
    Py_CLEAR(gen->exc_type);
    Py_CLEAR(gen->exc_value);
    Py_CLEAR(gen->exc_traceback);
    return 0;
}
static void __Pyx_Generator_dealloc(PyObject *self) {
    __pyx_GeneratorObject *gen = (__pyx_GeneratorObject *) self;
    PyObject_GC_UnTrack(gen);
    if (gen->gi_weakreflist != NULL)
        PyObject_ClearWeakRefs(self);
    if (gen->resume_label > 0) {
        PyObject_GC_Track(self);
#if PY_VERSION_HEX >= 0x030400a1
        if (PyObject_CallFinalizerFromDealloc(self))
#else
        Py_TYPE(gen)->tp_del(self);
        if (self->ob_refcnt > 0)
#endif
            return;                     /* resurrected.  :( */
        PyObject_GC_UnTrack(self);
    }
    __Pyx_Generator_clear(self);
    PyObject_GC_Del(gen);
}
static void __Pyx_Generator_del(PyObject *self) {
    PyObject *res;
    PyObject *error_type, *error_value, *error_traceback;
    __pyx_GeneratorObject *gen = (__pyx_GeneratorObject *) self;
    if (gen->resume_label <= 0)
        return ;
#if PY_VERSION_HEX < 0x030400a1
    assert(self->ob_refcnt == 0);
    self->ob_refcnt = 1;
#endif
    __Pyx_ErrFetch(&error_type, &error_value, &error_traceback);
    res = __Pyx_Generator_Close(self);
    if (res == NULL)
        PyErr_WriteUnraisable(self);
    else
        Py_DECREF(res);
    __Pyx_ErrRestore(error_type, error_value, error_traceback);
#if PY_VERSION_HEX < 0x030400a1
    /* Undo the temporary resurrection; can't use DECREF here, it would
     * cause a recursive call.
     */
    assert(self->ob_refcnt > 0);
    if (--self->ob_refcnt == 0)
        return; /* this is the normal path out */
    /* close() resurrected it!  Make it look like the original Py_DECREF
     * never happened.
     */
    {
        Py_ssize_t refcnt = self->ob_refcnt;
        _Py_NewReference(self);
        self->ob_refcnt = refcnt;
    }
#if CYTHON_COMPILING_IN_CPYTHON
    assert(PyType_IS_GC(self->ob_type) &&
           _Py_AS_GC(self)->gc.gc_refs != _PyGC_REFS_UNTRACKED);
    /* If Py_REF_DEBUG, _Py_NewReference bumped _Py_RefTotal, so
     * we need to undo that. */
    _Py_DEC_REFTOTAL;
#endif
    /* If Py_TRACE_REFS, _Py_NewReference re-added self to the object
     * chain, so no more to do there.
     * If COUNT_ALLOCS, the original decref bumped tp_frees, and
     * _Py_NewReference bumped tp_allocs:  both of those need to be
     * undone.
     */
#ifdef COUNT_ALLOCS
    --Py_TYPE(self)->tp_frees;
    --Py_TYPE(self)->tp_allocs;
#endif
#endif
}
static PyMemberDef __pyx_Generator_memberlist[] = {
    {(char *) "gi_running",
#if PY_VERSION_HEX >= 0x02060000
     T_BOOL,
#else
     T_BYTE,
#endif
     offsetof(__pyx_GeneratorObject, is_running),
     READONLY,
     NULL},
    {0, 0, 0, 0, 0}
};
static PyMethodDef __pyx_Generator_methods[] = {
    {__Pyx_NAMESTR("send"), (PyCFunction) __Pyx_Generator_Send, METH_O, 0},
    {__Pyx_NAMESTR("throw"), (PyCFunction) __Pyx_Generator_Throw, METH_VARARGS, 0},
    {__Pyx_NAMESTR("close"), (PyCFunction) __Pyx_Generator_Close, METH_NOARGS, 0},
    {0, 0, 0, 0}
};
static PyTypeObject __pyx_GeneratorType_type = {
    PyVarObject_HEAD_INIT(0, 0)
    __Pyx_NAMESTR("generator"),         /*tp_name*/
    sizeof(__pyx_GeneratorObject),      /*tp_basicsize*/
    0,                                  /*tp_itemsize*/
    (destructor) __Pyx_Generator_dealloc,/*tp_dealloc*/
    0,                                  /*tp_print*/
    0,                                  /*tp_getattr*/
    0,                                  /*tp_setattr*/
#if PY_MAJOR_VERSION < 3
    0,                                  /*tp_compare*/
#else
    0,                                  /*reserved*/
#endif
    0,                                   /*tp_repr*/
    0,                                  /*tp_as_number*/
    0,                                  /*tp_as_sequence*/
    0,                                  /*tp_as_mapping*/
    0,                                  /*tp_hash*/
    0,                                  /*tp_call*/
    0,                                  /*tp_str*/
    0,                                  /*tp_getattro*/
    0,                                  /*tp_setattro*/
    0,                                  /*tp_as_buffer*/
    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_HAVE_FINALIZE, /* tp_flags*/
    0,                                  /*tp_doc*/
    (traverseproc) __Pyx_Generator_traverse,   /*tp_traverse*/
    0,                                  /*tp_clear*/
    0,                                  /*tp_richcompare*/
    offsetof(__pyx_GeneratorObject, gi_weakreflist), /* tp_weaklistoffse */
    0,                                  /*tp_iter*/
    (iternextfunc) __Pyx_Generator_Next, /*tp_iternext*/
    __pyx_Generator_methods,            /*tp_methods*/
    __pyx_Generator_memberlist,         /*tp_members*/
    0,                                  /*tp_getset*/
    0,                                  /*tp_base*/
    0,                                  /*tp_dict*/
    0,                                  /*tp_descr_get*/
    0,                                  /*tp_descr_set*/
    0,                                  /*tp_dictoffset*/
    0,                                  /*tp_init*/
    0,                                  /*tp_alloc*/
    0,                                  /*tp_new*/
    0,                                  /*tp_free*/
    0,                                  /*tp_is_gc*/
    0,                                  /*tp_bases*/
    0,                                  /*tp_mro*/
    0,                                  /*tp_cache*/
    0,                                  /*tp_subclasses*/
    0,                                  /*tp_weaklist*/
#if PY_VERSION_HEX >= 0x030400a1
    0,                                  /*tp_del*/
#else
    __Pyx_Generator_del,                /*tp_del*/
#endif
#if PY_VERSION_HEX >= 0x02060000
    0,                                  /*tp_version_tag*/
#endif
#if PY_VERSION_HEX >= 0x030400a1
    __Pyx_Generator_del,                /*tp_finalize*/
#endif
};
static __pyx_GeneratorObject *__Pyx_Generator_New(__pyx_generator_body_t body,
                                                  PyObject *closure) {
    __pyx_GeneratorObject *gen =
        PyObject_GC_New(__pyx_GeneratorObject, &__pyx_GeneratorType_type);
    if (gen == NULL)
        return NULL;
    gen->body = body;
    gen->closure = closure;
    Py_XINCREF(closure);
    gen->is_running = 0;
    gen->resume_label = 0;
    gen->classobj = NULL;
    gen->yieldfrom = NULL;
    gen->exc_type = NULL;
    gen->exc_value = NULL;
    gen->exc_traceback = NULL;
    gen->gi_weakreflist = NULL;
    PyObject_GC_Track(gen);
    return gen;
}
static int __pyx_Generator_init(void) {
    __pyx_GeneratorType_type.tp_getattro = PyObject_GenericGetAttr;
    __pyx_GeneratorType_type.tp_iter = PyObject_SelfIter;
    __pyx_GeneratorType = __Pyx_FetchCommonType(&__pyx_GeneratorType_type);
    if (__pyx_GeneratorType == NULL) {
        return -1;
    }
    return 0;
}

static int __Pyx_check_binary_version(void) {
    char ctversion[4], rtversion[4];
    PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
    PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion());
    if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) {
        char message[200];
        PyOS_snprintf(message, sizeof(message),
                      "compiletime version %s of module '%.100s' "
                      "does not match runtime version %s",
                      ctversion, __Pyx_MODULE_NAME, rtversion);
        #if PY_VERSION_HEX < 0x02050000
        return PyErr_Warn(NULL, message);
        #else
        return PyErr_WarnEx(NULL, message, 1);
        #endif
    }
    return 0;
}

#ifndef __PYX_HAVE_RT_ImportModule
#define __PYX_HAVE_RT_ImportModule
static PyObject *__Pyx_ImportModule(const char *name) {
    PyObject *py_name = 0;
    PyObject *py_module = 0;
    py_name = __Pyx_PyIdentifier_FromString(name);
    if (!py_name)
        goto bad;
    py_module = PyImport_Import(py_name);
    Py_DECREF(py_name);
    return py_module;
bad:
    Py_XDECREF(py_name);
    return 0;
}
#endif

#ifndef __PYX_HAVE_RT_ImportType
#define __PYX_HAVE_RT_ImportType
static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name,
    size_t size, int strict)
{
    PyObject *py_module = 0;
    PyObject *result = 0;
    PyObject *py_name = 0;
    char warning[200];
    Py_ssize_t basicsize;
#ifdef Py_LIMITED_API
    PyObject *py_basicsize;
#endif
    py_module = __Pyx_ImportModule(module_name);
    if (!py_module)
        goto bad;
    py_name = __Pyx_PyIdentifier_FromString(class_name);
    if (!py_name)
        goto bad;
    result = PyObject_GetAttr(py_module, py_name);
    Py_DECREF(py_name);
    py_name = 0;
    Py_DECREF(py_module);
    py_module = 0;
    if (!result)
        goto bad;
    if (!PyType_Check(result)) {
        PyErr_Format(PyExc_TypeError,
            "%.200s.%.200s is not a type object",
            module_name, class_name);
        goto bad;
    }
#ifndef Py_LIMITED_API
    basicsize = ((PyTypeObject *)result)->tp_basicsize;
#else
    py_basicsize = PyObject_GetAttrString(result, "__basicsize__");
    if (!py_basicsize)
        goto bad;
    basicsize = PyLong_AsSsize_t(py_basicsize);
    Py_DECREF(py_basicsize);
    py_basicsize = 0;
    if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred())
        goto bad;
#endif
    if (!strict && (size_t)basicsize > size) {
        PyOS_snprintf(warning, sizeof(warning),
            "%s.%s size changed, may indicate binary incompatibility",
            module_name, class_name);
        #if PY_VERSION_HEX < 0x02050000
        if (PyErr_Warn(NULL, warning) < 0) goto bad;
        #else
        if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad;
        #endif
    }
    else if ((size_t)basicsize != size) {
        PyErr_Format(PyExc_ValueError,
            "%.200s.%.200s has the wrong size, try recompiling",
            module_name, class_name);
        goto bad;
    }
    return (PyTypeObject *)result;
bad:
    Py_XDECREF(py_module);
    Py_XDECREF(result);
    return NULL;
}
#endif

static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
    int start = 0, mid = 0, end = count - 1;
    if (end >= 0 && code_line > entries[end].code_line) {
        return count;
    }
    while (start < end) {
        mid = (start + end) / 2;
        if (code_line < entries[mid].code_line) {
            end = mid;
        } else if (code_line > entries[mid].code_line) {
             start = mid + 1;
        } else {
            return mid;
        }
    }
    if (code_line <= entries[mid].code_line) {
        return mid;
    } else {
        return mid + 1;
    }
}
static PyCodeObject *__pyx_find_code_object(int code_line) {
    PyCodeObject* code_object;
    int pos;
    if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
        return NULL;
    }
    pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
    if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
        return NULL;
    }
    code_object = __pyx_code_cache.entries[pos].code_object;
    Py_INCREF(code_object);
    return code_object;
}
static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
    int pos, i;
    __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
    if (unlikely(!code_line)) {
        return;
    }
    if (unlikely(!entries)) {
        entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
        if (likely(entries)) {
            __pyx_code_cache.entries = entries;
            __pyx_code_cache.max_count = 64;
            __pyx_code_cache.count = 1;
            entries[0].code_line = code_line;
            entries[0].code_object = code_object;
            Py_INCREF(code_object);
        }
        return;
    }
    pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
    if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
        PyCodeObject* tmp = entries[pos].code_object;
        entries[pos].code_object = code_object;
        Py_DECREF(tmp);
        return;
    }
    if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
        int new_max = __pyx_code_cache.max_count + 64;
        entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
            __pyx_code_cache.entries, (size_t)new_max*sizeof(__Pyx_CodeObjectCacheEntry));
        if (unlikely(!entries)) {
            return;
        }
        __pyx_code_cache.entries = entries;
        __pyx_code_cache.max_count = new_max;
    }
    for (i=__pyx_code_cache.count; i>pos; i--) {
        entries[i] = entries[i-1];
    }
    entries[pos].code_line = code_line;
    entries[pos].code_object = code_object;
    __pyx_code_cache.count++;
    Py_INCREF(code_object);
}

#include "compile.h"
#include "frameobject.h"
#include "traceback.h"
static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
            const char *funcname, int c_line,
            int py_line, const char *filename) {
    PyCodeObject *py_code = 0;
    PyObject *py_srcfile = 0;
    PyObject *py_funcname = 0;
    #if PY_MAJOR_VERSION < 3
    py_srcfile = PyString_FromString(filename);
    #else
    py_srcfile = PyUnicode_FromString(filename);
    #endif
    if (!py_srcfile) goto bad;
    if (c_line) {
        #if PY_MAJOR_VERSION < 3
        py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
        #else
        py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
        #endif
    }
    else {
        #if PY_MAJOR_VERSION < 3
        py_funcname = PyString_FromString(funcname);
        #else
        py_funcname = PyUnicode_FromString(funcname);
        #endif
    }
    if (!py_funcname) goto bad;
    py_code = __Pyx_PyCode_New(
        0,            /*int argcount,*/
        0,            /*int kwonlyargcount,*/
        0,            /*int nlocals,*/
        0,            /*int stacksize,*/
        0,            /*int flags,*/
        __pyx_empty_bytes, /*PyObject *code,*/
        __pyx_empty_tuple, /*PyObject *consts,*/
        __pyx_empty_tuple, /*PyObject *names,*/
        __pyx_empty_tuple, /*PyObject *varnames,*/
        __pyx_empty_tuple, /*PyObject *freevars,*/
        __pyx_empty_tuple, /*PyObject *cellvars,*/
        py_srcfile,   /*PyObject *filename,*/
        py_funcname,  /*PyObject *name,*/
        py_line,      /*int firstlineno,*/
        __pyx_empty_bytes  /*PyObject *lnotab*/
    );
    Py_DECREF(py_srcfile);
    Py_DECREF(py_funcname);
    return py_code;
bad:
    Py_XDECREF(py_srcfile);
    Py_XDECREF(py_funcname);
    return NULL;
}
static void __Pyx_AddTraceback(const char *funcname, int c_line,
                               int py_line, const char *filename) {
    PyCodeObject *py_code = 0;
    PyObject *py_globals = 0;
    PyFrameObject *py_frame = 0;
    py_code = __pyx_find_code_object(c_line ? c_line : py_line);
    if (!py_code) {
        py_code = __Pyx_CreateCodeObjectForTraceback(
            funcname, c_line, py_line, filename);
        if (!py_code) goto bad;
        __pyx_insert_code_object(c_line ? c_line : py_line, py_code);
    }
    py_globals = PyModule_GetDict(__pyx_m);
    if (!py_globals) goto bad;
    py_frame = PyFrame_New(
        PyThreadState_GET(), /*PyThreadState *tstate,*/
        py_code,             /*PyCodeObject *code,*/
        py_globals,          /*PyObject *globals,*/
        0                    /*PyObject *locals*/
    );
    if (!py_frame) goto bad;
    py_frame->f_lineno = py_line;
    PyTraceBack_Here(py_frame);
bad:
    Py_XDECREF(py_code);
    Py_XDECREF(py_frame);
}

static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
    while (t->p) {
        #if PY_MAJOR_VERSION < 3
        if (t->is_unicode) {
            *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
        } else if (t->intern) {
            *t->p = PyString_InternFromString(t->s);
        } else {
            *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
        }
        #else  /* Python 3+ has unicode identifiers */
        if (t->is_unicode | t->is_str) {
            if (t->intern) {
                *t->p = PyUnicode_InternFromString(t->s);
            } else if (t->encoding) {
                *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
            } else {
                *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
            }
        } else {
            *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
        }
        #endif
        if (!*t->p)
            return -1;
        ++t;
    }
    return 0;
}

static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
    return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str));
}
static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject* o) {
    Py_ssize_t ignore;
    return __Pyx_PyObject_AsStringAndSize(o, &ignore);
}
static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
    if (
#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
            __Pyx_sys_getdefaultencoding_not_ascii &&
#endif
            PyUnicode_Check(o)) {
#if PY_VERSION_HEX < 0x03030000
        char* defenc_c;
        PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
        if (!defenc) return NULL;
        defenc_c = PyBytes_AS_STRING(defenc);
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
        {
            char* end = defenc_c + PyBytes_GET_SIZE(defenc);
            char* c;
            for (c = defenc_c; c < end; c++) {
                if ((unsigned char) (*c) >= 128) {
                    PyUnicode_AsASCIIString(o);
                    return NULL;
                }
            }
        }
#endif /*__PYX_DEFAULT_STRING_ENCODING_IS_ASCII*/
        *length = PyBytes_GET_SIZE(defenc);
        return defenc_c;
#else /* PY_VERSION_HEX < 0x03030000 */
        if (PyUnicode_READY(o) == -1) return NULL;
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
        if (PyUnicode_IS_ASCII(o)) {
            *length = PyUnicode_GET_LENGTH(o);
            return PyUnicode_AsUTF8(o);
        } else {
            PyUnicode_AsASCIIString(o);
            return NULL;
        }
#else /* __PYX_DEFAULT_STRING_ENCODING_IS_ASCII */
        return PyUnicode_AsUTF8AndSize(o, length);
#endif /* __PYX_DEFAULT_STRING_ENCODING_IS_ASCII */
#endif /* PY_VERSION_HEX < 0x03030000 */
    } else
#endif /* __PYX_DEFAULT_STRING_ENCODING_IS_ASCII  || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT */
#if !CYTHON_COMPILING_IN_PYPY
#if PY_VERSION_HEX >= 0x02060000
    if (PyByteArray_Check(o)) {
        *length = PyByteArray_GET_SIZE(o);
        return PyByteArray_AS_STRING(o);
    } else
#endif
#endif
    {
        char* result;
        int r = PyBytes_AsStringAndSize(o, &result, length);
        if (unlikely(r < 0)) {
            return NULL;
        } else {
            return result;
        }
    }
}
static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
   int is_true = x == Py_True;
   if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
   else return PyObject_IsTrue(x);
}
static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) {
  PyNumberMethods *m;
  const char *name = NULL;
  PyObject *res = NULL;
#if PY_MAJOR_VERSION < 3
  if (PyInt_Check(x) || PyLong_Check(x))
#else
  if (PyLong_Check(x))
#endif
    return Py_INCREF(x), x;
  m = Py_TYPE(x)->tp_as_number;
#if PY_MAJOR_VERSION < 3
  if (m && m->nb_int) {
    name = "int";
    res = PyNumber_Int(x);
  }
  else if (m && m->nb_long) {
    name = "long";
    res = PyNumber_Long(x);
  }
#else
  if (m && m->nb_int) {
    name = "int";
    res = PyNumber_Long(x);
  }
#endif
  if (res) {
#if PY_MAJOR_VERSION < 3
    if (!PyInt_Check(res) && !PyLong_Check(res)) {
#else
    if (!PyLong_Check(res)) {
#endif
      PyErr_Format(PyExc_TypeError,
                   "__%.4s__ returned non-%.4s (type %.200s)",
                   name, name, Py_TYPE(res)->tp_name);
      Py_DECREF(res);
      return NULL;
    }
  }
  else if (!PyErr_Occurred()) {
    PyErr_SetString(PyExc_TypeError,
                    "an integer is required");
  }
  return res;
}
#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
 #if CYTHON_USE_PYLONG_INTERNALS
  #include "longintrepr.h"
 #endif
#endif
static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
  Py_ssize_t ival;
  PyObject *x;
#if PY_MAJOR_VERSION < 3
  if (likely(PyInt_CheckExact(b)))
      return PyInt_AS_LONG(b);
#endif
  if (likely(PyLong_CheckExact(b))) {
    #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
     #if CYTHON_USE_PYLONG_INTERNALS
       switch (Py_SIZE(b)) {
       case -1: return -(sdigit)((PyLongObject*)b)->ob_digit[0];
       case  0: return 0;
       case  1: return ((PyLongObject*)b)->ob_digit[0];
       }
     #endif
    #endif
  #if PY_VERSION_HEX < 0x02060000
    return PyInt_AsSsize_t(b);
  #else
    return PyLong_AsSsize_t(b);
  #endif
  }
  x = PyNumber_Index(b);
  if (!x) return -1;
  ival = PyInt_AsSsize_t(x);
  Py_DECREF(x);
  return ival;
}
static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
#if PY_VERSION_HEX < 0x02050000
   if (ival <= LONG_MAX)
       return PyInt_FromLong((long)ival);
   else {
       unsigned char *bytes = (unsigned char *) &ival;
       int one = 1; int little = (int)*(unsigned char*)&one;
       return _PyLong_FromByteArray(bytes, sizeof(size_t), little, 0);
   }
#else
   return PyInt_FromSize_t(ival);
#endif
}


#endif /* Py_PYTHON_H */
