/* Generated by Cython 0.28.3 */

#define PY_SSIZE_T_CLEAN
#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 < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000)
    #error Cython requires Python 2.6+ or Python 3.3+.
#else
#define CYTHON_ABI "0_28_3"
#define CYTHON_FUTURE_DIVISION 0
#include <stddef.h>
#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
#define __PYX_COMMA ,
#ifndef HAVE_LONG_LONG
  #if PY_VERSION_HEX >= 0x02070000
    #define HAVE_LONG_LONG
  #endif
#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_PYSTON 0
  #define CYTHON_COMPILING_IN_CPYTHON 0
  #undef CYTHON_USE_TYPE_SLOTS
  #define CYTHON_USE_TYPE_SLOTS 0
  #undef CYTHON_USE_PYTYPE_LOOKUP
  #define CYTHON_USE_PYTYPE_LOOKUP 0
  #if PY_VERSION_HEX < 0x03050000
    #undef CYTHON_USE_ASYNC_SLOTS
    #define CYTHON_USE_ASYNC_SLOTS 0
  #elif !defined(CYTHON_USE_ASYNC_SLOTS)
    #define CYTHON_USE_ASYNC_SLOTS 1
  #endif
  #undef CYTHON_USE_PYLIST_INTERNALS
  #define CYTHON_USE_PYLIST_INTERNALS 0
  #undef CYTHON_USE_UNICODE_INTERNALS
  #define CYTHON_USE_UNICODE_INTERNALS 0
  #undef CYTHON_USE_UNICODE_WRITER
  #define CYTHON_USE_UNICODE_WRITER 0
  #undef CYTHON_USE_PYLONG_INTERNALS
  #define CYTHON_USE_PYLONG_INTERNALS 0
  #undef CYTHON_AVOID_BORROWED_REFS
  #define CYTHON_AVOID_BORROWED_REFS 1
  #undef CYTHON_ASSUME_SAFE_MACROS
  #define CYTHON_ASSUME_SAFE_MACROS 0
  #undef CYTHON_UNPACK_METHODS
  #define CYTHON_UNPACK_METHODS 0
  #undef CYTHON_FAST_THREAD_STATE
  #define CYTHON_FAST_THREAD_STATE 0
  #undef CYTHON_FAST_PYCALL
  #define CYTHON_FAST_PYCALL 0
  #undef CYTHON_PEP489_MULTI_PHASE_INIT
  #define CYTHON_PEP489_MULTI_PHASE_INIT 0
  #undef CYTHON_USE_TP_FINALIZE
  #define CYTHON_USE_TP_FINALIZE 0
#elif defined(PYSTON_VERSION)
  #define CYTHON_COMPILING_IN_PYPY 0
  #define CYTHON_COMPILING_IN_PYSTON 1
  #define CYTHON_COMPILING_IN_CPYTHON 0
  #ifndef CYTHON_USE_TYPE_SLOTS
    #define CYTHON_USE_TYPE_SLOTS 1
  #endif
  #undef CYTHON_USE_PYTYPE_LOOKUP
  #define CYTHON_USE_PYTYPE_LOOKUP 0
  #undef CYTHON_USE_ASYNC_SLOTS
  #define CYTHON_USE_ASYNC_SLOTS 0
  #undef CYTHON_USE_PYLIST_INTERNALS
  #define CYTHON_USE_PYLIST_INTERNALS 0
  #ifndef CYTHON_USE_UNICODE_INTERNALS
    #define CYTHON_USE_UNICODE_INTERNALS 1
  #endif
  #undef CYTHON_USE_UNICODE_WRITER
  #define CYTHON_USE_UNICODE_WRITER 0
  #undef CYTHON_USE_PYLONG_INTERNALS
  #define CYTHON_USE_PYLONG_INTERNALS 0
  #ifndef CYTHON_AVOID_BORROWED_REFS
    #define CYTHON_AVOID_BORROWED_REFS 0
  #endif
  #ifndef CYTHON_ASSUME_SAFE_MACROS
    #define CYTHON_ASSUME_SAFE_MACROS 1
  #endif
  #ifndef CYTHON_UNPACK_METHODS
    #define CYTHON_UNPACK_METHODS 1
  #endif
  #undef CYTHON_FAST_THREAD_STATE
  #define CYTHON_FAST_THREAD_STATE 0
  #undef CYTHON_FAST_PYCALL
  #define CYTHON_FAST_PYCALL 0
  #undef CYTHON_PEP489_MULTI_PHASE_INIT
  #define CYTHON_PEP489_MULTI_PHASE_INIT 0
  #undef CYTHON_USE_TP_FINALIZE
  #define CYTHON_USE_TP_FINALIZE 0
#else
  #define CYTHON_COMPILING_IN_PYPY 0
  #define CYTHON_COMPILING_IN_PYSTON 0
  #define CYTHON_COMPILING_IN_CPYTHON 1
  #ifndef CYTHON_USE_TYPE_SLOTS
    #define CYTHON_USE_TYPE_SLOTS 1
  #endif
  #if PY_VERSION_HEX < 0x02070000
    #undef CYTHON_USE_PYTYPE_LOOKUP
    #define CYTHON_USE_PYTYPE_LOOKUP 0
  #elif !defined(CYTHON_USE_PYTYPE_LOOKUP)
    #define CYTHON_USE_PYTYPE_LOOKUP 1
  #endif
  #if PY_MAJOR_VERSION < 3
    #undef CYTHON_USE_ASYNC_SLOTS
    #define CYTHON_USE_ASYNC_SLOTS 0
  #elif !defined(CYTHON_USE_ASYNC_SLOTS)
    #define CYTHON_USE_ASYNC_SLOTS 1
  #endif
  #if PY_VERSION_HEX < 0x02070000
    #undef CYTHON_USE_PYLONG_INTERNALS
    #define CYTHON_USE_PYLONG_INTERNALS 0
  #elif !defined(CYTHON_USE_PYLONG_INTERNALS)
    #define CYTHON_USE_PYLONG_INTERNALS 1
  #endif
  #ifndef CYTHON_USE_PYLIST_INTERNALS
    #define CYTHON_USE_PYLIST_INTERNALS 1
  #endif
  #ifndef CYTHON_USE_UNICODE_INTERNALS
    #define CYTHON_USE_UNICODE_INTERNALS 1
  #endif
  #if PY_VERSION_HEX < 0x030300F0
    #undef CYTHON_USE_UNICODE_WRITER
    #define CYTHON_USE_UNICODE_WRITER 0
  #elif !defined(CYTHON_USE_UNICODE_WRITER)
    #define CYTHON_USE_UNICODE_WRITER 1
  #endif
  #ifndef CYTHON_AVOID_BORROWED_REFS
    #define CYTHON_AVOID_BORROWED_REFS 0
  #endif
  #ifndef CYTHON_ASSUME_SAFE_MACROS
    #define CYTHON_ASSUME_SAFE_MACROS 1
  #endif
  #ifndef CYTHON_UNPACK_METHODS
    #define CYTHON_UNPACK_METHODS 1
  #endif
  #ifndef CYTHON_FAST_THREAD_STATE
    #define CYTHON_FAST_THREAD_STATE 1
  #endif
  #ifndef CYTHON_FAST_PYCALL
    #define CYTHON_FAST_PYCALL 1
  #endif
  #ifndef CYTHON_PEP489_MULTI_PHASE_INIT
    #define CYTHON_PEP489_MULTI_PHASE_INIT (0 && PY_VERSION_HEX >= 0x03050000)
  #endif
  #ifndef CYTHON_USE_TP_FINALIZE
    #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1)
  #endif
#endif
#if !defined(CYTHON_FAST_PYCCALL)
#define CYTHON_FAST_PYCCALL  (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1)
#endif
#if CYTHON_USE_PYLONG_INTERNALS
  #include "longintrepr.h"
  #undef SHIFT
  #undef BASE
  #undef MASK
#endif
#ifndef __has_attribute
  #define __has_attribute(x) 0
#endif
#ifndef __has_cpp_attribute
  #define __has_cpp_attribute(x) 0
#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
#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
#ifndef CYTHON_MAYBE_UNUSED_VAR
#  if defined(__cplusplus)
     template<class T> void CYTHON_MAYBE_UNUSED_VAR( const T& ) { }
#  else
#    define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x)
#  endif
#endif
#ifndef CYTHON_NCP_UNUSED
# if CYTHON_COMPILING_IN_CPYTHON
#  define CYTHON_NCP_UNUSED
# else
#  define CYTHON_NCP_UNUSED CYTHON_UNUSED
# endif
#endif
#define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None)
#ifdef _MSC_VER
    #ifndef _MSC_STDINT_H_
        #if _MSC_VER < 1300
           typedef unsigned char     uint8_t;
           typedef unsigned int      uint32_t;
        #else
           typedef unsigned __int8   uint8_t;
           typedef unsigned __int32  uint32_t;
        #endif
    #endif
#else
   #include <stdint.h>
#endif
#ifndef CYTHON_FALLTHROUGH
  #if defined(__cplusplus) && __cplusplus >= 201103L
    #if __has_cpp_attribute(fallthrough)
      #define CYTHON_FALLTHROUGH [[fallthrough]]
    #elif __has_cpp_attribute(clang::fallthrough)
      #define CYTHON_FALLTHROUGH [[clang::fallthrough]]
    #elif __has_cpp_attribute(gnu::fallthrough)
      #define CYTHON_FALLTHROUGH [[gnu::fallthrough]]
    #endif
  #endif
  #ifndef CYTHON_FALLTHROUGH
    #if __has_attribute(fallthrough)
      #define CYTHON_FALLTHROUGH __attribute__((fallthrough))
    #else
      #define CYTHON_FALLTHROUGH
    #endif
  #endif
  #if defined(__clang__ ) && defined(__apple_build_version__)
    #if __apple_build_version__ < 7000000
      #undef  CYTHON_FALLTHROUGH
      #define CYTHON_FALLTHROUGH
    #endif
  #endif
#endif

#ifndef CYTHON_INLINE
  #if defined(__clang__)
    #define CYTHON_INLINE __inline__ __attribute__ ((__unused__))
  #elif 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

#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag)
  #define Py_OptimizeFlag 0
#endif
#define __PYX_BUILD_PY_SSIZE_T "n"
#define CYTHON_FORMAT_SSIZE_T "z"
#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
#ifndef Py_TPFLAGS_CHECKTYPES
  #define Py_TPFLAGS_CHECKTYPES 0
#endif
#ifndef Py_TPFLAGS_HAVE_INDEX
  #define Py_TPFLAGS_HAVE_INDEX 0
#endif
#ifndef Py_TPFLAGS_HAVE_NEWBUFFER
  #define Py_TPFLAGS_HAVE_NEWBUFFER 0
#endif
#ifndef Py_TPFLAGS_HAVE_FINALIZE
  #define Py_TPFLAGS_HAVE_FINALIZE 0
#endif
#if PY_VERSION_HEX <= 0x030700A3 || !defined(METH_FASTCALL)
  #ifndef METH_FASTCALL
     #define METH_FASTCALL 0x80
  #endif
  typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject *const *args, Py_ssize_t nargs);
  typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject *const *args,
                                                          Py_ssize_t nargs, PyObject *kwnames);
#else
  #define __Pyx_PyCFunctionFast _PyCFunctionFast
  #define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords
#endif
#if CYTHON_FAST_PYCCALL
#define __Pyx_PyFastCFunction_Check(func)\
    ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS)))))
#else
#define __Pyx_PyFastCFunction_Check(func) 0
#endif
#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc)
  #define PyObject_Malloc(s)   PyMem_Malloc(s)
  #define PyObject_Free(p)     PyMem_Free(p)
  #define PyObject_Realloc(p)  PyMem_Realloc(p)
#endif
#if CYTHON_COMPILING_IN_PYSTON
  #define __Pyx_PyCode_HasFreeVars(co)  PyCode_HasFreeVars(co)
  #define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno)
#else
  #define __Pyx_PyCode_HasFreeVars(co)  (PyCode_GetNumFree(co) > 0)
  #define __Pyx_PyFrame_SetLineNumber(frame, lineno)  (frame)->f_lineno = (lineno)
#endif
#if !CYTHON_FAST_THREAD_STATE || PY_VERSION_HEX < 0x02070000
  #define __Pyx_PyThreadState_Current PyThreadState_GET()
#elif PY_VERSION_HEX >= 0x03060000
  #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet()
#elif PY_VERSION_HEX >= 0x03000000
  #define __Pyx_PyThreadState_Current PyThreadState_GET()
#else
  #define __Pyx_PyThreadState_Current _PyThreadState_Current
#endif
#if PY_VERSION_HEX < 0x030700A2 && !defined(PyThread_tss_create) && !defined(Py_tss_NEEDS_INIT)
#include "pythread.h"
#define Py_tss_NEEDS_INIT 0
typedef int Py_tss_t;
static CYTHON_INLINE int PyThread_tss_create(Py_tss_t *key) {
  *key = PyThread_create_key();
  return 0; // PyThread_create_key reports success always
}
static CYTHON_INLINE Py_tss_t * PyThread_tss_alloc(void) {
  Py_tss_t *key = (Py_tss_t *)PyObject_Malloc(sizeof(Py_tss_t));
  *key = Py_tss_NEEDS_INIT;
  return key;
}
static CYTHON_INLINE void PyThread_tss_free(Py_tss_t *key) {
  PyObject_Free(key);
}
static CYTHON_INLINE int PyThread_tss_is_created(Py_tss_t *key) {
  return *key != Py_tss_NEEDS_INIT;
}
static CYTHON_INLINE void PyThread_tss_delete(Py_tss_t *key) {
  PyThread_delete_key(*key);
  *key = Py_tss_NEEDS_INIT;
}
static CYTHON_INLINE int PyThread_tss_set(Py_tss_t *key, void *value) {
  return PyThread_set_key_value(*key, value);
}
static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) {
  return PyThread_get_key_value(*key);
}
#endif // TSS (Thread Specific Storage) API
#if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized)
#define __Pyx_PyDict_NewPresized(n)  ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n))
#else
#define __Pyx_PyDict_NewPresized(n)  PyDict_New()
#endif
#if PY_MAJOR_VERSION >= 3 || CYTHON_FUTURE_DIVISION
  #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
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 && CYTHON_USE_UNICODE_INTERNALS
#define __Pyx_PyDict_GetItemStr(dict, name)  _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash)
#else
#define __Pyx_PyDict_GetItemStr(dict, name)  PyDict_GetItem(dict, name)
#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_MAX_CHAR_VALUE(u)   PyUnicode_MAX_CHAR_VALUE(u)
  #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)
  #define __Pyx_PyUnicode_WRITE(k, d, i, ch)  PyUnicode_WRITE(k, d, i, ch)
  #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u)))
#else
  #define CYTHON_PEP393_ENABLED 0
  #define PyUnicode_1BYTE_KIND  1
  #define PyUnicode_2BYTE_KIND  2
  #define PyUnicode_4BYTE_KIND  4
  #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_MAX_CHAR_VALUE(u)   ((sizeof(Py_UNICODE) == 2) ? 65535 : 1114111)
  #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]))
  #define __Pyx_PyUnicode_WRITE(k, d, i, ch)  (((void)(k)), ((Py_UNICODE*)d)[i] = ch)
  #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != PyUnicode_GET_SIZE(u))
#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
#if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains)
  #define PyUnicode_Contains(u, s)  PySequence_Contains(u, s)
#endif
#if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check)
  #define PyByteArray_Check(obj)  PyObject_TypeCheck(obj, &PyByteArray_Type)
#endif
#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format)
  #define PyObject_Format(obj, fmt)  PyObject_CallMethod(obj, "__format__", "O", fmt)
#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 && !defined(PyObject_ASCII)
  #define PyObject_ASCII(o)            PyObject_Repr(o)
#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
  #define PyObject_Unicode             PyObject_Str
#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_Check(obj) || PyUnicode_Check(obj))
  #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
#endif
#ifndef PySet_CheckExact
  #define PySet_CheckExact(obj)        (Py_TYPE(obj) == &PySet_Type)
#endif
#if CYTHON_ASSUME_SAFE_MACROS
  #define __Pyx_PySequence_SIZE(seq)  Py_SIZE(seq)
#else
  #define __Pyx_PySequence_SIZE(seq)  PySequence_Size(seq)
#endif
#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_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY
  #ifndef PyUnicode_InternFromString
    #define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
  #endif
#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
  #define __Pyx_PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : (Py_INCREF(func), func))
#else
  #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass)
#endif
#if CYTHON_USE_ASYNC_SLOTS
  #if PY_VERSION_HEX >= 0x030500B1
    #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods
    #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async)
  #else
    #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved))
  #endif
#else
  #define __Pyx_PyType_AsAsync(obj) NULL
#endif
#ifndef __Pyx_PyAsyncMethodsStruct
    typedef struct {
        unaryfunc am_await;
        unaryfunc am_aiter;
        unaryfunc am_anext;
    } __Pyx_PyAsyncMethodsStruct;
#endif

#if defined(WIN32) || defined(MS_WINDOWS)
  #define _USE_MATH_DEFINES
#endif
#include <math.h>
#ifdef NAN
#define __PYX_NAN() ((float) NAN)
#else
static CYTHON_INLINE float __PYX_NAN() {
  float value;
  memset(&value, 0xFF, sizeof(value));
  return value;
}
#endif
#if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL)
#define __Pyx_truncl trunc
#else
#define __Pyx_truncl truncl
#endif


#define __PYX_ERR(f_index, lineno, Ln_error) \
{ \
  __pyx_filename = __pyx_f[f_index]; __pyx_lineno = lineno; __pyx_clineno = __LINE__; goto Ln_error; \
}

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

#define __PYX_HAVE__pygrib
#define __PYX_HAVE_API__pygrib
/* Early includes */
#include "stdlib.h"
#include "stdio.h"
#include "numpy/arrayobject.h"
#include "grib_api.h"
#ifdef _OPENMP
#include <omp.h>
#endif /* _OPENMP */

#if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS)
#define CYTHON_WITHOUT_ASSERTIONS
#endif

typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* encoding;
                const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry;

#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_uchar_cast(c) ((unsigned char)c)
#define __Pyx_long_cast(x) ((long)x)
#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)))  )
#if defined (__cplusplus) && __cplusplus >= 201103L
    #include <cstdlib>
    #define __Pyx_sst_abs(value) std::abs(value)
#elif SIZEOF_INT >= SIZEOF_SIZE_T
    #define __Pyx_sst_abs(value) abs(value)
#elif SIZEOF_LONG >= SIZEOF_SIZE_T
    #define __Pyx_sst_abs(value) labs(value)
#elif defined (_MSC_VER)
    #define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value))
#elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
    #define __Pyx_sst_abs(value) llabs(value)
#elif defined (__GNUC__)
    #define __Pyx_sst_abs(value) __builtin_llabs(value)
#else
    #define __Pyx_sst_abs(value) ((value<0) ? -value : value)
#endif
static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject*);
static CYTHON_INLINE const 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_PyBytes_AsWritableString(s)     ((char*) PyBytes_AS_STRING(s))
#define __Pyx_PyBytes_AsWritableSString(s)    ((signed char*) PyBytes_AS_STRING(s))
#define __Pyx_PyBytes_AsWritableUString(s)    ((unsigned char*) PyBytes_AS_STRING(s))
#define __Pyx_PyBytes_AsString(s)     ((const char*) PyBytes_AS_STRING(s))
#define __Pyx_PyBytes_AsSString(s)    ((const signed char*) PyBytes_AS_STRING(s))
#define __Pyx_PyBytes_AsUString(s)    ((const unsigned char*) PyBytes_AS_STRING(s))
#define __Pyx_PyObject_AsWritableString(s)    ((char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_AsWritableSString(s)    ((signed char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_AsWritableUString(s)    ((unsigned char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_AsSString(s)    ((const signed char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_AsUString(s)    ((const unsigned char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_FromCString(s)  __Pyx_PyObject_FromString((const char*)s)
#define __Pyx_PyBytes_FromCString(s)   __Pyx_PyBytes_FromString((const char*)s)
#define __Pyx_PyByteArray_FromCString(s)   __Pyx_PyByteArray_FromString((const char*)s)
#define __Pyx_PyStr_FromCString(s)     __Pyx_PyStr_FromString((const char*)s)
#define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s)
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);
}
#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_NewRef(obj) (Py_INCREF(obj), obj)
#define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None)
static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b);
static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x);
#define __Pyx_PySequence_Tuple(obj)\
    (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj))
static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
#if CYTHON_ASSUME_SAFE_MACROS
#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
#define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x))
#else
#define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x))
#endif
#define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(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*) "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 CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; }

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


static const char *__pyx_f[] = {
  "pygrib.pyx",
  "stringsource",
};

/*--- Type declarations ---*/
struct __pyx_obj_6pygrib_open;
struct __pyx_obj_6pygrib_gribmessage;
struct __pyx_obj_6pygrib_index;
struct __pyx_opt_args_6pygrib__strencode;

/* "pygrib.pyx":2068
 *     return True
 * 
 * cdef _strencode(pystr,encoding=None):             # <<<<<<<<<<<<<<
 *     # encode a string into bytes.  If already bytes, do nothing.
 *     # uses default_encoding module variable for default encoding.
 */
struct __pyx_opt_args_6pygrib__strencode {
  int __pyx_n;
  PyObject *encoding;
};

/* "pygrib.pyx":363
 *     grib_multi_support_off(NULL)
 * 
 * cdef class open(object):             # <<<<<<<<<<<<<<
 *     """
 *     open(filename)
 */
struct __pyx_obj_6pygrib_open {
  PyObject_HEAD
  FILE *_fd;
  grib_handle *_gh;
  PyObject *name;
  PyObject *messagenumber;
  PyObject *messages;
  PyObject *closed;
  PyObject *has_multi_field_msgs;
};


/* "pygrib.pyx":793
 *     return fromstring(grb.tostring())
 * 
 * cdef class gribmessage(object):             # <<<<<<<<<<<<<<
 *     """
 *     Grib message object.
 */
struct __pyx_obj_6pygrib_gribmessage {
  PyObject_HEAD
  grib_handle *_gh;
  PyObject *messagenumber;
  PyObject *projparams;
  PyObject *validDate;
  PyObject *analDate;
  PyObject *expand_reduced;
  PyObject *_ro_keys;
  PyObject *_all_keys;
  PyObject *fcstimeunits;
};


/* "pygrib.pyx":1815
 *         return lats, lons
 * 
 * cdef class index(object):             # <<<<<<<<<<<<<<
 *     """
 * index(filename, *args)
 */
struct __pyx_obj_6pygrib_index {
  PyObject_HEAD
  grib_index *_gi;
  PyObject *keys;
  PyObject *types;
  PyObject *name;
};


/* --- Runtime support code (head) --- */
/* Refnanny.proto */
#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);
  #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
#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)

/* PyObjectGetAttrStr.proto */
#if CYTHON_USE_TYPE_SLOTS
static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name);
#else
#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
#endif

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

/* RaiseArgTupleInvalid.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);

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

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

/* FetchCommonType.proto */
static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type);

/* CythonFunction.proto */
#define __Pyx_CyFunction_USED 1
#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;
#if PY_VERSION_HEX < 0x030500A0
    PyObject *func_weakreflist;
#endif
    PyObject *func_dict;
    PyObject *func_name;
    PyObject *func_qualname;
    PyObject *func_doc;
    PyObject *func_globals;
    PyObject *func_code;
    PyObject *func_closure;
    PyObject *func_classobj;
    void *defaults;
    int defaults_pyobjects;
    int flags;
    PyObject *defaults_tuple;
    PyObject *defaults_kwdict;
    PyObject *(*defaults_getter)(PyObject *);
    PyObject *func_annotations;
} __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);

/* RaiseTooManyValuesToUnpack.proto */
static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);

/* RaiseNeedMoreValuesToUnpack.proto */
static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);

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

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

/* PyIntBinop.proto */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyInt_RemainderObjC(PyObject *op1, PyObject *op2, long intval, int inplace);
#else
#define __Pyx_PyInt_RemainderObjC(op1, op2, intval, inplace)\
    (inplace ? PyNumber_InPlaceRemainder(op1, op2) : PyNumber_Remainder(op1, op2))
#endif

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

/* PyThreadStateGet.proto */
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_PyThreadState_declare  PyThreadState *__pyx_tstate;
#define __Pyx_PyThreadState_assign  __pyx_tstate = __Pyx_PyThreadState_Current;
#define __Pyx_PyErr_Occurred()  __pyx_tstate->curexc_type
#else
#define __Pyx_PyThreadState_declare
#define __Pyx_PyThreadState_assign
#define __Pyx_PyErr_Occurred()  PyErr_Occurred()
#endif

/* PyErrFetchRestore.proto */
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL)
#define __Pyx_ErrRestoreWithState(type, value, tb)  __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb)
#define __Pyx_ErrFetchWithState(type, value, tb)    __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb)
#define __Pyx_ErrRestore(type, value, tb)  __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb)
#define __Pyx_ErrFetch(type, value, tb)    __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb)
static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
#if CYTHON_COMPILING_IN_CPYTHON
#define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL))
#else
#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
#endif
#else
#define __Pyx_PyErr_Clear() PyErr_Clear()
#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
#define __Pyx_ErrRestoreWithState(type, value, tb)  PyErr_Restore(type, value, tb)
#define __Pyx_ErrFetchWithState(type, value, tb)  PyErr_Fetch(type, value, tb)
#define __Pyx_ErrRestoreInState(tstate, type, value, tb)  PyErr_Restore(type, value, tb)
#define __Pyx_ErrFetchInState(tstate, type, value, tb)  PyErr_Fetch(type, value, tb)
#define __Pyx_ErrRestore(type, value, tb)  PyErr_Restore(type, value, tb)
#define __Pyx_ErrFetch(type, value, tb)  PyErr_Fetch(type, value, tb)
#endif

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

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

/* PyFunctionFastCall.proto */
#if CYTHON_FAST_PYCALL
#define __Pyx_PyFunction_FastCall(func, args, nargs)\
    __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL)
#if 1 || PY_VERSION_HEX < 0x030600B1
static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, int nargs, PyObject *kwargs);
#else
#define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs)
#endif
#endif

/* PyCFunctionFastCall.proto */
#if CYTHON_FAST_PYCCALL
static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs);
#else
#define __Pyx_PyCFunction_FastCall(func, args, nargs)  (assert(0), NULL)
#endif

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

/* None.proto */
static CYTHON_INLINE long __Pyx_div_long(long, long);

/* PyIntBinop.proto */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, long intval, int inplace);
#else
#define __Pyx_PyInt_AddObjC(op1, op2, intval, inplace)\
    (inplace ? PyNumber_InPlaceAdd(op1, op2) : PyNumber_Add(op1, op2))
#endif

/* PyObjectCallMethO.proto */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
#endif

/* PyObjectCallOneArg.proto */
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);

/* PyObjectCallNoArg.proto */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func);
#else
#define __Pyx_PyObject_CallNoArg(func) __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL)
#endif

/* ListCompAppend.proto */
#if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
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

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

/* PyIntBinop.proto */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyInt_EqObjC(PyObject *op1, PyObject *op2, long intval, int inplace);
#else
#define __Pyx_PyInt_EqObjC(op1, op2, intval, inplace)\
    PyObject_RichCompare(op1, op2, Py_EQ)
    #endif

/* GetAttr.proto */
static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *, PyObject *);

/* HasAttr.proto */
static CYTHON_INLINE int __Pyx_HasAttr(PyObject *, PyObject *);

/* IterNext.proto */
#define __Pyx_PyIter_Next(obj) __Pyx_PyIter_Next2(obj, NULL)
static CYTHON_INLINE PyObject *__Pyx_PyIter_Next2(PyObject *, PyObject *);

/* SaveResetException.proto */
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_ExceptionSave(type, value, tb)  __Pyx__ExceptionSave(__pyx_tstate, type, value, tb)
static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
#define __Pyx_ExceptionReset(type, value, tb)  __Pyx__ExceptionReset(__pyx_tstate, type, value, tb)
static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
#else
#define __Pyx_ExceptionSave(type, value, tb)   PyErr_GetExcInfo(type, value, tb)
#define __Pyx_ExceptionReset(type, value, tb)  PyErr_SetExcInfo(type, value, tb)
#endif

/* PyErrExceptionMatches.proto */
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err)
static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err);
#else
#define __Pyx_PyErr_ExceptionMatches(err)  PyErr_ExceptionMatches(err)
#endif

/* GetException.proto */
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_GetException(type, value, tb)  __Pyx__GetException(__pyx_tstate, type, value, tb)
static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
#else
static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb);
#endif

/* ListAppend.proto */
#if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
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

/* None.proto */
static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname);

/* ArgTypeTest.proto */
#define __Pyx_ArgTypeTest(obj, type, none_allowed, name, exact)\
    ((likely((Py_TYPE(obj) == type) | (none_allowed && (obj == Py_None)))) ? 1 :\
        __Pyx__ArgTypeTest(obj, type, name, exact))
static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact);

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

/* GetItemInt.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 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);

/* ObjectGetItem.proto */
#if CYTHON_USE_TYPE_SLOTS
static CYTHON_INLINE PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key);
#else
#define __Pyx_PyObject_GetItem(obj, key)  PyObject_GetItem(obj, key)
#endif

/* IncludeStringH.proto */
#include <string.h>

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

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

/* StrEquals.proto */
#if PY_MAJOR_VERSION >= 3
#define __Pyx_PyString_Equals __Pyx_PyUnicode_Equals
#else
#define __Pyx_PyString_Equals __Pyx_PyBytes_Equals
#endif

/* PyFloatBinop.proto */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyFloat_DivideObjC(PyObject *op1, PyObject *op2, double floatval, int inplace);
#else
#define __Pyx_PyFloat_DivideObjC(op1, op2, floatval, inplace)\
    ((inplace ? __Pyx_PyNumber_InPlaceDivide(op1, op2) : __Pyx_PyNumber_Divide(op1, op2)))
    #endif

/* StringJoin.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);
#endif

/* decode_c_string_utf16.proto */
static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16(const char *s, Py_ssize_t size, const char *errors) {
    int byteorder = 0;
    return PyUnicode_DecodeUTF16(s, size, errors, &byteorder);
}
static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16LE(const char *s, Py_ssize_t size, const char *errors) {
    int byteorder = -1;
    return PyUnicode_DecodeUTF16(s, size, errors, &byteorder);
}
static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16BE(const char *s, Py_ssize_t size, const char *errors) {
    int byteorder = 1;
    return PyUnicode_DecodeUTF16(s, size, errors, &byteorder);
}

/* decode_c_string.proto */
static CYTHON_INLINE PyObject* __Pyx_decode_c_string(
         const char* cstring, Py_ssize_t start, Py_ssize_t stop,
         const char* encoding, const char* errors,
         PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors));

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

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

/* PyObjectSetAttrStr.proto */
#if CYTHON_USE_TYPE_SLOTS
#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);
#else
#define __Pyx_PyObject_DelAttrStr(o,n)   PyObject_DelAttr(o,n)
#define __Pyx_PyObject_SetAttrStr(o,n,v) PyObject_SetAttr(o,n,v)
#endif

/* DictGetItem.proto */
#if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY
static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key);
#define __Pyx_PyObject_Dict_GetItem(obj, name)\
    (likely(PyDict_CheckExact(obj)) ?\
     __Pyx_PyDict_GetItem(obj, name) : PyObject_GetItem(obj, name))
#else
#define __Pyx_PyDict_GetItem(d, key) PyObject_GetItem(d, key)
#define __Pyx_PyObject_Dict_GetItem(obj, name)  PyObject_GetItem(obj, name)
#endif

/* PyFloatBinop.proto */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyFloat_EqObjC(PyObject *op1, PyObject *op2, double floatval, int inplace);
#else
#define __Pyx_PyFloat_EqObjC(op1, op2, floatval, inplace)\
    PyObject_RichCompare(op1, op2, Py_EQ)
    #endif

/* PyFloatBinop.proto */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyFloat_AddObjC(PyObject *op1, PyObject *op2, double floatval, int inplace);
#else
#define __Pyx_PyFloat_AddObjC(op1, op2, floatval, inplace)\
    (inplace ? PyNumber_InPlaceAdd(op1, op2) : PyNumber_Add(op1, op2))
#endif

/* PyIntBinop.proto */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyInt_AddCObj(PyObject *op1, PyObject *op2, long intval, int inplace);
#else
#define __Pyx_PyInt_AddCObj(op1, op2, intval, inplace)\
    (inplace ? PyNumber_InPlaceAdd(op1, op2) : PyNumber_Add(op1, op2))
#endif

/* PyIntBinop.proto */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyInt_SubtractObjC(PyObject *op1, PyObject *op2, long intval, int inplace);
#else
#define __Pyx_PyInt_SubtractObjC(op1, op2, intval, inplace)\
    (inplace ? PyNumber_InPlaceSubtract(op1, op2) : PyNumber_Subtract(op1, op2))
#endif

/* PyFloatBinop.proto */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyFloat_DivideCObj(PyObject *op1, PyObject *op2, double floatval, int inplace);
#else
#define __Pyx_PyFloat_DivideCObj(op1, op2, floatval, inplace)\
    ((inplace ? __Pyx_PyNumber_InPlaceDivide(op1, op2) : __Pyx_PyNumber_Divide(op1, op2)))
    #endif

/* py_dict_items.proto */
static CYTHON_INLINE PyObject* __Pyx_PyDict_Items(PyObject* d);

/* UnpackUnboundCMethod.proto */
typedef struct {
    PyObject *type;
    PyObject **method_name;
    PyCFunction func;
    PyObject *method;
    int flag;
} __Pyx_CachedCFunction;

/* CallUnboundCMethod0.proto */
static PyObject* __Pyx__CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self);
#if CYTHON_COMPILING_IN_CPYTHON
#define __Pyx_CallUnboundCMethod0(cfunc, self)\
    (likely((cfunc)->func) ?\
        (likely((cfunc)->flag == METH_NOARGS) ?  (*((cfunc)->func))(self, NULL) :\
         (PY_VERSION_HEX >= 0x030600B1 && likely((cfunc)->flag == METH_FASTCALL) ?\
            (PY_VERSION_HEX >= 0x030700A0 ?\
                (*(__Pyx_PyCFunctionFast)(cfunc)->func)(self, &__pyx_empty_tuple, 0) :\
                (*(__Pyx_PyCFunctionFastWithKeywords)(cfunc)->func)(self, &__pyx_empty_tuple, 0, NULL)) :\
          (PY_VERSION_HEX >= 0x030700A0 && (cfunc)->flag == (METH_FASTCALL | METH_KEYWORDS) ?\
            (*(__Pyx_PyCFunctionFastWithKeywords)(cfunc)->func)(self, &__pyx_empty_tuple, 0, NULL) :\
            (likely((cfunc)->flag == (METH_VARARGS | METH_KEYWORDS)) ?  ((*(PyCFunctionWithKeywords)(cfunc)->func)(self, __pyx_empty_tuple, NULL)) :\
               ((cfunc)->flag == METH_VARARGS ?  (*((cfunc)->func))(self, __pyx_empty_tuple) :\
               __Pyx__CallUnboundCMethod0(cfunc, self)))))) :\
        __Pyx__CallUnboundCMethod0(cfunc, self))
#else
#define __Pyx_CallUnboundCMethod0(cfunc, self)  __Pyx__CallUnboundCMethod0(cfunc, self)
#endif

/* pyobject_as_double.proto */
static double __Pyx__PyObject_AsDouble(PyObject* obj);
#if CYTHON_COMPILING_IN_PYPY
#define __Pyx_PyObject_AsDouble(obj)\
(likely(PyFloat_CheckExact(obj)) ? PyFloat_AS_DOUBLE(obj) :\
 likely(PyInt_CheckExact(obj)) ?\
 PyFloat_AsDouble(obj) : __Pyx__PyObject_AsDouble(obj))
#else
#define __Pyx_PyObject_AsDouble(obj)\
((likely(PyFloat_CheckExact(obj))) ?\
 PyFloat_AS_DOUBLE(obj) : __Pyx__PyObject_AsDouble(obj))
#endif

/* PyObject_GenericGetAttrNoDict.proto */
#if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name);
#else
#define __Pyx_PyObject_GenericGetAttrNoDict PyObject_GenericGetAttr
#endif

/* PyObject_GenericGetAttr.proto */
#if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name);
#else
#define __Pyx_PyObject_GenericGetAttr PyObject_GenericGetAttr
#endif

/* SetupReduce.proto */
static int __Pyx_setup_reduce(PyObject* type_obj);

/* SetItemInt.proto */
#define __Pyx_SetItemInt(o, i, v, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
    (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
    __Pyx_SetItemInt_Fast(o, (Py_ssize_t)i, v, is_list, wraparound, boundscheck) :\
    (is_list ? (PyErr_SetString(PyExc_IndexError, "list assignment index out of range"), -1) :\
               __Pyx_SetItemInt_Generic(o, to_py_func(i), v)))
static int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v);
static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v,
                                               int is_list, int wraparound, int boundscheck);

/* CLineInTraceback.proto */
#ifdef CYTHON_CLINE_IN_TRACEBACK
#define __Pyx_CLineForTraceback(tstate, c_line)  (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0)
#else
static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line);
#endif

/* CodeObjectCache.proto */
typedef struct {
    PyCodeObject* code_object;
    int code_line;
} __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);

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

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);

/* CIntFromPy.proto */
static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);

/* CIntFromPy.proto */
static CYTHON_INLINE size_t __Pyx_PyInt_As_size_t(PyObject *);

/* CIntFromPy.proto */
static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);

/* FastTypeChecks.proto */
#if CYTHON_COMPILING_IN_CPYTHON
#define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type)
static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b);
static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type);
static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2);
#else
#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
#define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type)
#define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2))
#endif
#define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception)

/* CheckBinaryVersion.proto */
static int __Pyx_check_binary_version(void);

/* PyIdentifierFromString.proto */
#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

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

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

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


/* Module declarations from 'numpy' */

/* Module declarations from 'pygrib' */
static PyTypeObject *__pyx_ptype_6pygrib_ndarray = 0;
static PyTypeObject *__pyx_ptype_6pygrib_open = 0;
static PyTypeObject *__pyx_ptype_6pygrib_gribmessage = 0;
static PyTypeObject *__pyx_ptype_6pygrib_index = 0;
static PyObject *__pyx_f_6pygrib__create_gribmessage(grib_handle *, PyObject *); /*proto*/
static PyObject *__pyx_f_6pygrib__strencode(PyObject *, struct __pyx_opt_args_6pygrib__strencode *__pyx_optional_args); /*proto*/
#define __Pyx_MODULE_NAME "pygrib"
extern int __pyx_module_is_main_pygrib;
int __pyx_module_is_main_pygrib = 0;

/* Implementation of 'pygrib' */
static PyObject *__pyx_builtin_ImportError;
static PyObject *__pyx_builtin_ValueError;
static PyObject *__pyx_builtin_IOError;
static PyObject *__pyx_builtin_StopIteration;
static PyObject *__pyx_builtin_RuntimeError;
static PyObject *__pyx_builtin_xrange;
static PyObject *__pyx_builtin_KeyError;
static PyObject *__pyx_builtin_range;
static PyObject *__pyx_builtin_TypeError;
static PyObject *__pyx_builtin_AttributeError;
static PyObject *__pyx_builtin_IndexError;
static const char __pyx_k_C[] = "C";
static const char __pyx_k_F[] = "F";
static const char __pyx_k_a[] = "a";
static const char __pyx_k_b[] = "b";
static const char __pyx_k_d[] = "d";
static const char __pyx_k_h[] = "h";
static const char __pyx_k_k[] = "k";
static const char __pyx_k_l[] = "l";
static const char __pyx_k_s[] = " %s";
static const char __pyx_k_v[] = "v";
static const char __pyx_k_Dx[] = "Dx";
static const char __pyx_k_Dy[] = "Dy";
static const char __pyx_k_Ni[] = "Ni";
static const char __pyx_k_Nj[] = "Nj";
static const char __pyx_k_Nr[] = "Nr";
static const char __pyx_k_Nx[] = "Nx";
static const char __pyx_k_Ny[] = "Ny";
static const char __pyx_k_dx[] = "dx";
static const char __pyx_k_dy[] = "dy";
static const char __pyx_k_gh[] = "_gh";
static const char __pyx_k_jd[] = "jd";
static const char __pyx_k_ma[] = "ma";
static const char __pyx_k_np[] = "np";
static const char __pyx_k_pi[] = "pi";
static const char __pyx_k_pl[] = "pl";
static const char __pyx_k_04i[] = "%04i";
static const char __pyx_k_LaD[] = "LaD";
static const char __pyx_k_LoV[] = "LoV";
static const char __pyx_k__10[] = "";
static const char __pyx_k__15[] = "-";
static const char __pyx_k__20[] = ":";
static const char __pyx_k__25[] = " (";
static const char __pyx_k__26[] = ")";
static const char __pyx_k_aea[] = "aea";
static const char __pyx_k_cyl[] = "cyl";
static const char __pyx_k_day[] = "day";
static const char __pyx_k_div[] = "div";
static const char __pyx_k_err[] = "err";
static const char __pyx_k_grb[] = "grb";
static const char __pyx_k_hrs[] = "hrs";
static const char __pyx_k_int[] = "int";
static const char __pyx_k_key[] = "key";
static const char __pyx_k_lcc[] = "lcc";
static const char __pyx_k_max[] = "max";
static const char __pyx_k_min[] = "min";
static const char __pyx_k_msg[] = "msg";
static const char __pyx_k_one[] = "one";
static const char __pyx_k_s_2[] = " (> %s)";
static const char __pyx_k_s_3[] = " (< %s)";
static const char __pyx_k_s_4[] = "s";
static const char __pyx_k_s_s[] = " (%s-%s)";
static const char __pyx_k_sum[] = "sum";
static const char __pyx_k_yrs[] = "yrs";
static const char __pyx_k_7777[] = "7777";
static const char __pyx_k_Proj[] = "Proj";
static const char __pyx_k__105[] = ",";
static const char __pyx_k_aeqd[] = "aeqd";
static const char __pyx_k_call[] = "__call__";
static const char __pyx_k_copy[] = "copy";
static const char __pyx_k_data[] = "data";
static const char __pyx_k_days[] = "days";
static const char __pyx_k_dict[] = "__dict__";
static const char __pyx_k_fabs[] = "fabs";
static const char __pyx_k_file[] = "file";
static const char __pyx_k_find[] = "_find";
static const char __pyx_k_from[] = ":from ";
static const char __pyx_k_geos[] = "geos";
static const char __pyx_k_gh_2[] = "gh";
static const char __pyx_k_hour[] = "hour";
static const char __pyx_k_isMA[] = "isMA";
static const char __pyx_k_join[] = "join";
static const char __pyx_k_keys[] = "keys";
static const char __pyx_k_laea[] = "laea";
static const char __pyx_k_lat1[] = "lat1";
static const char __pyx_k_lat2[] = "lat2";
static const char __pyx_k_lats[] = "lats";
static const char __pyx_k_lon1[] = "lon1";
static const char __pyx_k_lon2[] = "lon2";
static const char __pyx_k_main[] = "__main__";
static const char __pyx_k_merc[] = "merc";
static const char __pyx_k_mins[] = "mins";
static const char __pyx_k_msgs[] = "msgs";
static const char __pyx_k_name[] = "name";
static const char __pyx_k_ndim[] = "ndim";
static const char __pyx_k_next[] = "next";
static const char __pyx_k_proj[] = "proj";
static const char __pyx_k_secs[] = "secs";
static const char __pyx_k_seek[] = "seek";
static const char __pyx_k_size[] = "size";
static const char __pyx_k_tell[] = "tell";
static const char __pyx_k_test[] = "__test__";
static const char __pyx_k_warn[] = "warn";
static const char __pyx_k_year[] = "year";
static const char __pyx_k_zero[] = "zero";
static const char __pyx_k_1_9_0[] = "1.9.0";
static const char __pyx_k_2_0_3[] = "2.0.3";
static const char __pyx_k_Latin[] = "Latin";
static const char __pyx_k_ascii[] = "ascii";
static const char __pyx_k_atype[] = "atype";
static const char __pyx_k_close[] = "close";
static const char __pyx_k_d_d_d[] = "%d.%d.%d";
static const char __pyx_k_eight[] = "eight";
static const char __pyx_k_empty[] = "empty";
static const char __pyx_k_false[] = "false";
static const char __pyx_k_float[] = "float";
static const char __pyx_k_ftime[] = "ftime";
static const char __pyx_k_index[] = "index";
static const char __pyx_k_items[] = "items";
static const char __pyx_k_lat_0[] = "lat_0";
static const char __pyx_k_lat_1[] = "lat_1";
static const char __pyx_k_lat_2[] = "lat_2";
static const char __pyx_k_level[] = "level";
static const char __pyx_k_lon_0[] = "lon_0";
static const char __pyx_k_major[] = "major";
static const char __pyx_k_minor[] = "minor";
static const char __pyx_k_month[] = "month";
static const char __pyx_k_nlats[] = "nlats";
static const char __pyx_k_nmsgs[] = "nmsgs";
static const char __pyx_k_nsper[] = "nsper";
static const char __pyx_k_numpy[] = "numpy";
static const char __pyx_k_order[] = "order";
static const char __pyx_k_power[] = "power";
static const char __pyx_k_range[] = "range";
static const char __pyx_k_shape[] = "shape";
static const char __pyx_k_split[] = "split";
static const char __pyx_k_stere[] = "stere";
static const char __pyx_k_units[] = "units";
static const char __pyx_k_value[] = "value";
static const char __pyx_k_where[] = "where";
static const char __pyx_k_zeros[] = "zeros";
static const char __pyx_k_Latin1[] = "Latin1";
static const char __pyx_k_Latin2[] = "Latin2";
static const char __pyx_k_albers[] = "albers";
static const char __pyx_k_arange[] = "arange";
static const char __pyx_k_arcsin[] = "arcsin";
static const char __pyx_k_decode[] = "decode";
static const char __pyx_k_double[] = "double";
static const char __pyx_k_eleven[] = "eleven";
static const char __pyx_k_encode[] = "encode";
static const char __pyx_k_filled[] = "filled";
static const char __pyx_k_import[] = "__import__";
static const char __pyx_k_julday[] = "julday";
static const char __pyx_k_kwargs[] = "kwargs";
static const char __pyx_k_lat_ts[] = "lat_ts";
static const char __pyx_k_minute[] = "minute";
static const char __pyx_k_months[] = "months";
static const char __pyx_k_name_2[] = "__name__";
static const char __pyx_k_o_proj[] = "o_proj";
static const char __pyx_k_pygrib[] = "pygrib";
static const char __pyx_k_pyproj[] = "pyproj";
static const char __pyx_k_radius[] = "radius";
static const char __pyx_k_reduce[] = "__reduce__";
static const char __pyx_k_reload[] = "reload";
static const char __pyx_k_rewind[] = "rewind";
static const char __pyx_k_rstrip[] = "rstrip";
static const char __pyx_k_second[] = "second";
static const char __pyx_k_select[] = "select";
static const char __pyx_k_values[] = "values";
static const char __pyx_k_xrange[] = "xrange";
static const char __pyx_k_IOError[] = "IOError";
static const char __pyx_k_advance[] = "_advance";
static const char __pyx_k_asarray[] = "asarray";
static const char __pyx_k_decades[] = "decades";
static const char __pyx_k_default[] = "default";
static const char __pyx_k_float64[] = "float64";
static const char __pyx_k_gaulats[] = "gaulats";
static const char __pyx_k_get_key[] = "_get_key";
static const char __pyx_k_getitem[] = "__getitem__";
static const char __pyx_k_gribmsg[] = "gribmsg";
static const char __pyx_k_gribstr[] = "gribstr";
static const char __pyx_k_has_key[] = "has_key";
static const char __pyx_k_indices[] = "indices";
static const char __pyx_k_instant[] = "instant";
static const char __pyx_k_inverse[] = "inverse";
static const char __pyx_k_lambert[] = "lambert";
static const char __pyx_k_latlons[] = "latlons";
static const char __pyx_k_level_s[] = ":level %s";
static const char __pyx_k_longlat[] = "longlat";
static const char __pyx_k_message[] = "message";
static const char __pyx_k_o_lat_p[] = "o_lat_p";
static const char __pyx_k_o_lon_p[] = "o_lon_p";
static const char __pyx_k_ob_tran[] = "ob_tran";
static const char __pyx_k_paramId[] = "paramId";
static const char __pyx_k_reduced[] = "reduced";
static const char __pyx_k_reshape[] = "reshape";
static const char __pyx_k_ro_keys[] = "_ro_keys";
static const char __pyx_k_unknown[] = "unknown";
static const char __pyx_k_version[] = "__version__";
static const char __pyx_k_KeyError[] = "KeyError";
static const char __pyx_k_all_keys[] = "_all_keys";
static const char __pyx_k_analDate[] = "analDate";
static const char __pyx_k_dataDate[] = "dataDate";
static const char __pyx_k_dataTime[] = "dataTime";
static const char __pyx_k_datetime[] = "datetime";
static const char __pyx_k_ens_mean[] = ":ens mean";
static const char __pyx_k_filename[] = "filename";
static const char __pyx_k_getstate[] = "__getstate__";
static const char __pyx_k_gridType[] = "gridType";
static const char __pyx_k_linspace[] = "linspace";
static const char __pyx_k_localDir[] = "localDir";
static const char __pyx_k_mercator[] = "mercator";
static const char __pyx_k_meshgrid[] = "meshgrid";
static const char __pyx_k_redtoreg[] = "redtoreg";
static const char __pyx_k_revision[] = "revision";
static const char __pyx_k_setdates[] = "setdates";
static const char __pyx_k_setstate[] = "__setstate__";
static const char __pyx_k_stepType[] = "stepType";
static const char __pyx_k_thousand[] = "thousand";
static const char __pyx_k_topLevel[] = "topLevel";
static const char __pyx_k_tostring[] = "tostring";
static const char __pyx_k_warnings[] = "warnings";
static const char __pyx_k_TypeError[] = "TypeError";
static const char __pyx_k_centuries[] = "centuries";
static const char __pyx_k_from_what[] = "from_what";
static const char __pyx_k_ftimedict[] = "_ftimedict";
static const char __pyx_k_julianDay[] = "julianDay";
static const char __pyx_k_latitudes[] = "latitudes";
static const char __pyx_k_ncepgrib2[] = "ncepgrib2";
static const char __pyx_k_reduce_ex[] = "__reduce_ex__";
static const char __pyx_k_stepRange[] = "stepRange";
static const char __pyx_k_traceback[] = "traceback";
static const char __pyx_k_validDate[] = "validDate";
static const char __pyx_k_valid_key[] = "valid_key";
static const char __pyx_k_DxInMetres[] = "DxInMetres";
static const char __pyx_k_DyInMetres[] = "DyInMetres";
static const char __pyx_k_IndexError[] = "IndexError";
static const char __pyx_k_ValueError[] = "ValueError";
static const char __pyx_k_ens_spread[] = ":ens spread";
static const char __pyx_k_fromstring[] = "fromstring";
static const char __pyx_k_gribstring[] = "gribstring";
static const char __pyx_k_is_missing[] = "is_missing";
static const char __pyx_k_iscallable[] = "iscallable";
static const char __pyx_k_levels_s_s[] = ":levels %s-%s";
static const char __pyx_k_longitudes[] = "longitudes";
static const char __pyx_k_projparams[] = "projparams";
static const char __pyx_k_pygrib_pyx[] = "pygrib.pyx";
static const char __pyx_k_redtoreg_2[] = "_redtoreg";
static const char __pyx_k_reduced_gg[] = "reduced_gg";
static const char __pyx_k_reduced_ll[] = "reduced_ll";
static const char __pyx_k_regular_gg[] = "regular_gg";
static const char __pyx_k_regular_ll[] = "regular_ll";
static const char __pyx_k_rotated_gg[] = "rotated_gg";
static const char __pyx_k_rotated_ll[] = "rotated_ll";
static const char __pyx_k_space_view[] = "space_view";
static const char __pyx_k_startswith[] = "startswith";
static const char __pyx_k_typeOfGrid[] = "typeOfGrid";
static const char __pyx_k_Grib2Decode[] = "Grib2Decode";
static const char __pyx_k_ImportError[] = "ImportError";
static const char __pyx_k_bottomLevel[] = "bottomLevel";
static const char __pyx_k_ens_std_dev[] = ":ens std dev";
static const char __pyx_k_iscontainer[] = "iscontainer";
static const char __pyx_k_oneThousand[] = "oneThousand";
static const char __pyx_k_packingType[] = "packingType";
static const char __pyx_k_return_msgs[] = "return_msgs";
static const char __pyx_k_typeOfLevel[] = "typeOfLevel";
static const char __pyx_k_3_hr_periods[] = "3 hr periods";
static const char __pyx_k_6_hr_periods[] = "6 hr periods";
static const char __pyx_k_LaDInDegrees[] = "LaDInDegrees";
static const char __pyx_k_LoVInDegrees[] = "LoVInDegrees";
static const char __pyx_k_RuntimeError[] = "RuntimeError";
static const char __pyx_k_fcstimeunits[] = "fcstimeunits";
static const char __pyx_k_forecastTime[] = "forecastTime";
static const char __pyx_k_grib2divider[] = "grib2divider";
static const char __pyx_k_grid_complex[] = "grid_complex";
static const char __pyx_k_is_container[] = "_is_container";
static const char __pyx_k_missingValue[] = "missingValue";
static const char __pyx_k_private_atts[] = "_private_atts";
static const char __pyx_k_reshape_mask[] = "_reshape_mask";
static const char __pyx_k_unshape_mask[] = "_unshape_mask";
static const char __pyx_k_12_hr_periods[] = "12 hr periods";
static const char __pyx_k_30_yr_periods[] = "30 yr periods";
static const char __pyx_k_StopIteration[] = "StopIteration";
static const char __pyx_k_fcst_time_s_s[] = ":fcst time %s %s";
static const char __pyx_k_is_stringlike[] = "_is_stringlike";
static const char __pyx_k_masked_values[] = "masked_values";
static const char __pyx_k_messagenumber[] = "messagenumber";
static const char __pyx_k_parameterName[] = "parameterName";
static const char __pyx_k_parse_version[] = "parse_version";
static const char __pyx_k_pkg_resources[] = "pkg_resources";
static const char __pyx_k_reduce_cython[] = "__reduce_cython__";
static const char __pyx_k_AttributeError[] = "AttributeError";
static const char __pyx_k_expand_reduced[] = "expand_reduced";
static const char __pyx_k_neg_ens_pert_d[] = ":neg ens pert %d";
static const char __pyx_k_numberOfValues[] = "numberOfValues";
static const char __pyx_k_parameterUnits[] = "parameterUnits";
static const char __pyx_k_pos_ens_pert_d[] = ":pos ens pert %d";
static const char __pyx_k_read_only_keys[] = "_read_only_keys";
static const char __pyx_k_set_projparams[] = "_set_projparams";
static const char __pyx_k_Latin1InDegrees[] = "Latin1InDegrees";
static const char __pyx_k_Latin2InDegrees[] = "Latin2InDegrees";
static const char __pyx_k_derivedForecast[] = "derivedForecast";
static const char __pyx_k_fcst_time_s_s_s[] = ":fcst time %s %s (%s)";
static const char __pyx_k_numberOfMissing[] = "numberOfMissing";
static const char __pyx_k_setstate_cython[] = "__setstate_cython__";
static const char __pyx_k_shapeOfTheEarth[] = "shapeOfTheEarth";
static const char __pyx_k_truncateDegrees[] = "truncateDegrees";
static const char __pyx_k_centralLongitude[] = "centralLongitude";
static const char __pyx_k_could_not_open_s[] = "could not open %s";
static const char __pyx_k_default_encoding[] = "default_encoding";
static const char __pyx_k_grib_api_version[] = "grib_api_version";
static const char __pyx_k_hi_res_cntl_fcst[] = ":hi res cntl fcst";
static const char __pyx_k_lo_res_cntl_fcst[] = ":lo res cntl fcst";
static const char __pyx_k_missingvalue_int[] = "missingvalue_int";
static const char __pyx_k_multi_support_on[] = "multi_support_on";
static const char __pyx_k_no_matches_found[] = "no matches found";
static const char __pyx_k_standardParallel[] = "standardParallel";
static const char __pyx_k_tolerate_badgrib[] = "tolerate_badgrib";
static const char __pyx_k_distinctLatitudes[] = "distinctLatitudes";
static const char __pyx_k_multi_support_off[] = "multi_support_off";
static const char __pyx_k_weighted_ens_mean[] = ":weighted ens mean";
static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback";
static const char __pyx_k_datetime_to_julian[] = "datetime_to_julian";
static const char __pyx_k_distinctLongitudes[] = "distinctLongitudes";
static const char __pyx_k_julian_to_datetime[] = "julian_to_datetime";
static const char __pyx_k_key_s_is_read_only[] = "key \"%s\" is read only";
static const char __pyx_k_missingvalue_float[] = "missingvalue_float";
static const char __pyx_k_nlats_must_be_even[] = "nlats must be even";
static const char __pyx_k_perturbationNumber[] = "perturbationNumber";
static const char __pyx_k_unsupported_grid_s[] = "unsupported grid %s";
static const char __pyx_k_ens_mean_of_cluster[] = ":ens mean of cluster";
static const char __pyx_k_iDirectionIncrement[] = "iDirectionIncrement";
static const char __pyx_k_polar_stereographic[] = "polar_stereographic";
static const char __pyx_k_probabilityTypeName[] = "probabilityTypeName";
static const char __pyx_k_tolerate_badgrib_on[] = "tolerate_badgrib_on";
static const char __pyx_k_get_grib_api_version[] = "_get_grib_api_version";
static const char __pyx_k_mpl_toolkits_basemap[] = "mpl_toolkits.basemap";
static const char __pyx_k_projectionCenterFlag[] = "projectionCenterFlag";
static const char __pyx_k_projectionCentreFlag[] = "projectionCentreFlag";
static const char __pyx_k_tolerate_badgrib_off[] = "tolerate_badgrib_off";
static const char __pyx_k_jPointsAreConsecutive[] = "jPointsAreConsecutive";
static const char __pyx_k_alternativeRowScanning[] = "alternativeRowScanning";
static const char __pyx_k_array_must_be_1d_or_2d[] = "array must be 1d or 2d";
static const char __pyx_k_normalized_ens_std_dev[] = ":normalized ens std dev";
static const char __pyx_k_typeOfEnsembleForecast[] = "typeOfEnsembleForecast";
static const char __pyx_k_ens_large_anomaly_index[] = ":ens large anomaly index";
static const char __pyx_k_latitudeOfLastGridPoint[] = "latitudeOfLastGridPoint";
static const char __pyx_k_scaleFactorOfLowerLimit[] = "scaleFactorOfLowerLimit";
static const char __pyx_k_scaleFactorOfUpperLimit[] = "scaleFactorOfUpperLimit";
static const char __pyx_k_scaledValueOfLowerLimit[] = "scaledValueOfLowerLimit";
static const char __pyx_k_scaledValueOfUpperLimit[] = "scaledValueOfUpperLimit";
static const char __pyx_k_typeOfFirstFixedSurface[] = "typeOfFirstFixedSurface";
static const char __pyx_k_angleOfRotationInDegrees[] = "angleOfRotationInDegrees";
static const char __pyx_k_latitudeOfFirstGridPoint[] = "latitudeOfFirstGridPoint";
static const char __pyx_k_longitudeOfLastGridPoint[] = "longitudeOfLastGridPoint";
static const char __pyx_k_typeOfSecondFixedSurface[] = "typeOfSecondFixedSurface";
static const char __pyx_k_unitsOfFirstFixedSurface[] = "unitsOfFirstFixedSurface";
static const char __pyx_k_unrecognized_grib_type_d[] = "unrecognized grib type % d";
static const char __pyx_k_longitudeOfFirstGridPoint[] = "longitudeOfFirstGridPoint";
static const char __pyx_k_indicatorOfUnitOfTimeRange[] = "indicatorOfUnitOfTimeRange";
static const char __pyx_k_key_not_part_of_grib_index[] = "key not part of grib index";
static const char __pyx_k_nmsgs_must_be_0_in__advance[] = "nmsgs must be >= 0 in _advance";
static const char __pyx_k_scaledValueOfEarthMajorAxis[] = "scaledValueOfEarthMajorAxis";
static const char __pyx_k_scaledValueOfEarthMinorAxis[] = "scaledValueOfEarthMinorAxis";
static const char __pyx_k_lambert_azimuthal_equal_area[] = "lambert_azimuthal_equal_area";
static const char __pyx_k_xDirectionGridLengthInMetres[] = "xDirectionGridLengthInMetres";
static const char __pyx_k_yDirectionGridLengthInMetres[] = "yDirectionGridLengthInMetres";
static const char __pyx_k_orientationOfTheGridInDegrees[] = "orientationOfTheGridInDegrees";
static const char __pyx_k_Introduction_Python_module_for[] = "\nIntroduction\n============\n\nPython module for reading and writing GRIB (editions 1 and 2) files.\nGRIB is the World Meterological Organization\nU{standard<http://www.wmo.ch/pages/prog/www/WMOCodes/GRIB.html>} \nfor distributing gridded data. \nThe module is a python interface to the\nU{GRIB API<https://software.ecmwf.int/wiki/display/GRIB/Home>} C library\nfrom the European Centre for Medium-Range Weather Forecasts\n(U{ECMWF<http://www.ecmwf.int>}).\n\nRequired\n========\n\n- U{Python<http://python.org>} 2.4 or higher.\n- U{numpy<http://sourceforge.net/project/showfiles.php?group_id=1369>}\n  N-dimensional array object for python. Version 1.2.1 or higher (version\n  1.5.1 required for Python 3).\n- U{pyproj<http://code.google.com/p/pyproj/>} Python interface to \n  U{PROJ.4<http://trac.osgeo.org/proj>} library for cartographic\n  transformations B{or} U{matplotlib<http://matplotlib.sf.net>} and\n  the U{basemap<http://matplotlib.sf.net/basemap/doc/html>} toolkit.\n  Pyproj 1.8.9 is required for Python 3.\n- U{GRIB API<https://software.ecmwf.int/wiki/display/GRIB/Home>} C library\n  for encoding and decoding GRIB messages (edition 1 and edition 2).\n  Version 1.8.0 or higher required.\n  To be fully functional, the GRIB API library requires\n  U{Jasper<http://www.ece.uvic.ca/~mdadams/jasper>} or \n  U{OpenJPEG<http://www.openjpeg.org>} for JPEG200 encoding,\n  and U{PNG<http://www.libpng.org/pub/png/libpng.html>} for PNG encoding.\n\nThese dependencies are available via the package management system of most\nLinux distributions, and on MacOS X using U{macports<http://macports.org/>}. \nIf you build grib_api yourself as a static library on a 64-bit system\nyou may need to set C{CFLAGS} to C{'-O2 -fPIC'} before running the C{configure}\nscript.  To use pygrib on Windows, you must use the\nU{Cygwin<http://cygwin.com>} environment, since the grib_api library requires a \nposix environment.  Cygwin installation instructions are available\nU{here<http://code.google.com""/p/pygrib/wiki/CygwinWindowsInstall>}.\n\nInstallation\n============\n\n - U{Download<http://code.google.com/p/pygrib/downloads/list>} the source code. \n - pygrib installation options can either be set with environment variables,\n or specified in a text file (setup.cfg).  To use environment variables,\n set C{$GRIBAPI_DIR}, C{$JASPER_DIR}, C{$OPENJPEG_DIR},\n C{$PNG_DIR} and C{$ZLIB_DIR} so that the include files and libraries for\n GRIB API, Jasper, OpenJPEG, PNG and zlib will be found.  \n For example, the include files for \n jasper should be found in C{$JASPER_DIR/include} or\n C{$JASPER_DIR/include/jasper}, and the jasper\n library should be found in C{$JASPER_DIR/lib} or C{$JASPER_DIR/lib64}. If any of\n those environment variables are not set, then it is assumed that GRIB API was\n not built with support for that library.\n If the libraries and\n include files are installed in separate locations, the environment variables\n C{$GRIBAPI_INCDIR} and C{$GRIBAPI_LIBDIR} can be used to define the locations\n separately (same goes for C{JASPER}, C{OPENJPEG}, C{PNG} and C{ZLIB}).\n Note that if both C{$GRIBAPI_DIR} and C{$GRIBAPI_INCDIR}/C{$GRIBAPI_LIBDIR}\n are specified, C{$GRIBAPI_DIR} takes precedence.\n To use setup.cfg, copy setup.cfg.template to setup.cfg, open setup.cfg in a \n text editor and follow the instructions in the comments for editing.\n - Run 'python setup.py build' and then 'python setup.py install', as root if necessary.\n Note that if you are using environment variables to specify the build options,\n you cannot build and install in one step with 'sudo python setup.py install',\n since sudo does not pass environment variables.  Instead, run 'python setup.py\n build' first as a regular user, then run 'sudo python setup.py install' if the\n install directory requires admin or root privileges.\n - Run 'python test.py' to test your installation.\n - Look at examples in C{test} directory (most require \n U{matplotlib<http://matplotlib.sf.net>} and""\n U{basemap<http://matplotlib.sourceforge.net/basemap/doc/html/>}).\n - If you're on MacOS X, see README.macosx\n for special instruction on how to install pygrib and all it's\n dependencies using U{macports<http://macports.org>}.\n\n\nExample usage\n=============\n\n - from the python interpreter prompt, import the package::\n    >>> import pygrib\n - open a GRIB file, create a grib message iterator::\n    >>> grbs = pygrib.open('sampledata/flux.grb')  \n - pygrib open instances behave like regular python file objects, with\n C{seek}, C{tell}, C{read}, C{readline} and C{close} methods, except that offsets\n are measured in grib messages instead of bytes::\n    >>> grbs.seek(2)\n    >>> grbs.tell()\n    2\n    >>> grb = grbs.read(1)[0] # read returns a list with the next N (N=1 in this case) messages.\n    >>> grb # printing a grib message object displays summary info\n    3:Maximum temperature:K (instant):regular_gg:heightAboveGround:level 2 m:fcst time 108-120 hrs:from 200402291200\n    >>> grbs.tell()\n    3\n - print an inventory of the file::\n    >>> grbs.seek(0)\n    >>> for grb in grbs:\n    >>>     grb \n    1:Precipitation rate:kg m**-2 s**-1 (avg):regular_gg:surface:level 0:fcst time 108-120 hrs (avg):from 200402291200\n    2:Surface pressure:Pa (instant):regular_gg:surface:level 0:fcst time 120 hrs:from 200402291200\n    3:Maximum temperature:K (instant):regular_gg:heightAboveGround:level 2 m:fcst time 108-120 hrs:from 200402291200\n    4:Minimum temperature:K (instant):regular_gg:heightAboveGround:level 2 m:fcst time 108-120 hrs:from 200402291200\n - find the first grib message with a matching name::\n    >>> grb = grbs.select(name='Maximum temperature')[0]\n - extract the data values using the 'values' key\n (grb.keys() will return a list of the available keys)::\n    # The data is returned as a numpy array, or if missing values or a bitmap\n    # are present, a numpy masked array.  Reduced lat/lon or gaussian grid\n    # data is automatically expande""d to a regular grid. Details of the internal\n    # representation of the grib data (such as the scanning mode) are handled\n    # automatically.\n    >>> maxt = grb.values # same as grb['values']\n    >>> maxt.shape, maxt.min(), maxt.max()\n    (94, 192) 223.7 319.9\n - get the latitudes and longitudes of the grid::\n    >>> lats, lons = grb.latlons()\n    >>> lats.shape, lats.min(), lats.max(), lons.shape, lons.min(), lons.max()\n    (94, 192) -88.5419501373 88.5419501373  0.0 358.125\n - get the second grib message::\n    >>> grb = grbs.message(2) # same as grbs.seek(1); grb=grbs.readline()\n    >>> grb\n    2:Surface pressure:Pa (instant):regular_gg:surface:level 0:fcst time 120 hrs:from 200402291200\n - extract data and get lat/lon values for a subset over North America::\n    >>> data, lats, lons = grb.data(lat1=20,lat2=70,lon1=220,lon2=320)\n    >>> data.shape, lats.min(), lats.max(), lons.min(), lons.max()\n    (26, 53) 21.904439458 69.5216630593 221.25 318.75\n - modify the values associated with existing keys (either via attribute or\n dictionary access)::\n    >>> grb['forecastTime'] = 240\n    >>> grb.dataDate = 20100101\n - get the binary string associated with the coded message::\n    >>> msg = grb.tostring()\n    >>> grbs.close() # close the grib file.\n - write the modified message to a new GRIB file::\n    >>> grbout = open('test.grb','wb')\n    >>> grbout.write(msg)\n    >>> grbout.close()\n    >>> pygrib.open('test.grb').readline() \n    1:Surface pressure:Pa (instant):regular_gg:surface:level 0:fcst time 240 hrs:from 201001011200\n\nDocumentation\n=============\n\n - see below for the full python API documentation.\n  \n@author: Jeffrey Whitaker.\n\n@contact: U{Jeff Whitaker<mailto:jeffrey.s.whitaker@noaa.gov>}\n\n@version: 2.0.0\n\n@copyright: copyright 2010 by Jeffrey Whitaker.\n\n@license: Permission to use, copy, modify, and distribute this software and its\ndocumentation for any purpose and without fee is hereby granted,\nprovided that the a""bove copyright notice appear in all copies and that\nboth that copyright notice and this permission notice appear in\nsupporting documentation.\nTHE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,\nINCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO\nEVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, INDIRECT OR\nCONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF\nUSE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\nPERFORMANCE OF THIS SOFTWARE.";
static const char __pyx_k_grb_message_numbers_start_at_1[] = "grb message numbers start at 1";
static const char __pyx_k_not_that_many_messages_in_file[] = "not that many messages in file";
static const char __pyx_k_scaleFactorOfFirstFixedSurface[] = "scaleFactorOfFirstFixedSurface";
static const char __pyx_k_scaledValueOfFirstFixedSurface[] = "scaledValueOfFirstFixedSurface";
static const char __pyx_k_file_s_has_multi_field_messages[] = "\nfile %s has multi-field messages, keys inside multi-field\nmessages will not be indexed correctly";
static const char __pyx_k_get_grib_api_version_locals_lam[] = "_get_grib_api_version.<locals>.<lambda>";
static const char __pyx_k_latitudeOfSouthernPoleInDegrees[] = "latitudeOfSouthernPoleInDegrees";
static const char __pyx_k_reduced_grid_data_array_must_be[] = "reduced grid data array must be 1d";
static const char __pyx_k_scaleFactorOfSecondFixedSurface[] = "scaleFactorOfSecondFixedSurface";
static const char __pyx_k_scaledValueOfSecondFixedSurface[] = "scaledValueOfSecondFixedSurface";
static const char __pyx_k_self__gh_cannot_be_converted_to[] = "self._gh cannot be converted to a Python object for pickling";
static const char __pyx_k_unknown_shape_of_the_earth_flag[] = "unknown shape of the earth flag";
static const char __pyx_k_This_class_cannot_be_instantiate[] = "This class cannot be instantiated from Python";
static const char __pyx_k_can_only_modify_existing_grib_ke[] = "can only modify existing grib keys (key \"%s\" not found)";
static const char __pyx_k_cannot_find_projection_center_fl[] = "cannot find projection center flag";
static const char __pyx_k_either_pyproj_or_basemap_require[] = "either pyproj or basemap required";
static const char __pyx_k_equatorial_azimuthal_equidistant[] = "equatorial_azimuthal_equidistant";
static const char __pyx_k_from_what_keyword_arg_to_seek_mu[] = "from_what keyword arg to seek must be 0,1 or 2";
static const char __pyx_k_key_must_be_an_integer_message_n[] = "key must be an integer message number or a slice";
static const char __pyx_k_latitudeOfFirstGridPointInDegree[] = "latitudeOfFirstGridPointInDegrees";
static const char __pyx_k_latitudeOfLastGridPointInDegrees[] = "latitudeOfLastGridPointInDegrees";
static const char __pyx_k_latitudeOfSubSatellitePointInDeg[] = "latitudeOfSubSatellitePointInDegrees";
static const char __pyx_k_latitudeWhereDxAndDyAreSpecified[] = "latitudeWhereDxAndDyAreSpecifiedInDegrees";
static const char __pyx_k_longitudeOfFirstGridPointInDegre[] = "longitudeOfFirstGridPointInDegrees";
static const char __pyx_k_longitudeOfLastGridPointInDegree[] = "longitudeOfLastGridPointInDegrees";
static const char __pyx_k_longitudeOfSouthernPoleInDegrees[] = "longitudeOfSouthernPoleInDegrees";
static const char __pyx_k_longitudeOfSubSatellitePointInDe[] = "longitudeOfSubSatellitePointInDegrees";
static const char __pyx_k_no_default___reduce___due_to_non[] = "no default __reduce__ due to non-trivial __cinit__";
static const char __pyx_k_scaleFactorOfMajorAxisOfOblateSp[] = "scaleFactorOfMajorAxisOfOblateSpheroidEarth";
static const char __pyx_k_scaleFactorOfMinorAxisOfOblateSp[] = "scaleFactorOfMinorAxisOfOblateSpheroidEarth";
static const char __pyx_k_scaleFactorOfRadiusOfSphericalEa[] = "scaleFactorOfRadiusOfSphericalEarth";
static const char __pyx_k_scaledValueOfMajorAxisOfOblateSp[] = "scaledValueOfMajorAxisOfOblateSpheroidEarth";
static const char __pyx_k_scaledValueOfMinorAxisOfOblateSp[] = "scaledValueOfMinorAxisOfOblateSpheroidEarth";
static const char __pyx_k_scaledValueOfRadiusOfSphericalEa[] = "scaledValueOfRadiusOfSphericalEarth";
static const char __pyx_k_unsupported_grid_earth_not_a_per[] = "unsupported grid - earth not a perfect sphere";
static const char __pyx_k_value_must_be_float_int_or_strin[] = "value must be float, int or string";
static PyObject *__pyx_kp_s_04i;
static PyObject *__pyx_kp_s_12_hr_periods;
static PyObject *__pyx_kp_s_1_9_0;
static PyObject *__pyx_kp_s_2_0_3;
static PyObject *__pyx_kp_s_30_yr_periods;
static PyObject *__pyx_kp_s_3_hr_periods;
static PyObject *__pyx_kp_s_6_hr_periods;
static PyObject *__pyx_kp_s_7777;
static PyObject *__pyx_n_s_AttributeError;
static PyObject *__pyx_n_s_C;
static PyObject *__pyx_n_s_Dx;
static PyObject *__pyx_n_s_DxInMetres;
static PyObject *__pyx_n_s_Dy;
static PyObject *__pyx_n_s_DyInMetres;
static PyObject *__pyx_n_s_F;
static PyObject *__pyx_n_s_Grib2Decode;
static PyObject *__pyx_n_s_IOError;
static PyObject *__pyx_n_s_ImportError;
static PyObject *__pyx_n_s_IndexError;
static PyObject *__pyx_n_s_KeyError;
static PyObject *__pyx_n_s_LaD;
static PyObject *__pyx_n_s_LaDInDegrees;
static PyObject *__pyx_n_s_Latin;
static PyObject *__pyx_n_s_Latin1;
static PyObject *__pyx_n_s_Latin1InDegrees;
static PyObject *__pyx_n_s_Latin2;
static PyObject *__pyx_n_s_Latin2InDegrees;
static PyObject *__pyx_n_s_LoV;
static PyObject *__pyx_n_s_LoVInDegrees;
static PyObject *__pyx_n_s_Ni;
static PyObject *__pyx_n_s_Nj;
static PyObject *__pyx_n_s_Nr;
static PyObject *__pyx_n_s_Nx;
static PyObject *__pyx_n_s_Ny;
static PyObject *__pyx_n_s_Proj;
static PyObject *__pyx_n_s_RuntimeError;
static PyObject *__pyx_n_s_StopIteration;
static PyObject *__pyx_kp_s_This_class_cannot_be_instantiate;
static PyObject *__pyx_n_s_TypeError;
static PyObject *__pyx_n_s_ValueError;
static PyObject *__pyx_kp_s__10;
static PyObject *__pyx_kp_s__105;
static PyObject *__pyx_kp_s__15;
static PyObject *__pyx_kp_s__20;
static PyObject *__pyx_kp_s__25;
static PyObject *__pyx_kp_s__26;
static PyObject *__pyx_n_s_a;
static PyObject *__pyx_n_s_advance;
static PyObject *__pyx_n_s_aea;
static PyObject *__pyx_n_s_aeqd;
static PyObject *__pyx_n_s_albers;
static PyObject *__pyx_n_s_all_keys;
static PyObject *__pyx_n_s_alternativeRowScanning;
static PyObject *__pyx_n_s_analDate;
static PyObject *__pyx_n_s_angleOfRotationInDegrees;
static PyObject *__pyx_n_s_arange;
static PyObject *__pyx_n_s_arcsin;
static PyObject *__pyx_kp_s_array_must_be_1d_or_2d;
static PyObject *__pyx_n_s_asarray;
static PyObject *__pyx_n_s_ascii;
static PyObject *__pyx_n_s_atype;
static PyObject *__pyx_n_s_b;
static PyObject *__pyx_n_s_bottomLevel;
static PyObject *__pyx_n_s_call;
static PyObject *__pyx_kp_s_can_only_modify_existing_grib_ke;
static PyObject *__pyx_kp_s_cannot_find_projection_center_fl;
static PyObject *__pyx_n_s_centralLongitude;
static PyObject *__pyx_n_s_centuries;
static PyObject *__pyx_n_s_cline_in_traceback;
static PyObject *__pyx_n_s_close;
static PyObject *__pyx_n_s_copy;
static PyObject *__pyx_kp_s_could_not_open_s;
static PyObject *__pyx_n_s_cyl;
static PyObject *__pyx_n_s_d;
static PyObject *__pyx_kp_s_d_d_d;
static PyObject *__pyx_n_s_data;
static PyObject *__pyx_n_s_dataDate;
static PyObject *__pyx_n_s_dataTime;
static PyObject *__pyx_n_s_datetime;
static PyObject *__pyx_n_s_datetime_to_julian;
static PyObject *__pyx_n_s_day;
static PyObject *__pyx_n_s_days;
static PyObject *__pyx_n_s_decades;
static PyObject *__pyx_n_s_decode;
static PyObject *__pyx_n_s_default;
static PyObject *__pyx_n_s_default_encoding;
static PyObject *__pyx_n_s_derivedForecast;
static PyObject *__pyx_n_s_dict;
static PyObject *__pyx_n_s_distinctLatitudes;
static PyObject *__pyx_n_s_distinctLongitudes;
static PyObject *__pyx_n_s_div;
static PyObject *__pyx_n_s_double;
static PyObject *__pyx_n_s_dx;
static PyObject *__pyx_n_s_dy;
static PyObject *__pyx_n_s_eight;
static PyObject *__pyx_kp_s_either_pyproj_or_basemap_require;
static PyObject *__pyx_n_s_eleven;
static PyObject *__pyx_n_s_empty;
static PyObject *__pyx_n_s_encode;
static PyObject *__pyx_kp_s_ens_large_anomaly_index;
static PyObject *__pyx_kp_s_ens_mean;
static PyObject *__pyx_kp_s_ens_mean_of_cluster;
static PyObject *__pyx_kp_s_ens_spread;
static PyObject *__pyx_kp_s_ens_std_dev;
static PyObject *__pyx_n_s_equatorial_azimuthal_equidistant;
static PyObject *__pyx_n_s_err;
static PyObject *__pyx_n_s_expand_reduced;
static PyObject *__pyx_n_s_fabs;
static PyObject *__pyx_n_s_false;
static PyObject *__pyx_kp_s_fcst_time_s_s;
static PyObject *__pyx_kp_s_fcst_time_s_s_s;
static PyObject *__pyx_n_s_fcstimeunits;
static PyObject *__pyx_n_s_file;
static PyObject *__pyx_kp_s_file_s_has_multi_field_messages;
static PyObject *__pyx_n_s_filename;
static PyObject *__pyx_n_s_filled;
static PyObject *__pyx_n_s_find;
static PyObject *__pyx_n_s_float;
static PyObject *__pyx_n_s_float64;
static PyObject *__pyx_n_s_forecastTime;
static PyObject *__pyx_kp_s_from;
static PyObject *__pyx_n_s_from_what;
static PyObject *__pyx_kp_s_from_what_keyword_arg_to_seek_mu;
static PyObject *__pyx_n_s_fromstring;
static PyObject *__pyx_n_s_ftime;
static PyObject *__pyx_n_s_ftimedict;
static PyObject *__pyx_n_s_gaulats;
static PyObject *__pyx_n_s_geos;
static PyObject *__pyx_n_s_get_grib_api_version;
static PyObject *__pyx_n_s_get_grib_api_version_locals_lam;
static PyObject *__pyx_n_s_get_key;
static PyObject *__pyx_n_s_getitem;
static PyObject *__pyx_n_s_getstate;
static PyObject *__pyx_n_s_gh;
static PyObject *__pyx_n_s_gh_2;
static PyObject *__pyx_n_s_grb;
static PyObject *__pyx_kp_s_grb_message_numbers_start_at_1;
static PyObject *__pyx_n_s_grib2divider;
static PyObject *__pyx_n_s_grib_api_version;
static PyObject *__pyx_n_s_gribmsg;
static PyObject *__pyx_n_s_gribstr;
static PyObject *__pyx_n_s_gribstring;
static PyObject *__pyx_n_s_gridType;
static PyObject *__pyx_n_s_grid_complex;
static PyObject *__pyx_n_s_h;
static PyObject *__pyx_n_s_has_key;
static PyObject *__pyx_kp_s_hi_res_cntl_fcst;
static PyObject *__pyx_n_s_hour;
static PyObject *__pyx_n_s_hrs;
static PyObject *__pyx_n_s_iDirectionIncrement;
static PyObject *__pyx_n_s_import;
static PyObject *__pyx_n_s_index;
static PyObject *__pyx_n_s_indicatorOfUnitOfTimeRange;
static PyObject *__pyx_n_s_indices;
static PyObject *__pyx_n_s_instant;
static PyObject *__pyx_n_s_int;
static PyObject *__pyx_n_s_inverse;
static PyObject *__pyx_n_s_isMA;
static PyObject *__pyx_n_s_is_container;
static PyObject *__pyx_n_s_is_missing;
static PyObject *__pyx_n_s_is_stringlike;
static PyObject *__pyx_n_s_iscallable;
static PyObject *__pyx_n_s_iscontainer;
static PyObject *__pyx_n_s_items;
static PyObject *__pyx_n_s_jPointsAreConsecutive;
static PyObject *__pyx_n_s_jd;
static PyObject *__pyx_n_s_join;
static PyObject *__pyx_n_s_julday;
static PyObject *__pyx_n_s_julianDay;
static PyObject *__pyx_n_s_julian_to_datetime;
static PyObject *__pyx_n_s_k;
static PyObject *__pyx_n_s_key;
static PyObject *__pyx_kp_s_key_must_be_an_integer_message_n;
static PyObject *__pyx_kp_s_key_not_part_of_grib_index;
static PyObject *__pyx_kp_s_key_s_is_read_only;
static PyObject *__pyx_n_s_keys;
static PyObject *__pyx_n_s_kwargs;
static PyObject *__pyx_n_s_l;
static PyObject *__pyx_n_s_laea;
static PyObject *__pyx_n_s_lambert;
static PyObject *__pyx_n_s_lambert_azimuthal_equal_area;
static PyObject *__pyx_n_s_lat1;
static PyObject *__pyx_n_s_lat2;
static PyObject *__pyx_n_s_lat_0;
static PyObject *__pyx_n_s_lat_1;
static PyObject *__pyx_n_s_lat_2;
static PyObject *__pyx_n_s_lat_ts;
static PyObject *__pyx_n_s_latitudeOfFirstGridPoint;
static PyObject *__pyx_n_s_latitudeOfFirstGridPointInDegree;
static PyObject *__pyx_n_s_latitudeOfLastGridPoint;
static PyObject *__pyx_n_s_latitudeOfLastGridPointInDegrees;
static PyObject *__pyx_n_s_latitudeOfSouthernPoleInDegrees;
static PyObject *__pyx_n_s_latitudeOfSubSatellitePointInDeg;
static PyObject *__pyx_n_s_latitudeWhereDxAndDyAreSpecified;
static PyObject *__pyx_n_s_latitudes;
static PyObject *__pyx_n_s_latlons;
static PyObject *__pyx_n_s_lats;
static PyObject *__pyx_n_s_lcc;
static PyObject *__pyx_n_s_level;
static PyObject *__pyx_kp_s_level_s;
static PyObject *__pyx_kp_s_levels_s_s;
static PyObject *__pyx_n_s_linspace;
static PyObject *__pyx_kp_s_lo_res_cntl_fcst;
static PyObject *__pyx_n_s_localDir;
static PyObject *__pyx_n_s_lon1;
static PyObject *__pyx_n_s_lon2;
static PyObject *__pyx_n_s_lon_0;
static PyObject *__pyx_n_s_longitudeOfFirstGridPoint;
static PyObject *__pyx_n_s_longitudeOfFirstGridPointInDegre;
static PyObject *__pyx_n_s_longitudeOfLastGridPoint;
static PyObject *__pyx_n_s_longitudeOfLastGridPointInDegree;
static PyObject *__pyx_n_s_longitudeOfSouthernPoleInDegrees;
static PyObject *__pyx_n_s_longitudeOfSubSatellitePointInDe;
static PyObject *__pyx_n_s_longitudes;
static PyObject *__pyx_n_s_longlat;
static PyObject *__pyx_n_s_ma;
static PyObject *__pyx_n_s_main;
static PyObject *__pyx_n_s_major;
static PyObject *__pyx_n_s_masked_values;
static PyObject *__pyx_n_s_max;
static PyObject *__pyx_n_s_merc;
static PyObject *__pyx_n_s_mercator;
static PyObject *__pyx_n_s_meshgrid;
static PyObject *__pyx_n_s_message;
static PyObject *__pyx_n_s_messagenumber;
static PyObject *__pyx_n_s_min;
static PyObject *__pyx_n_s_minor;
static PyObject *__pyx_n_s_mins;
static PyObject *__pyx_n_s_minute;
static PyObject *__pyx_n_s_missingValue;
static PyObject *__pyx_n_s_missingvalue_float;
static PyObject *__pyx_n_s_missingvalue_int;
static PyObject *__pyx_n_s_month;
static PyObject *__pyx_n_s_months;
static PyObject *__pyx_n_s_mpl_toolkits_basemap;
static PyObject *__pyx_n_s_msg;
static PyObject *__pyx_n_s_msgs;
static PyObject *__pyx_n_s_multi_support_off;
static PyObject *__pyx_n_s_multi_support_on;
static PyObject *__pyx_n_s_name;
static PyObject *__pyx_n_s_name_2;
static PyObject *__pyx_n_s_ncepgrib2;
static PyObject *__pyx_n_s_ndim;
static PyObject *__pyx_kp_s_neg_ens_pert_d;
static PyObject *__pyx_n_s_next;
static PyObject *__pyx_n_s_nlats;
static PyObject *__pyx_kp_s_nlats_must_be_even;
static PyObject *__pyx_n_s_nmsgs;
static PyObject *__pyx_kp_s_nmsgs_must_be_0_in__advance;
static PyObject *__pyx_kp_s_no_default___reduce___due_to_non;
static PyObject *__pyx_kp_s_no_matches_found;
static PyObject *__pyx_kp_s_normalized_ens_std_dev;
static PyObject *__pyx_kp_s_not_that_many_messages_in_file;
static PyObject *__pyx_n_s_np;
static PyObject *__pyx_n_s_nsper;
static PyObject *__pyx_n_s_numberOfMissing;
static PyObject *__pyx_n_s_numberOfValues;
static PyObject *__pyx_n_s_numpy;
static PyObject *__pyx_n_s_o_lat_p;
static PyObject *__pyx_n_s_o_lon_p;
static PyObject *__pyx_n_s_o_proj;
static PyObject *__pyx_n_s_ob_tran;
static PyObject *__pyx_n_s_one;
static PyObject *__pyx_n_s_oneThousand;
static PyObject *__pyx_n_s_order;
static PyObject *__pyx_n_s_orientationOfTheGridInDegrees;
static PyObject *__pyx_n_s_packingType;
static PyObject *__pyx_n_s_paramId;
static PyObject *__pyx_n_s_parameterName;
static PyObject *__pyx_n_s_parameterUnits;
static PyObject *__pyx_n_s_parse_version;
static PyObject *__pyx_n_s_perturbationNumber;
static PyObject *__pyx_n_s_pi;
static PyObject *__pyx_n_s_pkg_resources;
static PyObject *__pyx_n_s_pl;
static PyObject *__pyx_n_s_polar_stereographic;
static PyObject *__pyx_kp_s_pos_ens_pert_d;
static PyObject *__pyx_n_s_power;
static PyObject *__pyx_n_s_private_atts;
static PyObject *__pyx_n_s_probabilityTypeName;
static PyObject *__pyx_n_s_proj;
static PyObject *__pyx_n_s_projectionCenterFlag;
static PyObject *__pyx_n_s_projectionCentreFlag;
static PyObject *__pyx_n_s_projparams;
static PyObject *__pyx_n_s_pygrib;
static PyObject *__pyx_kp_s_pygrib_pyx;
static PyObject *__pyx_n_s_pyproj;
static PyObject *__pyx_n_s_radius;
static PyObject *__pyx_n_s_range;
static PyObject *__pyx_n_s_read_only_keys;
static PyObject *__pyx_n_s_redtoreg;
static PyObject *__pyx_n_s_redtoreg_2;
static PyObject *__pyx_n_s_reduce;
static PyObject *__pyx_n_s_reduce_cython;
static PyObject *__pyx_n_s_reduce_ex;
static PyObject *__pyx_n_s_reduced;
static PyObject *__pyx_n_s_reduced_gg;
static PyObject *__pyx_kp_s_reduced_grid_data_array_must_be;
static PyObject *__pyx_n_s_reduced_ll;
static PyObject *__pyx_n_s_regular_gg;
static PyObject *__pyx_n_s_regular_ll;
static PyObject *__pyx_n_s_reload;
static PyObject *__pyx_n_s_reshape;
static PyObject *__pyx_n_s_reshape_mask;
static PyObject *__pyx_n_s_return_msgs;
static PyObject *__pyx_n_s_revision;
static PyObject *__pyx_n_s_rewind;
static PyObject *__pyx_n_s_ro_keys;
static PyObject *__pyx_n_s_rotated_gg;
static PyObject *__pyx_n_s_rotated_ll;
static PyObject *__pyx_n_s_rstrip;
static PyObject *__pyx_kp_s_s;
static PyObject *__pyx_kp_s_s_2;
static PyObject *__pyx_kp_s_s_3;
static PyObject *__pyx_n_s_s_4;
static PyObject *__pyx_kp_s_s_s;
static PyObject *__pyx_n_s_scaleFactorOfFirstFixedSurface;
static PyObject *__pyx_n_s_scaleFactorOfLowerLimit;
static PyObject *__pyx_n_s_scaleFactorOfMajorAxisOfOblateSp;
static PyObject *__pyx_n_s_scaleFactorOfMinorAxisOfOblateSp;
static PyObject *__pyx_n_s_scaleFactorOfRadiusOfSphericalEa;
static PyObject *__pyx_n_s_scaleFactorOfSecondFixedSurface;
static PyObject *__pyx_n_s_scaleFactorOfUpperLimit;
static PyObject *__pyx_n_s_scaledValueOfEarthMajorAxis;
static PyObject *__pyx_n_s_scaledValueOfEarthMinorAxis;
static PyObject *__pyx_n_s_scaledValueOfFirstFixedSurface;
static PyObject *__pyx_n_s_scaledValueOfLowerLimit;
static PyObject *__pyx_n_s_scaledValueOfMajorAxisOfOblateSp;
static PyObject *__pyx_n_s_scaledValueOfMinorAxisOfOblateSp;
static PyObject *__pyx_n_s_scaledValueOfRadiusOfSphericalEa;
static PyObject *__pyx_n_s_scaledValueOfSecondFixedSurface;
static PyObject *__pyx_n_s_scaledValueOfUpperLimit;
static PyObject *__pyx_n_s_second;
static PyObject *__pyx_n_s_secs;
static PyObject *__pyx_n_s_seek;
static PyObject *__pyx_n_s_select;
static PyObject *__pyx_kp_s_self__gh_cannot_be_converted_to;
static PyObject *__pyx_n_s_set_projparams;
static PyObject *__pyx_n_s_setdates;
static PyObject *__pyx_n_s_setstate;
static PyObject *__pyx_n_s_setstate_cython;
static PyObject *__pyx_n_s_shape;
static PyObject *__pyx_n_s_shapeOfTheEarth;
static PyObject *__pyx_n_s_size;
static PyObject *__pyx_n_s_space_view;
static PyObject *__pyx_n_s_split;
static PyObject *__pyx_n_s_standardParallel;
static PyObject *__pyx_n_s_startswith;
static PyObject *__pyx_n_s_stepRange;
static PyObject *__pyx_n_s_stepType;
static PyObject *__pyx_n_s_stere;
static PyObject *__pyx_n_s_sum;
static PyObject *__pyx_n_s_tell;
static PyObject *__pyx_n_s_test;
static PyObject *__pyx_n_s_thousand;
static PyObject *__pyx_n_s_tolerate_badgrib;
static PyObject *__pyx_n_s_tolerate_badgrib_off;
static PyObject *__pyx_n_s_tolerate_badgrib_on;
static PyObject *__pyx_n_s_topLevel;
static PyObject *__pyx_n_s_tostring;
static PyObject *__pyx_n_s_traceback;
static PyObject *__pyx_n_s_truncateDegrees;
static PyObject *__pyx_n_s_typeOfEnsembleForecast;
static PyObject *__pyx_n_s_typeOfFirstFixedSurface;
static PyObject *__pyx_n_s_typeOfGrid;
static PyObject *__pyx_n_s_typeOfLevel;
static PyObject *__pyx_n_s_typeOfSecondFixedSurface;
static PyObject *__pyx_n_s_units;
static PyObject *__pyx_n_s_unitsOfFirstFixedSurface;
static PyObject *__pyx_n_s_unknown;
static PyObject *__pyx_kp_s_unknown_shape_of_the_earth_flag;
static PyObject *__pyx_kp_s_unrecognized_grib_type_d;
static PyObject *__pyx_n_s_unshape_mask;
static PyObject *__pyx_kp_s_unsupported_grid_earth_not_a_per;
static PyObject *__pyx_kp_s_unsupported_grid_s;
static PyObject *__pyx_n_s_v;
static PyObject *__pyx_n_s_validDate;
static PyObject *__pyx_n_s_valid_key;
static PyObject *__pyx_n_s_value;
static PyObject *__pyx_kp_s_value_must_be_float_int_or_strin;
static PyObject *__pyx_n_b_values;
static PyObject *__pyx_n_s_values;
static PyObject *__pyx_n_s_version;
static PyObject *__pyx_n_s_warn;
static PyObject *__pyx_n_s_warnings;
static PyObject *__pyx_kp_s_weighted_ens_mean;
static PyObject *__pyx_n_s_where;
static PyObject *__pyx_n_s_xDirectionGridLengthInMetres;
static PyObject *__pyx_n_s_xrange;
static PyObject *__pyx_n_s_yDirectionGridLengthInMetres;
static PyObject *__pyx_n_s_year;
static PyObject *__pyx_n_s_yrs;
static PyObject *__pyx_n_s_zero;
static PyObject *__pyx_n_s_zeros;
static PyObject *__pyx_lambda_funcdef_lambda(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_v, PyObject *__pyx_v_d); /* proto */
static PyObject *__pyx_pf_6pygrib__get_grib_api_version(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_6pygrib_2tolerate_badgrib_on(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_6pygrib_4tolerate_badgrib_off(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_6pygrib_6gaulats(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_nlats); /* proto */
static PyObject *__pyx_pf_6pygrib_8multi_support_on(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_6pygrib_10multi_support_off(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
static int __pyx_pf_6pygrib_4open___cinit__(struct __pyx_obj_6pygrib_open *__pyx_v_self, PyObject *__pyx_v_filename); /* proto */
static int __pyx_pf_6pygrib_4open_2__init__(struct __pyx_obj_6pygrib_open *__pyx_v_self, PyObject *__pyx_v_filename); /* proto */
static PyObject *__pyx_pf_6pygrib_4open_4__iter__(struct __pyx_obj_6pygrib_open *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pygrib_4open_6__next__(struct __pyx_obj_6pygrib_open *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pygrib_4open_8__getitem__(struct __pyx_obj_6pygrib_open *__pyx_v_self, PyObject *__pyx_v_key); /* proto */
static PyObject *__pyx_pf_6pygrib_4open_10__call__(struct __pyx_obj_6pygrib_open *__pyx_v_self, PyObject *__pyx_v_kwargs); /* proto */
static PyObject *__pyx_pf_6pygrib_4open_12__enter__(struct __pyx_obj_6pygrib_open *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pygrib_4open_14__exit__(struct __pyx_obj_6pygrib_open *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_atype, CYTHON_UNUSED PyObject *__pyx_v_value, CYTHON_UNUSED PyObject *__pyx_v_traceback); /* proto */
static PyObject *__pyx_pf_6pygrib_4open_16tell(struct __pyx_obj_6pygrib_open *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pygrib_4open_18seek(struct __pyx_obj_6pygrib_open *__pyx_v_self, PyObject *__pyx_v_msg, PyObject *__pyx_v_from_what); /* proto */
static PyObject *__pyx_pf_6pygrib_4open_20readline(struct __pyx_obj_6pygrib_open *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pygrib_4open_22read(struct __pyx_obj_6pygrib_open *__pyx_v_self, PyObject *__pyx_v_msgs); /* proto */
static PyObject *__pyx_pf_6pygrib_4open_24close(struct __pyx_obj_6pygrib_open *__pyx_v_self); /* proto */
static void __pyx_pf_6pygrib_4open_26__dealloc__(struct __pyx_obj_6pygrib_open *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pygrib_4open_28rewind(struct __pyx_obj_6pygrib_open *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pygrib_4open_30message(struct __pyx_obj_6pygrib_open *__pyx_v_self, PyObject *__pyx_v_N); /* proto */
static PyObject *__pyx_pf_6pygrib_4open_32select(struct __pyx_obj_6pygrib_open *__pyx_v_self, PyObject *__pyx_v_kwargs); /* proto */
static PyObject *__pyx_pf_6pygrib_4open_34_advance(struct __pyx_obj_6pygrib_open *__pyx_v_self, PyObject *__pyx_v_nmsgs, PyObject *__pyx_v_return_msgs); /* proto */
static PyObject *__pyx_pf_6pygrib_4open_4name___get__(struct __pyx_obj_6pygrib_open *__pyx_v_self); /* proto */
static int __pyx_pf_6pygrib_4open_4name_2__set__(struct __pyx_obj_6pygrib_open *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static int __pyx_pf_6pygrib_4open_4name_4__del__(struct __pyx_obj_6pygrib_open *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pygrib_4open_13messagenumber___get__(struct __pyx_obj_6pygrib_open *__pyx_v_self); /* proto */
static int __pyx_pf_6pygrib_4open_13messagenumber_2__set__(struct __pyx_obj_6pygrib_open *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static int __pyx_pf_6pygrib_4open_13messagenumber_4__del__(struct __pyx_obj_6pygrib_open *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pygrib_4open_8messages___get__(struct __pyx_obj_6pygrib_open *__pyx_v_self); /* proto */
static int __pyx_pf_6pygrib_4open_8messages_2__set__(struct __pyx_obj_6pygrib_open *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static int __pyx_pf_6pygrib_4open_8messages_4__del__(struct __pyx_obj_6pygrib_open *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pygrib_4open_6closed___get__(struct __pyx_obj_6pygrib_open *__pyx_v_self); /* proto */
static int __pyx_pf_6pygrib_4open_6closed_2__set__(struct __pyx_obj_6pygrib_open *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static int __pyx_pf_6pygrib_4open_6closed_4__del__(struct __pyx_obj_6pygrib_open *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pygrib_4open_20has_multi_field_msgs___get__(struct __pyx_obj_6pygrib_open *__pyx_v_self); /* proto */
static int __pyx_pf_6pygrib_4open_20has_multi_field_msgs_2__set__(struct __pyx_obj_6pygrib_open *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static int __pyx_pf_6pygrib_4open_20has_multi_field_msgs_4__del__(struct __pyx_obj_6pygrib_open *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pygrib_4open_36__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6pygrib_open *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pygrib_4open_38__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6pygrib_open *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_6pygrib_12julian_to_datetime(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_jd); /* proto */
static PyObject *__pyx_pf_6pygrib_14datetime_to_julian(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_d); /* proto */
static PyObject *__pyx_pf_6pygrib_16fromstring(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_gribstring); /* proto */
static PyObject *__pyx_pf_6pygrib_18setdates(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_6pygrib_gribmessage *__pyx_v_grb); /* proto */
static PyObject *__pyx_pf_6pygrib_20reload(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_6pygrib_gribmessage *__pyx_v_grb); /* proto */
static int __pyx_pf_6pygrib_11gribmessage___init__(CYTHON_UNUSED struct __pyx_obj_6pygrib_gribmessage *__pyx_v_self); /* proto */
static void __pyx_pf_6pygrib_11gribmessage_2__dealloc__(struct __pyx_obj_6pygrib_gribmessage *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pygrib_11gribmessage_4__getattr__(struct __pyx_obj_6pygrib_gribmessage *__pyx_v_self, PyObject *__pyx_v_item); /* proto */
static int __pyx_pf_6pygrib_11gribmessage_6__setattr__(struct __pyx_obj_6pygrib_gribmessage *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_6pygrib_11gribmessage_8__repr__(struct __pyx_obj_6pygrib_gribmessage *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pygrib_11gribmessage_10_get_key(struct __pyx_obj_6pygrib_gribmessage *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_default); /* proto */
static PyObject *__pyx_pf_6pygrib_11gribmessage_12expand_grid(struct __pyx_obj_6pygrib_gribmessage *__pyx_v_self, PyObject *__pyx_v_expand_reduced); /* proto */
static PyObject *__pyx_pf_6pygrib_11gribmessage_14is_missing(struct __pyx_obj_6pygrib_gribmessage *__pyx_v_self, PyObject *__pyx_v_key); /* proto */
static PyObject *__pyx_pf_6pygrib_11gribmessage_16keys(struct __pyx_obj_6pygrib_gribmessage *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pygrib_11gribmessage_18_read_only_keys(struct __pyx_obj_6pygrib_gribmessage *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pygrib_11gribmessage_20data(struct __pyx_obj_6pygrib_gribmessage *__pyx_v_self, PyObject *__pyx_v_lat1, PyObject *__pyx_v_lat2, PyObject *__pyx_v_lon1, PyObject *__pyx_v_lon2); /* proto */
static int __pyx_pf_6pygrib_11gribmessage_22__setitem__(struct __pyx_obj_6pygrib_gribmessage *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_6pygrib_11gribmessage_24__getitem__(struct __pyx_obj_6pygrib_gribmessage *__pyx_v_self, PyObject *__pyx_v_key); /* proto */
static PyObject *__pyx_pf_6pygrib_11gribmessage_26has_key(struct __pyx_obj_6pygrib_gribmessage *__pyx_v_self, PyObject *__pyx_v_key); /* proto */
static PyObject *__pyx_pf_6pygrib_11gribmessage_28valid_key(struct __pyx_obj_6pygrib_gribmessage *__pyx_v_self, PyObject *__pyx_v_key); /* proto */
static PyObject *__pyx_pf_6pygrib_11gribmessage_30tostring(struct __pyx_obj_6pygrib_gribmessage *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pygrib_11gribmessage_32_unshape_mask(struct __pyx_obj_6pygrib_gribmessage *__pyx_v_self, PyObject *__pyx_v_datarr); /* proto */
static PyObject *__pyx_pf_6pygrib_11gribmessage_34_reshape_mask(struct __pyx_obj_6pygrib_gribmessage *__pyx_v_self, PyObject *__pyx_v_datarr); /* proto */
static PyObject *__pyx_pf_6pygrib_11gribmessage_36_set_projparams(struct __pyx_obj_6pygrib_gribmessage *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pygrib_11gribmessage_38latlons(struct __pyx_obj_6pygrib_gribmessage *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pygrib_11gribmessage_13messagenumber___get__(struct __pyx_obj_6pygrib_gribmessage *__pyx_v_self); /* proto */
static int __pyx_pf_6pygrib_11gribmessage_13messagenumber_2__set__(struct __pyx_obj_6pygrib_gribmessage *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static int __pyx_pf_6pygrib_11gribmessage_13messagenumber_4__del__(struct __pyx_obj_6pygrib_gribmessage *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pygrib_11gribmessage_10projparams___get__(struct __pyx_obj_6pygrib_gribmessage *__pyx_v_self); /* proto */
static int __pyx_pf_6pygrib_11gribmessage_10projparams_2__set__(struct __pyx_obj_6pygrib_gribmessage *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static int __pyx_pf_6pygrib_11gribmessage_10projparams_4__del__(struct __pyx_obj_6pygrib_gribmessage *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pygrib_11gribmessage_9validDate___get__(struct __pyx_obj_6pygrib_gribmessage *__pyx_v_self); /* proto */
static int __pyx_pf_6pygrib_11gribmessage_9validDate_2__set__(struct __pyx_obj_6pygrib_gribmessage *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static int __pyx_pf_6pygrib_11gribmessage_9validDate_4__del__(struct __pyx_obj_6pygrib_gribmessage *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pygrib_11gribmessage_8analDate___get__(struct __pyx_obj_6pygrib_gribmessage *__pyx_v_self); /* proto */
static int __pyx_pf_6pygrib_11gribmessage_8analDate_2__set__(struct __pyx_obj_6pygrib_gribmessage *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static int __pyx_pf_6pygrib_11gribmessage_8analDate_4__del__(struct __pyx_obj_6pygrib_gribmessage *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pygrib_11gribmessage_14expand_reduced___get__(struct __pyx_obj_6pygrib_gribmessage *__pyx_v_self); /* proto */
static int __pyx_pf_6pygrib_11gribmessage_14expand_reduced_2__set__(struct __pyx_obj_6pygrib_gribmessage *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static int __pyx_pf_6pygrib_11gribmessage_14expand_reduced_4__del__(struct __pyx_obj_6pygrib_gribmessage *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pygrib_11gribmessage_8_ro_keys___get__(struct __pyx_obj_6pygrib_gribmessage *__pyx_v_self); /* proto */
static int __pyx_pf_6pygrib_11gribmessage_8_ro_keys_2__set__(struct __pyx_obj_6pygrib_gribmessage *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static int __pyx_pf_6pygrib_11gribmessage_8_ro_keys_4__del__(struct __pyx_obj_6pygrib_gribmessage *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pygrib_11gribmessage_9_all_keys___get__(struct __pyx_obj_6pygrib_gribmessage *__pyx_v_self); /* proto */
static int __pyx_pf_6pygrib_11gribmessage_9_all_keys_2__set__(struct __pyx_obj_6pygrib_gribmessage *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static int __pyx_pf_6pygrib_11gribmessage_9_all_keys_4__del__(struct __pyx_obj_6pygrib_gribmessage *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pygrib_11gribmessage_12fcstimeunits___get__(struct __pyx_obj_6pygrib_gribmessage *__pyx_v_self); /* proto */
static int __pyx_pf_6pygrib_11gribmessage_12fcstimeunits_2__set__(struct __pyx_obj_6pygrib_gribmessage *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static int __pyx_pf_6pygrib_11gribmessage_12fcstimeunits_4__del__(struct __pyx_obj_6pygrib_gribmessage *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pygrib_11gribmessage_40__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6pygrib_gribmessage *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pygrib_11gribmessage_42__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6pygrib_gribmessage *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static int __pyx_pf_6pygrib_5index___cinit__(struct __pyx_obj_6pygrib_index *__pyx_v_self, PyObject *__pyx_v_filename, PyObject *__pyx_v_args); /* proto */
static int __pyx_pf_6pygrib_5index_2__init__(struct __pyx_obj_6pygrib_index *__pyx_v_self, PyObject *__pyx_v_filename, PyObject *__pyx_v_args); /* proto */
static PyObject *__pyx_pf_6pygrib_5index_4__call__(struct __pyx_obj_6pygrib_index *__pyx_v_self, PyObject *__pyx_v_kwargs); /* proto */
static PyObject *__pyx_pf_6pygrib_5index_6select(struct __pyx_obj_6pygrib_index *__pyx_v_self, PyObject *__pyx_v_kwargs); /* proto */
static PyObject *__pyx_pf_6pygrib_5index_8write(struct __pyx_obj_6pygrib_index *__pyx_v_self, PyObject *__pyx_v_filename); /* proto */
static PyObject *__pyx_pf_6pygrib_5index_10close(struct __pyx_obj_6pygrib_index *__pyx_v_self); /* proto */
static void __pyx_pf_6pygrib_5index_12__dealloc__(struct __pyx_obj_6pygrib_index *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pygrib_5index_4keys___get__(struct __pyx_obj_6pygrib_index *__pyx_v_self); /* proto */
static int __pyx_pf_6pygrib_5index_4keys_2__set__(struct __pyx_obj_6pygrib_index *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static int __pyx_pf_6pygrib_5index_4keys_4__del__(struct __pyx_obj_6pygrib_index *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pygrib_5index_5types___get__(struct __pyx_obj_6pygrib_index *__pyx_v_self); /* proto */
static int __pyx_pf_6pygrib_5index_5types_2__set__(struct __pyx_obj_6pygrib_index *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static int __pyx_pf_6pygrib_5index_5types_4__del__(struct __pyx_obj_6pygrib_index *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pygrib_5index_4name___get__(struct __pyx_obj_6pygrib_index *__pyx_v_self); /* proto */
static int __pyx_pf_6pygrib_5index_4name_2__set__(struct __pyx_obj_6pygrib_index *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static int __pyx_pf_6pygrib_5index_4name_4__del__(struct __pyx_obj_6pygrib_index *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pygrib_5index_14__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6pygrib_index *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pygrib_5index_16__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6pygrib_index *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_6pygrib_22_is_stringlike(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_a); /* proto */
static PyObject *__pyx_pf_6pygrib_24_is_container(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_a); /* proto */
static PyObject *__pyx_pf_6pygrib_26_find(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_grb, PyObject *__pyx_v_kwargs); /* proto */
static PyObject *__pyx_tp_new_6pygrib_open(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_6pygrib_gribmessage(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_6pygrib_index(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_items = {0, &__pyx_n_s_items, 0, 0, 0};
static PyObject *__pyx_float_0_;
static PyObject *__pyx_float_1_;
static PyObject *__pyx_float_2_;
static PyObject *__pyx_float_4_;
static PyObject *__pyx_float_8_;
static PyObject *__pyx_float_0_5;
static PyObject *__pyx_float_24_;
static PyObject *__pyx_float_90_;
static PyObject *__pyx_float_1_e3;
static PyObject *__pyx_float_1_e6;
static PyObject *__pyx_float_10_0;
static PyObject *__pyx_float_180_;
static PyObject *__pyx_float_360_;
static PyObject *__pyx_float_1_e20;
static PyObject *__pyx_float_1_e30;
static PyObject *__pyx_float_1000_;
static PyObject *__pyx_float_1440_;
static PyObject *__pyx_float_86400_;
static PyObject *__pyx_float_6356775_0;
static PyObject *__pyx_float_6367470_0;
static PyObject *__pyx_float_6371200_0;
static PyObject *__pyx_float_6371229_0;
static PyObject *__pyx_float_6378137_0;
static PyObject *__pyx_float_6378160_0;
static PyObject *__pyx_float_6356752_3142;
static PyObject *__pyx_float_neg_0_5;
static PyObject *__pyx_float_neg_90_;
static PyObject *__pyx_float_neg_1_e100;
static PyObject *__pyx_int_0;
static PyObject *__pyx_int_1;
static PyObject *__pyx_int_2;
static PyObject *__pyx_int_3;
static PyObject *__pyx_int_4;
static PyObject *__pyx_int_5;
static PyObject *__pyx_int_6;
static PyObject *__pyx_int_7;
static PyObject *__pyx_int_8;
static PyObject *__pyx_int_100;
static PyObject *__pyx_int_255;
static PyObject *__pyx_int_360;
static PyObject *__pyx_int_1000;
static PyObject *__pyx_int_neg_1;
static PyObject *__pyx_tuple_;
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__9;
static PyObject *__pyx_slice__54;
static PyObject *__pyx_slice__56;
static PyObject *__pyx_slice__65;
static PyObject *__pyx_slice__66;
static PyObject *__pyx_slice__68;
static PyObject *__pyx_slice__69;
static PyObject *__pyx_slice__78;
static PyObject *__pyx_slice__79;
static PyObject *__pyx_slice__81;
static PyObject *__pyx_slice__82;
static PyObject *__pyx_slice__97;
static PyObject *__pyx_slice__98;
static PyObject *__pyx_tuple__11;
static PyObject *__pyx_tuple__12;
static PyObject *__pyx_tuple__13;
static PyObject *__pyx_tuple__14;
static PyObject *__pyx_tuple__16;
static PyObject *__pyx_tuple__17;
static PyObject *__pyx_tuple__18;
static PyObject *__pyx_tuple__19;
static PyObject *__pyx_tuple__21;
static PyObject *__pyx_tuple__22;
static PyObject *__pyx_tuple__23;
static PyObject *__pyx_tuple__24;
static PyObject *__pyx_tuple__27;
static PyObject *__pyx_tuple__28;
static PyObject *__pyx_tuple__29;
static PyObject *__pyx_tuple__30;
static PyObject *__pyx_tuple__31;
static PyObject *__pyx_tuple__32;
static PyObject *__pyx_tuple__33;
static PyObject *__pyx_tuple__34;
static PyObject *__pyx_tuple__35;
static PyObject *__pyx_tuple__36;
static PyObject *__pyx_tuple__37;
static PyObject *__pyx_tuple__38;
static PyObject *__pyx_tuple__39;
static PyObject *__pyx_tuple__40;
static PyObject *__pyx_tuple__41;
static PyObject *__pyx_tuple__42;
static PyObject *__pyx_tuple__43;
static PyObject *__pyx_tuple__44;
static PyObject *__pyx_tuple__45;
static PyObject *__pyx_tuple__46;
static PyObject *__pyx_tuple__47;
static PyObject *__pyx_tuple__48;
static PyObject *__pyx_tuple__49;
static PyObject *__pyx_tuple__50;
static PyObject *__pyx_tuple__51;
static PyObject *__pyx_tuple__52;
static PyObject *__pyx_tuple__53;
static PyObject *__pyx_tuple__55;
static PyObject *__pyx_tuple__57;
static PyObject *__pyx_tuple__58;
static PyObject *__pyx_tuple__59;
static PyObject *__pyx_tuple__60;
static PyObject *__pyx_tuple__61;
static PyObject *__pyx_tuple__62;
static PyObject *__pyx_tuple__63;
static PyObject *__pyx_tuple__64;
static PyObject *__pyx_tuple__67;
static PyObject *__pyx_tuple__70;
static PyObject *__pyx_tuple__71;
static PyObject *__pyx_tuple__72;
static PyObject *__pyx_tuple__73;
static PyObject *__pyx_tuple__74;
static PyObject *__pyx_tuple__75;
static PyObject *__pyx_tuple__76;
static PyObject *__pyx_tuple__77;
static PyObject *__pyx_tuple__80;
static PyObject *__pyx_tuple__83;
static PyObject *__pyx_tuple__84;
static PyObject *__pyx_tuple__85;
static PyObject *__pyx_tuple__86;
static PyObject *__pyx_tuple__87;
static PyObject *__pyx_tuple__88;
static PyObject *__pyx_tuple__89;
static PyObject *__pyx_tuple__90;
static PyObject *__pyx_tuple__91;
static PyObject *__pyx_tuple__92;
static PyObject *__pyx_tuple__93;
static PyObject *__pyx_tuple__94;
static PyObject *__pyx_tuple__95;
static PyObject *__pyx_tuple__96;
static PyObject *__pyx_tuple__99;
static PyObject *__pyx_tuple__100;
static PyObject *__pyx_tuple__101;
static PyObject *__pyx_tuple__102;
static PyObject *__pyx_tuple__103;
static PyObject *__pyx_tuple__104;
static PyObject *__pyx_tuple__106;
static PyObject *__pyx_tuple__107;
static PyObject *__pyx_tuple__108;
static PyObject *__pyx_tuple__109;
static PyObject *__pyx_tuple__110;
static PyObject *__pyx_tuple__111;
static PyObject *__pyx_tuple__112;
static PyObject *__pyx_tuple__113;
static PyObject *__pyx_tuple__114;
static PyObject *__pyx_tuple__115;
static PyObject *__pyx_tuple__119;
static PyObject *__pyx_tuple__123;
static PyObject *__pyx_tuple__125;
static PyObject *__pyx_tuple__127;
static PyObject *__pyx_tuple__129;
static PyObject *__pyx_tuple__131;
static PyObject *__pyx_tuple__133;
static PyObject *__pyx_tuple__135;
static PyObject *__pyx_tuple__137;
static PyObject *__pyx_codeobj__116;
static PyObject *__pyx_codeobj__117;
static PyObject *__pyx_codeobj__118;
static PyObject *__pyx_codeobj__120;
static PyObject *__pyx_codeobj__121;
static PyObject *__pyx_codeobj__122;
static PyObject *__pyx_codeobj__124;
static PyObject *__pyx_codeobj__126;
static PyObject *__pyx_codeobj__128;
static PyObject *__pyx_codeobj__130;
static PyObject *__pyx_codeobj__132;
static PyObject *__pyx_codeobj__134;
static PyObject *__pyx_codeobj__136;
static PyObject *__pyx_codeobj__138;
/* Late includes */

/* "pygrib.pyx":299
 * #missingvalue_float = GRIB_MISSING_DOUBLE
 * missingvalue_float = -1.e100 # value given in grib_api.h version 1.90
 * def _get_grib_api_version():             # <<<<<<<<<<<<<<
 *     div = lambda v,d: (v/d,v%d)
 *     v = grib_get_api_version()
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pygrib_1_get_grib_api_version(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyMethodDef __pyx_mdef_6pygrib_1_get_grib_api_version = {"_get_grib_api_version", (PyCFunction)__pyx_pw_6pygrib_1_get_grib_api_version, METH_NOARGS, 0};
static PyObject *__pyx_pw_6pygrib_1_get_grib_api_version(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_get_grib_api_version (wrapper)", 0);
  __pyx_r = __pyx_pf_6pygrib__get_grib_api_version(__pyx_self);

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

/* "pygrib.pyx":300
 * missingvalue_float = -1.e100 # value given in grib_api.h version 1.90
 * def _get_grib_api_version():
 *     div = lambda v,d: (v/d,v%d)             # <<<<<<<<<<<<<<
 *     v = grib_get_api_version()
 *     v,revision = div(v,100)
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pygrib_21_get_grib_api_version_lambda(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_6pygrib_21_get_grib_api_version_lambda = {"lambda", (PyCFunction)__pyx_pw_6pygrib_21_get_grib_api_version_lambda, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6pygrib_21_get_grib_api_version_lambda(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_v = 0;
  PyObject *__pyx_v_d = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("lambda (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_v,&__pyx_n_s_d,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);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_v)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_d)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("lambda", 1, 2, 2, 1); __PYX_ERR(0, 300, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "lambda") < 0)) __PYX_ERR(0, 300, __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_v = values[0];
    __pyx_v_d = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("lambda", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 300, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pygrib._get_grib_api_version.lambda", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_lambda_funcdef_lambda(__pyx_self, __pyx_v_v, __pyx_v_d);

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

static PyObject *__pyx_lambda_funcdef_lambda(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_v, PyObject *__pyx_v_d) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("lambda", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyNumber_Divide(__pyx_v_v, __pyx_v_d); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 300, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyNumber_Remainder(__pyx_v_v, __pyx_v_d); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 300, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 300, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

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

/* "pygrib.pyx":299
 * #missingvalue_float = GRIB_MISSING_DOUBLE
 * missingvalue_float = -1.e100 # value given in grib_api.h version 1.90
 * def _get_grib_api_version():             # <<<<<<<<<<<<<<
 *     div = lambda v,d: (v/d,v%d)
 *     v = grib_get_api_version()
 */

static PyObject *__pyx_pf_6pygrib__get_grib_api_version(CYTHON_UNUSED PyObject *__pyx_self) {
  PyObject *__pyx_v_div = NULL;
  PyObject *__pyx_v_v = NULL;
  PyObject *__pyx_v_revision = NULL;
  PyObject *__pyx_v_minor = NULL;
  PyObject *__pyx_v_major = NULL;
  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)(PyObject *);
  __Pyx_RefNannySetupContext("_get_grib_api_version", 0);

  /* "pygrib.pyx":300
 * missingvalue_float = -1.e100 # value given in grib_api.h version 1.90
 * def _get_grib_api_version():
 *     div = lambda v,d: (v/d,v%d)             # <<<<<<<<<<<<<<
 *     v = grib_get_api_version()
 *     v,revision = div(v,100)
 */
  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6pygrib_21_get_grib_api_version_lambda, 0, __pyx_n_s_get_grib_api_version_locals_lam, NULL, __pyx_n_s_pygrib, __pyx_d, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 300, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_div = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pygrib.pyx":301
 * def _get_grib_api_version():
 *     div = lambda v,d: (v/d,v%d)
 *     v = grib_get_api_version()             # <<<<<<<<<<<<<<
 *     v,revision = div(v,100)
 *     v,minor = div(v,100)
 */
  __pyx_t_1 = __Pyx_PyInt_From_long(grib_get_api_version()); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 301, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_v = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pygrib.pyx":302
 *     div = lambda v,d: (v/d,v%d)
 *     v = grib_get_api_version()
 *     v,revision = div(v,100)             # <<<<<<<<<<<<<<
 *     v,minor = div(v,100)
 *     major = v
 */
  __pyx_t_1 = __pyx_lambda_funcdef_lambda(__pyx_v_div, __pyx_v_v, __pyx_int_100); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 302, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
    PyObject* sequence = __pyx_t_1;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 302, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_3);
    #else
    __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 302, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 302, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_4 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 302, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_5 = Py_TYPE(__pyx_t_4)->tp_iternext;
    index = 0; __pyx_t_2 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    index = 1; __pyx_t_3 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_4), 2) < 0) __PYX_ERR(0, 302, __pyx_L1_error)
    __pyx_t_5 = NULL;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_5 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 302, __pyx_L1_error)
    __pyx_L4_unpacking_done:;
  }
  __Pyx_DECREF_SET(__pyx_v_v, __pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_v_revision = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "pygrib.pyx":303
 *     v = grib_get_api_version()
 *     v,revision = div(v,100)
 *     v,minor = div(v,100)             # <<<<<<<<<<<<<<
 *     major = v
 *     return "%d.%d.%d" % (major,minor,revision)
 */
  __pyx_t_1 = __pyx_lambda_funcdef_lambda(__pyx_v_div, __pyx_v_v, __pyx_int_100); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 303, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
    PyObject* sequence = __pyx_t_1;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 303, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_3 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_2 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_2);
    #else
    __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 303, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 303, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_4 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 303, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_5 = Py_TYPE(__pyx_t_4)->tp_iternext;
    index = 0; __pyx_t_3 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_3)) goto __pyx_L5_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    index = 1; __pyx_t_2 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_2)) goto __pyx_L5_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_4), 2) < 0) __PYX_ERR(0, 303, __pyx_L1_error)
    __pyx_t_5 = NULL;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L6_unpacking_done;
    __pyx_L5_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_5 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 303, __pyx_L1_error)
    __pyx_L6_unpacking_done:;
  }
  __Pyx_DECREF_SET(__pyx_v_v, __pyx_t_3);
  __pyx_t_3 = 0;
  __pyx_v_minor = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "pygrib.pyx":304
 *     v,revision = div(v,100)
 *     v,minor = div(v,100)
 *     major = v             # <<<<<<<<<<<<<<
 *     return "%d.%d.%d" % (major,minor,revision)
 * grib_api_version = _get_grib_api_version()
 */
  __Pyx_INCREF(__pyx_v_v);
  __pyx_v_major = __pyx_v_v;

  /* "pygrib.pyx":305
 *     v,minor = div(v,100)
 *     major = v
 *     return "%d.%d.%d" % (major,minor,revision)             # <<<<<<<<<<<<<<
 * grib_api_version = _get_grib_api_version()
 * tolerate_badgrib = False
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 305, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_major);
  __Pyx_GIVEREF(__pyx_v_major);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_major);
  __Pyx_INCREF(__pyx_v_minor);
  __Pyx_GIVEREF(__pyx_v_minor);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_minor);
  __Pyx_INCREF(__pyx_v_revision);
  __Pyx_GIVEREF(__pyx_v_revision);
  PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_revision);
  __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_d_d_d, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 305, __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;

  /* "pygrib.pyx":299
 * #missingvalue_float = GRIB_MISSING_DOUBLE
 * missingvalue_float = -1.e100 # value given in grib_api.h version 1.90
 * def _get_grib_api_version():             # <<<<<<<<<<<<<<
 *     div = lambda v,d: (v/d,v%d)
 *     v = grib_get_api_version()
 */

  /* 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("pygrib._get_grib_api_version", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_div);
  __Pyx_XDECREF(__pyx_v_v);
  __Pyx_XDECREF(__pyx_v_revision);
  __Pyx_XDECREF(__pyx_v_minor);
  __Pyx_XDECREF(__pyx_v_major);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pygrib.pyx":309
 * tolerate_badgrib = False
 * 
 * def tolerate_badgrib_on():             # <<<<<<<<<<<<<<
 *     """
 *     don't raise an exception when a missing or malformed key is encountered.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pygrib_3tolerate_badgrib_on(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6pygrib_2tolerate_badgrib_on[] = "\n    don't raise an exception when a missing or malformed key is encountered.\n    ";
static PyMethodDef __pyx_mdef_6pygrib_3tolerate_badgrib_on = {"tolerate_badgrib_on", (PyCFunction)__pyx_pw_6pygrib_3tolerate_badgrib_on, METH_NOARGS, __pyx_doc_6pygrib_2tolerate_badgrib_on};
static PyObject *__pyx_pw_6pygrib_3tolerate_badgrib_on(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("tolerate_badgrib_on (wrapper)", 0);
  __pyx_r = __pyx_pf_6pygrib_2tolerate_badgrib_on(__pyx_self);

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

static PyObject *__pyx_pf_6pygrib_2tolerate_badgrib_on(CYTHON_UNUSED PyObject *__pyx_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("tolerate_badgrib_on", 0);

  /* "pygrib.pyx":314
 *     """
 *     global tolerate_badgrib
 *     tolerate_badgrib = True             # <<<<<<<<<<<<<<
 * 
 * def tolerate_badgrib_off():
 */
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_tolerate_badgrib, Py_True) < 0) __PYX_ERR(0, 314, __pyx_L1_error)

  /* "pygrib.pyx":309
 * tolerate_badgrib = False
 * 
 * def tolerate_badgrib_on():             # <<<<<<<<<<<<<<
 *     """
 *     don't raise an exception when a missing or malformed key is encountered.
 */

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

/* "pygrib.pyx":316
 *     tolerate_badgrib = True
 * 
 * def tolerate_badgrib_off():             # <<<<<<<<<<<<<<
 *     """
 *     raise an exception when a missing or malformed key is encountered
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pygrib_5tolerate_badgrib_off(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6pygrib_4tolerate_badgrib_off[] = "\n    raise an exception when a missing or malformed key is encountered\n    (default behavior).\n    ";
static PyMethodDef __pyx_mdef_6pygrib_5tolerate_badgrib_off = {"tolerate_badgrib_off", (PyCFunction)__pyx_pw_6pygrib_5tolerate_badgrib_off, METH_NOARGS, __pyx_doc_6pygrib_4tolerate_badgrib_off};
static PyObject *__pyx_pw_6pygrib_5tolerate_badgrib_off(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("tolerate_badgrib_off (wrapper)", 0);
  __pyx_r = __pyx_pf_6pygrib_4tolerate_badgrib_off(__pyx_self);

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

static PyObject *__pyx_pf_6pygrib_4tolerate_badgrib_off(CYTHON_UNUSED PyObject *__pyx_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("tolerate_badgrib_off", 0);

  /* "pygrib.pyx":322
 *     """
 *     global tolerate_badgrib
 *     tolerate_badgrib = False             # <<<<<<<<<<<<<<
 * 
 * def gaulats(object nlats):
 */
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_tolerate_badgrib, Py_False) < 0) __PYX_ERR(0, 322, __pyx_L1_error)

  /* "pygrib.pyx":316
 *     tolerate_badgrib = True
 * 
 * def tolerate_badgrib_off():             # <<<<<<<<<<<<<<
 *     """
 *     raise an exception when a missing or malformed key is encountered
 */

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

/* "pygrib.pyx":324
 *     tolerate_badgrib = False
 * 
 * def gaulats(object nlats):             # <<<<<<<<<<<<<<
 *     """
 *     gaulats(nlats)
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pygrib_7gaulats(PyObject *__pyx_self, PyObject *__pyx_v_nlats); /*proto*/
static char __pyx_doc_6pygrib_6gaulats[] = "\n    gaulats(nlats)\n\n    Returns nlats gaussian latitudes, in degrees, oriented from\n    north to south.  nlats must be even.";
static PyMethodDef __pyx_mdef_6pygrib_7gaulats = {"gaulats", (PyCFunction)__pyx_pw_6pygrib_7gaulats, METH_O, __pyx_doc_6pygrib_6gaulats};
static PyObject *__pyx_pw_6pygrib_7gaulats(PyObject *__pyx_self, PyObject *__pyx_v_nlats) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("gaulats (wrapper)", 0);
  __pyx_r = __pyx_pf_6pygrib_6gaulats(__pyx_self, ((PyObject *)__pyx_v_nlats));

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

static PyObject *__pyx_pf_6pygrib_6gaulats(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_nlats) {
  PyArrayObject *__pyx_v_lats = 0;
  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;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  long __pyx_t_8;
  __Pyx_RefNannySetupContext("gaulats", 0);

  /* "pygrib.pyx":331
 *     north to south.  nlats must be even."""
 *     cdef ndarray lats
 *     if nlats%2:             # <<<<<<<<<<<<<<
 *         raise ValueError('nlats must be even')
 *     lats = np.empty(nlats, np.float64)
 */
  __pyx_t_1 = __Pyx_PyInt_RemainderObjC(__pyx_v_nlats, __pyx_int_2, 2, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 331, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 331, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(__pyx_t_2)) {

    /* "pygrib.pyx":332
 *     cdef ndarray lats
 *     if nlats%2:
 *         raise ValueError('nlats must be even')             # <<<<<<<<<<<<<<
 *     lats = np.empty(nlats, np.float64)
 *     grib_get_gaussian_latitudes(<long>nlats//2, <double *>lats.data)
 */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple_, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 332, __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_ERR(0, 332, __pyx_L1_error)

    /* "pygrib.pyx":331
 *     north to south.  nlats must be even."""
 *     cdef ndarray lats
 *     if nlats%2:             # <<<<<<<<<<<<<<
 *         raise ValueError('nlats must be even')
 *     lats = np.empty(nlats, np.float64)
 */
  }

  /* "pygrib.pyx":333
 *     if nlats%2:
 *         raise ValueError('nlats must be even')
 *     lats = np.empty(nlats, np.float64)             # <<<<<<<<<<<<<<
 *     grib_get_gaussian_latitudes(<long>nlats//2, <double *>lats.data)
 *     return lats
 */
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 333, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_empty); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 333, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 333, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_float64); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 333, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  __pyx_t_6 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
      __pyx_t_6 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_4)) {
    PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_nlats, __pyx_t_5};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 333, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
    PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_nlats, __pyx_t_5};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 333, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  } else
  #endif
  {
    __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 333, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    if (__pyx_t_3) {
      __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_3); __pyx_t_3 = NULL;
    }
    __Pyx_INCREF(__pyx_v_nlats);
    __Pyx_GIVEREF(__pyx_v_nlats);
    PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_v_nlats);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_t_5);
    __pyx_t_5 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 333, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_6pygrib_ndarray))))) __PYX_ERR(0, 333, __pyx_L1_error)
  __pyx_v_lats = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pygrib.pyx":334
 *         raise ValueError('nlats must be even')
 *     lats = np.empty(nlats, np.float64)
 *     grib_get_gaussian_latitudes(<long>nlats//2, <double *>lats.data)             # <<<<<<<<<<<<<<
 *     return lats
 * 
 */
  __pyx_t_8 = __Pyx_PyInt_As_long(__pyx_v_nlats); if (unlikely((__pyx_t_8 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 334, __pyx_L1_error)
  (void)(grib_get_gaussian_latitudes(__Pyx_div_long(((long)__pyx_t_8), 2), ((double *)__pyx_v_lats->data)));

  /* "pygrib.pyx":335
 *     lats = np.empty(nlats, np.float64)
 *     grib_get_gaussian_latitudes(<long>nlats//2, <double *>lats.data)
 *     return lats             # <<<<<<<<<<<<<<
 * 
 * # dict for forecast time units (Code Table 4.4).
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_lats));
  __pyx_r = ((PyObject *)__pyx_v_lats);
  goto __pyx_L0;

  /* "pygrib.pyx":324
 *     tolerate_badgrib = False
 * 
 * def gaulats(object nlats):             # <<<<<<<<<<<<<<
 *     """
 *     gaulats(nlats)
 */

  /* 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_7);
  __Pyx_AddTraceback("pygrib.gaulats", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_lats);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pygrib.pyx":355
 * grib_multi_support_on(NULL)
 * 
 * def multi_support_on():             # <<<<<<<<<<<<<<
 *     """turn on support for multi-field grib messages (default)"""
 *     grib_multi_support_on(NULL)
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pygrib_9multi_support_on(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6pygrib_8multi_support_on[] = "turn on support for multi-field grib messages (default)";
static PyMethodDef __pyx_mdef_6pygrib_9multi_support_on = {"multi_support_on", (PyCFunction)__pyx_pw_6pygrib_9multi_support_on, METH_NOARGS, __pyx_doc_6pygrib_8multi_support_on};
static PyObject *__pyx_pw_6pygrib_9multi_support_on(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("multi_support_on (wrapper)", 0);
  __pyx_r = __pyx_pf_6pygrib_8multi_support_on(__pyx_self);

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

static PyObject *__pyx_pf_6pygrib_8multi_support_on(CYTHON_UNUSED PyObject *__pyx_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("multi_support_on", 0);

  /* "pygrib.pyx":357
 * def multi_support_on():
 *     """turn on support for multi-field grib messages (default)"""
 *     grib_multi_support_on(NULL)             # <<<<<<<<<<<<<<
 * 
 * def multi_support_off():
 */
  grib_multi_support_on(NULL);

  /* "pygrib.pyx":355
 * grib_multi_support_on(NULL)
 * 
 * def multi_support_on():             # <<<<<<<<<<<<<<
 *     """turn on support for multi-field grib messages (default)"""
 *     grib_multi_support_on(NULL)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pygrib.pyx":359
 *     grib_multi_support_on(NULL)
 * 
 * def multi_support_off():             # <<<<<<<<<<<<<<
 *     """turn off support for multi-field grib messages"""
 *     grib_multi_support_off(NULL)
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pygrib_11multi_support_off(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6pygrib_10multi_support_off[] = "turn off support for multi-field grib messages";
static PyMethodDef __pyx_mdef_6pygrib_11multi_support_off = {"multi_support_off", (PyCFunction)__pyx_pw_6pygrib_11multi_support_off, METH_NOARGS, __pyx_doc_6pygrib_10multi_support_off};
static PyObject *__pyx_pw_6pygrib_11multi_support_off(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("multi_support_off (wrapper)", 0);
  __pyx_r = __pyx_pf_6pygrib_10multi_support_off(__pyx_self);

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

static PyObject *__pyx_pf_6pygrib_10multi_support_off(CYTHON_UNUSED PyObject *__pyx_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("multi_support_off", 0);

  /* "pygrib.pyx":361
 * def multi_support_off():
 *     """turn off support for multi-field grib messages"""
 *     grib_multi_support_off(NULL)             # <<<<<<<<<<<<<<
 * 
 * cdef class open(object):
 */
  grib_multi_support_off(NULL);

  /* "pygrib.pyx":359
 *     grib_multi_support_on(NULL)
 * 
 * def multi_support_off():             # <<<<<<<<<<<<<<
 *     """turn off support for multi-field grib messages"""
 *     grib_multi_support_off(NULL)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pygrib.pyx":388
 *     cdef public object name, messagenumber, messages, closed,\
 *                        has_multi_field_msgs
 *     def __cinit__(self, filename):             # <<<<<<<<<<<<<<
 *         # initialize C level objects.
 *         cdef grib_handle *gh
 */

/* Python wrapper */
static int __pyx_pw_6pygrib_4open_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_6pygrib_4open_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_filename = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_filename,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);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_filename)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(0, 388, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
    }
    __pyx_v_filename = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 388, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pygrib.open.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pygrib_4open___cinit__(((struct __pyx_obj_6pygrib_open *)__pyx_v_self), __pyx_v_filename);

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

static int __pyx_pf_6pygrib_4open___cinit__(struct __pyx_obj_6pygrib_open *__pyx_v_self, PyObject *__pyx_v_filename) {
  PyObject *__pyx_v_bytestr = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  char *__pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "pygrib.pyx":392
 *         cdef grib_handle *gh
 *         cdef FILE *_fd
 *         bytestr = _strencode(filename)             # <<<<<<<<<<<<<<
 *         self._fd = fopen(bytestr, "rb")
 *         if self._fd == NULL:
 */
  __pyx_t_1 = __pyx_f_6pygrib__strencode(__pyx_v_filename, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 392, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_bytestr = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pygrib.pyx":393
 *         cdef FILE *_fd
 *         bytestr = _strencode(filename)
 *         self._fd = fopen(bytestr, "rb")             # <<<<<<<<<<<<<<
 *         if self._fd == NULL:
 *             raise IOError("could not open %s", filename)
 */
  __pyx_t_2 = __Pyx_PyObject_AsWritableString(__pyx_v_bytestr); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 393, __pyx_L1_error)
  __pyx_v_self->_fd = fopen(__pyx_t_2, ((char *)"rb"));

  /* "pygrib.pyx":394
 *         bytestr = _strencode(filename)
 *         self._fd = fopen(bytestr, "rb")
 *         if self._fd == NULL:             # <<<<<<<<<<<<<<
 *             raise IOError("could not open %s", filename)
 *         self._gh = NULL
 */
  __pyx_t_3 = ((__pyx_v_self->_fd == NULL) != 0);
  if (unlikely(__pyx_t_3)) {

    /* "pygrib.pyx":395
 *         self._fd = fopen(bytestr, "rb")
 *         if self._fd == NULL:
 *             raise IOError("could not open %s", filename)             # <<<<<<<<<<<<<<
 *         self._gh = NULL
 *     def __init__(self, filename):
 */
    __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 395, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_kp_s_could_not_open_s);
    __Pyx_GIVEREF(__pyx_kp_s_could_not_open_s);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_kp_s_could_not_open_s);
    __Pyx_INCREF(__pyx_v_filename);
    __Pyx_GIVEREF(__pyx_v_filename);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_filename);
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_IOError, __pyx_t_1, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 395, __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_ERR(0, 395, __pyx_L1_error)

    /* "pygrib.pyx":394
 *         bytestr = _strencode(filename)
 *         self._fd = fopen(bytestr, "rb")
 *         if self._fd == NULL:             # <<<<<<<<<<<<<<
 *             raise IOError("could not open %s", filename)
 *         self._gh = NULL
 */
  }

  /* "pygrib.pyx":396
 *         if self._fd == NULL:
 *             raise IOError("could not open %s", filename)
 *         self._gh = NULL             # <<<<<<<<<<<<<<
 *     def __init__(self, filename):
 *         cdef int err, ncount
 */
  __pyx_v_self->_gh = NULL;

  /* "pygrib.pyx":388
 *     cdef public object name, messagenumber, messages, closed,\
 *                        has_multi_field_msgs
 *     def __cinit__(self, filename):             # <<<<<<<<<<<<<<
 *         # initialize C level objects.
 *         cdef grib_handle *gh
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("pygrib.open.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_bytestr);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pygrib.pyx":397
 *             raise IOError("could not open %s", filename)
 *         self._gh = NULL
 *     def __init__(self, filename):             # <<<<<<<<<<<<<<
 *         cdef int err, ncount
 *         cdef grib_handle *gh
 */

/* Python wrapper */
static int __pyx_pw_6pygrib_4open_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_6pygrib_4open_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_filename = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_filename,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);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_filename)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 397, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
    }
    __pyx_v_filename = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 397, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pygrib.open.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pygrib_4open_2__init__(((struct __pyx_obj_6pygrib_open *)__pyx_v_self), __pyx_v_filename);

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

static int __pyx_pf_6pygrib_4open_2__init__(struct __pyx_obj_6pygrib_open *__pyx_v_self, PyObject *__pyx_v_filename) {
  int __pyx_v_err;
  int __pyx_v_ncount;
  grib_handle *__pyx_v_gh;
  PyObject *__pyx_v_nmsgs = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "pygrib.pyx":401
 *         cdef grib_handle *gh
 *         # initalize Python level objects
 *         self.name = filename             # <<<<<<<<<<<<<<
 *         self.closed = False
 *         self.messagenumber = 0
 */
  __Pyx_INCREF(__pyx_v_filename);
  __Pyx_GIVEREF(__pyx_v_filename);
  __Pyx_GOTREF(__pyx_v_self->name);
  __Pyx_DECREF(__pyx_v_self->name);
  __pyx_v_self->name = __pyx_v_filename;

  /* "pygrib.pyx":402
 *         # initalize Python level objects
 *         self.name = filename
 *         self.closed = False             # <<<<<<<<<<<<<<
 *         self.messagenumber = 0
 *         # count number of messages in file.
 */
  __Pyx_INCREF(Py_False);
  __Pyx_GIVEREF(Py_False);
  __Pyx_GOTREF(__pyx_v_self->closed);
  __Pyx_DECREF(__pyx_v_self->closed);
  __pyx_v_self->closed = Py_False;

  /* "pygrib.pyx":403
 *         self.name = filename
 *         self.closed = False
 *         self.messagenumber = 0             # <<<<<<<<<<<<<<
 *         # count number of messages in file.
 *         nmsgs = 0
 */
  __Pyx_INCREF(__pyx_int_0);
  __Pyx_GIVEREF(__pyx_int_0);
  __Pyx_GOTREF(__pyx_v_self->messagenumber);
  __Pyx_DECREF(__pyx_v_self->messagenumber);
  __pyx_v_self->messagenumber = __pyx_int_0;

  /* "pygrib.pyx":405
 *         self.messagenumber = 0
 *         # count number of messages in file.
 *         nmsgs = 0             # <<<<<<<<<<<<<<
 *         while 1:
 *             gh = grib_handle_new_from_file(NULL, self._fd, &err)
 */
  __Pyx_INCREF(__pyx_int_0);
  __pyx_v_nmsgs = __pyx_int_0;

  /* "pygrib.pyx":406
 *         # count number of messages in file.
 *         nmsgs = 0
 *         while 1:             # <<<<<<<<<<<<<<
 *             gh = grib_handle_new_from_file(NULL, self._fd, &err)
 *             err = grib_handle_delete(gh)
 */
  while (1) {

    /* "pygrib.pyx":407
 *         nmsgs = 0
 *         while 1:
 *             gh = grib_handle_new_from_file(NULL, self._fd, &err)             # <<<<<<<<<<<<<<
 *             err = grib_handle_delete(gh)
 *             if gh == NULL: break
 */
    __pyx_v_gh = grib_handle_new_from_file(NULL, __pyx_v_self->_fd, (&__pyx_v_err));

    /* "pygrib.pyx":408
 *         while 1:
 *             gh = grib_handle_new_from_file(NULL, self._fd, &err)
 *             err = grib_handle_delete(gh)             # <<<<<<<<<<<<<<
 *             if gh == NULL: break
 *             nmsgs = nmsgs + 1
 */
    __pyx_v_err = grib_handle_delete(__pyx_v_gh);

    /* "pygrib.pyx":409
 *             gh = grib_handle_new_from_file(NULL, self._fd, &err)
 *             err = grib_handle_delete(gh)
 *             if gh == NULL: break             # <<<<<<<<<<<<<<
 *             nmsgs = nmsgs + 1
 *         rewind(self._fd)
 */
    __pyx_t_1 = ((__pyx_v_gh == NULL) != 0);
    if (__pyx_t_1) {
      goto __pyx_L4_break;
    }

    /* "pygrib.pyx":410
 *             err = grib_handle_delete(gh)
 *             if gh == NULL: break
 *             nmsgs = nmsgs + 1             # <<<<<<<<<<<<<<
 *         rewind(self._fd)
 *         self.messages = nmsgs
 */
    __pyx_t_2 = __Pyx_PyInt_AddObjC(__pyx_v_nmsgs, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 410, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_nmsgs, __pyx_t_2);
    __pyx_t_2 = 0;
  }
  __pyx_L4_break:;

  /* "pygrib.pyx":411
 *             if gh == NULL: break
 *             nmsgs = nmsgs + 1
 *         rewind(self._fd)             # <<<<<<<<<<<<<<
 *         self.messages = nmsgs
 *         err =  grib_count_in_file(NULL, self._fd, &ncount)
 */
  rewind(__pyx_v_self->_fd);

  /* "pygrib.pyx":412
 *             nmsgs = nmsgs + 1
 *         rewind(self._fd)
 *         self.messages = nmsgs             # <<<<<<<<<<<<<<
 *         err =  grib_count_in_file(NULL, self._fd, &ncount)
 *         # if number of messages returned by grib_count_in_file
 */
  __Pyx_INCREF(__pyx_v_nmsgs);
  __Pyx_GIVEREF(__pyx_v_nmsgs);
  __Pyx_GOTREF(__pyx_v_self->messages);
  __Pyx_DECREF(__pyx_v_self->messages);
  __pyx_v_self->messages = __pyx_v_nmsgs;

  /* "pygrib.pyx":413
 *         rewind(self._fd)
 *         self.messages = nmsgs
 *         err =  grib_count_in_file(NULL, self._fd, &ncount)             # <<<<<<<<<<<<<<
 *         # if number of messages returned by grib_count_in_file
 *         # differs from brute-force method of counting, then
 */
  __pyx_v_err = grib_count_in_file(NULL, __pyx_v_self->_fd, (&__pyx_v_ncount));

  /* "pygrib.pyx":417
 *         # differs from brute-force method of counting, then
 *         # there must be multi-field messages in the file.
 *         if ncount != self.messages:             # <<<<<<<<<<<<<<
 *             self.has_multi_field_msgs=True
 *         else:
 */
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_ncount); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 417, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, __pyx_v_self->messages, Py_NE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 417, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 417, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__pyx_t_1) {

    /* "pygrib.pyx":418
 *         # there must be multi-field messages in the file.
 *         if ncount != self.messages:
 *             self.has_multi_field_msgs=True             # <<<<<<<<<<<<<<
 *         else:
 *             self.has_multi_field_msgs=False
 */
    __Pyx_INCREF(Py_True);
    __Pyx_GIVEREF(Py_True);
    __Pyx_GOTREF(__pyx_v_self->has_multi_field_msgs);
    __Pyx_DECREF(__pyx_v_self->has_multi_field_msgs);
    __pyx_v_self->has_multi_field_msgs = Py_True;

    /* "pygrib.pyx":417
 *         # differs from brute-force method of counting, then
 *         # there must be multi-field messages in the file.
 *         if ncount != self.messages:             # <<<<<<<<<<<<<<
 *             self.has_multi_field_msgs=True
 *         else:
 */
    goto __pyx_L6;
  }

  /* "pygrib.pyx":420
 *             self.has_multi_field_msgs=True
 *         else:
 *             self.has_multi_field_msgs=False             # <<<<<<<<<<<<<<
 *     def __iter__(self):
 *         return self
 */
  /*else*/ {
    __Pyx_INCREF(Py_False);
    __Pyx_GIVEREF(Py_False);
    __Pyx_GOTREF(__pyx_v_self->has_multi_field_msgs);
    __Pyx_DECREF(__pyx_v_self->has_multi_field_msgs);
    __pyx_v_self->has_multi_field_msgs = Py_False;
  }
  __pyx_L6:;

  /* "pygrib.pyx":397
 *             raise IOError("could not open %s", filename)
 *         self._gh = NULL
 *     def __init__(self, filename):             # <<<<<<<<<<<<<<
 *         cdef int err, ncount
 *         cdef grib_handle *gh
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("pygrib.open.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_nmsgs);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pygrib.pyx":421
 *         else:
 *             self.has_multi_field_msgs=False
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return self
 *     def __next__(self):
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pygrib_4open_5__iter__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6pygrib_4open_5__iter__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pygrib_4open_4__iter__(((struct __pyx_obj_6pygrib_open *)__pyx_v_self));

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

static PyObject *__pyx_pf_6pygrib_4open_4__iter__(struct __pyx_obj_6pygrib_open *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__", 0);

  /* "pygrib.pyx":422
 *             self.has_multi_field_msgs=False
 *     def __iter__(self):
 *         return self             # <<<<<<<<<<<<<<
 *     def __next__(self):
 *         cdef grib_handle* gh
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "pygrib.pyx":421
 *         else:
 *             self.has_multi_field_msgs=False
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return self
 *     def __next__(self):
 */

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

/* "pygrib.pyx":423
 *     def __iter__(self):
 *         return self
 *     def __next__(self):             # <<<<<<<<<<<<<<
 *         cdef grib_handle* gh
 *         cdef int err
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pygrib_4open_7__next__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6pygrib_4open_7__next__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__next__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pygrib_4open_6__next__(((struct __pyx_obj_6pygrib_open *)__pyx_v_self));

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

static PyObject *__pyx_pf_6pygrib_4open_6__next__(struct __pyx_obj_6pygrib_open *__pyx_v_self) {
  grib_handle *__pyx_v_gh;
  int __pyx_v_err;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("__next__", 0);

  /* "pygrib.pyx":426
 *         cdef grib_handle* gh
 *         cdef int err
 *         if self.messagenumber == self.messages:             # <<<<<<<<<<<<<<
 *             raise StopIteration
 *         if self._gh is not NULL:
 */
  __pyx_t_1 = PyObject_RichCompare(__pyx_v_self->messagenumber, __pyx_v_self->messages, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 426, __pyx_L1_error)
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 426, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(__pyx_t_2)) {

    /* "pygrib.pyx":427
 *         cdef int err
 *         if self.messagenumber == self.messages:
 *             raise StopIteration             # <<<<<<<<<<<<<<
 *         if self._gh is not NULL:
 *             err = grib_handle_delete(self._gh)
 */
    __Pyx_Raise(__pyx_builtin_StopIteration, 0, 0, 0);
    __PYX_ERR(0, 427, __pyx_L1_error)

    /* "pygrib.pyx":426
 *         cdef grib_handle* gh
 *         cdef int err
 *         if self.messagenumber == self.messages:             # <<<<<<<<<<<<<<
 *             raise StopIteration
 *         if self._gh is not NULL:
 */
  }

  /* "pygrib.pyx":428
 *         if self.messagenumber == self.messages:
 *             raise StopIteration
 *         if self._gh is not NULL:             # <<<<<<<<<<<<<<
 *             err = grib_handle_delete(self._gh)
 *             if err:
 */
  __pyx_t_2 = ((__pyx_v_self->_gh != NULL) != 0);
  if (__pyx_t_2) {

    /* "pygrib.pyx":429
 *             raise StopIteration
 *         if self._gh is not NULL:
 *             err = grib_handle_delete(self._gh)             # <<<<<<<<<<<<<<
 *             if err:
 *                 raise RuntimeError(grib_get_error_message(err))
 */
    __pyx_v_err = grib_handle_delete(__pyx_v_self->_gh);

    /* "pygrib.pyx":430
 *         if self._gh is not NULL:
 *             err = grib_handle_delete(self._gh)
 *             if err:             # <<<<<<<<<<<<<<
 *                 raise RuntimeError(grib_get_error_message(err))
 *         gh = grib_handle_new_from_file(NULL, self._fd, &err)
 */
    __pyx_t_2 = (__pyx_v_err != 0);
    if (unlikely(__pyx_t_2)) {

      /* "pygrib.pyx":431
 *             err = grib_handle_delete(self._gh)
 *             if err:
 *                 raise RuntimeError(grib_get_error_message(err))             # <<<<<<<<<<<<<<
 *         gh = grib_handle_new_from_file(NULL, self._fd, &err)
 *         if err:
 */
      __pyx_t_1 = __Pyx_PyBytes_FromString(grib_get_error_message(__pyx_v_err)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 431, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_RuntimeError, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 431, __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_ERR(0, 431, __pyx_L1_error)

      /* "pygrib.pyx":430
 *         if self._gh is not NULL:
 *             err = grib_handle_delete(self._gh)
 *             if err:             # <<<<<<<<<<<<<<
 *                 raise RuntimeError(grib_get_error_message(err))
 *         gh = grib_handle_new_from_file(NULL, self._fd, &err)
 */
    }

    /* "pygrib.pyx":428
 *         if self.messagenumber == self.messages:
 *             raise StopIteration
 *         if self._gh is not NULL:             # <<<<<<<<<<<<<<
 *             err = grib_handle_delete(self._gh)
 *             if err:
 */
  }

  /* "pygrib.pyx":432
 *             if err:
 *                 raise RuntimeError(grib_get_error_message(err))
 *         gh = grib_handle_new_from_file(NULL, self._fd, &err)             # <<<<<<<<<<<<<<
 *         if err:
 *             raise RuntimeError(grib_get_error_message(err))
 */
  __pyx_v_gh = grib_handle_new_from_file(NULL, __pyx_v_self->_fd, (&__pyx_v_err));

  /* "pygrib.pyx":433
 *                 raise RuntimeError(grib_get_error_message(err))
 *         gh = grib_handle_new_from_file(NULL, self._fd, &err)
 *         if err:             # <<<<<<<<<<<<<<
 *             raise RuntimeError(grib_get_error_message(err))
 *         if gh == NULL:
 */
  __pyx_t_2 = (__pyx_v_err != 0);
  if (unlikely(__pyx_t_2)) {

    /* "pygrib.pyx":434
 *         gh = grib_handle_new_from_file(NULL, self._fd, &err)
 *         if err:
 *             raise RuntimeError(grib_get_error_message(err))             # <<<<<<<<<<<<<<
 *         if gh == NULL:
 *             raise StopIteration
 */
    __pyx_t_3 = __Pyx_PyBytes_FromString(grib_get_error_message(__pyx_v_err)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 434, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_RuntimeError, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 434, __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_ERR(0, 434, __pyx_L1_error)

    /* "pygrib.pyx":433
 *                 raise RuntimeError(grib_get_error_message(err))
 *         gh = grib_handle_new_from_file(NULL, self._fd, &err)
 *         if err:             # <<<<<<<<<<<<<<
 *             raise RuntimeError(grib_get_error_message(err))
 *         if gh == NULL:
 */
  }

  /* "pygrib.pyx":435
 *         if err:
 *             raise RuntimeError(grib_get_error_message(err))
 *         if gh == NULL:             # <<<<<<<<<<<<<<
 *             raise StopIteration
 *         else:
 */
  __pyx_t_2 = ((__pyx_v_gh == NULL) != 0);
  if (unlikely(__pyx_t_2)) {

    /* "pygrib.pyx":436
 *             raise RuntimeError(grib_get_error_message(err))
 *         if gh == NULL:
 *             raise StopIteration             # <<<<<<<<<<<<<<
 *         else:
 *             self._gh = gh
 */
    __Pyx_Raise(__pyx_builtin_StopIteration, 0, 0, 0);
    __PYX_ERR(0, 436, __pyx_L1_error)

    /* "pygrib.pyx":435
 *         if err:
 *             raise RuntimeError(grib_get_error_message(err))
 *         if gh == NULL:             # <<<<<<<<<<<<<<
 *             raise StopIteration
 *         else:
 */
  }

  /* "pygrib.pyx":438
 *             raise StopIteration
 *         else:
 *             self._gh = gh             # <<<<<<<<<<<<<<
 *             self.messagenumber = self.messagenumber + 1
 *         return _create_gribmessage(self._gh, self.messagenumber)
 */
  /*else*/ {
    __pyx_v_self->_gh = __pyx_v_gh;

    /* "pygrib.pyx":439
 *         else:
 *             self._gh = gh
 *             self.messagenumber = self.messagenumber + 1             # <<<<<<<<<<<<<<
 *         return _create_gribmessage(self._gh, self.messagenumber)
 *     def __getitem__(self, key):
 */
    __pyx_t_1 = __Pyx_PyInt_AddObjC(__pyx_v_self->messagenumber, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 439, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    __Pyx_GOTREF(__pyx_v_self->messagenumber);
    __Pyx_DECREF(__pyx_v_self->messagenumber);
    __pyx_v_self->messagenumber = __pyx_t_1;
    __pyx_t_1 = 0;
  }

  /* "pygrib.pyx":440
 *             self._gh = gh
 *             self.messagenumber = self.messagenumber + 1
 *         return _create_gribmessage(self._gh, self.messagenumber)             # <<<<<<<<<<<<<<
 *     def __getitem__(self, key):
 *         if type(key) == slice:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_v_self->messagenumber;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_3 = __pyx_f_6pygrib__create_gribmessage(__pyx_v_self->_gh, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 440, __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;

  /* "pygrib.pyx":423
 *     def __iter__(self):
 *         return self
 *     def __next__(self):             # <<<<<<<<<<<<<<
 *         cdef grib_handle* gh
 *         cdef int err
 */

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

/* "pygrib.pyx":441
 *             self.messagenumber = self.messagenumber + 1
 *         return _create_gribmessage(self._gh, self.messagenumber)
 *     def __getitem__(self, key):             # <<<<<<<<<<<<<<
 *         if type(key) == slice:
 *             # for a slice, return a list of grib messages.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pygrib_4open_9__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/
static PyObject *__pyx_pw_6pygrib_4open_9__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pygrib_4open_8__getitem__(((struct __pyx_obj_6pygrib_open *)__pyx_v_self), ((PyObject *)__pyx_v_key));

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

static PyObject *__pyx_pf_6pygrib_4open_8__getitem__(struct __pyx_obj_6pygrib_open *__pyx_v_self, PyObject *__pyx_v_key) {
  PyObject *__pyx_v_beg = NULL;
  PyObject *__pyx_v_end = NULL;
  PyObject *__pyx_v_inc = NULL;
  PyObject *__pyx_v_msg = NULL;
  PyObject *__pyx_v_grbs = NULL;
  PyObject *__pyx_v_grb = NULL;
  PyObject *__pyx_v_n = 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;
  PyObject *(*__pyx_t_7)(PyObject *);
  Py_ssize_t __pyx_t_8;
  PyObject *(*__pyx_t_9)(PyObject *);
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  int __pyx_t_12;
  __Pyx_RefNannySetupContext("__getitem__", 0);

  /* "pygrib.pyx":442
 *         return _create_gribmessage(self._gh, self.messagenumber)
 *     def __getitem__(self, key):
 *         if type(key) == slice:             # <<<<<<<<<<<<<<
 *             # for a slice, return a list of grib messages.
 *             beg, end, inc = key.indices(self.messages)
 */
  __pyx_t_1 = PyObject_RichCompare(((PyObject *)Py_TYPE(__pyx_v_key)), ((PyObject *)(&PySlice_Type)), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 442, __pyx_L1_error)
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 442, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "pygrib.pyx":444
 *         if type(key) == slice:
 *             # for a slice, return a list of grib messages.
 *             beg, end, inc = key.indices(self.messages)             # <<<<<<<<<<<<<<
 *             msg = self.tell()
 *             grbs = [self.message(n+1) for n in xrange(beg,end,inc)]
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_key, __pyx_n_s_indices); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 444, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    if (!__pyx_t_4) {
      __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_self->messages); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 444, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_3)) {
        PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_v_self->messages};
        __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 444, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_GOTREF(__pyx_t_1);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
        PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_v_self->messages};
        __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 444, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_GOTREF(__pyx_t_1);
      } else
      #endif
      {
        __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 444, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __pyx_t_4 = NULL;
        __Pyx_INCREF(__pyx_v_self->messages);
        __Pyx_GIVEREF(__pyx_v_self->messages);
        PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_v_self->messages);
        __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 444, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
      PyObject* sequence = __pyx_t_1;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 3)) {
        if (size > 3) __Pyx_RaiseTooManyValuesError(3);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 444, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); 
        __pyx_t_4 = PyTuple_GET_ITEM(sequence, 2); 
      } else {
        __pyx_t_3 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_5 = PyList_GET_ITEM(sequence, 1); 
        __pyx_t_4 = PyList_GET_ITEM(sequence, 2); 
      }
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_4);
      #else
      __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 444, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 444, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_4 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 444, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      #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_ERR(0, 444, __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_3 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_3)) goto __pyx_L4_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_3);
      index = 1; __pyx_t_5 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_5)) goto __pyx_L4_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_5);
      index = 2; __pyx_t_4 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_4)) goto __pyx_L4_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_4);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_6), 3) < 0) __PYX_ERR(0, 444, __pyx_L1_error)
      __pyx_t_7 = NULL;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      goto __pyx_L5_unpacking_done;
      __pyx_L4_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_7 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 444, __pyx_L1_error)
      __pyx_L5_unpacking_done:;
    }
    __pyx_v_beg = __pyx_t_3;
    __pyx_t_3 = 0;
    __pyx_v_end = __pyx_t_5;
    __pyx_t_5 = 0;
    __pyx_v_inc = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "pygrib.pyx":445
 *             # for a slice, return a list of grib messages.
 *             beg, end, inc = key.indices(self.messages)
 *             msg = self.tell()             # <<<<<<<<<<<<<<
 *             grbs = [self.message(n+1) for n in xrange(beg,end,inc)]
 *             self.seek(msg) # put iterator back in original position
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_tell); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 445, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    if (__pyx_t_5) {
      __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 445, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else {
      __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 445, __pyx_L1_error)
    }
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_v_msg = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "pygrib.pyx":446
 *             beg, end, inc = key.indices(self.messages)
 *             msg = self.tell()
 *             grbs = [self.message(n+1) for n in xrange(beg,end,inc)]             # <<<<<<<<<<<<<<
 *             self.seek(msg) # put iterator back in original position
 *             return grbs
 */
    __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 446, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 446, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_v_beg);
    __Pyx_GIVEREF(__pyx_v_beg);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_beg);
    __Pyx_INCREF(__pyx_v_end);
    __Pyx_GIVEREF(__pyx_v_end);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_end);
    __Pyx_INCREF(__pyx_v_inc);
    __Pyx_GIVEREF(__pyx_v_inc);
    PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_inc);
    __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_xrange, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 446, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (likely(PyList_CheckExact(__pyx_t_5)) || PyTuple_CheckExact(__pyx_t_5)) {
      __pyx_t_4 = __pyx_t_5; __Pyx_INCREF(__pyx_t_4); __pyx_t_8 = 0;
      __pyx_t_9 = NULL;
    } else {
      __pyx_t_8 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 446, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_9 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 446, __pyx_L1_error)
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    for (;;) {
      if (likely(!__pyx_t_9)) {
        if (likely(PyList_CheckExact(__pyx_t_4))) {
          if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_4)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_5 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_8); __Pyx_INCREF(__pyx_t_5); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(0, 446, __pyx_L1_error)
          #else
          __pyx_t_5 = PySequence_ITEM(__pyx_t_4, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 446, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_5);
          #endif
        } else {
          if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_8); __Pyx_INCREF(__pyx_t_5); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(0, 446, __pyx_L1_error)
          #else
          __pyx_t_5 = PySequence_ITEM(__pyx_t_4, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 446, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_5);
          #endif
        }
      } else {
        __pyx_t_5 = __pyx_t_9(__pyx_t_4);
        if (unlikely(!__pyx_t_5)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(0, 446, __pyx_L1_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_5);
      }
      __Pyx_XDECREF_SET(__pyx_v_n, __pyx_t_5);
      __pyx_t_5 = 0;
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_message); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 446, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_6 = __Pyx_PyInt_AddObjC(__pyx_v_n, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 446, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_10 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
        __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_3);
        if (likely(__pyx_t_10)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
          __Pyx_INCREF(__pyx_t_10);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_3, function);
        }
      }
      if (!__pyx_t_10) {
        __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 446, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_GOTREF(__pyx_t_5);
      } else {
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_3)) {
          PyObject *__pyx_temp[2] = {__pyx_t_10, __pyx_t_6};
          __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 446, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
          PyObject *__pyx_temp[2] = {__pyx_t_10, __pyx_t_6};
          __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 446, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        } else
        #endif
        {
          __pyx_t_11 = PyTuple_New(1+1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 446, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_11);
          __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_10); __pyx_t_10 = NULL;
          __Pyx_GIVEREF(__pyx_t_6);
          PyTuple_SET_ITEM(__pyx_t_11, 0+1, __pyx_t_6);
          __pyx_t_6 = 0;
          __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_11, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 446, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        }
      }
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) __PYX_ERR(0, 446, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_v_grbs = ((PyObject*)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "pygrib.pyx":447
 *             msg = self.tell()
 *             grbs = [self.message(n+1) for n in xrange(beg,end,inc)]
 *             self.seek(msg) # put iterator back in original position             # <<<<<<<<<<<<<<
 *             return grbs
 *         elif type(key) == int or type(key) == long:
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_seek); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 447, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    if (!__pyx_t_5) {
      __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_msg); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 447, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_4)) {
        PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_v_msg};
        __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 447, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_GOTREF(__pyx_t_1);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
        PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_v_msg};
        __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 447, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_GOTREF(__pyx_t_1);
      } else
      #endif
      {
        __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 447, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5); __pyx_t_5 = NULL;
        __Pyx_INCREF(__pyx_v_msg);
        __Pyx_GIVEREF(__pyx_v_msg);
        PyTuple_SET_ITEM(__pyx_t_3, 0+1, __pyx_v_msg);
        __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 447, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "pygrib.pyx":448
 *             grbs = [self.message(n+1) for n in xrange(beg,end,inc)]
 *             self.seek(msg) # put iterator back in original position
 *             return grbs             # <<<<<<<<<<<<<<
 *         elif type(key) == int or type(key) == long:
 *             # for an integer, return a single grib message.
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_grbs);
    __pyx_r = __pyx_v_grbs;
    goto __pyx_L0;

    /* "pygrib.pyx":442
 *         return _create_gribmessage(self._gh, self.messagenumber)
 *     def __getitem__(self, key):
 *         if type(key) == slice:             # <<<<<<<<<<<<<<
 *             # for a slice, return a list of grib messages.
 *             beg, end, inc = key.indices(self.messages)
 */
  }

  /* "pygrib.pyx":449
 *             self.seek(msg) # put iterator back in original position
 *             return grbs
 *         elif type(key) == int or type(key) == long:             # <<<<<<<<<<<<<<
 *             # for an integer, return a single grib message.
 *             msg = self.tell()
 */
  __pyx_t_1 = PyObject_RichCompare(((PyObject *)Py_TYPE(__pyx_v_key)), ((PyObject *)(&PyInt_Type)), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 449, __pyx_L1_error)
  __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_12 < 0)) __PYX_ERR(0, 449, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (!__pyx_t_12) {
  } else {
    __pyx_t_2 = __pyx_t_12;
    goto __pyx_L8_bool_binop_done;
  }
  __pyx_t_1 = PyObject_RichCompare(((PyObject *)Py_TYPE(__pyx_v_key)), ((PyObject *)(&PyLong_Type)), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 449, __pyx_L1_error)
  __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_12 < 0)) __PYX_ERR(0, 449, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_2 = __pyx_t_12;
  __pyx_L8_bool_binop_done:;
  if (likely(__pyx_t_2)) {

    /* "pygrib.pyx":451
 *         elif type(key) == int or type(key) == long:
 *             # for an integer, return a single grib message.
 *             msg = self.tell()             # <<<<<<<<<<<<<<
 *             grb = self.message(key)
 *             self.seek(msg) # put iterator back in original position
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_tell); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 451, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    if (__pyx_t_3) {
      __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 451, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else {
      __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 451, __pyx_L1_error)
    }
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_v_msg = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "pygrib.pyx":452
 *             # for an integer, return a single grib message.
 *             msg = self.tell()
 *             grb = self.message(key)             # <<<<<<<<<<<<<<
 *             self.seek(msg) # put iterator back in original position
 *             return grb
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_message); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 452, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    if (!__pyx_t_3) {
      __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_key); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 452, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_4)) {
        PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_key};
        __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 452, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_GOTREF(__pyx_t_1);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
        PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_key};
        __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 452, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_GOTREF(__pyx_t_1);
      } else
      #endif
      {
        __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 452, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL;
        __Pyx_INCREF(__pyx_v_key);
        __Pyx_GIVEREF(__pyx_v_key);
        PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_v_key);
        __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 452, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_v_grb = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "pygrib.pyx":453
 *             msg = self.tell()
 *             grb = self.message(key)
 *             self.seek(msg) # put iterator back in original position             # <<<<<<<<<<<<<<
 *             return grb
 *         else:
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_seek); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 453, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    if (!__pyx_t_5) {
      __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_msg); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 453, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_4)) {
        PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_v_msg};
        __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 453, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_GOTREF(__pyx_t_1);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
        PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_v_msg};
        __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 453, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_GOTREF(__pyx_t_1);
      } else
      #endif
      {
        __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 453, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5); __pyx_t_5 = NULL;
        __Pyx_INCREF(__pyx_v_msg);
        __Pyx_GIVEREF(__pyx_v_msg);
        PyTuple_SET_ITEM(__pyx_t_3, 0+1, __pyx_v_msg);
        __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 453, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "pygrib.pyx":454
 *             grb = self.message(key)
 *             self.seek(msg) # put iterator back in original position
 *             return grb             # <<<<<<<<<<<<<<
 *         else:
 *             raise KeyError('key must be an integer message number or a slice')
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_grb);
    __pyx_r = __pyx_v_grb;
    goto __pyx_L0;

    /* "pygrib.pyx":449
 *             self.seek(msg) # put iterator back in original position
 *             return grbs
 *         elif type(key) == int or type(key) == long:             # <<<<<<<<<<<<<<
 *             # for an integer, return a single grib message.
 *             msg = self.tell()
 */
  }

  /* "pygrib.pyx":456
 *             return grb
 *         else:
 *             raise KeyError('key must be an integer message number or a slice')             # <<<<<<<<<<<<<<
 *     def __call__(self, **kwargs):
 *         """same as L{select}"""
 */
  /*else*/ {
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_KeyError, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 456, __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_ERR(0, 456, __pyx_L1_error)
  }

  /* "pygrib.pyx":441
 *             self.messagenumber = self.messagenumber + 1
 *         return _create_gribmessage(self._gh, self.messagenumber)
 *     def __getitem__(self, key):             # <<<<<<<<<<<<<<
 *         if type(key) == slice:
 *             # for a slice, return a list of grib messages.
 */

  /* 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_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_AddTraceback("pygrib.open.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_beg);
  __Pyx_XDECREF(__pyx_v_end);
  __Pyx_XDECREF(__pyx_v_inc);
  __Pyx_XDECREF(__pyx_v_msg);
  __Pyx_XDECREF(__pyx_v_grbs);
  __Pyx_XDECREF(__pyx_v_grb);
  __Pyx_XDECREF(__pyx_v_n);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pygrib.pyx":457
 *         else:
 *             raise KeyError('key must be an integer message number or a slice')
 *     def __call__(self, **kwargs):             # <<<<<<<<<<<<<<
 *         """same as L{select}"""
 *         return self.select(**kwargs)
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pygrib_4open_11__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6pygrib_4open_10__call__[] = "same as L{select}";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_6pygrib_4open_10__call__;
#endif
static PyObject *__pyx_pw_6pygrib_4open_11__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_kwargs = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__call__ (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("__call__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (__pyx_kwds && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__call__", 1))) return NULL;
  if (__pyx_kwds) {
    __pyx_v_kwargs = PyDict_Copy(__pyx_kwds); if (unlikely(!__pyx_v_kwargs)) return NULL;
    __Pyx_GOTREF(__pyx_v_kwargs);
  } else {
    __pyx_v_kwargs = NULL;
  }
  __pyx_r = __pyx_pf_6pygrib_4open_10__call__(((struct __pyx_obj_6pygrib_open *)__pyx_v_self), __pyx_v_kwargs);

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

static PyObject *__pyx_pf_6pygrib_4open_10__call__(struct __pyx_obj_6pygrib_open *__pyx_v_self, PyObject *__pyx_v_kwargs) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("__call__", 0);

  /* "pygrib.pyx":459
 *     def __call__(self, **kwargs):
 *         """same as L{select}"""
 *         return self.select(**kwargs)             # <<<<<<<<<<<<<<
 *     def __enter__(self):
 *         return self
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_select); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 459, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, __pyx_v_kwargs); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 459, __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;

  /* "pygrib.pyx":457
 *         else:
 *             raise KeyError('key must be an integer message number or a slice')
 *     def __call__(self, **kwargs):             # <<<<<<<<<<<<<<
 *         """same as L{select}"""
 *         return self.select(**kwargs)
 */

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

/* "pygrib.pyx":460
 *         """same as L{select}"""
 *         return self.select(**kwargs)
 *     def __enter__(self):             # <<<<<<<<<<<<<<
 *         return self
 *     def __exit__(self,atype,value,traceback):
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pygrib_4open_13__enter__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_6pygrib_4open_13__enter__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__enter__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pygrib_4open_12__enter__(((struct __pyx_obj_6pygrib_open *)__pyx_v_self));

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

static PyObject *__pyx_pf_6pygrib_4open_12__enter__(struct __pyx_obj_6pygrib_open *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__enter__", 0);

  /* "pygrib.pyx":461
 *         return self.select(**kwargs)
 *     def __enter__(self):
 *         return self             # <<<<<<<<<<<<<<
 *     def __exit__(self,atype,value,traceback):
 *         self.close()
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "pygrib.pyx":460
 *         """same as L{select}"""
 *         return self.select(**kwargs)
 *     def __enter__(self):             # <<<<<<<<<<<<<<
 *         return self
 *     def __exit__(self,atype,value,traceback):
 */

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

/* "pygrib.pyx":462
 *     def __enter__(self):
 *         return self
 *     def __exit__(self,atype,value,traceback):             # <<<<<<<<<<<<<<
 *         self.close()
 *     def tell(self):
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pygrib_4open_15__exit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_6pygrib_4open_15__exit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED PyObject *__pyx_v_atype = 0;
  CYTHON_UNUSED PyObject *__pyx_v_value = 0;
  CYTHON_UNUSED PyObject *__pyx_v_traceback = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__exit__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_atype,&__pyx_n_s_value,&__pyx_n_s_traceback,0};
    PyObject* values[3] = {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  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_atype)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_value)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__exit__", 1, 3, 3, 1); __PYX_ERR(0, 462, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_traceback)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__exit__", 1, 3, 3, 2); __PYX_ERR(0, 462, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__exit__") < 0)) __PYX_ERR(0, 462, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      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);
    }
    __pyx_v_atype = values[0];
    __pyx_v_value = values[1];
    __pyx_v_traceback = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__exit__", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 462, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pygrib.open.__exit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pygrib_4open_14__exit__(((struct __pyx_obj_6pygrib_open *)__pyx_v_self), __pyx_v_atype, __pyx_v_value, __pyx_v_traceback);

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

static PyObject *__pyx_pf_6pygrib_4open_14__exit__(struct __pyx_obj_6pygrib_open *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_atype, CYTHON_UNUSED PyObject *__pyx_v_value, CYTHON_UNUSED PyObject *__pyx_v_traceback) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("__exit__", 0);

  /* "pygrib.pyx":463
 *         return self
 *     def __exit__(self,atype,value,traceback):
 *         self.close()             # <<<<<<<<<<<<<<
 *     def tell(self):
 *         """returns position of iterator (grib message number, 0 means iterator
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_close); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 463, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  if (__pyx_t_3) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 463, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else {
    __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 463, __pyx_L1_error)
  }
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pygrib.pyx":462
 *     def __enter__(self):
 *         return self
 *     def __exit__(self,atype,value,traceback):             # <<<<<<<<<<<<<<
 *         self.close()
 *     def tell(self):
 */

  /* 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("pygrib.open.__exit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pygrib.pyx":464
 *     def __exit__(self,atype,value,traceback):
 *         self.close()
 *     def tell(self):             # <<<<<<<<<<<<<<
 *         """returns position of iterator (grib message number, 0 means iterator
 *         is positioned at beginning of file)."""
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pygrib_4open_17tell(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6pygrib_4open_16tell[] = "returns position of iterator (grib message number, 0 means iterator\n        is positioned at beginning of file).";
static PyObject *__pyx_pw_6pygrib_4open_17tell(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("tell (wrapper)", 0);
  __pyx_r = __pyx_pf_6pygrib_4open_16tell(((struct __pyx_obj_6pygrib_open *)__pyx_v_self));

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

static PyObject *__pyx_pf_6pygrib_4open_16tell(struct __pyx_obj_6pygrib_open *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("tell", 0);

  /* "pygrib.pyx":467
 *         """returns position of iterator (grib message number, 0 means iterator
 *         is positioned at beginning of file)."""
 *         return self.messagenumber             # <<<<<<<<<<<<<<
 *     def seek(self, msg, from_what=0):
 *         """
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->messagenumber);
  __pyx_r = __pyx_v_self->messagenumber;
  goto __pyx_L0;

  /* "pygrib.pyx":464
 *     def __exit__(self,atype,value,traceback):
 *         self.close()
 *     def tell(self):             # <<<<<<<<<<<<<<
 *         """returns position of iterator (grib message number, 0 means iterator
 *         is positioned at beginning of file)."""
 */

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

/* "pygrib.pyx":468
 *         is positioned at beginning of file)."""
 *         return self.messagenumber
 *     def seek(self, msg, from_what=0):             # <<<<<<<<<<<<<<
 *         """
 *         seek(N,from_what=0)
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pygrib_4open_19seek(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6pygrib_4open_18seek[] = "\n        seek(N,from_what=0)\n        \n        advance iterator N grib messages from beginning of file \n        (if C{from_what=0}), from current position (if C{from_what=1})\n        or from the end of file (if C{from_what=2}).";
static PyObject *__pyx_pw_6pygrib_4open_19seek(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_msg = 0;
  PyObject *__pyx_v_from_what = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("seek (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_msg,&__pyx_n_s_from_what,0};
    PyObject* values[2] = {0,0};
    values[1] = ((PyObject *)__pyx_int_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);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_msg)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_from_what);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "seek") < 0)) __PYX_ERR(0, 468, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_msg = values[0];
    __pyx_v_from_what = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("seek", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 468, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pygrib.open.seek", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pygrib_4open_18seek(((struct __pyx_obj_6pygrib_open *)__pyx_v_self), __pyx_v_msg, __pyx_v_from_what);

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

static PyObject *__pyx_pf_6pygrib_4open_18seek(struct __pyx_obj_6pygrib_open *__pyx_v_self, PyObject *__pyx_v_msg, PyObject *__pyx_v_from_what) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  __Pyx_RefNannySetupContext("seek", 0);

  /* "pygrib.pyx":475
 *         (if C{from_what=0}), from current position (if C{from_what=1})
 *         or from the end of file (if C{from_what=2})."""
 *         if from_what not in [0,1,2]:             # <<<<<<<<<<<<<<
 *             raise ValueError('from_what keyword arg to seek must be 0,1 or 2')
 *         if msg == 0:
 */
  __Pyx_INCREF(__pyx_v_from_what);
  __pyx_t_1 = __pyx_v_from_what;
  __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_int_0, Py_NE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 475, __pyx_L1_error)
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 475, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__pyx_t_4) {
  } else {
    __pyx_t_2 = __pyx_t_4;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_int_1, Py_NE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 475, __pyx_L1_error)
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 475, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__pyx_t_4) {
  } else {
    __pyx_t_2 = __pyx_t_4;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_int_2, Py_NE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 475, __pyx_L1_error)
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 475, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_2 = __pyx_t_4;
  __pyx_L4_bool_binop_done:;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_4 = (__pyx_t_2 != 0);
  if (unlikely(__pyx_t_4)) {

    /* "pygrib.pyx":476
 *         or from the end of file (if C{from_what=2})."""
 *         if from_what not in [0,1,2]:
 *             raise ValueError('from_what keyword arg to seek must be 0,1 or 2')             # <<<<<<<<<<<<<<
 *         if msg == 0:
 *             if from_what == 0:
 */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 476, __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_ERR(0, 476, __pyx_L1_error)

    /* "pygrib.pyx":475
 *         (if C{from_what=0}), from current position (if C{from_what=1})
 *         or from the end of file (if C{from_what=2})."""
 *         if from_what not in [0,1,2]:             # <<<<<<<<<<<<<<
 *             raise ValueError('from_what keyword arg to seek must be 0,1 or 2')
 *         if msg == 0:
 */
  }

  /* "pygrib.pyx":477
 *         if from_what not in [0,1,2]:
 *             raise ValueError('from_what keyword arg to seek must be 0,1 or 2')
 *         if msg == 0:             # <<<<<<<<<<<<<<
 *             if from_what == 0:
 *                 self.rewind()
 */
  __pyx_t_1 = __Pyx_PyInt_EqObjC(__pyx_v_msg, __pyx_int_0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 477, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 477, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_4) {

    /* "pygrib.pyx":478
 *             raise ValueError('from_what keyword arg to seek must be 0,1 or 2')
 *         if msg == 0:
 *             if from_what == 0:             # <<<<<<<<<<<<<<
 *                 self.rewind()
 *             elif from_what == 1:
 */
    __pyx_t_1 = __Pyx_PyInt_EqObjC(__pyx_v_from_what, __pyx_int_0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 478, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 478, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (__pyx_t_4) {

      /* "pygrib.pyx":479
 *         if msg == 0:
 *             if from_what == 0:
 *                 self.rewind()             # <<<<<<<<<<<<<<
 *             elif from_what == 1:
 *                 return
 */
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_rewind); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 479, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
        __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
        if (likely(__pyx_t_5)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
          __Pyx_INCREF(__pyx_t_5);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_3, function);
        }
      }
      if (__pyx_t_5) {
        __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 479, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      } else {
        __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 479, __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;

      /* "pygrib.pyx":478
 *             raise ValueError('from_what keyword arg to seek must be 0,1 or 2')
 *         if msg == 0:
 *             if from_what == 0:             # <<<<<<<<<<<<<<
 *                 self.rewind()
 *             elif from_what == 1:
 */
      goto __pyx_L8;
    }

    /* "pygrib.pyx":480
 *             if from_what == 0:
 *                 self.rewind()
 *             elif from_what == 1:             # <<<<<<<<<<<<<<
 *                 return
 *             elif from_what == 2:
 */
    __pyx_t_1 = __Pyx_PyInt_EqObjC(__pyx_v_from_what, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 480, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 480, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (__pyx_t_4) {

      /* "pygrib.pyx":481
 *                 self.rewind()
 *             elif from_what == 1:
 *                 return             # <<<<<<<<<<<<<<
 *             elif from_what == 2:
 *                 self.message(self.messages)
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_r = Py_None; __Pyx_INCREF(Py_None);
      goto __pyx_L0;

      /* "pygrib.pyx":480
 *             if from_what == 0:
 *                 self.rewind()
 *             elif from_what == 1:             # <<<<<<<<<<<<<<
 *                 return
 *             elif from_what == 2:
 */
    }

    /* "pygrib.pyx":482
 *             elif from_what == 1:
 *                 return
 *             elif from_what == 2:             # <<<<<<<<<<<<<<
 *                 self.message(self.messages)
 *         else:
 */
    __pyx_t_1 = __Pyx_PyInt_EqObjC(__pyx_v_from_what, __pyx_int_2, 2, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 482, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 482, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (__pyx_t_4) {

      /* "pygrib.pyx":483
 *                 return
 *             elif from_what == 2:
 *                 self.message(self.messages)             # <<<<<<<<<<<<<<
 *         else:
 *             if from_what == 0:
 */
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_message); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 483, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
        __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
        if (likely(__pyx_t_5)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
          __Pyx_INCREF(__pyx_t_5);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_3, function);
        }
      }
      if (!__pyx_t_5) {
        __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_self->messages); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 483, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
      } else {
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_3)) {
          PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_v_self->messages};
          __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 483, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_GOTREF(__pyx_t_1);
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
          PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_v_self->messages};
          __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 483, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_GOTREF(__pyx_t_1);
        } else
        #endif
        {
          __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 483, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); __pyx_t_5 = NULL;
          __Pyx_INCREF(__pyx_v_self->messages);
          __Pyx_GIVEREF(__pyx_v_self->messages);
          PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_v_self->messages);
          __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 483, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        }
      }
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "pygrib.pyx":482
 *             elif from_what == 1:
 *                 return
 *             elif from_what == 2:             # <<<<<<<<<<<<<<
 *                 self.message(self.messages)
 *         else:
 */
    }
    __pyx_L8:;

    /* "pygrib.pyx":477
 *         if from_what not in [0,1,2]:
 *             raise ValueError('from_what keyword arg to seek must be 0,1 or 2')
 *         if msg == 0:             # <<<<<<<<<<<<<<
 *             if from_what == 0:
 *                 self.rewind()
 */
    goto __pyx_L7;
  }

  /* "pygrib.pyx":485
 *                 self.message(self.messages)
 *         else:
 *             if from_what == 0:             # <<<<<<<<<<<<<<
 *                 self.message(msg)
 *             elif from_what == 1:
 */
  /*else*/ {
    __pyx_t_1 = __Pyx_PyInt_EqObjC(__pyx_v_from_what, __pyx_int_0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 485, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 485, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (__pyx_t_4) {

      /* "pygrib.pyx":486
 *         else:
 *             if from_what == 0:
 *                 self.message(msg)             # <<<<<<<<<<<<<<
 *             elif from_what == 1:
 *                 self.message(self.messagenumber+msg)
 */
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_message); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 486, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_6 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
        __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3);
        if (likely(__pyx_t_6)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
          __Pyx_INCREF(__pyx_t_6);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_3, function);
        }
      }
      if (!__pyx_t_6) {
        __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_msg); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 486, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
      } else {
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_3)) {
          PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_v_msg};
          __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 486, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_GOTREF(__pyx_t_1);
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
          PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_v_msg};
          __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 486, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_GOTREF(__pyx_t_1);
        } else
        #endif
        {
          __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 486, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_6); __pyx_t_6 = NULL;
          __Pyx_INCREF(__pyx_v_msg);
          __Pyx_GIVEREF(__pyx_v_msg);
          PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_v_msg);
          __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 486, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        }
      }
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "pygrib.pyx":485
 *                 self.message(self.messages)
 *         else:
 *             if from_what == 0:             # <<<<<<<<<<<<<<
 *                 self.message(msg)
 *             elif from_what == 1:
 */
      goto __pyx_L9;
    }

    /* "pygrib.pyx":487
 *             if from_what == 0:
 *                 self.message(msg)
 *             elif from_what == 1:             # <<<<<<<<<<<<<<
 *                 self.message(self.messagenumber+msg)
 *             elif from_what == 2:
 */
    __pyx_t_1 = __Pyx_PyInt_EqObjC(__pyx_v_from_what, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 487, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 487, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (__pyx_t_4) {

      /* "pygrib.pyx":488
 *                 self.message(msg)
 *             elif from_what == 1:
 *                 self.message(self.messagenumber+msg)             # <<<<<<<<<<<<<<
 *             elif from_what == 2:
 *                 self.message(self.messages+msg)
 */
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_message); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 488, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = PyNumber_Add(__pyx_v_self->messagenumber, __pyx_v_msg); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 488, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
        __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3);
        if (likely(__pyx_t_6)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
          __Pyx_INCREF(__pyx_t_6);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_3, function);
        }
      }
      if (!__pyx_t_6) {
        __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 488, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_GOTREF(__pyx_t_1);
      } else {
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_3)) {
          PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_t_5};
          __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 488, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
          PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_t_5};
          __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 488, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        } else
        #endif
        {
          __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 488, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_6); __pyx_t_6 = NULL;
          __Pyx_GIVEREF(__pyx_t_5);
          PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_t_5);
          __pyx_t_5 = 0;
          __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 488, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        }
      }
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "pygrib.pyx":487
 *             if from_what == 0:
 *                 self.message(msg)
 *             elif from_what == 1:             # <<<<<<<<<<<<<<
 *                 self.message(self.messagenumber+msg)
 *             elif from_what == 2:
 */
      goto __pyx_L9;
    }

    /* "pygrib.pyx":489
 *             elif from_what == 1:
 *                 self.message(self.messagenumber+msg)
 *             elif from_what == 2:             # <<<<<<<<<<<<<<
 *                 self.message(self.messages+msg)
 *     def readline(self):
 */
    __pyx_t_1 = __Pyx_PyInt_EqObjC(__pyx_v_from_what, __pyx_int_2, 2, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 489, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 489, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (__pyx_t_4) {

      /* "pygrib.pyx":490
 *                 self.message(self.messagenumber+msg)
 *             elif from_what == 2:
 *                 self.message(self.messages+msg)             # <<<<<<<<<<<<<<
 *     def readline(self):
 *         """
 */
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_message); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 490, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_7 = PyNumber_Add(__pyx_v_self->messages, __pyx_v_msg); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 490, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_5 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
        __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
        if (likely(__pyx_t_5)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
          __Pyx_INCREF(__pyx_t_5);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_3, function);
        }
      }
      if (!__pyx_t_5) {
        __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 490, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_GOTREF(__pyx_t_1);
      } else {
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_3)) {
          PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_7};
          __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 490, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
          PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_7};
          __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 490, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        } else
        #endif
        {
          __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 490, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); __pyx_t_5 = NULL;
          __Pyx_GIVEREF(__pyx_t_7);
          PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_t_7);
          __pyx_t_7 = 0;
          __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 490, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        }
      }
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "pygrib.pyx":489
 *             elif from_what == 1:
 *                 self.message(self.messagenumber+msg)
 *             elif from_what == 2:             # <<<<<<<<<<<<<<
 *                 self.message(self.messages+msg)
 *     def readline(self):
 */
    }
    __pyx_L9:;
  }
  __pyx_L7:;

  /* "pygrib.pyx":468
 *         is positioned at beginning of file)."""
 *         return self.messagenumber
 *     def seek(self, msg, from_what=0):             # <<<<<<<<<<<<<<
 *         """
 *         seek(N,from_what=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_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("pygrib.open.seek", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pygrib.pyx":491
 *             elif from_what == 2:
 *                 self.message(self.messages+msg)
 *     def readline(self):             # <<<<<<<<<<<<<<
 *         """
 *         readline()
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pygrib_4open_21readline(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6pygrib_4open_20readline[] = "\n        readline()\n\n        read one entire grib message from the file.\n        Returns a L{gribmessage} instance, or None if an EOF is encountered.";
static PyObject *__pyx_pw_6pygrib_4open_21readline(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("readline (wrapper)", 0);
  __pyx_r = __pyx_pf_6pygrib_4open_20readline(((struct __pyx_obj_6pygrib_open *)__pyx_v_self));

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

static PyObject *__pyx_pf_6pygrib_4open_20readline(struct __pyx_obj_6pygrib_open *__pyx_v_self) {
  PyObject *__pyx_v_grb = 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_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  __Pyx_RefNannySetupContext("readline", 0);

  /* "pygrib.pyx":497
 *         read one entire grib message from the file.
 *         Returns a L{gribmessage} instance, or None if an EOF is encountered."""
 *         try:             # <<<<<<<<<<<<<<
 *             if hasattr(self,'next'):
 *                 grb = self.next()
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __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:*/ {

      /* "pygrib.pyx":498
 *         Returns a L{gribmessage} instance, or None if an EOF is encountered."""
 *         try:
 *             if hasattr(self,'next'):             # <<<<<<<<<<<<<<
 *                 grb = self.next()
 *             else:
 */
      __pyx_t_4 = __Pyx_HasAttr(((PyObject *)__pyx_v_self), __pyx_n_s_next); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 498, __pyx_L3_error)
      __pyx_t_5 = (__pyx_t_4 != 0);
      if (__pyx_t_5) {

        /* "pygrib.pyx":499
 *         try:
 *             if hasattr(self,'next'):
 *                 grb = self.next()             # <<<<<<<<<<<<<<
 *             else:
 *                 grb = next(self)
 */
        __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_next); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 499, __pyx_L3_error)
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_8 = NULL;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
          __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
          if (likely(__pyx_t_8)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
            __Pyx_INCREF(__pyx_t_8);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_7, function);
          }
        }
        if (__pyx_t_8) {
          __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_8); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 499, __pyx_L3_error)
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        } else {
          __pyx_t_6 = __Pyx_PyObject_CallNoArg(__pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 499, __pyx_L3_error)
        }
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_v_grb = __pyx_t_6;
        __pyx_t_6 = 0;

        /* "pygrib.pyx":498
 *         Returns a L{gribmessage} instance, or None if an EOF is encountered."""
 *         try:
 *             if hasattr(self,'next'):             # <<<<<<<<<<<<<<
 *                 grb = self.next()
 *             else:
 */
        goto __pyx_L9;
      }

      /* "pygrib.pyx":501
 *                 grb = self.next()
 *             else:
 *                 grb = next(self)             # <<<<<<<<<<<<<<
 *         except StopIteration:
 *             grb = None
 */
      /*else*/ {
        __pyx_t_6 = __Pyx_PyIter_Next(((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 501, __pyx_L3_error)
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_v_grb = __pyx_t_6;
        __pyx_t_6 = 0;
      }
      __pyx_L9:;

      /* "pygrib.pyx":497
 *         read one entire grib message from the file.
 *         Returns a L{gribmessage} instance, or None if an EOF is encountered."""
 *         try:             # <<<<<<<<<<<<<<
 *             if hasattr(self,'next'):
 *                 grb = self.next()
 */
    }
    __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_L8_try_end;
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "pygrib.pyx":502
 *             else:
 *                 grb = next(self)
 *         except StopIteration:             # <<<<<<<<<<<<<<
 *             grb = None
 *         return grb
 */
    __pyx_t_9 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_StopIteration);
    if (__pyx_t_9) {
      __Pyx_AddTraceback("pygrib.open.readline", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8) < 0) __PYX_ERR(0, 502, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_GOTREF(__pyx_t_8);

      /* "pygrib.pyx":503
 *                 grb = next(self)
 *         except StopIteration:
 *             grb = None             # <<<<<<<<<<<<<<
 *         return grb
 *     def read(self,msgs=None):
 */
      __Pyx_INCREF(Py_None);
      __Pyx_XDECREF_SET(__pyx_v_grb, Py_None);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      goto __pyx_L4_exception_handled;
    }
    goto __pyx_L5_except_error;
    __pyx_L5_except_error:;

    /* "pygrib.pyx":497
 *         read one entire grib message from the file.
 *         Returns a L{gribmessage} instance, or None if an EOF is encountered."""
 *         try:             # <<<<<<<<<<<<<<
 *             if hasattr(self,'next'):
 *                 grb = self.next()
 */
    __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_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_L8_try_end:;
  }

  /* "pygrib.pyx":504
 *         except StopIteration:
 *             grb = None
 *         return grb             # <<<<<<<<<<<<<<
 *     def read(self,msgs=None):
 *         """
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_grb);
  __pyx_r = __pyx_v_grb;
  goto __pyx_L0;

  /* "pygrib.pyx":491
 *             elif from_what == 2:
 *                 self.message(self.messages+msg)
 *     def readline(self):             # <<<<<<<<<<<<<<
 *         """
 *         readline()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("pygrib.open.readline", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_grb);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pygrib.pyx":505
 *             grb = None
 *         return grb
 *     def read(self,msgs=None):             # <<<<<<<<<<<<<<
 *         """
 *         read(N=None)
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pygrib_4open_23read(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6pygrib_4open_22read[] = "\n        read(N=None)\n        \n        read N messages from current position, returning grib messages instances in a\n        list.  If N=None, all the messages to the end of the file are read.\n        C{pygrib.open(f).read()} is equivalent to C{list(pygrib.open(f))},\n        both return a list containing L{gribmessage} instances for all the\n        grib messages in the file C{f}.\n        ";
static PyObject *__pyx_pw_6pygrib_4open_23read(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_msgs = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("read (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_msgs,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);
        CYTHON_FALLTHROUGH;
        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 = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_msgs);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "read") < 0)) __PYX_ERR(0, 505, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_msgs = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("read", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 505, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pygrib.open.read", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pygrib_4open_22read(((struct __pyx_obj_6pygrib_open *)__pyx_v_self), __pyx_v_msgs);

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

static PyObject *__pyx_pf_6pygrib_4open_22read(struct __pyx_obj_6pygrib_open *__pyx_v_self, PyObject *__pyx_v_msgs) {
  PyObject *__pyx_v_grbs = NULL;
  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;
  PyObject *__pyx_t_6 = NULL;
  __Pyx_RefNannySetupContext("read", 0);

  /* "pygrib.pyx":515
 *         grib messages in the file C{f}.
 *         """
 *         if msgs is None:             # <<<<<<<<<<<<<<
 *             grbs = self._advance(self.messages-self.messagenumber,return_msgs=True)
 *         else:
 */
  __pyx_t_1 = (__pyx_v_msgs == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "pygrib.pyx":516
 *         """
 *         if msgs is None:
 *             grbs = self._advance(self.messages-self.messagenumber,return_msgs=True)             # <<<<<<<<<<<<<<
 *         else:
 *             grbs = self._advance(msgs,return_msgs=True)
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_advance); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 516, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyNumber_Subtract(__pyx_v_self->messages, __pyx_v_self->messagenumber); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 516, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 516, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
    __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 516, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_return_msgs, Py_True) < 0) __PYX_ERR(0, 516, __pyx_L1_error)
    __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 516, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_v_grbs = __pyx_t_6;
    __pyx_t_6 = 0;

    /* "pygrib.pyx":515
 *         grib messages in the file C{f}.
 *         """
 *         if msgs is None:             # <<<<<<<<<<<<<<
 *             grbs = self._advance(self.messages-self.messagenumber,return_msgs=True)
 *         else:
 */
    goto __pyx_L3;
  }

  /* "pygrib.pyx":518
 *             grbs = self._advance(self.messages-self.messagenumber,return_msgs=True)
 *         else:
 *             grbs = self._advance(msgs,return_msgs=True)             # <<<<<<<<<<<<<<
 *         return grbs
 *     def close(self):
 */
  /*else*/ {
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_advance); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 518, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 518, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_v_msgs);
    __Pyx_GIVEREF(__pyx_v_msgs);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_msgs);
    __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 518, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_return_msgs, Py_True) < 0) __PYX_ERR(0, 518, __pyx_L1_error)
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 518, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_v_grbs = __pyx_t_3;
    __pyx_t_3 = 0;
  }
  __pyx_L3:;

  /* "pygrib.pyx":519
 *         else:
 *             grbs = self._advance(msgs,return_msgs=True)
 *         return grbs             # <<<<<<<<<<<<<<
 *     def close(self):
 *         """
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_grbs);
  __pyx_r = __pyx_v_grbs;
  goto __pyx_L0;

  /* "pygrib.pyx":505
 *             grb = None
 *         return grb
 *     def read(self,msgs=None):             # <<<<<<<<<<<<<<
 *         """
 *         read(N=None)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("pygrib.open.read", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_grbs);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pygrib.pyx":520
 *             grbs = self._advance(msgs,return_msgs=True)
 *         return grbs
 *     def close(self):             # <<<<<<<<<<<<<<
 *         """
 *         close()
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pygrib_4open_25close(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6pygrib_4open_24close[] = "\n        close()\n\n        close GRIB file, deallocate C structures associated with class instance";
static PyObject *__pyx_pw_6pygrib_4open_25close(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("close (wrapper)", 0);
  __pyx_r = __pyx_pf_6pygrib_4open_24close(((struct __pyx_obj_6pygrib_open *)__pyx_v_self));

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

static PyObject *__pyx_pf_6pygrib_4open_24close(struct __pyx_obj_6pygrib_open *__pyx_v_self) {
  int __pyx_v_err;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("close", 0);

  /* "pygrib.pyx":526
 *         close GRIB file, deallocate C structures associated with class instance"""
 *         cdef int err
 *         fclose(self._fd)             # <<<<<<<<<<<<<<
 *         if self._gh != NULL:
 *             err = grib_handle_delete(self._gh)
 */
  (void)(fclose(__pyx_v_self->_fd));

  /* "pygrib.pyx":527
 *         cdef int err
 *         fclose(self._fd)
 *         if self._gh != NULL:             # <<<<<<<<<<<<<<
 *             err = grib_handle_delete(self._gh)
 *             if err:
 */
  __pyx_t_1 = ((__pyx_v_self->_gh != NULL) != 0);
  if (__pyx_t_1) {

    /* "pygrib.pyx":528
 *         fclose(self._fd)
 *         if self._gh != NULL:
 *             err = grib_handle_delete(self._gh)             # <<<<<<<<<<<<<<
 *             if err:
 *                 raise RuntimeError(grib_get_error_message(err))
 */
    __pyx_v_err = grib_handle_delete(__pyx_v_self->_gh);

    /* "pygrib.pyx":529
 *         if self._gh != NULL:
 *             err = grib_handle_delete(self._gh)
 *             if err:             # <<<<<<<<<<<<<<
 *                 raise RuntimeError(grib_get_error_message(err))
 *         self.closed = True
 */
    __pyx_t_1 = (__pyx_v_err != 0);
    if (unlikely(__pyx_t_1)) {

      /* "pygrib.pyx":530
 *             err = grib_handle_delete(self._gh)
 *             if err:
 *                 raise RuntimeError(grib_get_error_message(err))             # <<<<<<<<<<<<<<
 *         self.closed = True
 *         self._fd = NULL
 */
      __pyx_t_2 = __Pyx_PyBytes_FromString(grib_get_error_message(__pyx_v_err)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 530, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_RuntimeError, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 530, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_Raise(__pyx_t_3, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __PYX_ERR(0, 530, __pyx_L1_error)

      /* "pygrib.pyx":529
 *         if self._gh != NULL:
 *             err = grib_handle_delete(self._gh)
 *             if err:             # <<<<<<<<<<<<<<
 *                 raise RuntimeError(grib_get_error_message(err))
 *         self.closed = True
 */
    }

    /* "pygrib.pyx":527
 *         cdef int err
 *         fclose(self._fd)
 *         if self._gh != NULL:             # <<<<<<<<<<<<<<
 *             err = grib_handle_delete(self._gh)
 *             if err:
 */
  }

  /* "pygrib.pyx":531
 *             if err:
 *                 raise RuntimeError(grib_get_error_message(err))
 *         self.closed = True             # <<<<<<<<<<<<<<
 *         self._fd = NULL
 * 
 */
  __Pyx_INCREF(Py_True);
  __Pyx_GIVEREF(Py_True);
  __Pyx_GOTREF(__pyx_v_self->closed);
  __Pyx_DECREF(__pyx_v_self->closed);
  __pyx_v_self->closed = Py_True;

  /* "pygrib.pyx":532
 *                 raise RuntimeError(grib_get_error_message(err))
 *         self.closed = True
 *         self._fd = NULL             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(self):
 */
  __pyx_v_self->_fd = NULL;

  /* "pygrib.pyx":520
 *             grbs = self._advance(msgs,return_msgs=True)
 *         return grbs
 *     def close(self):             # <<<<<<<<<<<<<<
 *         """
 *         close()
 */

  /* 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_AddTraceback("pygrib.open.close", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pygrib.pyx":534
 *         self._fd = NULL
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         # close file handle if there are no more references
 *         # to the object.
 */

/* Python wrapper */
static void __pyx_pw_6pygrib_4open_27__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_6pygrib_4open_27__dealloc__(PyObject *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_pf_6pygrib_4open_26__dealloc__(((struct __pyx_obj_6pygrib_open *)__pyx_v_self));

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

static void __pyx_pf_6pygrib_4open_26__dealloc__(struct __pyx_obj_6pygrib_open *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("__dealloc__", 0);

  /* "pygrib.pyx":538
 *         # to the object.
 *         cdef int err
 *         if self._fd:             # <<<<<<<<<<<<<<
 *             fclose(self._fd)
 * 
 */
  __pyx_t_1 = (__pyx_v_self->_fd != 0);
  if (__pyx_t_1) {

    /* "pygrib.pyx":539
 *         cdef int err
 *         if self._fd:
 *             fclose(self._fd)             # <<<<<<<<<<<<<<
 * 
 *     def rewind(self):
 */
    (void)(fclose(__pyx_v_self->_fd));

    /* "pygrib.pyx":538
 *         # to the object.
 *         cdef int err
 *         if self._fd:             # <<<<<<<<<<<<<<
 *             fclose(self._fd)
 * 
 */
  }

  /* "pygrib.pyx":534
 *         self._fd = NULL
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         # close file handle if there are no more references
 *         # to the object.
 */

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

/* "pygrib.pyx":541
 *             fclose(self._fd)
 * 
 *     def rewind(self):             # <<<<<<<<<<<<<<
 *         """rewind iterator (same as seek(0))"""
 *         # before rewinding, move iterator to end of file
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pygrib_4open_29rewind(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6pygrib_4open_28rewind[] = "rewind iterator (same as seek(0))";
static PyObject *__pyx_pw_6pygrib_4open_29rewind(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("rewind (wrapper)", 0);
  __pyx_r = __pyx_pf_6pygrib_4open_28rewind(((struct __pyx_obj_6pygrib_open *)__pyx_v_self));

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

static PyObject *__pyx_pf_6pygrib_4open_28rewind(struct __pyx_obj_6pygrib_open *__pyx_v_self) {
  grib_handle *__pyx_v_gh;
  int __pyx_v_err;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("rewind", 0);

  /* "pygrib.pyx":546
 *         # to make sure it is not left in a funky state
 *         # (such as in the middle of a multi-part message, issue 54)
 *         while 1:             # <<<<<<<<<<<<<<
 *             gh = grib_handle_new_from_file(NULL, self._fd, &err)
 *             err = grib_handle_delete(gh)
 */
  while (1) {

    /* "pygrib.pyx":547
 *         # (such as in the middle of a multi-part message, issue 54)
 *         while 1:
 *             gh = grib_handle_new_from_file(NULL, self._fd, &err)             # <<<<<<<<<<<<<<
 *             err = grib_handle_delete(gh)
 *             if gh == NULL: break
 */
    __pyx_v_gh = grib_handle_new_from_file(NULL, __pyx_v_self->_fd, (&__pyx_v_err));

    /* "pygrib.pyx":548
 *         while 1:
 *             gh = grib_handle_new_from_file(NULL, self._fd, &err)
 *             err = grib_handle_delete(gh)             # <<<<<<<<<<<<<<
 *             if gh == NULL: break
 *         rewind(self._fd)
 */
    __pyx_v_err = grib_handle_delete(__pyx_v_gh);

    /* "pygrib.pyx":549
 *             gh = grib_handle_new_from_file(NULL, self._fd, &err)
 *             err = grib_handle_delete(gh)
 *             if gh == NULL: break             # <<<<<<<<<<<<<<
 *         rewind(self._fd)
 *         self.messagenumber = 0
 */
    __pyx_t_1 = ((__pyx_v_gh == NULL) != 0);
    if (__pyx_t_1) {
      goto __pyx_L4_break;
    }
  }
  __pyx_L4_break:;

  /* "pygrib.pyx":550
 *             err = grib_handle_delete(gh)
 *             if gh == NULL: break
 *         rewind(self._fd)             # <<<<<<<<<<<<<<
 *         self.messagenumber = 0
 *     def message(self, N):
 */
  rewind(__pyx_v_self->_fd);

  /* "pygrib.pyx":551
 *             if gh == NULL: break
 *         rewind(self._fd)
 *         self.messagenumber = 0             # <<<<<<<<<<<<<<
 *     def message(self, N):
 *         """
 */
  __Pyx_INCREF(__pyx_int_0);
  __Pyx_GIVEREF(__pyx_int_0);
  __Pyx_GOTREF(__pyx_v_self->messagenumber);
  __Pyx_DECREF(__pyx_v_self->messagenumber);
  __pyx_v_self->messagenumber = __pyx_int_0;

  /* "pygrib.pyx":541
 *             fclose(self._fd)
 * 
 *     def rewind(self):             # <<<<<<<<<<<<<<
 *         """rewind iterator (same as seek(0))"""
 *         # before rewinding, move iterator to end of file
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pygrib.pyx":552
 *         rewind(self._fd)
 *         self.messagenumber = 0
 *     def message(self, N):             # <<<<<<<<<<<<<<
 *         """
 *         message(N)
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pygrib_4open_31message(PyObject *__pyx_v_self, PyObject *__pyx_v_N); /*proto*/
static char __pyx_doc_6pygrib_4open_30message[] = "\n        message(N)\n        \n        retrieve N'th message in iterator.\n        same as seek(N-1) followed by readline().";
static PyObject *__pyx_pw_6pygrib_4open_31message(PyObject *__pyx_v_self, PyObject *__pyx_v_N) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("message (wrapper)", 0);
  __pyx_r = __pyx_pf_6pygrib_4open_30message(((struct __pyx_obj_6pygrib_open *)__pyx_v_self), ((PyObject *)__pyx_v_N));

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

static PyObject *__pyx_pf_6pygrib_4open_30message(struct __pyx_obj_6pygrib_open *__pyx_v_self, PyObject *__pyx_v_N) {
  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;
  __Pyx_RefNannySetupContext("message", 0);

  /* "pygrib.pyx":558
 *         retrieve N'th message in iterator.
 *         same as seek(N-1) followed by readline()."""
 *         if N < 1:             # <<<<<<<<<<<<<<
 *             raise IOError('grb message numbers start at 1')
 *         # if iterator positioned past message N, reposition at beginning.
 */
  __pyx_t_1 = PyObject_RichCompare(__pyx_v_N, __pyx_int_1, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 558, __pyx_L1_error)
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 558, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(__pyx_t_2)) {

    /* "pygrib.pyx":559
 *         same as seek(N-1) followed by readline()."""
 *         if N < 1:
 *             raise IOError('grb message numbers start at 1')             # <<<<<<<<<<<<<<
 *         # if iterator positioned past message N, reposition at beginning.
 *         if self.messagenumber >= N:
 */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_IOError, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 559, __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_ERR(0, 559, __pyx_L1_error)

    /* "pygrib.pyx":558
 *         retrieve N'th message in iterator.
 *         same as seek(N-1) followed by readline()."""
 *         if N < 1:             # <<<<<<<<<<<<<<
 *             raise IOError('grb message numbers start at 1')
 *         # if iterator positioned past message N, reposition at beginning.
 */
  }

  /* "pygrib.pyx":561
 *             raise IOError('grb message numbers start at 1')
 *         # if iterator positioned past message N, reposition at beginning.
 *         if self.messagenumber >= N:             # <<<<<<<<<<<<<<
 *             self.rewind()
 *         # move iterator forward to message N.
 */
  __pyx_t_1 = PyObject_RichCompare(__pyx_v_self->messagenumber, __pyx_v_N, Py_GE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 561, __pyx_L1_error)
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 561, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "pygrib.pyx":562
 *         # if iterator positioned past message N, reposition at beginning.
 *         if self.messagenumber >= N:
 *             self.rewind()             # <<<<<<<<<<<<<<
 *         # move iterator forward to message N.
 *         self._advance(N-self.messagenumber)
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_rewind); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 562, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    if (__pyx_t_4) {
      __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 562, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else {
      __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 562, __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;

    /* "pygrib.pyx":561
 *             raise IOError('grb message numbers start at 1')
 *         # if iterator positioned past message N, reposition at beginning.
 *         if self.messagenumber >= N:             # <<<<<<<<<<<<<<
 *             self.rewind()
 *         # move iterator forward to message N.
 */
  }

  /* "pygrib.pyx":564
 *             self.rewind()
 *         # move iterator forward to message N.
 *         self._advance(N-self.messagenumber)             # <<<<<<<<<<<<<<
 *         return _create_gribmessage(self._gh, self.messagenumber)
 *     def select(self, **kwargs):
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_advance); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 564, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyNumber_Subtract(__pyx_v_N, __pyx_v_self->messagenumber); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 564, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  if (!__pyx_t_5) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 564, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_4};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 564, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_4};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 564, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else
    #endif
    {
      __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 564, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); __pyx_t_5 = NULL;
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_t_4);
      __pyx_t_4 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 564, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pygrib.pyx":565
 *         # move iterator forward to message N.
 *         self._advance(N-self.messagenumber)
 *         return _create_gribmessage(self._gh, self.messagenumber)             # <<<<<<<<<<<<<<
 *     def select(self, **kwargs):
 *         """
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_v_self->messagenumber;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_3 = __pyx_f_6pygrib__create_gribmessage(__pyx_v_self->_gh, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 565, __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;

  /* "pygrib.pyx":552
 *         rewind(self._fd)
 *         self.messagenumber = 0
 *     def message(self, N):             # <<<<<<<<<<<<<<
 *         """
 *         message(N)
 */

  /* 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("pygrib.open.message", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pygrib.pyx":566
 *         self._advance(N-self.messagenumber)
 *         return _create_gribmessage(self._gh, self.messagenumber)
 *     def select(self, **kwargs):             # <<<<<<<<<<<<<<
 *         """
 * select(**kwargs)
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pygrib_4open_33select(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6pygrib_4open_32select[] = "\nselect(**kwargs)\n\nreturn a list of L{gribmessage} instances from iterator filtered by kwargs.\nIf keyword is a container object, each grib message\nin the iterator is searched for membership in the container.\nIf keyword is a callable (has a _call__ method), each grib\nmessage in the iterator is tested using the callable (which should\nreturn a boolean).\nIf keyword is not a container object or a callable, each \ngrib message in the iterator is tested for equality.\n\nExample usage:\n\n>>> import pygrib\n>>> grbs = pygrib.open('sampledata/gfs.grb')\n>>> selected_grbs=grbs.select(shortName='gh',typeOfLevel='isobaricInhPa',level=10)\n>>> for grb in selected_grbs: grb\n26:Geopotential height:gpm (instant):regular_ll:isobaricInhPa:level 10 Pa:fcst time 72 hrs:from 200412091200:lo res cntl fcst\n>>> # the __call__ method does the same thing\n>>> selected_grbs=grbs(shortName='gh',typeOfLevel='isobaricInhPa',level=10)\n>>> for grb in selected_grbs: grb\n26:Geopotential height:gpm (instant):regular_ll:isobaricInhPa:level 10 Pa:fcst time 72 hrs:from 200412091200:lo res cntl fcst\n>>> # to select multiple specific key values, use containers (e.g. sequences)\n>>> selected_grbs=grbs(shortName=['u','v'],typeOfLevel='isobaricInhPa',level=[10,50])\n>>> for grb in selected_grbs: grb\n193:u-component of wind:m s**-1 (instant):regular_ll:isobaricInhPa:level 50 Pa:fcst time 72 hrs:from 200412091200:lo res cntl fcst\n194:v-component of wind:m s**-1 (instant):regular_ll:isobaricInhPa:level 50 Pa:fcst time 72 hrs:from 200412091200:lo res cntl fcst\n199:u-component of wind:m s**-1 (instant):regular_ll:isobaricInhPa:level 10 Pa:fcst time 72 hrs:from 200412091200:lo res cntl fcst\n200:v-component of wind:m s**-1 (instant):regular_ll:isobaricInhPa:level 10 Pa:fcst time 72 hrs:from 200412091200:lo res cntl fcst\n>>> # to select key values based on a conditional expression, use a function\n>>> selected_grbs=grbs(shortName='gh',level=lambda l: l < 500 and l >= 300)\n>>> for grb in selected_""grbs: grb\n14:Geopotential height:gpm (instant):regular_ll:isobaricInhPa:level 45000 Pa:fcst time 72 hrs:from 200412091200:lo res cntl fcst\n15:Geopotential height:gpm (instant):regular_ll:isobaricInhPa:level 40000 Pa:fcst time 72 hrs:from 200412091200:lo res cntl fcst\n16:Geopotential height:gpm (instant):regular_ll:isobaricInhPa:level 35000 Pa:fcst time 72 hrs:from 200412091200:lo res cntl fcst\n17:Geopotential height:gpm (instant):regular_ll:isobaricInhPa:level 30000 Pa:fcst time 72 hrs:from 200412091200:lo res cntl fcst\n";
static PyObject *__pyx_pw_6pygrib_4open_33select(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_kwargs = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("select (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("select", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (__pyx_kwds && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "select", 1))) return NULL;
  if (__pyx_kwds) {
    __pyx_v_kwargs = PyDict_Copy(__pyx_kwds); if (unlikely(!__pyx_v_kwargs)) return NULL;
    __Pyx_GOTREF(__pyx_v_kwargs);
  } else {
    __pyx_v_kwargs = NULL;
  }
  __pyx_r = __pyx_pf_6pygrib_4open_32select(((struct __pyx_obj_6pygrib_open *)__pyx_v_self), __pyx_v_kwargs);

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

static PyObject *__pyx_pf_6pygrib_4open_32select(struct __pyx_obj_6pygrib_open *__pyx_v_self, PyObject *__pyx_v_kwargs) {
  PyObject *__pyx_v_msgnum = NULL;
  PyObject *__pyx_v_grbs = NULL;
  PyObject *__pyx_v_grb = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t __pyx_t_4;
  PyObject *(*__pyx_t_5)(PyObject *);
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  int __pyx_t_9;
  __Pyx_RefNannySetupContext("select", 0);

  /* "pygrib.pyx":605
 * 17:Geopotential height:gpm (instant):regular_ll:isobaricInhPa:level 30000 Pa:fcst time 72 hrs:from 200412091200:lo res cntl fcst
 * """
 *         msgnum = self.tell()             # <<<<<<<<<<<<<<
 *         self.rewind() # always search from beginning
 *         grbs = [grb for grb in self if _find(grb, **kwargs)]
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_tell); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 605, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  if (__pyx_t_3) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 605, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else {
    __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 605, __pyx_L1_error)
  }
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_msgnum = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pygrib.pyx":606
 * """
 *         msgnum = self.tell()
 *         self.rewind() # always search from beginning             # <<<<<<<<<<<<<<
 *         grbs = [grb for grb in self if _find(grb, **kwargs)]
 *         self.seek(msgnum) # leave iterator in original position.
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_rewind); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 606, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  if (__pyx_t_3) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 606, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else {
    __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 606, __pyx_L1_error)
  }
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pygrib.pyx":607
 *         msgnum = self.tell()
 *         self.rewind() # always search from beginning
 *         grbs = [grb for grb in self if _find(grb, **kwargs)]             # <<<<<<<<<<<<<<
 *         self.seek(msgnum) # leave iterator in original position.
 *         if not grbs:
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 607, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (likely(PyList_CheckExact(((PyObject *)__pyx_v_self))) || PyTuple_CheckExact(((PyObject *)__pyx_v_self))) {
    __pyx_t_2 = ((PyObject *)__pyx_v_self); __Pyx_INCREF(__pyx_t_2); __pyx_t_4 = 0;
    __pyx_t_5 = NULL;
  } else {
    __pyx_t_4 = -1; __pyx_t_2 = PyObject_GetIter(((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 607, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 607, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_5)) {
      if (likely(PyList_CheckExact(__pyx_t_2))) {
        if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_3 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_3); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 607, __pyx_L1_error)
        #else
        __pyx_t_3 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 607, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        #endif
      } else {
        if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_3); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 607, __pyx_L1_error)
        #else
        __pyx_t_3 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 607, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        #endif
      }
    } else {
      __pyx_t_3 = __pyx_t_5(__pyx_t_2);
      if (unlikely(!__pyx_t_3)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 607, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_3);
    }
    __Pyx_XDECREF_SET(__pyx_v_grb, __pyx_t_3);
    __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_find); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 607, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 607, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_INCREF(__pyx_v_grb);
    __Pyx_GIVEREF(__pyx_v_grb);
    PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_grb);
    __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, __pyx_v_kwargs); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 607, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 607, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (__pyx_t_8) {
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_v_grb))) __PYX_ERR(0, 607, __pyx_L1_error)
    }
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_grbs = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pygrib.pyx":608
 *         self.rewind() # always search from beginning
 *         grbs = [grb for grb in self if _find(grb, **kwargs)]
 *         self.seek(msgnum) # leave iterator in original position.             # <<<<<<<<<<<<<<
 *         if not grbs:
 *             raise ValueError('no matches found')
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_seek); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 608, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_7 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_7)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  if (!__pyx_t_7) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_msgnum); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 608, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_v_msgnum};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 608, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_GOTREF(__pyx_t_1);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_v_msgnum};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 608, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_GOTREF(__pyx_t_1);
    } else
    #endif
    {
      __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 608, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_7); __pyx_t_7 = NULL;
      __Pyx_INCREF(__pyx_v_msgnum);
      __Pyx_GIVEREF(__pyx_v_msgnum);
      PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_v_msgnum);
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 608, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pygrib.pyx":609
 *         grbs = [grb for grb in self if _find(grb, **kwargs)]
 *         self.seek(msgnum) # leave iterator in original position.
 *         if not grbs:             # <<<<<<<<<<<<<<
 *             raise ValueError('no matches found')
 *         return grbs
 */
  __pyx_t_8 = (PyList_GET_SIZE(__pyx_v_grbs) != 0);
  __pyx_t_9 = ((!__pyx_t_8) != 0);
  if (unlikely(__pyx_t_9)) {

    /* "pygrib.pyx":610
 *         self.seek(msgnum) # leave iterator in original position.
 *         if not grbs:
 *             raise ValueError('no matches found')             # <<<<<<<<<<<<<<
 *         return grbs
 *     def _advance(self,nmsgs,return_msgs=False):
 */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 610, __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_ERR(0, 610, __pyx_L1_error)

    /* "pygrib.pyx":609
 *         grbs = [grb for grb in self if _find(grb, **kwargs)]
 *         self.seek(msgnum) # leave iterator in original position.
 *         if not grbs:             # <<<<<<<<<<<<<<
 *             raise ValueError('no matches found')
 *         return grbs
 */
  }

  /* "pygrib.pyx":611
 *         if not grbs:
 *             raise ValueError('no matches found')
 *         return grbs             # <<<<<<<<<<<<<<
 *     def _advance(self,nmsgs,return_msgs=False):
 *         """advance iterator n messages from current position.
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_grbs);
  __pyx_r = __pyx_v_grbs;
  goto __pyx_L0;

  /* "pygrib.pyx":566
 *         self._advance(N-self.messagenumber)
 *         return _create_gribmessage(self._gh, self.messagenumber)
 *     def select(self, **kwargs):             # <<<<<<<<<<<<<<
 *         """
 * select(**kwargs)
 */

  /* 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_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("pygrib.open.select", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_msgnum);
  __Pyx_XDECREF(__pyx_v_grbs);
  __Pyx_XDECREF(__pyx_v_grb);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pygrib.pyx":612
 *             raise ValueError('no matches found')
 *         return grbs
 *     def _advance(self,nmsgs,return_msgs=False):             # <<<<<<<<<<<<<<
 *         """advance iterator n messages from current position.
 *         if return_msgs==True, grib message instances are returned
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pygrib_4open_35_advance(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6pygrib_4open_34_advance[] = "advance iterator n messages from current position.\n        if return_msgs==True, grib message instances are returned\n        in a list";
static PyObject *__pyx_pw_6pygrib_4open_35_advance(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_nmsgs = 0;
  PyObject *__pyx_v_return_msgs = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_advance (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nmsgs,&__pyx_n_s_return_msgs,0};
    PyObject* values[2] = {0,0};
    values[1] = ((PyObject *)Py_False);
    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);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nmsgs)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_return_msgs);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_advance") < 0)) __PYX_ERR(0, 612, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_nmsgs = values[0];
    __pyx_v_return_msgs = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_advance", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 612, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pygrib.open._advance", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pygrib_4open_34_advance(((struct __pyx_obj_6pygrib_open *)__pyx_v_self), __pyx_v_nmsgs, __pyx_v_return_msgs);

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

static PyObject *__pyx_pf_6pygrib_4open_34_advance(struct __pyx_obj_6pygrib_open *__pyx_v_self, PyObject *__pyx_v_nmsgs, PyObject *__pyx_v_return_msgs) {
  int __pyx_v_err;
  PyObject *__pyx_v_grbs = NULL;
  CYTHON_UNUSED PyObject *__pyx_v_n = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t __pyx_t_4;
  PyObject *(*__pyx_t_5)(PyObject *);
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  __Pyx_RefNannySetupContext("_advance", 0);

  /* "pygrib.pyx":617
 *         in a list"""
 *         cdef int err
 *         if nmsgs < 0:             # <<<<<<<<<<<<<<
 *             raise ValueError('nmsgs must be >= 0 in _advance')
 *         if return_msgs: grbs=[]
 */
  __pyx_t_1 = PyObject_RichCompare(__pyx_v_nmsgs, __pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 617, __pyx_L1_error)
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 617, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(__pyx_t_2)) {

    /* "pygrib.pyx":618
 *         cdef int err
 *         if nmsgs < 0:
 *             raise ValueError('nmsgs must be >= 0 in _advance')             # <<<<<<<<<<<<<<
 *         if return_msgs: grbs=[]
 *         for n in range(self.messagenumber,self.messagenumber+nmsgs):
 */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 618, __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_ERR(0, 618, __pyx_L1_error)

    /* "pygrib.pyx":617
 *         in a list"""
 *         cdef int err
 *         if nmsgs < 0:             # <<<<<<<<<<<<<<
 *             raise ValueError('nmsgs must be >= 0 in _advance')
 *         if return_msgs: grbs=[]
 */
  }

  /* "pygrib.pyx":619
 *         if nmsgs < 0:
 *             raise ValueError('nmsgs must be >= 0 in _advance')
 *         if return_msgs: grbs=[]             # <<<<<<<<<<<<<<
 *         for n in range(self.messagenumber,self.messagenumber+nmsgs):
 *             err = grib_handle_delete(self._gh)
 */
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_return_msgs); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 619, __pyx_L1_error)
  if (__pyx_t_2) {
    __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 619, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_grbs = ((PyObject*)__pyx_t_1);
    __pyx_t_1 = 0;
  }

  /* "pygrib.pyx":620
 *             raise ValueError('nmsgs must be >= 0 in _advance')
 *         if return_msgs: grbs=[]
 *         for n in range(self.messagenumber,self.messagenumber+nmsgs):             # <<<<<<<<<<<<<<
 *             err = grib_handle_delete(self._gh)
 *             if err:
 */
  __pyx_t_1 = PyNumber_Add(__pyx_v_self->messagenumber, __pyx_v_nmsgs); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 620, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 620, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_v_self->messagenumber);
  __Pyx_GIVEREF(__pyx_v_self->messagenumber);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_self->messagenumber);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 620, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {
    __pyx_t_3 = __pyx_t_1; __Pyx_INCREF(__pyx_t_3); __pyx_t_4 = 0;
    __pyx_t_5 = NULL;
  } else {
    __pyx_t_4 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 620, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 620, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  for (;;) {
    if (likely(!__pyx_t_5)) {
      if (likely(PyList_CheckExact(__pyx_t_3))) {
        if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_3)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_1 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 620, __pyx_L1_error)
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 620, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      } else {
        if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 620, __pyx_L1_error)
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 620, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      }
    } else {
      __pyx_t_1 = __pyx_t_5(__pyx_t_3);
      if (unlikely(!__pyx_t_1)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 620, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_XDECREF_SET(__pyx_v_n, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "pygrib.pyx":621
 *         if return_msgs: grbs=[]
 *         for n in range(self.messagenumber,self.messagenumber+nmsgs):
 *             err = grib_handle_delete(self._gh)             # <<<<<<<<<<<<<<
 *             if err:
 *                 raise RuntimeError(grib_get_error_message(err))
 */
    __pyx_v_err = grib_handle_delete(__pyx_v_self->_gh);

    /* "pygrib.pyx":622
 *         for n in range(self.messagenumber,self.messagenumber+nmsgs):
 *             err = grib_handle_delete(self._gh)
 *             if err:             # <<<<<<<<<<<<<<
 *                 raise RuntimeError(grib_get_error_message(err))
 *             self._gh = grib_handle_new_from_file(NULL, self._fd, &err)
 */
    __pyx_t_2 = (__pyx_v_err != 0);
    if (unlikely(__pyx_t_2)) {

      /* "pygrib.pyx":623
 *             err = grib_handle_delete(self._gh)
 *             if err:
 *                 raise RuntimeError(grib_get_error_message(err))             # <<<<<<<<<<<<<<
 *             self._gh = grib_handle_new_from_file(NULL, self._fd, &err)
 *             if err:
 */
      __pyx_t_1 = __Pyx_PyBytes_FromString(grib_get_error_message(__pyx_v_err)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 623, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_builtin_RuntimeError, __pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 623, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_Raise(__pyx_t_6, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __PYX_ERR(0, 623, __pyx_L1_error)

      /* "pygrib.pyx":622
 *         for n in range(self.messagenumber,self.messagenumber+nmsgs):
 *             err = grib_handle_delete(self._gh)
 *             if err:             # <<<<<<<<<<<<<<
 *                 raise RuntimeError(grib_get_error_message(err))
 *             self._gh = grib_handle_new_from_file(NULL, self._fd, &err)
 */
    }

    /* "pygrib.pyx":624
 *             if err:
 *                 raise RuntimeError(grib_get_error_message(err))
 *             self._gh = grib_handle_new_from_file(NULL, self._fd, &err)             # <<<<<<<<<<<<<<
 *             if err:
 *                 raise RuntimeError(grib_get_error_message(err))
 */
    __pyx_v_self->_gh = grib_handle_new_from_file(NULL, __pyx_v_self->_fd, (&__pyx_v_err));

    /* "pygrib.pyx":625
 *                 raise RuntimeError(grib_get_error_message(err))
 *             self._gh = grib_handle_new_from_file(NULL, self._fd, &err)
 *             if err:             # <<<<<<<<<<<<<<
 *                 raise RuntimeError(grib_get_error_message(err))
 *             if self._gh == NULL:
 */
    __pyx_t_2 = (__pyx_v_err != 0);
    if (unlikely(__pyx_t_2)) {

      /* "pygrib.pyx":626
 *             self._gh = grib_handle_new_from_file(NULL, self._fd, &err)
 *             if err:
 *                 raise RuntimeError(grib_get_error_message(err))             # <<<<<<<<<<<<<<
 *             if self._gh == NULL:
 *                 raise IOError('not that many messages in file')
 */
      __pyx_t_6 = __Pyx_PyBytes_FromString(grib_get_error_message(__pyx_v_err)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 626, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_RuntimeError, __pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 626, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_Raise(__pyx_t_1, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __PYX_ERR(0, 626, __pyx_L1_error)

      /* "pygrib.pyx":625
 *                 raise RuntimeError(grib_get_error_message(err))
 *             self._gh = grib_handle_new_from_file(NULL, self._fd, &err)
 *             if err:             # <<<<<<<<<<<<<<
 *                 raise RuntimeError(grib_get_error_message(err))
 *             if self._gh == NULL:
 */
    }

    /* "pygrib.pyx":627
 *             if err:
 *                 raise RuntimeError(grib_get_error_message(err))
 *             if self._gh == NULL:             # <<<<<<<<<<<<<<
 *                 raise IOError('not that many messages in file')
 *             self.messagenumber = self.messagenumber + 1
 */
    __pyx_t_2 = ((__pyx_v_self->_gh == NULL) != 0);
    if (unlikely(__pyx_t_2)) {

      /* "pygrib.pyx":628
 *                 raise RuntimeError(grib_get_error_message(err))
 *             if self._gh == NULL:
 *                 raise IOError('not that many messages in file')             # <<<<<<<<<<<<<<
 *             self.messagenumber = self.messagenumber + 1
 *             if return_msgs: grbs.append(_create_gribmessage(self._gh, self.messagenumber))
 */
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_IOError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 628, __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_ERR(0, 628, __pyx_L1_error)

      /* "pygrib.pyx":627
 *             if err:
 *                 raise RuntimeError(grib_get_error_message(err))
 *             if self._gh == NULL:             # <<<<<<<<<<<<<<
 *                 raise IOError('not that many messages in file')
 *             self.messagenumber = self.messagenumber + 1
 */
    }

    /* "pygrib.pyx":629
 *             if self._gh == NULL:
 *                 raise IOError('not that many messages in file')
 *             self.messagenumber = self.messagenumber + 1             # <<<<<<<<<<<<<<
 *             if return_msgs: grbs.append(_create_gribmessage(self._gh, self.messagenumber))
 *         if return_msgs: return grbs
 */
    __pyx_t_1 = __Pyx_PyInt_AddObjC(__pyx_v_self->messagenumber, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 629, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    __Pyx_GOTREF(__pyx_v_self->messagenumber);
    __Pyx_DECREF(__pyx_v_self->messagenumber);
    __pyx_v_self->messagenumber = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "pygrib.pyx":630
 *                 raise IOError('not that many messages in file')
 *             self.messagenumber = self.messagenumber + 1
 *             if return_msgs: grbs.append(_create_gribmessage(self._gh, self.messagenumber))             # <<<<<<<<<<<<<<
 *         if return_msgs: return grbs
 * 
 */
    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_return_msgs); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 630, __pyx_L1_error)
    if (__pyx_t_2) {
      if (unlikely(!__pyx_v_grbs)) { __Pyx_RaiseUnboundLocalError("grbs"); __PYX_ERR(0, 630, __pyx_L1_error) }
      __pyx_t_1 = __pyx_v_self->messagenumber;
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_6 = __pyx_f_6pygrib__create_gribmessage(__pyx_v_self->_gh, __pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 630, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_7 = __Pyx_PyList_Append(__pyx_v_grbs, __pyx_t_6); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 630, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    }

    /* "pygrib.pyx":620
 *             raise ValueError('nmsgs must be >= 0 in _advance')
 *         if return_msgs: grbs=[]
 *         for n in range(self.messagenumber,self.messagenumber+nmsgs):             # <<<<<<<<<<<<<<
 *             err = grib_handle_delete(self._gh)
 *             if err:
 */
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pygrib.pyx":631
 *             self.messagenumber = self.messagenumber + 1
 *             if return_msgs: grbs.append(_create_gribmessage(self._gh, self.messagenumber))
 *         if return_msgs: return grbs             # <<<<<<<<<<<<<<
 * 
 * # keep track of python gribmessage attributes so they can be
 */
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_return_msgs); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 631, __pyx_L1_error)
  if (__pyx_t_2) {
    __Pyx_XDECREF(__pyx_r);
    if (unlikely(!__pyx_v_grbs)) { __Pyx_RaiseUnboundLocalError("grbs"); __PYX_ERR(0, 631, __pyx_L1_error) }
    __Pyx_INCREF(__pyx_v_grbs);
    __pyx_r = __pyx_v_grbs;
    goto __pyx_L0;
  }

  /* "pygrib.pyx":612
 *             raise ValueError('no matches found')
 *         return grbs
 *     def _advance(self,nmsgs,return_msgs=False):             # <<<<<<<<<<<<<<
 *         """advance iterator n messages from current position.
 *         if return_msgs==True, grib message instances are returned
 */

  /* 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_3);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("pygrib.open._advance", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_grbs);
  __Pyx_XDECREF(__pyx_v_n);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pygrib.pyx":386
 *     cdef FILE *_fd
 *     cdef grib_handle *_gh
 *     cdef public object name, messagenumber, messages, closed,\             # <<<<<<<<<<<<<<
 *                        has_multi_field_msgs
 *     def __cinit__(self, filename):
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pygrib_4open_4name_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6pygrib_4open_4name_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pygrib_4open_4name___get__(((struct __pyx_obj_6pygrib_open *)__pyx_v_self));

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

static PyObject *__pyx_pf_6pygrib_4open_4name___get__(struct __pyx_obj_6pygrib_open *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->name);
  __pyx_r = __pyx_v_self->name;
  goto __pyx_L0;

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

/* Python wrapper */
static int __pyx_pw_6pygrib_4open_4name_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_6pygrib_4open_4name_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pygrib_4open_4name_2__set__(((struct __pyx_obj_6pygrib_open *)__pyx_v_self), ((PyObject *)__pyx_v_value));

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

static int __pyx_pf_6pygrib_4open_4name_2__set__(struct __pyx_obj_6pygrib_open *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__", 0);
  __Pyx_INCREF(__pyx_v_value);
  __Pyx_GIVEREF(__pyx_v_value);
  __Pyx_GOTREF(__pyx_v_self->name);
  __Pyx_DECREF(__pyx_v_self->name);
  __pyx_v_self->name = __pyx_v_value;

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

/* Python wrapper */
static int __pyx_pw_6pygrib_4open_4name_5__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_6pygrib_4open_4name_5__del__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pygrib_4open_4name_4__del__(((struct __pyx_obj_6pygrib_open *)__pyx_v_self));

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

static int __pyx_pf_6pygrib_4open_4name_4__del__(struct __pyx_obj_6pygrib_open *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__", 0);
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->name);
  __Pyx_DECREF(__pyx_v_self->name);
  __pyx_v_self->name = Py_None;

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

/* Python wrapper */
static PyObject *__pyx_pw_6pygrib_4open_13messagenumber_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6pygrib_4open_13messagenumber_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pygrib_4open_13messagenumber___get__(((struct __pyx_obj_6pygrib_open *)__pyx_v_self));

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

static PyObject *__pyx_pf_6pygrib_4open_13messagenumber___get__(struct __pyx_obj_6pygrib_open *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->messagenumber);
  __pyx_r = __pyx_v_self->messagenumber;
  goto __pyx_L0;

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

/* Python wrapper */
static int __pyx_pw_6pygrib_4open_13messagenumber_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_6pygrib_4open_13messagenumber_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pygrib_4open_13messagenumber_2__set__(((struct __pyx_obj_6pygrib_open *)__pyx_v_self), ((PyObject *)__pyx_v_value));

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

static int __pyx_pf_6pygrib_4open_13messagenumber_2__set__(struct __pyx_obj_6pygrib_open *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__", 0);
  __Pyx_INCREF(__pyx_v_value);
  __Pyx_GIVEREF(__pyx_v_value);
  __Pyx_GOTREF(__pyx_v_self->messagenumber);
  __Pyx_DECREF(__pyx_v_self->messagenumber);
  __pyx_v_self->messagenumber = __pyx_v_value;

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

/* Python wrapper */
static int __pyx_pw_6pygrib_4open_13messagenumber_5__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_6pygrib_4open_13messagenumber_5__del__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pygrib_4open_13messagenumber_4__del__(((struct __pyx_obj_6pygrib_open *)__pyx_v_self));

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

static int __pyx_pf_6pygrib_4open_13messagenumber_4__del__(struct __pyx_obj_6pygrib_open *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__", 0);
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->messagenumber);
  __Pyx_DECREF(__pyx_v_self->messagenumber);
  __pyx_v_self->messagenumber = Py_None;

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

/* Python wrapper */
static PyObject *__pyx_pw_6pygrib_4open_8messages_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6pygrib_4open_8messages_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pygrib_4open_8messages___get__(((struct __pyx_obj_6pygrib_open *)__pyx_v_self));

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

static PyObject *__pyx_pf_6pygrib_4open_8messages___get__(struct __pyx_obj_6pygrib_open *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->messages);
  __pyx_r = __pyx_v_self->messages;
  goto __pyx_L0;

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

/* Python wrapper */
static int __pyx_pw_6pygrib_4open_8messages_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_6pygrib_4open_8messages_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pygrib_4open_8messages_2__set__(((struct __pyx_obj_6pygrib_open *)__pyx_v_self), ((PyObject *)__pyx_v_value));

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

static int __pyx_pf_6pygrib_4open_8messages_2__set__(struct __pyx_obj_6pygrib_open *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__", 0);
  __Pyx_INCREF(__pyx_v_value);
  __Pyx_GIVEREF(__pyx_v_value);
  __Pyx_GOTREF(__pyx_v_self->messages);
  __Pyx_DECREF(__pyx_v_self->messages);
  __pyx_v_self->messages = __pyx_v_value;

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

/* Python wrapper */
static int __pyx_pw_6pygrib_4open_8messages_5__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_6pygrib_4open_8messages_5__del__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pygrib_4open_8messages_4__del__(((struct __pyx_obj_6pygrib_open *)__pyx_v_self));

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

static int __pyx_pf_6pygrib_4open_8messages_4__del__(struct __pyx_obj_6pygrib_open *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__", 0);
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->messages);
  __Pyx_DECREF(__pyx_v_self->messages);
  __pyx_v_self->messages = Py_None;

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

/* Python wrapper */
static PyObject *__pyx_pw_6pygrib_4open_6closed_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6pygrib_4open_6closed_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pygrib_4open_6closed___get__(((struct __pyx_obj_6pygrib_open *)__pyx_v_self));

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

static PyObject *__pyx_pf_6pygrib_4open_6closed___get__(struct __pyx_obj_6pygrib_open *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->closed);
  __pyx_r = __pyx_v_self->closed;
  goto __pyx_L0;

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

/* Python wrapper */
static int __pyx_pw_6pygrib_4open_6closed_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_6pygrib_4open_6closed_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pygrib_4open_6closed_2__set__(((struct __pyx_obj_6pygrib_open *)__pyx_v_self), ((PyObject *)__pyx_v_value));

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

static int __pyx_pf_6pygrib_4open_6closed_2__set__(struct __pyx_obj_6pygrib_open *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__", 0);
  __Pyx_INCREF(__pyx_v_value);
  __Pyx_GIVEREF(__pyx_v_value);
  __Pyx_GOTREF(__pyx_v_self->closed);
  __Pyx_DECREF(__pyx_v_self->closed);
  __pyx_v_self->closed = __pyx_v_value;

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

/* Python wrapper */
static int __pyx_pw_6pygrib_4open_6closed_5__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_6pygrib_4open_6closed_5__del__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pygrib_4open_6closed_4__del__(((struct __pyx_obj_6pygrib_open *)__pyx_v_self));

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

static int __pyx_pf_6pygrib_4open_6closed_4__del__(struct __pyx_obj_6pygrib_open *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__", 0);
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->closed);
  __Pyx_DECREF(__pyx_v_self->closed);
  __pyx_v_self->closed = Py_None;

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

/* "pygrib.pyx":387
 *     cdef grib_handle *_gh
 *     cdef public object name, messagenumber, messages, closed,\
 *                        has_multi_field_msgs             # <<<<<<<<<<<<<<
 *     def __cinit__(self, filename):
 *         # initialize C level objects.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pygrib_4open_20has_multi_field_msgs_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6pygrib_4open_20has_multi_field_msgs_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pygrib_4open_20has_multi_field_msgs___get__(((struct __pyx_obj_6pygrib_open *)__pyx_v_self));

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

static PyObject *__pyx_pf_6pygrib_4open_20has_multi_field_msgs___get__(struct __pyx_obj_6pygrib_open *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->has_multi_field_msgs);
  __pyx_r = __pyx_v_self->has_multi_field_msgs;
  goto __pyx_L0;

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

/* Python wrapper */
static int __pyx_pw_6pygrib_4open_20has_multi_field_msgs_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_6pygrib_4open_20has_multi_field_msgs_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pygrib_4open_20has_multi_field_msgs_2__set__(((struct __pyx_obj_6pygrib_open *)__pyx_v_self), ((PyObject *)__pyx_v_value));

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

static int __pyx_pf_6pygrib_4open_20has_multi_field_msgs_2__set__(struct __pyx_obj_6pygrib_open *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__", 0);
  __Pyx_INCREF(__pyx_v_value);
  __Pyx_GIVEREF(__pyx_v_value);
  __Pyx_GOTREF(__pyx_v_self->has_multi_field_msgs);
  __Pyx_DECREF(__pyx_v_self->has_multi_field_msgs);
  __pyx_v_self->has_multi_field_msgs = __pyx_v_value;

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

/* Python wrapper */
static int __pyx_pw_6pygrib_4open_20has_multi_field_msgs_5__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_6pygrib_4open_20has_multi_field_msgs_5__del__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pygrib_4open_20has_multi_field_msgs_4__del__(((struct __pyx_obj_6pygrib_open *)__pyx_v_self));

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

static int __pyx_pf_6pygrib_4open_20has_multi_field_msgs_4__del__(struct __pyx_obj_6pygrib_open *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__", 0);
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->has_multi_field_msgs);
  __Pyx_DECREF(__pyx_v_self->has_multi_field_msgs);
  __pyx_v_self->has_multi_field_msgs = Py_None;

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

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pygrib_4open_37__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_6pygrib_4open_37__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pygrib_4open_36__reduce_cython__(((struct __pyx_obj_6pygrib_open *)__pyx_v_self));

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

static PyObject *__pyx_pf_6pygrib_4open_36__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6pygrib_open *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__8, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __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_ERR(1, 2, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):
 */

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

/* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pygrib_4open_39__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static PyObject *__pyx_pw_6pygrib_4open_39__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pygrib_4open_38__setstate_cython__(((struct __pyx_obj_6pygrib_open *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

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

static PyObject *__pyx_pf_6pygrib_4open_38__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6pygrib_open *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":4
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__9, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __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_ERR(1, 4, __pyx_L1_error)

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 */

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

/* "pygrib.pyx":638
 * ['_gh','fcstimeunits','expand_reduced','projparams','messagenumber','_all_keys','_ro_keys']
 * 
 * def julian_to_datetime(object jd):             # <<<<<<<<<<<<<<
 *     """
 *     julian_to_datetime(julday)
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pygrib_13julian_to_datetime(PyObject *__pyx_self, PyObject *__pyx_v_jd); /*proto*/
static char __pyx_doc_6pygrib_12julian_to_datetime[] = "\n    julian_to_datetime(julday)\n    \n    convert Julian day number to python datetime instance.\n\n    Used to create validDate and analDate attributes from\n    julianDay and forecastTime keys.";
static PyMethodDef __pyx_mdef_6pygrib_13julian_to_datetime = {"julian_to_datetime", (PyCFunction)__pyx_pw_6pygrib_13julian_to_datetime, METH_O, __pyx_doc_6pygrib_12julian_to_datetime};
static PyObject *__pyx_pw_6pygrib_13julian_to_datetime(PyObject *__pyx_self, PyObject *__pyx_v_jd) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("julian_to_datetime (wrapper)", 0);
  __pyx_r = __pyx_pf_6pygrib_12julian_to_datetime(__pyx_self, ((PyObject *)__pyx_v_jd));

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

static PyObject *__pyx_pf_6pygrib_12julian_to_datetime(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_jd) {
  double __pyx_v_julday;
  long __pyx_v_year;
  long __pyx_v_month;
  long __pyx_v_day;
  long __pyx_v_hour;
  long __pyx_v_minute;
  long __pyx_v_second;
  int __pyx_v_err;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  double __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;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  int __pyx_t_12;
  PyObject *__pyx_t_13 = NULL;
  __Pyx_RefNannySetupContext("julian_to_datetime", 0);

  /* "pygrib.pyx":649
 *     cdef long year, month, day, hour, minute, second
 *     cdef int err
 *     julday = jd             # <<<<<<<<<<<<<<
 *     err = grib_julian_to_datetime(julday, &year, &month, &day, &hour, &minute, &second)
 *     if err:
 */
  __pyx_t_1 = __pyx_PyFloat_AsDouble(__pyx_v_jd); if (unlikely((__pyx_t_1 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 649, __pyx_L1_error)
  __pyx_v_julday = __pyx_t_1;

  /* "pygrib.pyx":650
 *     cdef int err
 *     julday = jd
 *     err = grib_julian_to_datetime(julday, &year, &month, &day, &hour, &minute, &second)             # <<<<<<<<<<<<<<
 *     if err:
 *         raise RuntimeError(grib_get_error_message(err))
 */
  __pyx_v_err = grib_julian_to_datetime(__pyx_v_julday, (&__pyx_v_year), (&__pyx_v_month), (&__pyx_v_day), (&__pyx_v_hour), (&__pyx_v_minute), (&__pyx_v_second));

  /* "pygrib.pyx":651
 *     julday = jd
 *     err = grib_julian_to_datetime(julday, &year, &month, &day, &hour, &minute, &second)
 *     if err:             # <<<<<<<<<<<<<<
 *         raise RuntimeError(grib_get_error_message(err))
 *     return datetime(year, month, day, hour, minute, second)
 */
  __pyx_t_2 = (__pyx_v_err != 0);
  if (unlikely(__pyx_t_2)) {

    /* "pygrib.pyx":652
 *     err = grib_julian_to_datetime(julday, &year, &month, &day, &hour, &minute, &second)
 *     if err:
 *         raise RuntimeError(grib_get_error_message(err))             # <<<<<<<<<<<<<<
 *     return datetime(year, month, day, hour, minute, second)
 * 
 */
    __pyx_t_3 = __Pyx_PyBytes_FromString(grib_get_error_message(__pyx_v_err)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 652, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_RuntimeError, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 652, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_t_4, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __PYX_ERR(0, 652, __pyx_L1_error)

    /* "pygrib.pyx":651
 *     julday = jd
 *     err = grib_julian_to_datetime(julday, &year, &month, &day, &hour, &minute, &second)
 *     if err:             # <<<<<<<<<<<<<<
 *         raise RuntimeError(grib_get_error_message(err))
 *     return datetime(year, month, day, hour, minute, second)
 */
  }

  /* "pygrib.pyx":653
 *     if err:
 *         raise RuntimeError(grib_get_error_message(err))
 *     return datetime(year, month, day, hour, minute, second)             # <<<<<<<<<<<<<<
 * 
 * def datetime_to_julian(object d):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_datetime); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 653, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = __Pyx_PyInt_From_long(__pyx_v_year); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 653, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = __Pyx_PyInt_From_long(__pyx_v_month); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 653, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = __Pyx_PyInt_From_long(__pyx_v_day); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 653, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_8 = __Pyx_PyInt_From_long(__pyx_v_hour); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 653, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_9 = __Pyx_PyInt_From_long(__pyx_v_minute); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 653, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_10 = __Pyx_PyInt_From_long(__pyx_v_second); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 653, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_11 = NULL;
  __pyx_t_12 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_11)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_11);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_12 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[7] = {__pyx_t_11, __pyx_t_5, __pyx_t_6, __pyx_t_7, __pyx_t_8, __pyx_t_9, __pyx_t_10};
    __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_12, 6+__pyx_t_12); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 653, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[7] = {__pyx_t_11, __pyx_t_5, __pyx_t_6, __pyx_t_7, __pyx_t_8, __pyx_t_9, __pyx_t_10};
    __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_12, 6+__pyx_t_12); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 653, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  } else
  #endif
  {
    __pyx_t_13 = PyTuple_New(6+__pyx_t_12); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 653, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_13);
    if (__pyx_t_11) {
      __Pyx_GIVEREF(__pyx_t_11); PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_11); __pyx_t_11 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_13, 0+__pyx_t_12, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_13, 1+__pyx_t_12, __pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_7);
    PyTuple_SET_ITEM(__pyx_t_13, 2+__pyx_t_12, __pyx_t_7);
    __Pyx_GIVEREF(__pyx_t_8);
    PyTuple_SET_ITEM(__pyx_t_13, 3+__pyx_t_12, __pyx_t_8);
    __Pyx_GIVEREF(__pyx_t_9);
    PyTuple_SET_ITEM(__pyx_t_13, 4+__pyx_t_12, __pyx_t_9);
    __Pyx_GIVEREF(__pyx_t_10);
    PyTuple_SET_ITEM(__pyx_t_13, 5+__pyx_t_12, __pyx_t_10);
    __pyx_t_5 = 0;
    __pyx_t_6 = 0;
    __pyx_t_7 = 0;
    __pyx_t_8 = 0;
    __pyx_t_9 = 0;
    __pyx_t_10 = 0;
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_13, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 653, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "pygrib.pyx":638
 * ['_gh','fcstimeunits','expand_reduced','projparams','messagenumber','_all_keys','_ro_keys']
 * 
 * def julian_to_datetime(object jd):             # <<<<<<<<<<<<<<
 *     """
 *     julian_to_datetime(julday)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_AddTraceback("pygrib.julian_to_datetime", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pygrib.pyx":655
 *     return datetime(year, month, day, hour, minute, second)
 * 
 * def datetime_to_julian(object d):             # <<<<<<<<<<<<<<
 *     """
 *     datetime_to_julian(date)
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pygrib_15datetime_to_julian(PyObject *__pyx_self, PyObject *__pyx_v_d); /*proto*/
static char __pyx_doc_6pygrib_14datetime_to_julian[] = "\n    datetime_to_julian(date)\n    \n    convert python datetime instance to Julian day number.";
static PyMethodDef __pyx_mdef_6pygrib_15datetime_to_julian = {"datetime_to_julian", (PyCFunction)__pyx_pw_6pygrib_15datetime_to_julian, METH_O, __pyx_doc_6pygrib_14datetime_to_julian};
static PyObject *__pyx_pw_6pygrib_15datetime_to_julian(PyObject *__pyx_self, PyObject *__pyx_v_d) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("datetime_to_julian (wrapper)", 0);
  __pyx_r = __pyx_pf_6pygrib_14datetime_to_julian(__pyx_self, ((PyObject *)__pyx_v_d));

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

static PyObject *__pyx_pf_6pygrib_14datetime_to_julian(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_d) {
  double __pyx_v_julday;
  int __pyx_v_err;
  long __pyx_v_year;
  long __pyx_v_month;
  long __pyx_v_day;
  long __pyx_v_hour;
  long __pyx_v_minute;
  long __pyx_v_second;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  long __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("datetime_to_julian", 0);

  /* "pygrib.pyx":663
 *     cdef int err
 *     cdef long year, month, day, hour, minute, second
 *     year = d.year; month = d.month; day = d.day; hour = d.hour             # <<<<<<<<<<<<<<
 *     minute = d.minute; second = d.second
 *     err = grib_datetime_to_julian(year,month,day,hour,minute,second,&julday)
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_d, __pyx_n_s_year); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 663, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_As_long(__pyx_t_1); if (unlikely((__pyx_t_2 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 663, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_year = __pyx_t_2;
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_d, __pyx_n_s_month); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 663, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_As_long(__pyx_t_1); if (unlikely((__pyx_t_2 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 663, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_month = __pyx_t_2;
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_d, __pyx_n_s_day); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 663, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_As_long(__pyx_t_1); if (unlikely((__pyx_t_2 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 663, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_day = __pyx_t_2;
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_d, __pyx_n_s_hour); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 663, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_As_long(__pyx_t_1); if (unlikely((__pyx_t_2 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 663, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_hour = __pyx_t_2;

  /* "pygrib.pyx":664
 *     cdef long year, month, day, hour, minute, second
 *     year = d.year; month = d.month; day = d.day; hour = d.hour
 *     minute = d.minute; second = d.second             # <<<<<<<<<<<<<<
 *     err = grib_datetime_to_julian(year,month,day,hour,minute,second,&julday)
 *     if err:
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_d, __pyx_n_s_minute); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 664, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_As_long(__pyx_t_1); if (unlikely((__pyx_t_2 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 664, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_minute = __pyx_t_2;
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_d, __pyx_n_s_second); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 664, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_As_long(__pyx_t_1); if (unlikely((__pyx_t_2 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 664, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_second = __pyx_t_2;

  /* "pygrib.pyx":665
 *     year = d.year; month = d.month; day = d.day; hour = d.hour
 *     minute = d.minute; second = d.second
 *     err = grib_datetime_to_julian(year,month,day,hour,minute,second,&julday)             # <<<<<<<<<<<<<<
 *     if err:
 *         raise RuntimeError(grib_get_error_message(err))
 */
  __pyx_v_err = grib_datetime_to_julian(__pyx_v_year, __pyx_v_month, __pyx_v_day, __pyx_v_hour, __pyx_v_minute, __pyx_v_second, (&__pyx_v_julday));

  /* "pygrib.pyx":666
 *     minute = d.minute; second = d.second
 *     err = grib_datetime_to_julian(year,month,day,hour,minute,second,&julday)
 *     if err:             # <<<<<<<<<<<<<<
 *         raise RuntimeError(grib_get_error_message(err))
 *     return julday
 */
  __pyx_t_3 = (__pyx_v_err != 0);
  if (unlikely(__pyx_t_3)) {

    /* "pygrib.pyx":667
 *     err = grib_datetime_to_julian(year,month,day,hour,minute,second,&julday)
 *     if err:
 *         raise RuntimeError(grib_get_error_message(err))             # <<<<<<<<<<<<<<
 *     return julday
 * 
 */
    __pyx_t_1 = __Pyx_PyBytes_FromString(grib_get_error_message(__pyx_v_err)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 667, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_RuntimeError, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 667, __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_ERR(0, 667, __pyx_L1_error)

    /* "pygrib.pyx":666
 *     minute = d.minute; second = d.second
 *     err = grib_datetime_to_julian(year,month,day,hour,minute,second,&julday)
 *     if err:             # <<<<<<<<<<<<<<
 *         raise RuntimeError(grib_get_error_message(err))
 *     return julday
 */
  }

  /* "pygrib.pyx":668
 *     if err:
 *         raise RuntimeError(grib_get_error_message(err))
 *     return julday             # <<<<<<<<<<<<<<
 * 
 * cdef _create_gribmessage(grib_handle *gh, object messagenumber):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_4 = PyFloat_FromDouble(__pyx_v_julday); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 668, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "pygrib.pyx":655
 *     return datetime(year, month, day, hour, minute, second)
 * 
 * def datetime_to_julian(object d):             # <<<<<<<<<<<<<<
 *     """
 *     datetime_to_julian(date)
 */

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

/* "pygrib.pyx":670
 *     return julday
 * 
 * cdef _create_gribmessage(grib_handle *gh, object messagenumber):             # <<<<<<<<<<<<<<
 *     """factory function for creating gribmessage instances"""
 *     cdef gribmessage grb  = gribmessage.__new__(gribmessage)
 */

static PyObject *__pyx_f_6pygrib__create_gribmessage(grib_handle *__pyx_v_gh, PyObject *__pyx_v_messagenumber) {
  struct __pyx_obj_6pygrib_gribmessage *__pyx_v_grb = 0;
  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;
  __Pyx_RefNannySetupContext("_create_gribmessage", 0);

  /* "pygrib.pyx":672
 * cdef _create_gribmessage(grib_handle *gh, object messagenumber):
 *     """factory function for creating gribmessage instances"""
 *     cdef gribmessage grb  = gribmessage.__new__(gribmessage)             # <<<<<<<<<<<<<<
 *     grb.messagenumber = messagenumber
 *     grb.expand_reduced = True
 */
  __pyx_t_1 = ((PyObject *)__pyx_tp_new_6pygrib_gribmessage(((PyTypeObject *)__pyx_ptype_6pygrib_gribmessage), __pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 672, __pyx_L1_error)
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __pyx_v_grb = ((struct __pyx_obj_6pygrib_gribmessage *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pygrib.pyx":673
 *     """factory function for creating gribmessage instances"""
 *     cdef gribmessage grb  = gribmessage.__new__(gribmessage)
 *     grb.messagenumber = messagenumber             # <<<<<<<<<<<<<<
 *     grb.expand_reduced = True
 *     grb._gh = grib_handle_clone(gh)
 */
  __Pyx_INCREF(__pyx_v_messagenumber);
  __Pyx_GIVEREF(__pyx_v_messagenumber);
  __Pyx_GOTREF(__pyx_v_grb->messagenumber);
  __Pyx_DECREF(__pyx_v_grb->messagenumber);
  __pyx_v_grb->messagenumber = __pyx_v_messagenumber;

  /* "pygrib.pyx":674
 *     cdef gribmessage grb  = gribmessage.__new__(gribmessage)
 *     grb.messagenumber = messagenumber
 *     grb.expand_reduced = True             # <<<<<<<<<<<<<<
 *     grb._gh = grib_handle_clone(gh)
 *     grb._all_keys = grb.keys()
 */
  __Pyx_INCREF(Py_True);
  __Pyx_GIVEREF(Py_True);
  __Pyx_GOTREF(__pyx_v_grb->expand_reduced);
  __Pyx_DECREF(__pyx_v_grb->expand_reduced);
  __pyx_v_grb->expand_reduced = Py_True;

  /* "pygrib.pyx":675
 *     grb.messagenumber = messagenumber
 *     grb.expand_reduced = True
 *     grb._gh = grib_handle_clone(gh)             # <<<<<<<<<<<<<<
 *     grb._all_keys = grb.keys()
 *     grb._ro_keys  = grb._read_only_keys()
 */
  __pyx_v_grb->_gh = grib_handle_clone(__pyx_v_gh);

  /* "pygrib.pyx":676
 *     grb.expand_reduced = True
 *     grb._gh = grib_handle_clone(gh)
 *     grb._all_keys = grb.keys()             # <<<<<<<<<<<<<<
 *     grb._ro_keys  = grb._read_only_keys()
 *     grb._set_projparams() # set projection parameter dict.
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_grb), __pyx_n_s_keys); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 676, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  if (__pyx_t_3) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 676, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else {
    __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 676, __pyx_L1_error)
  }
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_grb->_all_keys);
  __Pyx_DECREF(__pyx_v_grb->_all_keys);
  __pyx_v_grb->_all_keys = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pygrib.pyx":677
 *     grb._gh = grib_handle_clone(gh)
 *     grb._all_keys = grb.keys()
 *     grb._ro_keys  = grb._read_only_keys()             # <<<<<<<<<<<<<<
 *     grb._set_projparams() # set projection parameter dict.
 *     return setdates(grb)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_grb), __pyx_n_s_read_only_keys); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 677, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  if (__pyx_t_3) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 677, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else {
    __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 677, __pyx_L1_error)
  }
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_grb->_ro_keys);
  __Pyx_DECREF(__pyx_v_grb->_ro_keys);
  __pyx_v_grb->_ro_keys = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pygrib.pyx":678
 *     grb._all_keys = grb.keys()
 *     grb._ro_keys  = grb._read_only_keys()
 *     grb._set_projparams() # set projection parameter dict.             # <<<<<<<<<<<<<<
 *     return setdates(grb)
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_grb), __pyx_n_s_set_projparams); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 678, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  if (__pyx_t_3) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 678, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else {
    __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 678, __pyx_L1_error)
  }
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pygrib.pyx":679
 *     grb._ro_keys  = grb._read_only_keys()
 *     grb._set_projparams() # set projection parameter dict.
 *     return setdates(grb)             # <<<<<<<<<<<<<<
 * 
 * def fromstring(gribstring):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_setdates); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 679, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  if (!__pyx_t_3) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, ((PyObject *)__pyx_v_grb)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 679, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[2] = {__pyx_t_3, ((PyObject *)__pyx_v_grb)};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 679, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_GOTREF(__pyx_t_1);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[2] = {__pyx_t_3, ((PyObject *)__pyx_v_grb)};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 679, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_GOTREF(__pyx_t_1);
    } else
    #endif
    {
      __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 679, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __pyx_t_3 = NULL;
      __Pyx_INCREF(((PyObject *)__pyx_v_grb));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_grb));
      PyTuple_SET_ITEM(__pyx_t_4, 0+1, ((PyObject *)__pyx_v_grb));
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 679, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "pygrib.pyx":670
 *     return julday
 * 
 * cdef _create_gribmessage(grib_handle *gh, object messagenumber):             # <<<<<<<<<<<<<<
 *     """factory function for creating gribmessage instances"""
 *     cdef gribmessage grb  = gribmessage.__new__(gribmessage)
 */

  /* 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("pygrib._create_gribmessage", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_grb);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pygrib.pyx":681
 *     return setdates(grb)
 * 
 * def fromstring(gribstring):             # <<<<<<<<<<<<<<
 *     """
 *     fromstring(string)
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pygrib_17fromstring(PyObject *__pyx_self, PyObject *__pyx_v_gribstring); /*proto*/
static char __pyx_doc_6pygrib_16fromstring[] = "\n    fromstring(string)\n\n    Create a gribmessage instance from a python bytes object\n    representing a binary grib message (the reverse of L{gribmessage.tostring}).\n    ";
static PyMethodDef __pyx_mdef_6pygrib_17fromstring = {"fromstring", (PyCFunction)__pyx_pw_6pygrib_17fromstring, METH_O, __pyx_doc_6pygrib_16fromstring};
static PyObject *__pyx_pw_6pygrib_17fromstring(PyObject *__pyx_self, PyObject *__pyx_v_gribstring) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("fromstring (wrapper)", 0);
  __pyx_r = __pyx_pf_6pygrib_16fromstring(__pyx_self, ((PyObject *)__pyx_v_gribstring));

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

static PyObject *__pyx_pf_6pygrib_16fromstring(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_gribstring) {
  char *__pyx_v_gribstr;
  grib_handle *__pyx_v_gh;
  struct __pyx_obj_6pygrib_gribmessage *__pyx_v_grb = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  char *__pyx_t_1;
  Py_ssize_t __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  __Pyx_RefNannySetupContext("fromstring", 0);

  /* "pygrib.pyx":691
 *     cdef grib_handle * gh
 *     cdef gribmessage grb
 *     gribstr = gribstring             # <<<<<<<<<<<<<<
 *     gh = grib_handle_new_from_message_copy(NULL, <void *>gribstr, len(gribstring))
 *     grb  = gribmessage.__new__(gribmessage)
 */
  __pyx_t_1 = __Pyx_PyObject_AsWritableString(__pyx_v_gribstring); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) __PYX_ERR(0, 691, __pyx_L1_error)
  __pyx_v_gribstr = __pyx_t_1;

  /* "pygrib.pyx":692
 *     cdef gribmessage grb
 *     gribstr = gribstring
 *     gh = grib_handle_new_from_message_copy(NULL, <void *>gribstr, len(gribstring))             # <<<<<<<<<<<<<<
 *     grb  = gribmessage.__new__(gribmessage)
 *     grb.messagenumber = 1
 */
  __pyx_t_2 = PyObject_Length(__pyx_v_gribstring); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 692, __pyx_L1_error)
  __pyx_v_gh = grib_handle_new_from_message_copy(NULL, ((void *)__pyx_v_gribstr), __pyx_t_2);

  /* "pygrib.pyx":693
 *     gribstr = gribstring
 *     gh = grib_handle_new_from_message_copy(NULL, <void *>gribstr, len(gribstring))
 *     grb  = gribmessage.__new__(gribmessage)             # <<<<<<<<<<<<<<
 *     grb.messagenumber = 1
 *     grb.expand_reduced = True
 */
  __pyx_t_3 = ((PyObject *)__pyx_tp_new_6pygrib_gribmessage(((PyTypeObject *)__pyx_ptype_6pygrib_gribmessage), __pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 693, __pyx_L1_error)
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  __pyx_v_grb = ((struct __pyx_obj_6pygrib_gribmessage *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "pygrib.pyx":694
 *     gh = grib_handle_new_from_message_copy(NULL, <void *>gribstr, len(gribstring))
 *     grb  = gribmessage.__new__(gribmessage)
 *     grb.messagenumber = 1             # <<<<<<<<<<<<<<
 *     grb.expand_reduced = True
 *     grb._gh = gh
 */
  __Pyx_INCREF(__pyx_int_1);
  __Pyx_GIVEREF(__pyx_int_1);
  __Pyx_GOTREF(__pyx_v_grb->messagenumber);
  __Pyx_DECREF(__pyx_v_grb->messagenumber);
  __pyx_v_grb->messagenumber = __pyx_int_1;

  /* "pygrib.pyx":695
 *     grb  = gribmessage.__new__(gribmessage)
 *     grb.messagenumber = 1
 *     grb.expand_reduced = True             # <<<<<<<<<<<<<<
 *     grb._gh = gh
 *     grb._all_keys = grb.keys()
 */
  __Pyx_INCREF(Py_True);
  __Pyx_GIVEREF(Py_True);
  __Pyx_GOTREF(__pyx_v_grb->expand_reduced);
  __Pyx_DECREF(__pyx_v_grb->expand_reduced);
  __pyx_v_grb->expand_reduced = Py_True;

  /* "pygrib.pyx":696
 *     grb.messagenumber = 1
 *     grb.expand_reduced = True
 *     grb._gh = gh             # <<<<<<<<<<<<<<
 *     grb._all_keys = grb.keys()
 *     grb._ro_keys  = grb._read_only_keys()
 */
  __pyx_v_grb->_gh = __pyx_v_gh;

  /* "pygrib.pyx":697
 *     grb.expand_reduced = True
 *     grb._gh = gh
 *     grb._all_keys = grb.keys()             # <<<<<<<<<<<<<<
 *     grb._ro_keys  = grb._read_only_keys()
 *     grb._set_projparams() # set projection parameter dict.
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_grb), __pyx_n_s_keys); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 697, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  if (__pyx_t_5) {
    __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 697, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  } else {
    __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 697, __pyx_L1_error)
  }
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_GIVEREF(__pyx_t_3);
  __Pyx_GOTREF(__pyx_v_grb->_all_keys);
  __Pyx_DECREF(__pyx_v_grb->_all_keys);
  __pyx_v_grb->_all_keys = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "pygrib.pyx":698
 *     grb._gh = gh
 *     grb._all_keys = grb.keys()
 *     grb._ro_keys  = grb._read_only_keys()             # <<<<<<<<<<<<<<
 *     grb._set_projparams() # set projection parameter dict.
 *     return setdates(grb)
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_grb), __pyx_n_s_read_only_keys); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 698, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  if (__pyx_t_5) {
    __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 698, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  } else {
    __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 698, __pyx_L1_error)
  }
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_GIVEREF(__pyx_t_3);
  __Pyx_GOTREF(__pyx_v_grb->_ro_keys);
  __Pyx_DECREF(__pyx_v_grb->_ro_keys);
  __pyx_v_grb->_ro_keys = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "pygrib.pyx":699
 *     grb._all_keys = grb.keys()
 *     grb._ro_keys  = grb._read_only_keys()
 *     grb._set_projparams() # set projection parameter dict.             # <<<<<<<<<<<<<<
 *     return setdates(grb)
 * 
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_grb), __pyx_n_s_set_projparams); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 699, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  if (__pyx_t_5) {
    __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 699, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  } else {
    __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 699, __pyx_L1_error)
  }
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pygrib.pyx":700
 *     grb._ro_keys  = grb._read_only_keys()
 *     grb._set_projparams() # set projection parameter dict.
 *     return setdates(grb)             # <<<<<<<<<<<<<<
 * 
 * def setdates(gribmessage grb):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_setdates); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 700, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  if (!__pyx_t_5) {
    __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_4, ((PyObject *)__pyx_v_grb)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 700, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[2] = {__pyx_t_5, ((PyObject *)__pyx_v_grb)};
      __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 700, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_3);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[2] = {__pyx_t_5, ((PyObject *)__pyx_v_grb)};
      __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 700, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_3);
    } else
    #endif
    {
      __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 700, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); __pyx_t_5 = NULL;
      __Pyx_INCREF(((PyObject *)__pyx_v_grb));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_grb));
      PyTuple_SET_ITEM(__pyx_t_6, 0+1, ((PyObject *)__pyx_v_grb));
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_6, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 700, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "pygrib.pyx":681
 *     return setdates(grb)
 * 
 * def fromstring(gribstring):             # <<<<<<<<<<<<<<
 *     """
 *     fromstring(string)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("pygrib.fromstring", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_grb);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pygrib.pyx":702
 *     return setdates(grb)
 * 
 * def setdates(gribmessage grb):             # <<<<<<<<<<<<<<
 *     """
 *     setdates(grb)
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pygrib_19setdates(PyObject *__pyx_self, PyObject *__pyx_v_grb); /*proto*/
static char __pyx_doc_6pygrib_18setdates[] = "\n    setdates(grb)\n    \n    set fcstimeunits, analDate and validDate attributes using\n    julianDay, forecastTime and indicatorOfUnitOfTimeRange.\n    Called automatically when gribmessage instance created,\n    but can be called manually to update keys if one of \n    them is modified after instance creation.\n    ";
static PyMethodDef __pyx_mdef_6pygrib_19setdates = {"setdates", (PyCFunction)__pyx_pw_6pygrib_19setdates, METH_O, __pyx_doc_6pygrib_18setdates};
static PyObject *__pyx_pw_6pygrib_19setdates(PyObject *__pyx_self, PyObject *__pyx_v_grb) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setdates (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_grb), __pyx_ptype_6pygrib_gribmessage, 1, "grb", 0))) __PYX_ERR(0, 702, __pyx_L1_error)
  __pyx_r = __pyx_pf_6pygrib_18setdates(__pyx_self, ((struct __pyx_obj_6pygrib_gribmessage *)__pyx_v_grb));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pygrib_18setdates(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_6pygrib_gribmessage *__pyx_v_grb) {
  PyObject *__pyx_v_ftime = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  int __pyx_t_12;
  __Pyx_RefNannySetupContext("setdates", 0);

  /* "pygrib.pyx":712
 *     them is modified after instance creation.
 *     """
 *     grb.fcstimeunits = ""             # <<<<<<<<<<<<<<
 *     if grb.has_key('indicatorOfUnitOfTimeRange') and\
 *        grb.indicatorOfUnitOfTimeRange in _ftimedict:
 */
  __Pyx_INCREF(__pyx_kp_s__10);
  __Pyx_GIVEREF(__pyx_kp_s__10);
  __Pyx_GOTREF(__pyx_v_grb->fcstimeunits);
  __Pyx_DECREF(__pyx_v_grb->fcstimeunits);
  __pyx_v_grb->fcstimeunits = __pyx_kp_s__10;

  /* "pygrib.pyx":713
 *     """
 *     grb.fcstimeunits = ""
 *     if grb.has_key('indicatorOfUnitOfTimeRange') and\             # <<<<<<<<<<<<<<
 *        grb.indicatorOfUnitOfTimeRange in _ftimedict:
 *         grb.fcstimeunits = _ftimedict[grb.indicatorOfUnitOfTimeRange]
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_grb), __pyx_n_s_has_key); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 713, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 713, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 713, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__pyx_t_4) {
  } else {
    __pyx_t_1 = __pyx_t_4;
    goto __pyx_L4_bool_binop_done;
  }

  /* "pygrib.pyx":714
 *     grb.fcstimeunits = ""
 *     if grb.has_key('indicatorOfUnitOfTimeRange') and\
 *        grb.indicatorOfUnitOfTimeRange in _ftimedict:             # <<<<<<<<<<<<<<
 *         grb.fcstimeunits = _ftimedict[grb.indicatorOfUnitOfTimeRange]
 *     if grb.has_key('forecastTime'):
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_grb), __pyx_n_s_indicatorOfUnitOfTimeRange); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 714, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_ftimedict); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 714, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = (__Pyx_PySequence_ContainsTF(__pyx_t_3, __pyx_t_2, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 714, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_5 = (__pyx_t_4 != 0);
  __pyx_t_1 = __pyx_t_5;
  __pyx_L4_bool_binop_done:;

  /* "pygrib.pyx":713
 *     """
 *     grb.fcstimeunits = ""
 *     if grb.has_key('indicatorOfUnitOfTimeRange') and\             # <<<<<<<<<<<<<<
 *        grb.indicatorOfUnitOfTimeRange in _ftimedict:
 *         grb.fcstimeunits = _ftimedict[grb.indicatorOfUnitOfTimeRange]
 */
  if (__pyx_t_1) {

    /* "pygrib.pyx":715
 *     if grb.has_key('indicatorOfUnitOfTimeRange') and\
 *        grb.indicatorOfUnitOfTimeRange in _ftimedict:
 *         grb.fcstimeunits = _ftimedict[grb.indicatorOfUnitOfTimeRange]             # <<<<<<<<<<<<<<
 *     if grb.has_key('forecastTime'):
 *         if grb.has_key('forecastTime'):
 */
    __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_ftimedict); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 715, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_grb), __pyx_n_s_indicatorOfUnitOfTimeRange); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 715, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_6 = __Pyx_PyObject_GetItem(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 715, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GIVEREF(__pyx_t_6);
    __Pyx_GOTREF(__pyx_v_grb->fcstimeunits);
    __Pyx_DECREF(__pyx_v_grb->fcstimeunits);
    __pyx_v_grb->fcstimeunits = __pyx_t_6;
    __pyx_t_6 = 0;

    /* "pygrib.pyx":713
 *     """
 *     grb.fcstimeunits = ""
 *     if grb.has_key('indicatorOfUnitOfTimeRange') and\             # <<<<<<<<<<<<<<
 *        grb.indicatorOfUnitOfTimeRange in _ftimedict:
 *         grb.fcstimeunits = _ftimedict[grb.indicatorOfUnitOfTimeRange]
 */
  }

  /* "pygrib.pyx":716
 *        grb.indicatorOfUnitOfTimeRange in _ftimedict:
 *         grb.fcstimeunits = _ftimedict[grb.indicatorOfUnitOfTimeRange]
 *     if grb.has_key('forecastTime'):             # <<<<<<<<<<<<<<
 *         if grb.has_key('forecastTime'):
 *             ftime = grb.forecastTime
 */
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_grb), __pyx_n_s_has_key); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 716, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_tuple__12, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 716, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 716, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__pyx_t_1) {

    /* "pygrib.pyx":717
 *         grb.fcstimeunits = _ftimedict[grb.indicatorOfUnitOfTimeRange]
 *     if grb.has_key('forecastTime'):
 *         if grb.has_key('forecastTime'):             # <<<<<<<<<<<<<<
 *             ftime = grb.forecastTime
 *         elif grb.has_key('stepRange'):
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_grb), __pyx_n_s_has_key); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 717, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__13, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 717, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 717, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (__pyx_t_1) {

      /* "pygrib.pyx":718
 *     if grb.has_key('forecastTime'):
 *         if grb.has_key('forecastTime'):
 *             ftime = grb.forecastTime             # <<<<<<<<<<<<<<
 *         elif grb.has_key('stepRange'):
 *             # if forecastTime doesn't exist, use end of stepRange.
 */
      __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_grb), __pyx_n_s_forecastTime); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 718, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_v_ftime = __pyx_t_6;
      __pyx_t_6 = 0;

      /* "pygrib.pyx":717
 *         grb.fcstimeunits = _ftimedict[grb.indicatorOfUnitOfTimeRange]
 *     if grb.has_key('forecastTime'):
 *         if grb.has_key('forecastTime'):             # <<<<<<<<<<<<<<
 *             ftime = grb.forecastTime
 *         elif grb.has_key('stepRange'):
 */
      goto __pyx_L7;
    }

    /* "pygrib.pyx":719
 *         if grb.has_key('forecastTime'):
 *             ftime = grb.forecastTime
 *         elif grb.has_key('stepRange'):             # <<<<<<<<<<<<<<
 *             # if forecastTime doesn't exist, use end of stepRange.
 *             ftime = grb['stepRange'] # computed key, uses stepUnits
 */
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_grb), __pyx_n_s_has_key); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 719, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_tuple__14, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 719, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 719, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (__pyx_t_1) {

      /* "pygrib.pyx":721
 *         elif grb.has_key('stepRange'):
 *             # if forecastTime doesn't exist, use end of stepRange.
 *             ftime = grb['stepRange'] # computed key, uses stepUnits             # <<<<<<<<<<<<<<
 *             # if it's a range, use the end of the range to define validDate
 *             try:
 */
      __pyx_t_3 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_grb), __pyx_n_s_stepRange); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 721, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_v_ftime = __pyx_t_3;
      __pyx_t_3 = 0;

      /* "pygrib.pyx":723
 *             ftime = grb['stepRange'] # computed key, uses stepUnits
 *             # if it's a range, use the end of the range to define validDate
 *             try:             # <<<<<<<<<<<<<<
 *                 ftime = float(ftime.split('-')[1])
 *             except:
 */
      {
        __Pyx_PyThreadState_declare
        __Pyx_PyThreadState_assign
        __Pyx_ExceptionSave(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9);
        __Pyx_XGOTREF(__pyx_t_7);
        __Pyx_XGOTREF(__pyx_t_8);
        __Pyx_XGOTREF(__pyx_t_9);
        /*try:*/ {

          /* "pygrib.pyx":724
 *             # if it's a range, use the end of the range to define validDate
 *             try:
 *                 ftime = float(ftime.split('-')[1])             # <<<<<<<<<<<<<<
 *             except:
 *                 ftime = None
 */
          __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_ftime, __pyx_n_s_split); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 724, __pyx_L8_error)
          __Pyx_GOTREF(__pyx_t_3);
          __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__16, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 724, __pyx_L8_error)
          __Pyx_GOTREF(__pyx_t_6);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_6, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 724, __pyx_L8_error)
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __pyx_t_6 = __Pyx_PyNumber_Float(__pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 724, __pyx_L8_error)
          __Pyx_GOTREF(__pyx_t_6);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_DECREF_SET(__pyx_v_ftime, __pyx_t_6);
          __pyx_t_6 = 0;

          /* "pygrib.pyx":723
 *             ftime = grb['stepRange'] # computed key, uses stepUnits
 *             # if it's a range, use the end of the range to define validDate
 *             try:             # <<<<<<<<<<<<<<
 *                 ftime = float(ftime.split('-')[1])
 *             except:
 */
        }
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        goto __pyx_L13_try_end;
        __pyx_L8_error:;
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;

        /* "pygrib.pyx":725
 *             try:
 *                 ftime = float(ftime.split('-')[1])
 *             except:             # <<<<<<<<<<<<<<
 *                 ftime = None
 *     else:
 */
        /*except:*/ {
          __Pyx_AddTraceback("pygrib.setdates", __pyx_clineno, __pyx_lineno, __pyx_filename);
          if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_3, &__pyx_t_2) < 0) __PYX_ERR(0, 725, __pyx_L10_except_error)
          __Pyx_GOTREF(__pyx_t_6);
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_GOTREF(__pyx_t_2);

          /* "pygrib.pyx":726
 *                 ftime = float(ftime.split('-')[1])
 *             except:
 *                 ftime = None             # <<<<<<<<<<<<<<
 *     else:
 *         ftime = 0
 */
          __Pyx_INCREF(Py_None);
          __Pyx_DECREF_SET(__pyx_v_ftime, Py_None);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          goto __pyx_L9_exception_handled;
        }
        __pyx_L10_except_error:;

        /* "pygrib.pyx":723
 *             ftime = grb['stepRange'] # computed key, uses stepUnits
 *             # if it's a range, use the end of the range to define validDate
 *             try:             # <<<<<<<<<<<<<<
 *                 ftime = float(ftime.split('-')[1])
 *             except:
 */
        __Pyx_XGIVEREF(__pyx_t_7);
        __Pyx_XGIVEREF(__pyx_t_8);
        __Pyx_XGIVEREF(__pyx_t_9);
        __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9);
        goto __pyx_L1_error;
        __pyx_L9_exception_handled:;
        __Pyx_XGIVEREF(__pyx_t_7);
        __Pyx_XGIVEREF(__pyx_t_8);
        __Pyx_XGIVEREF(__pyx_t_9);
        __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9);
        __pyx_L13_try_end:;
      }

      /* "pygrib.pyx":719
 *         if grb.has_key('forecastTime'):
 *             ftime = grb.forecastTime
 *         elif grb.has_key('stepRange'):             # <<<<<<<<<<<<<<
 *             # if forecastTime doesn't exist, use end of stepRange.
 *             ftime = grb['stepRange'] # computed key, uses stepUnits
 */
    }
    __pyx_L7:;

    /* "pygrib.pyx":716
 *        grb.indicatorOfUnitOfTimeRange in _ftimedict:
 *         grb.fcstimeunits = _ftimedict[grb.indicatorOfUnitOfTimeRange]
 *     if grb.has_key('forecastTime'):             # <<<<<<<<<<<<<<
 *         if grb.has_key('forecastTime'):
 *             ftime = grb.forecastTime
 */
    goto __pyx_L6;
  }

  /* "pygrib.pyx":728
 *                 ftime = None
 *     else:
 *         ftime = 0             # <<<<<<<<<<<<<<
 *     if ftime is None: ftime = 0. # make sure ftime is not None
 *     if grb.has_key('julianDay'):
 */
  /*else*/ {
    __Pyx_INCREF(__pyx_int_0);
    __pyx_v_ftime = __pyx_int_0;
  }
  __pyx_L6:;

  /* "pygrib.pyx":729
 *     else:
 *         ftime = 0
 *     if ftime is None: ftime = 0. # make sure ftime is not None             # <<<<<<<<<<<<<<
 *     if grb.has_key('julianDay'):
 *         # don't do anything if datetime fails (because of a miscoded julianDay)
 */
  if (unlikely(!__pyx_v_ftime)) { __Pyx_RaiseUnboundLocalError("ftime"); __PYX_ERR(0, 729, __pyx_L1_error) }
  __pyx_t_1 = (__pyx_v_ftime == Py_None);
  __pyx_t_5 = (__pyx_t_1 != 0);
  if (__pyx_t_5) {
    __Pyx_INCREF(__pyx_float_0_);
    __Pyx_XDECREF_SET(__pyx_v_ftime, __pyx_float_0_);
  }

  /* "pygrib.pyx":730
 *         ftime = 0
 *     if ftime is None: ftime = 0. # make sure ftime is not None
 *     if grb.has_key('julianDay'):             # <<<<<<<<<<<<<<
 *         # don't do anything if datetime fails (because of a miscoded julianDay)
 *         try:
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_grb), __pyx_n_s_has_key); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 730, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__17, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 730, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 730, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__pyx_t_5) {

    /* "pygrib.pyx":732
 *     if grb.has_key('julianDay'):
 *         # don't do anything if datetime fails (because of a miscoded julianDay)
 *         try:             # <<<<<<<<<<<<<<
 *             grb.analDate =\
 *             julian_to_datetime(grb.julianDay)
 */
    {
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __Pyx_ExceptionSave(&__pyx_t_9, &__pyx_t_8, &__pyx_t_7);
      __Pyx_XGOTREF(__pyx_t_9);
      __Pyx_XGOTREF(__pyx_t_8);
      __Pyx_XGOTREF(__pyx_t_7);
      /*try:*/ {

        /* "pygrib.pyx":734
 *         try:
 *             grb.analDate =\
 *             julian_to_datetime(grb.julianDay)             # <<<<<<<<<<<<<<
 *         except ValueError:
 *             return grb
 */
        __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_julian_to_datetime); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 734, __pyx_L18_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_grb), __pyx_n_s_julianDay); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 734, __pyx_L18_error)
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_10 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
          __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_2);
          if (likely(__pyx_t_10)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
            __Pyx_INCREF(__pyx_t_10);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_2, function);
          }
        }
        if (!__pyx_t_10) {
          __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 734, __pyx_L18_error)
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_GOTREF(__pyx_t_3);
        } else {
          #if CYTHON_FAST_PYCALL
          if (PyFunction_Check(__pyx_t_2)) {
            PyObject *__pyx_temp[2] = {__pyx_t_10, __pyx_t_6};
            __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 734, __pyx_L18_error)
            __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
            __Pyx_GOTREF(__pyx_t_3);
            __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          } else
          #endif
          #if CYTHON_FAST_PYCCALL
          if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
            PyObject *__pyx_temp[2] = {__pyx_t_10, __pyx_t_6};
            __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 734, __pyx_L18_error)
            __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
            __Pyx_GOTREF(__pyx_t_3);
            __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          } else
          #endif
          {
            __pyx_t_11 = PyTuple_New(1+1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 734, __pyx_L18_error)
            __Pyx_GOTREF(__pyx_t_11);
            __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_10); __pyx_t_10 = NULL;
            __Pyx_GIVEREF(__pyx_t_6);
            PyTuple_SET_ITEM(__pyx_t_11, 0+1, __pyx_t_6);
            __pyx_t_6 = 0;
            __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_11, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 734, __pyx_L18_error)
            __Pyx_GOTREF(__pyx_t_3);
            __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
          }
        }
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

        /* "pygrib.pyx":733
 *         # don't do anything if datetime fails (because of a miscoded julianDay)
 *         try:
 *             grb.analDate =\             # <<<<<<<<<<<<<<
 *             julian_to_datetime(grb.julianDay)
 *         except ValueError:
 */
        __Pyx_GIVEREF(__pyx_t_3);
        __Pyx_GOTREF(__pyx_v_grb->analDate);
        __Pyx_DECREF(__pyx_v_grb->analDate);
        __pyx_v_grb->analDate = __pyx_t_3;
        __pyx_t_3 = 0;

        /* "pygrib.pyx":732
 *     if grb.has_key('julianDay'):
 *         # don't do anything if datetime fails (because of a miscoded julianDay)
 *         try:             # <<<<<<<<<<<<<<
 *             grb.analDate =\
 *             julian_to_datetime(grb.julianDay)
 */
      }
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L23_try_end;
      __pyx_L18_error:;
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "pygrib.pyx":735
 *             grb.analDate =\
 *             julian_to_datetime(grb.julianDay)
 *         except ValueError:             # <<<<<<<<<<<<<<
 *             return grb
 *         if grb.fcstimeunits == 'hrs':
 */
      __pyx_t_12 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_ValueError);
      if (__pyx_t_12) {
        __Pyx_AddTraceback("pygrib.setdates", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_2, &__pyx_t_11) < 0) __PYX_ERR(0, 735, __pyx_L20_except_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_GOTREF(__pyx_t_11);

        /* "pygrib.pyx":736
 *             julian_to_datetime(grb.julianDay)
 *         except ValueError:
 *             return grb             # <<<<<<<<<<<<<<
 *         if grb.fcstimeunits == 'hrs':
 *             try:
 */
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(((PyObject *)__pyx_v_grb));
        __pyx_r = ((PyObject *)__pyx_v_grb);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        goto __pyx_L21_except_return;
      }
      goto __pyx_L20_except_error;
      __pyx_L20_except_error:;

      /* "pygrib.pyx":732
 *     if grb.has_key('julianDay'):
 *         # don't do anything if datetime fails (because of a miscoded julianDay)
 *         try:             # <<<<<<<<<<<<<<
 *             grb.analDate =\
 *             julian_to_datetime(grb.julianDay)
 */
      __Pyx_XGIVEREF(__pyx_t_9);
      __Pyx_XGIVEREF(__pyx_t_8);
      __Pyx_XGIVEREF(__pyx_t_7);
      __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_8, __pyx_t_7);
      goto __pyx_L1_error;
      __pyx_L21_except_return:;
      __Pyx_XGIVEREF(__pyx_t_9);
      __Pyx_XGIVEREF(__pyx_t_8);
      __Pyx_XGIVEREF(__pyx_t_7);
      __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_8, __pyx_t_7);
      goto __pyx_L0;
      __pyx_L23_try_end:;
    }

    /* "pygrib.pyx":737
 *         except ValueError:
 *             return grb
 *         if grb.fcstimeunits == 'hrs':             # <<<<<<<<<<<<<<
 *             try:
 *                 grb.validDate =\
 */
    __pyx_t_5 = (__Pyx_PyString_Equals(__pyx_v_grb->fcstimeunits, __pyx_n_s_hrs, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 737, __pyx_L1_error)
    if (__pyx_t_5) {

      /* "pygrib.pyx":738
 *             return grb
 *         if grb.fcstimeunits == 'hrs':
 *             try:             # <<<<<<<<<<<<<<
 *                 grb.validDate =\
 *                 julian_to_datetime(grb.julianDay+ftime/24.)
 */
      {
        __Pyx_PyThreadState_declare
        __Pyx_PyThreadState_assign
        __Pyx_ExceptionSave(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9);
        __Pyx_XGOTREF(__pyx_t_7);
        __Pyx_XGOTREF(__pyx_t_8);
        __Pyx_XGOTREF(__pyx_t_9);
        /*try:*/ {

          /* "pygrib.pyx":740
 *             try:
 *                 grb.validDate =\
 *                 julian_to_datetime(grb.julianDay+ftime/24.)             # <<<<<<<<<<<<<<
 *             except ValueError:
 *                 return grb
 */
          __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_julian_to_datetime); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 740, __pyx_L27_error)
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_grb), __pyx_n_s_julianDay); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 740, __pyx_L27_error)
          __Pyx_GOTREF(__pyx_t_3);
          if (unlikely(!__pyx_v_ftime)) { __Pyx_RaiseUnboundLocalError("ftime"); __PYX_ERR(0, 740, __pyx_L27_error) }
          __pyx_t_6 = __Pyx_PyFloat_DivideObjC(__pyx_v_ftime, __pyx_float_24_, 24., 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 740, __pyx_L27_error)
          __Pyx_GOTREF(__pyx_t_6);
          __pyx_t_10 = PyNumber_Add(__pyx_t_3, __pyx_t_6); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 740, __pyx_L27_error)
          __Pyx_GOTREF(__pyx_t_10);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __pyx_t_6 = NULL;
          if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
            __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_2);
            if (likely(__pyx_t_6)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
              __Pyx_INCREF(__pyx_t_6);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_2, function);
            }
          }
          if (!__pyx_t_6) {
            __pyx_t_11 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_10); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 740, __pyx_L27_error)
            __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
            __Pyx_GOTREF(__pyx_t_11);
          } else {
            #if CYTHON_FAST_PYCALL
            if (PyFunction_Check(__pyx_t_2)) {
              PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_t_10};
              __pyx_t_11 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 740, __pyx_L27_error)
              __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
              __Pyx_GOTREF(__pyx_t_11);
              __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
            } else
            #endif
            #if CYTHON_FAST_PYCCALL
            if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
              PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_t_10};
              __pyx_t_11 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 740, __pyx_L27_error)
              __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
              __Pyx_GOTREF(__pyx_t_11);
              __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
            } else
            #endif
            {
              __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 740, __pyx_L27_error)
              __Pyx_GOTREF(__pyx_t_3);
              __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_6); __pyx_t_6 = NULL;
              __Pyx_GIVEREF(__pyx_t_10);
              PyTuple_SET_ITEM(__pyx_t_3, 0+1, __pyx_t_10);
              __pyx_t_10 = 0;
              __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 740, __pyx_L27_error)
              __Pyx_GOTREF(__pyx_t_11);
              __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
            }
          }
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

          /* "pygrib.pyx":739
 *         if grb.fcstimeunits == 'hrs':
 *             try:
 *                 grb.validDate =\             # <<<<<<<<<<<<<<
 *                 julian_to_datetime(grb.julianDay+ftime/24.)
 *             except ValueError:
 */
          __Pyx_GIVEREF(__pyx_t_11);
          __Pyx_GOTREF(__pyx_v_grb->validDate);
          __Pyx_DECREF(__pyx_v_grb->validDate);
          __pyx_v_grb->validDate = __pyx_t_11;
          __pyx_t_11 = 0;

          /* "pygrib.pyx":738
 *             return grb
 *         if grb.fcstimeunits == 'hrs':
 *             try:             # <<<<<<<<<<<<<<
 *                 grb.validDate =\
 *                 julian_to_datetime(grb.julianDay+ftime/24.)
 */
        }
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        goto __pyx_L32_try_end;
        __pyx_L27_error:;
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;

        /* "pygrib.pyx":741
 *                 grb.validDate =\
 *                 julian_to_datetime(grb.julianDay+ftime/24.)
 *             except ValueError:             # <<<<<<<<<<<<<<
 *                 return grb
 *         elif grb.fcstimeunits == 'mins':
 */
        __pyx_t_12 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_ValueError);
        if (__pyx_t_12) {
          __Pyx_AddTraceback("pygrib.setdates", __pyx_clineno, __pyx_lineno, __pyx_filename);
          if (__Pyx_GetException(&__pyx_t_11, &__pyx_t_2, &__pyx_t_3) < 0) __PYX_ERR(0, 741, __pyx_L29_except_error)
          __Pyx_GOTREF(__pyx_t_11);
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_GOTREF(__pyx_t_3);

          /* "pygrib.pyx":742
 *                 julian_to_datetime(grb.julianDay+ftime/24.)
 *             except ValueError:
 *                 return grb             # <<<<<<<<<<<<<<
 *         elif grb.fcstimeunits == 'mins':
 *             try:
 */
          __Pyx_XDECREF(__pyx_r);
          __Pyx_INCREF(((PyObject *)__pyx_v_grb));
          __pyx_r = ((PyObject *)__pyx_v_grb);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
          goto __pyx_L30_except_return;
        }
        goto __pyx_L29_except_error;
        __pyx_L29_except_error:;

        /* "pygrib.pyx":738
 *             return grb
 *         if grb.fcstimeunits == 'hrs':
 *             try:             # <<<<<<<<<<<<<<
 *                 grb.validDate =\
 *                 julian_to_datetime(grb.julianDay+ftime/24.)
 */
        __Pyx_XGIVEREF(__pyx_t_7);
        __Pyx_XGIVEREF(__pyx_t_8);
        __Pyx_XGIVEREF(__pyx_t_9);
        __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9);
        goto __pyx_L1_error;
        __pyx_L30_except_return:;
        __Pyx_XGIVEREF(__pyx_t_7);
        __Pyx_XGIVEREF(__pyx_t_8);
        __Pyx_XGIVEREF(__pyx_t_9);
        __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9);
        goto __pyx_L0;
        __pyx_L32_try_end:;
      }

      /* "pygrib.pyx":737
 *         except ValueError:
 *             return grb
 *         if grb.fcstimeunits == 'hrs':             # <<<<<<<<<<<<<<
 *             try:
 *                 grb.validDate =\
 */
      goto __pyx_L26;
    }

    /* "pygrib.pyx":743
 *             except ValueError:
 *                 return grb
 *         elif grb.fcstimeunits == 'mins':             # <<<<<<<<<<<<<<
 *             try:
 *                 grb.validDate =\
 */
    __pyx_t_5 = (__Pyx_PyString_Equals(__pyx_v_grb->fcstimeunits, __pyx_n_s_mins, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 743, __pyx_L1_error)
    if (__pyx_t_5) {

      /* "pygrib.pyx":744
 *                 return grb
 *         elif grb.fcstimeunits == 'mins':
 *             try:             # <<<<<<<<<<<<<<
 *                 grb.validDate =\
 *                 julian_to_datetime(grb.julianDay+ftime/1440.)
 */
      {
        __Pyx_PyThreadState_declare
        __Pyx_PyThreadState_assign
        __Pyx_ExceptionSave(&__pyx_t_9, &__pyx_t_8, &__pyx_t_7);
        __Pyx_XGOTREF(__pyx_t_9);
        __Pyx_XGOTREF(__pyx_t_8);
        __Pyx_XGOTREF(__pyx_t_7);
        /*try:*/ {

          /* "pygrib.pyx":746
 *             try:
 *                 grb.validDate =\
 *                 julian_to_datetime(grb.julianDay+ftime/1440.)             # <<<<<<<<<<<<<<
 *             except ValueError:
 *                 return grb
 */
          __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_julian_to_datetime); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 746, __pyx_L35_error)
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_11 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_grb), __pyx_n_s_julianDay); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 746, __pyx_L35_error)
          __Pyx_GOTREF(__pyx_t_11);
          if (unlikely(!__pyx_v_ftime)) { __Pyx_RaiseUnboundLocalError("ftime"); __PYX_ERR(0, 746, __pyx_L35_error) }
          __pyx_t_10 = __Pyx_PyFloat_DivideObjC(__pyx_v_ftime, __pyx_float_1440_, 1440., 0); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 746, __pyx_L35_error)
          __Pyx_GOTREF(__pyx_t_10);
          __pyx_t_6 = PyNumber_Add(__pyx_t_11, __pyx_t_10); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 746, __pyx_L35_error)
          __Pyx_GOTREF(__pyx_t_6);
          __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
          __pyx_t_10 = NULL;
          if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
            __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_2);
            if (likely(__pyx_t_10)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
              __Pyx_INCREF(__pyx_t_10);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_2, function);
            }
          }
          if (!__pyx_t_10) {
            __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 746, __pyx_L35_error)
            __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
            __Pyx_GOTREF(__pyx_t_3);
          } else {
            #if CYTHON_FAST_PYCALL
            if (PyFunction_Check(__pyx_t_2)) {
              PyObject *__pyx_temp[2] = {__pyx_t_10, __pyx_t_6};
              __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 746, __pyx_L35_error)
              __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
              __Pyx_GOTREF(__pyx_t_3);
              __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
            } else
            #endif
            #if CYTHON_FAST_PYCCALL
            if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
              PyObject *__pyx_temp[2] = {__pyx_t_10, __pyx_t_6};
              __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 746, __pyx_L35_error)
              __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
              __Pyx_GOTREF(__pyx_t_3);
              __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
            } else
            #endif
            {
              __pyx_t_11 = PyTuple_New(1+1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 746, __pyx_L35_error)
              __Pyx_GOTREF(__pyx_t_11);
              __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_10); __pyx_t_10 = NULL;
              __Pyx_GIVEREF(__pyx_t_6);
              PyTuple_SET_ITEM(__pyx_t_11, 0+1, __pyx_t_6);
              __pyx_t_6 = 0;
              __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_11, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 746, __pyx_L35_error)
              __Pyx_GOTREF(__pyx_t_3);
              __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
            }
          }
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

          /* "pygrib.pyx":745
 *         elif grb.fcstimeunits == 'mins':
 *             try:
 *                 grb.validDate =\             # <<<<<<<<<<<<<<
 *                 julian_to_datetime(grb.julianDay+ftime/1440.)
 *             except ValueError:
 */
          __Pyx_GIVEREF(__pyx_t_3);
          __Pyx_GOTREF(__pyx_v_grb->validDate);
          __Pyx_DECREF(__pyx_v_grb->validDate);
          __pyx_v_grb->validDate = __pyx_t_3;
          __pyx_t_3 = 0;

          /* "pygrib.pyx":744
 *                 return grb
 *         elif grb.fcstimeunits == 'mins':
 *             try:             # <<<<<<<<<<<<<<
 *                 grb.validDate =\
 *                 julian_to_datetime(grb.julianDay+ftime/1440.)
 */
        }
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        goto __pyx_L40_try_end;
        __pyx_L35_error:;
        __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;

        /* "pygrib.pyx":747
 *                 grb.validDate =\
 *                 julian_to_datetime(grb.julianDay+ftime/1440.)
 *             except ValueError:             # <<<<<<<<<<<<<<
 *                 return grb
 *         elif grb.fcstimeunits == 'days':
 */
        __pyx_t_12 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_ValueError);
        if (__pyx_t_12) {
          __Pyx_AddTraceback("pygrib.setdates", __pyx_clineno, __pyx_lineno, __pyx_filename);
          if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_2, &__pyx_t_11) < 0) __PYX_ERR(0, 747, __pyx_L37_except_error)
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_GOTREF(__pyx_t_11);

          /* "pygrib.pyx":748
 *                 julian_to_datetime(grb.julianDay+ftime/1440.)
 *             except ValueError:
 *                 return grb             # <<<<<<<<<<<<<<
 *         elif grb.fcstimeunits == 'days':
 *             try:
 */
          __Pyx_XDECREF(__pyx_r);
          __Pyx_INCREF(((PyObject *)__pyx_v_grb));
          __pyx_r = ((PyObject *)__pyx_v_grb);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
          goto __pyx_L38_except_return;
        }
        goto __pyx_L37_except_error;
        __pyx_L37_except_error:;

        /* "pygrib.pyx":744
 *                 return grb
 *         elif grb.fcstimeunits == 'mins':
 *             try:             # <<<<<<<<<<<<<<
 *                 grb.validDate =\
 *                 julian_to_datetime(grb.julianDay+ftime/1440.)
 */
        __Pyx_XGIVEREF(__pyx_t_9);
        __Pyx_XGIVEREF(__pyx_t_8);
        __Pyx_XGIVEREF(__pyx_t_7);
        __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_8, __pyx_t_7);
        goto __pyx_L1_error;
        __pyx_L38_except_return:;
        __Pyx_XGIVEREF(__pyx_t_9);
        __Pyx_XGIVEREF(__pyx_t_8);
        __Pyx_XGIVEREF(__pyx_t_7);
        __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_8, __pyx_t_7);
        goto __pyx_L0;
        __pyx_L40_try_end:;
      }

      /* "pygrib.pyx":743
 *             except ValueError:
 *                 return grb
 *         elif grb.fcstimeunits == 'mins':             # <<<<<<<<<<<<<<
 *             try:
 *                 grb.validDate =\
 */
      goto __pyx_L26;
    }

    /* "pygrib.pyx":749
 *             except ValueError:
 *                 return grb
 *         elif grb.fcstimeunits == 'days':             # <<<<<<<<<<<<<<
 *             try:
 *                 grb.validDate =\
 */
    __pyx_t_5 = (__Pyx_PyString_Equals(__pyx_v_grb->fcstimeunits, __pyx_n_s_days, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 749, __pyx_L1_error)
    if (__pyx_t_5) {

      /* "pygrib.pyx":750
 *                 return grb
 *         elif grb.fcstimeunits == 'days':
 *             try:             # <<<<<<<<<<<<<<
 *                 grb.validDate =\
 *                 julian_to_datetime(grb.julianDay+ftime)
 */
      {
        __Pyx_PyThreadState_declare
        __Pyx_PyThreadState_assign
        __Pyx_ExceptionSave(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9);
        __Pyx_XGOTREF(__pyx_t_7);
        __Pyx_XGOTREF(__pyx_t_8);
        __Pyx_XGOTREF(__pyx_t_9);
        /*try:*/ {

          /* "pygrib.pyx":752
 *             try:
 *                 grb.validDate =\
 *                 julian_to_datetime(grb.julianDay+ftime)             # <<<<<<<<<<<<<<
 *             except ValueError:
 *                 return grb
 */
          __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_julian_to_datetime); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 752, __pyx_L43_error)
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_grb), __pyx_n_s_julianDay); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 752, __pyx_L43_error)
          __Pyx_GOTREF(__pyx_t_3);
          if (unlikely(!__pyx_v_ftime)) { __Pyx_RaiseUnboundLocalError("ftime"); __PYX_ERR(0, 752, __pyx_L43_error) }
          __pyx_t_6 = PyNumber_Add(__pyx_t_3, __pyx_v_ftime); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 752, __pyx_L43_error)
          __Pyx_GOTREF(__pyx_t_6);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __pyx_t_3 = NULL;
          if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
            __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
            if (likely(__pyx_t_3)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
              __Pyx_INCREF(__pyx_t_3);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_2, function);
            }
          }
          if (!__pyx_t_3) {
            __pyx_t_11 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_6); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 752, __pyx_L43_error)
            __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
            __Pyx_GOTREF(__pyx_t_11);
          } else {
            #if CYTHON_FAST_PYCALL
            if (PyFunction_Check(__pyx_t_2)) {
              PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_6};
              __pyx_t_11 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 752, __pyx_L43_error)
              __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
              __Pyx_GOTREF(__pyx_t_11);
              __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
            } else
            #endif
            #if CYTHON_FAST_PYCCALL
            if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
              PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_6};
              __pyx_t_11 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 752, __pyx_L43_error)
              __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
              __Pyx_GOTREF(__pyx_t_11);
              __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
            } else
            #endif
            {
              __pyx_t_10 = PyTuple_New(1+1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 752, __pyx_L43_error)
              __Pyx_GOTREF(__pyx_t_10);
              __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_3); __pyx_t_3 = NULL;
              __Pyx_GIVEREF(__pyx_t_6);
              PyTuple_SET_ITEM(__pyx_t_10, 0+1, __pyx_t_6);
              __pyx_t_6 = 0;
              __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_10, NULL); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 752, __pyx_L43_error)
              __Pyx_GOTREF(__pyx_t_11);
              __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
            }
          }
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

          /* "pygrib.pyx":751
 *         elif grb.fcstimeunits == 'days':
 *             try:
 *                 grb.validDate =\             # <<<<<<<<<<<<<<
 *                 julian_to_datetime(grb.julianDay+ftime)
 *             except ValueError:
 */
          __Pyx_GIVEREF(__pyx_t_11);
          __Pyx_GOTREF(__pyx_v_grb->validDate);
          __Pyx_DECREF(__pyx_v_grb->validDate);
          __pyx_v_grb->validDate = __pyx_t_11;
          __pyx_t_11 = 0;

          /* "pygrib.pyx":750
 *                 return grb
 *         elif grb.fcstimeunits == 'days':
 *             try:             # <<<<<<<<<<<<<<
 *                 grb.validDate =\
 *                 julian_to_datetime(grb.julianDay+ftime)
 */
        }
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        goto __pyx_L48_try_end;
        __pyx_L43_error:;
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;

        /* "pygrib.pyx":753
 *                 grb.validDate =\
 *                 julian_to_datetime(grb.julianDay+ftime)
 *             except ValueError:             # <<<<<<<<<<<<<<
 *                 return grb
 *         elif grb.fcstimeunits == 'secs':
 */
        __pyx_t_12 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_ValueError);
        if (__pyx_t_12) {
          __Pyx_AddTraceback("pygrib.setdates", __pyx_clineno, __pyx_lineno, __pyx_filename);
          if (__Pyx_GetException(&__pyx_t_11, &__pyx_t_2, &__pyx_t_10) < 0) __PYX_ERR(0, 753, __pyx_L45_except_error)
          __Pyx_GOTREF(__pyx_t_11);
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_GOTREF(__pyx_t_10);

          /* "pygrib.pyx":754
 *                 julian_to_datetime(grb.julianDay+ftime)
 *             except ValueError:
 *                 return grb             # <<<<<<<<<<<<<<
 *         elif grb.fcstimeunits == 'secs':
 *             try:
 */
          __Pyx_XDECREF(__pyx_r);
          __Pyx_INCREF(((PyObject *)__pyx_v_grb));
          __pyx_r = ((PyObject *)__pyx_v_grb);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
          __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
          goto __pyx_L46_except_return;
        }
        goto __pyx_L45_except_error;
        __pyx_L45_except_error:;

        /* "pygrib.pyx":750
 *                 return grb
 *         elif grb.fcstimeunits == 'days':
 *             try:             # <<<<<<<<<<<<<<
 *                 grb.validDate =\
 *                 julian_to_datetime(grb.julianDay+ftime)
 */
        __Pyx_XGIVEREF(__pyx_t_7);
        __Pyx_XGIVEREF(__pyx_t_8);
        __Pyx_XGIVEREF(__pyx_t_9);
        __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9);
        goto __pyx_L1_error;
        __pyx_L46_except_return:;
        __Pyx_XGIVEREF(__pyx_t_7);
        __Pyx_XGIVEREF(__pyx_t_8);
        __Pyx_XGIVEREF(__pyx_t_9);
        __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9);
        goto __pyx_L0;
        __pyx_L48_try_end:;
      }

      /* "pygrib.pyx":749
 *             except ValueError:
 *                 return grb
 *         elif grb.fcstimeunits == 'days':             # <<<<<<<<<<<<<<
 *             try:
 *                 grb.validDate =\
 */
      goto __pyx_L26;
    }

    /* "pygrib.pyx":755
 *             except ValueError:
 *                 return grb
 *         elif grb.fcstimeunits == 'secs':             # <<<<<<<<<<<<<<
 *             try:
 *                 grb.validDate =\
 */
    __pyx_t_5 = (__Pyx_PyString_Equals(__pyx_v_grb->fcstimeunits, __pyx_n_s_secs, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 755, __pyx_L1_error)
    if (__pyx_t_5) {

      /* "pygrib.pyx":756
 *                 return grb
 *         elif grb.fcstimeunits == 'secs':
 *             try:             # <<<<<<<<<<<<<<
 *                 grb.validDate =\
 *                 julian_to_datetime(grb.julianDay+ftime/86400.)
 */
      {
        __Pyx_PyThreadState_declare
        __Pyx_PyThreadState_assign
        __Pyx_ExceptionSave(&__pyx_t_9, &__pyx_t_8, &__pyx_t_7);
        __Pyx_XGOTREF(__pyx_t_9);
        __Pyx_XGOTREF(__pyx_t_8);
        __Pyx_XGOTREF(__pyx_t_7);
        /*try:*/ {

          /* "pygrib.pyx":758
 *             try:
 *                 grb.validDate =\
 *                 julian_to_datetime(grb.julianDay+ftime/86400.)             # <<<<<<<<<<<<<<
 *             except ValueError:
 *                 return grb
 */
          __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_julian_to_datetime); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 758, __pyx_L51_error)
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_11 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_grb), __pyx_n_s_julianDay); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 758, __pyx_L51_error)
          __Pyx_GOTREF(__pyx_t_11);
          if (unlikely(!__pyx_v_ftime)) { __Pyx_RaiseUnboundLocalError("ftime"); __PYX_ERR(0, 758, __pyx_L51_error) }
          __pyx_t_6 = __Pyx_PyFloat_DivideObjC(__pyx_v_ftime, __pyx_float_86400_, 86400., 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 758, __pyx_L51_error)
          __Pyx_GOTREF(__pyx_t_6);
          __pyx_t_3 = PyNumber_Add(__pyx_t_11, __pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 758, __pyx_L51_error)
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __pyx_t_6 = NULL;
          if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
            __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_2);
            if (likely(__pyx_t_6)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
              __Pyx_INCREF(__pyx_t_6);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_2, function);
            }
          }
          if (!__pyx_t_6) {
            __pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 758, __pyx_L51_error)
            __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
            __Pyx_GOTREF(__pyx_t_10);
          } else {
            #if CYTHON_FAST_PYCALL
            if (PyFunction_Check(__pyx_t_2)) {
              PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_t_3};
              __pyx_t_10 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 758, __pyx_L51_error)
              __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
              __Pyx_GOTREF(__pyx_t_10);
              __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
            } else
            #endif
            #if CYTHON_FAST_PYCCALL
            if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
              PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_t_3};
              __pyx_t_10 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 758, __pyx_L51_error)
              __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
              __Pyx_GOTREF(__pyx_t_10);
              __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
            } else
            #endif
            {
              __pyx_t_11 = PyTuple_New(1+1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 758, __pyx_L51_error)
              __Pyx_GOTREF(__pyx_t_11);
              __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_6); __pyx_t_6 = NULL;
              __Pyx_GIVEREF(__pyx_t_3);
              PyTuple_SET_ITEM(__pyx_t_11, 0+1, __pyx_t_3);
              __pyx_t_3 = 0;
              __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_11, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 758, __pyx_L51_error)
              __Pyx_GOTREF(__pyx_t_10);
              __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
            }
          }
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

          /* "pygrib.pyx":757
 *         elif grb.fcstimeunits == 'secs':
 *             try:
 *                 grb.validDate =\             # <<<<<<<<<<<<<<
 *                 julian_to_datetime(grb.julianDay+ftime/86400.)
 *             except ValueError:
 */
          __Pyx_GIVEREF(__pyx_t_10);
          __Pyx_GOTREF(__pyx_v_grb->validDate);
          __Pyx_DECREF(__pyx_v_grb->validDate);
          __pyx_v_grb->validDate = __pyx_t_10;
          __pyx_t_10 = 0;

          /* "pygrib.pyx":756
 *                 return grb
 *         elif grb.fcstimeunits == 'secs':
 *             try:             # <<<<<<<<<<<<<<
 *                 grb.validDate =\
 *                 julian_to_datetime(grb.julianDay+ftime/86400.)
 */
        }
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        goto __pyx_L56_try_end;
        __pyx_L51_error:;
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;

        /* "pygrib.pyx":759
 *                 grb.validDate =\
 *                 julian_to_datetime(grb.julianDay+ftime/86400.)
 *             except ValueError:             # <<<<<<<<<<<<<<
 *                 return grb
 *         elif grb.fcstimeunits == '3 hr periods':
 */
        __pyx_t_12 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_ValueError);
        if (__pyx_t_12) {
          __Pyx_AddTraceback("pygrib.setdates", __pyx_clineno, __pyx_lineno, __pyx_filename);
          if (__Pyx_GetException(&__pyx_t_10, &__pyx_t_2, &__pyx_t_11) < 0) __PYX_ERR(0, 759, __pyx_L53_except_error)
          __Pyx_GOTREF(__pyx_t_10);
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_GOTREF(__pyx_t_11);

          /* "pygrib.pyx":760
 *                 julian_to_datetime(grb.julianDay+ftime/86400.)
 *             except ValueError:
 *                 return grb             # <<<<<<<<<<<<<<
 *         elif grb.fcstimeunits == '3 hr periods':
 *             try:
 */
          __Pyx_XDECREF(__pyx_r);
          __Pyx_INCREF(((PyObject *)__pyx_v_grb));
          __pyx_r = ((PyObject *)__pyx_v_grb);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
          __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
          goto __pyx_L54_except_return;
        }
        goto __pyx_L53_except_error;
        __pyx_L53_except_error:;

        /* "pygrib.pyx":756
 *                 return grb
 *         elif grb.fcstimeunits == 'secs':
 *             try:             # <<<<<<<<<<<<<<
 *                 grb.validDate =\
 *                 julian_to_datetime(grb.julianDay+ftime/86400.)
 */
        __Pyx_XGIVEREF(__pyx_t_9);
        __Pyx_XGIVEREF(__pyx_t_8);
        __Pyx_XGIVEREF(__pyx_t_7);
        __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_8, __pyx_t_7);
        goto __pyx_L1_error;
        __pyx_L54_except_return:;
        __Pyx_XGIVEREF(__pyx_t_9);
        __Pyx_XGIVEREF(__pyx_t_8);
        __Pyx_XGIVEREF(__pyx_t_7);
        __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_8, __pyx_t_7);
        goto __pyx_L0;
        __pyx_L56_try_end:;
      }

      /* "pygrib.pyx":755
 *             except ValueError:
 *                 return grb
 *         elif grb.fcstimeunits == 'secs':             # <<<<<<<<<<<<<<
 *             try:
 *                 grb.validDate =\
 */
      goto __pyx_L26;
    }

    /* "pygrib.pyx":761
 *             except ValueError:
 *                 return grb
 *         elif grb.fcstimeunits == '3 hr periods':             # <<<<<<<<<<<<<<
 *             try:
 *                 grb.validDate =\
 */
    __pyx_t_5 = (__Pyx_PyString_Equals(__pyx_v_grb->fcstimeunits, __pyx_kp_s_3_hr_periods, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 761, __pyx_L1_error)
    if (__pyx_t_5) {

      /* "pygrib.pyx":762
 *                 return grb
 *         elif grb.fcstimeunits == '3 hr periods':
 *             try:             # <<<<<<<<<<<<<<
 *                 grb.validDate =\
 *                 julian_to_datetime(grb.julianDay+ftime/8.)
 */
      {
        __Pyx_PyThreadState_declare
        __Pyx_PyThreadState_assign
        __Pyx_ExceptionSave(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9);
        __Pyx_XGOTREF(__pyx_t_7);
        __Pyx_XGOTREF(__pyx_t_8);
        __Pyx_XGOTREF(__pyx_t_9);
        /*try:*/ {

          /* "pygrib.pyx":764
 *             try:
 *                 grb.validDate =\
 *                 julian_to_datetime(grb.julianDay+ftime/8.)             # <<<<<<<<<<<<<<
 *             except ValueError:
 *                 return grb
 */
          __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_julian_to_datetime); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 764, __pyx_L59_error)
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_10 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_grb), __pyx_n_s_julianDay); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 764, __pyx_L59_error)
          __Pyx_GOTREF(__pyx_t_10);
          if (unlikely(!__pyx_v_ftime)) { __Pyx_RaiseUnboundLocalError("ftime"); __PYX_ERR(0, 764, __pyx_L59_error) }
          __pyx_t_3 = __Pyx_PyFloat_DivideObjC(__pyx_v_ftime, __pyx_float_8_, 8., 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 764, __pyx_L59_error)
          __Pyx_GOTREF(__pyx_t_3);
          __pyx_t_6 = PyNumber_Add(__pyx_t_10, __pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 764, __pyx_L59_error)
          __Pyx_GOTREF(__pyx_t_6);
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __pyx_t_3 = NULL;
          if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
            __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
            if (likely(__pyx_t_3)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
              __Pyx_INCREF(__pyx_t_3);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_2, function);
            }
          }
          if (!__pyx_t_3) {
            __pyx_t_11 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_6); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 764, __pyx_L59_error)
            __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
            __Pyx_GOTREF(__pyx_t_11);
          } else {
            #if CYTHON_FAST_PYCALL
            if (PyFunction_Check(__pyx_t_2)) {
              PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_6};
              __pyx_t_11 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 764, __pyx_L59_error)
              __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
              __Pyx_GOTREF(__pyx_t_11);
              __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
            } else
            #endif
            #if CYTHON_FAST_PYCCALL
            if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
              PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_6};
              __pyx_t_11 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 764, __pyx_L59_error)
              __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
              __Pyx_GOTREF(__pyx_t_11);
              __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
            } else
            #endif
            {
              __pyx_t_10 = PyTuple_New(1+1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 764, __pyx_L59_error)
              __Pyx_GOTREF(__pyx_t_10);
              __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_3); __pyx_t_3 = NULL;
              __Pyx_GIVEREF(__pyx_t_6);
              PyTuple_SET_ITEM(__pyx_t_10, 0+1, __pyx_t_6);
              __pyx_t_6 = 0;
              __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_10, NULL); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 764, __pyx_L59_error)
              __Pyx_GOTREF(__pyx_t_11);
              __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
            }
          }
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

          /* "pygrib.pyx":763
 *         elif grb.fcstimeunits == '3 hr periods':
 *             try:
 *                 grb.validDate =\             # <<<<<<<<<<<<<<
 *                 julian_to_datetime(grb.julianDay+ftime/8.)
 *             except ValueError:
 */
          __Pyx_GIVEREF(__pyx_t_11);
          __Pyx_GOTREF(__pyx_v_grb->validDate);
          __Pyx_DECREF(__pyx_v_grb->validDate);
          __pyx_v_grb->validDate = __pyx_t_11;
          __pyx_t_11 = 0;

          /* "pygrib.pyx":762
 *                 return grb
 *         elif grb.fcstimeunits == '3 hr periods':
 *             try:             # <<<<<<<<<<<<<<
 *                 grb.validDate =\
 *                 julian_to_datetime(grb.julianDay+ftime/8.)
 */
        }
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        goto __pyx_L64_try_end;
        __pyx_L59_error:;
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;

        /* "pygrib.pyx":765
 *                 grb.validDate =\
 *                 julian_to_datetime(grb.julianDay+ftime/8.)
 *             except ValueError:             # <<<<<<<<<<<<<<
 *                 return grb
 *         elif grb.fcstimeunits == '6 hr periods':
 */
        __pyx_t_12 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_ValueError);
        if (__pyx_t_12) {
          __Pyx_AddTraceback("pygrib.setdates", __pyx_clineno, __pyx_lineno, __pyx_filename);
          if (__Pyx_GetException(&__pyx_t_11, &__pyx_t_2, &__pyx_t_10) < 0) __PYX_ERR(0, 765, __pyx_L61_except_error)
          __Pyx_GOTREF(__pyx_t_11);
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_GOTREF(__pyx_t_10);

          /* "pygrib.pyx":766
 *                 julian_to_datetime(grb.julianDay+ftime/8.)
 *             except ValueError:
 *                 return grb             # <<<<<<<<<<<<<<
 *         elif grb.fcstimeunits == '6 hr periods':
 *             try:
 */
          __Pyx_XDECREF(__pyx_r);
          __Pyx_INCREF(((PyObject *)__pyx_v_grb));
          __pyx_r = ((PyObject *)__pyx_v_grb);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
          __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
          goto __pyx_L62_except_return;
        }
        goto __pyx_L61_except_error;
        __pyx_L61_except_error:;

        /* "pygrib.pyx":762
 *                 return grb
 *         elif grb.fcstimeunits == '3 hr periods':
 *             try:             # <<<<<<<<<<<<<<
 *                 grb.validDate =\
 *                 julian_to_datetime(grb.julianDay+ftime/8.)
 */
        __Pyx_XGIVEREF(__pyx_t_7);
        __Pyx_XGIVEREF(__pyx_t_8);
        __Pyx_XGIVEREF(__pyx_t_9);
        __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9);
        goto __pyx_L1_error;
        __pyx_L62_except_return:;
        __Pyx_XGIVEREF(__pyx_t_7);
        __Pyx_XGIVEREF(__pyx_t_8);
        __Pyx_XGIVEREF(__pyx_t_9);
        __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9);
        goto __pyx_L0;
        __pyx_L64_try_end:;
      }

      /* "pygrib.pyx":761
 *             except ValueError:
 *                 return grb
 *         elif grb.fcstimeunits == '3 hr periods':             # <<<<<<<<<<<<<<
 *             try:
 *                 grb.validDate =\
 */
      goto __pyx_L26;
    }

    /* "pygrib.pyx":767
 *             except ValueError:
 *                 return grb
 *         elif grb.fcstimeunits == '6 hr periods':             # <<<<<<<<<<<<<<
 *             try:
 *                 grb.validDate =\
 */
    __pyx_t_5 = (__Pyx_PyString_Equals(__pyx_v_grb->fcstimeunits, __pyx_kp_s_6_hr_periods, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 767, __pyx_L1_error)
    if (__pyx_t_5) {

      /* "pygrib.pyx":768
 *                 return grb
 *         elif grb.fcstimeunits == '6 hr periods':
 *             try:             # <<<<<<<<<<<<<<
 *                 grb.validDate =\
 *                 julian_to_datetime(grb.julianDay+ftime/4.)
 */
      {
        __Pyx_PyThreadState_declare
        __Pyx_PyThreadState_assign
        __Pyx_ExceptionSave(&__pyx_t_9, &__pyx_t_8, &__pyx_t_7);
        __Pyx_XGOTREF(__pyx_t_9);
        __Pyx_XGOTREF(__pyx_t_8);
        __Pyx_XGOTREF(__pyx_t_7);
        /*try:*/ {

          /* "pygrib.pyx":770
 *             try:
 *                 grb.validDate =\
 *                 julian_to_datetime(grb.julianDay+ftime/4.)             # <<<<<<<<<<<<<<
 *             except ValueError:
 *                 return grb
 */
          __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_julian_to_datetime); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 770, __pyx_L67_error)
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_11 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_grb), __pyx_n_s_julianDay); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 770, __pyx_L67_error)
          __Pyx_GOTREF(__pyx_t_11);
          if (unlikely(!__pyx_v_ftime)) { __Pyx_RaiseUnboundLocalError("ftime"); __PYX_ERR(0, 770, __pyx_L67_error) }
          __pyx_t_6 = __Pyx_PyFloat_DivideObjC(__pyx_v_ftime, __pyx_float_4_, 4., 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 770, __pyx_L67_error)
          __Pyx_GOTREF(__pyx_t_6);
          __pyx_t_3 = PyNumber_Add(__pyx_t_11, __pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 770, __pyx_L67_error)
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __pyx_t_6 = NULL;
          if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
            __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_2);
            if (likely(__pyx_t_6)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
              __Pyx_INCREF(__pyx_t_6);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_2, function);
            }
          }
          if (!__pyx_t_6) {
            __pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 770, __pyx_L67_error)
            __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
            __Pyx_GOTREF(__pyx_t_10);
          } else {
            #if CYTHON_FAST_PYCALL
            if (PyFunction_Check(__pyx_t_2)) {
              PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_t_3};
              __pyx_t_10 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 770, __pyx_L67_error)
              __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
              __Pyx_GOTREF(__pyx_t_10);
              __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
            } else
            #endif
            #if CYTHON_FAST_PYCCALL
            if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
              PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_t_3};
              __pyx_t_10 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 770, __pyx_L67_error)
              __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
              __Pyx_GOTREF(__pyx_t_10);
              __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
            } else
            #endif
            {
              __pyx_t_11 = PyTuple_New(1+1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 770, __pyx_L67_error)
              __Pyx_GOTREF(__pyx_t_11);
              __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_6); __pyx_t_6 = NULL;
              __Pyx_GIVEREF(__pyx_t_3);
              PyTuple_SET_ITEM(__pyx_t_11, 0+1, __pyx_t_3);
              __pyx_t_3 = 0;
              __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_11, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 770, __pyx_L67_error)
              __Pyx_GOTREF(__pyx_t_10);
              __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
            }
          }
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

          /* "pygrib.pyx":769
 *         elif grb.fcstimeunits == '6 hr periods':
 *             try:
 *                 grb.validDate =\             # <<<<<<<<<<<<<<
 *                 julian_to_datetime(grb.julianDay+ftime/4.)
 *             except ValueError:
 */
          __Pyx_GIVEREF(__pyx_t_10);
          __Pyx_GOTREF(__pyx_v_grb->validDate);
          __Pyx_DECREF(__pyx_v_grb->validDate);
          __pyx_v_grb->validDate = __pyx_t_10;
          __pyx_t_10 = 0;

          /* "pygrib.pyx":768
 *                 return grb
 *         elif grb.fcstimeunits == '6 hr periods':
 *             try:             # <<<<<<<<<<<<<<
 *                 grb.validDate =\
 *                 julian_to_datetime(grb.julianDay+ftime/4.)
 */
        }
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        goto __pyx_L72_try_end;
        __pyx_L67_error:;
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;

        /* "pygrib.pyx":771
 *                 grb.validDate =\
 *                 julian_to_datetime(grb.julianDay+ftime/4.)
 *             except ValueError:             # <<<<<<<<<<<<<<
 *                 return grb
 *         elif grb.fcstimeunits == '12 hr periods':
 */
        __pyx_t_12 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_ValueError);
        if (__pyx_t_12) {
          __Pyx_AddTraceback("pygrib.setdates", __pyx_clineno, __pyx_lineno, __pyx_filename);
          if (__Pyx_GetException(&__pyx_t_10, &__pyx_t_2, &__pyx_t_11) < 0) __PYX_ERR(0, 771, __pyx_L69_except_error)
          __Pyx_GOTREF(__pyx_t_10);
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_GOTREF(__pyx_t_11);

          /* "pygrib.pyx":772
 *                 julian_to_datetime(grb.julianDay+ftime/4.)
 *             except ValueError:
 *                 return grb             # <<<<<<<<<<<<<<
 *         elif grb.fcstimeunits == '12 hr periods':
 *             try:
 */
          __Pyx_XDECREF(__pyx_r);
          __Pyx_INCREF(((PyObject *)__pyx_v_grb));
          __pyx_r = ((PyObject *)__pyx_v_grb);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
          __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
          goto __pyx_L70_except_return;
        }
        goto __pyx_L69_except_error;
        __pyx_L69_except_error:;

        /* "pygrib.pyx":768
 *                 return grb
 *         elif grb.fcstimeunits == '6 hr periods':
 *             try:             # <<<<<<<<<<<<<<
 *                 grb.validDate =\
 *                 julian_to_datetime(grb.julianDay+ftime/4.)
 */
        __Pyx_XGIVEREF(__pyx_t_9);
        __Pyx_XGIVEREF(__pyx_t_8);
        __Pyx_XGIVEREF(__pyx_t_7);
        __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_8, __pyx_t_7);
        goto __pyx_L1_error;
        __pyx_L70_except_return:;
        __Pyx_XGIVEREF(__pyx_t_9);
        __Pyx_XGIVEREF(__pyx_t_8);
        __Pyx_XGIVEREF(__pyx_t_7);
        __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_8, __pyx_t_7);
        goto __pyx_L0;
        __pyx_L72_try_end:;
      }

      /* "pygrib.pyx":767
 *             except ValueError:
 *                 return grb
 *         elif grb.fcstimeunits == '6 hr periods':             # <<<<<<<<<<<<<<
 *             try:
 *                 grb.validDate =\
 */
      goto __pyx_L26;
    }

    /* "pygrib.pyx":773
 *             except ValueError:
 *                 return grb
 *         elif grb.fcstimeunits == '12 hr periods':             # <<<<<<<<<<<<<<
 *             try:
 *                 grb.validDate =\
 */
    __pyx_t_5 = (__Pyx_PyString_Equals(__pyx_v_grb->fcstimeunits, __pyx_kp_s_12_hr_periods, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 773, __pyx_L1_error)
    if (__pyx_t_5) {

      /* "pygrib.pyx":774
 *                 return grb
 *         elif grb.fcstimeunits == '12 hr periods':
 *             try:             # <<<<<<<<<<<<<<
 *                 grb.validDate =\
 *                 julian_to_datetime(grb.julianDay+ftime/2.)
 */
      {
        __Pyx_PyThreadState_declare
        __Pyx_PyThreadState_assign
        __Pyx_ExceptionSave(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9);
        __Pyx_XGOTREF(__pyx_t_7);
        __Pyx_XGOTREF(__pyx_t_8);
        __Pyx_XGOTREF(__pyx_t_9);
        /*try:*/ {

          /* "pygrib.pyx":776
 *             try:
 *                 grb.validDate =\
 *                 julian_to_datetime(grb.julianDay+ftime/2.)             # <<<<<<<<<<<<<<
 *             except ValueError:
 *                 return grb
 */
          __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_julian_to_datetime); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 776, __pyx_L75_error)
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_10 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_grb), __pyx_n_s_julianDay); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 776, __pyx_L75_error)
          __Pyx_GOTREF(__pyx_t_10);
          if (unlikely(!__pyx_v_ftime)) { __Pyx_RaiseUnboundLocalError("ftime"); __PYX_ERR(0, 776, __pyx_L75_error) }
          __pyx_t_3 = __Pyx_PyFloat_DivideObjC(__pyx_v_ftime, __pyx_float_2_, 2., 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 776, __pyx_L75_error)
          __Pyx_GOTREF(__pyx_t_3);
          __pyx_t_6 = PyNumber_Add(__pyx_t_10, __pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 776, __pyx_L75_error)
          __Pyx_GOTREF(__pyx_t_6);
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __pyx_t_3 = NULL;
          if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
            __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
            if (likely(__pyx_t_3)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
              __Pyx_INCREF(__pyx_t_3);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_2, function);
            }
          }
          if (!__pyx_t_3) {
            __pyx_t_11 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_6); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 776, __pyx_L75_error)
            __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
            __Pyx_GOTREF(__pyx_t_11);
          } else {
            #if CYTHON_FAST_PYCALL
            if (PyFunction_Check(__pyx_t_2)) {
              PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_6};
              __pyx_t_11 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 776, __pyx_L75_error)
              __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
              __Pyx_GOTREF(__pyx_t_11);
              __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
            } else
            #endif
            #if CYTHON_FAST_PYCCALL
            if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
              PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_6};
              __pyx_t_11 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 776, __pyx_L75_error)
              __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
              __Pyx_GOTREF(__pyx_t_11);
              __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
            } else
            #endif
            {
              __pyx_t_10 = PyTuple_New(1+1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 776, __pyx_L75_error)
              __Pyx_GOTREF(__pyx_t_10);
              __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_3); __pyx_t_3 = NULL;
              __Pyx_GIVEREF(__pyx_t_6);
              PyTuple_SET_ITEM(__pyx_t_10, 0+1, __pyx_t_6);
              __pyx_t_6 = 0;
              __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_10, NULL); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 776, __pyx_L75_error)
              __Pyx_GOTREF(__pyx_t_11);
              __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
            }
          }
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

          /* "pygrib.pyx":775
 *         elif grb.fcstimeunits == '12 hr periods':
 *             try:
 *                 grb.validDate =\             # <<<<<<<<<<<<<<
 *                 julian_to_datetime(grb.julianDay+ftime/2.)
 *             except ValueError:
 */
          __Pyx_GIVEREF(__pyx_t_11);
          __Pyx_GOTREF(__pyx_v_grb->validDate);
          __Pyx_DECREF(__pyx_v_grb->validDate);
          __pyx_v_grb->validDate = __pyx_t_11;
          __pyx_t_11 = 0;

          /* "pygrib.pyx":774
 *                 return grb
 *         elif grb.fcstimeunits == '12 hr periods':
 *             try:             # <<<<<<<<<<<<<<
 *                 grb.validDate =\
 *                 julian_to_datetime(grb.julianDay+ftime/2.)
 */
        }
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        goto __pyx_L80_try_end;
        __pyx_L75_error:;
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;

        /* "pygrib.pyx":777
 *                 grb.validDate =\
 *                 julian_to_datetime(grb.julianDay+ftime/2.)
 *             except ValueError:             # <<<<<<<<<<<<<<
 *                 return grb
 *     return grb
 */
        __pyx_t_12 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_ValueError);
        if (__pyx_t_12) {
          __Pyx_AddTraceback("pygrib.setdates", __pyx_clineno, __pyx_lineno, __pyx_filename);
          if (__Pyx_GetException(&__pyx_t_11, &__pyx_t_2, &__pyx_t_10) < 0) __PYX_ERR(0, 777, __pyx_L77_except_error)
          __Pyx_GOTREF(__pyx_t_11);
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_GOTREF(__pyx_t_10);

          /* "pygrib.pyx":778
 *                 julian_to_datetime(grb.julianDay+ftime/2.)
 *             except ValueError:
 *                 return grb             # <<<<<<<<<<<<<<
 *     return grb
 * 
 */
          __Pyx_XDECREF(__pyx_r);
          __Pyx_INCREF(((PyObject *)__pyx_v_grb));
          __pyx_r = ((PyObject *)__pyx_v_grb);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
          __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
          goto __pyx_L78_except_return;
        }
        goto __pyx_L77_except_error;
        __pyx_L77_except_error:;

        /* "pygrib.pyx":774
 *                 return grb
 *         elif grb.fcstimeunits == '12 hr periods':
 *             try:             # <<<<<<<<<<<<<<
 *                 grb.validDate =\
 *                 julian_to_datetime(grb.julianDay+ftime/2.)
 */
        __Pyx_XGIVEREF(__pyx_t_7);
        __Pyx_XGIVEREF(__pyx_t_8);
        __Pyx_XGIVEREF(__pyx_t_9);
        __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9);
        goto __pyx_L1_error;
        __pyx_L78_except_return:;
        __Pyx_XGIVEREF(__pyx_t_7);
        __Pyx_XGIVEREF(__pyx_t_8);
        __Pyx_XGIVEREF(__pyx_t_9);
        __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9);
        goto __pyx_L0;
        __pyx_L80_try_end:;
      }

      /* "pygrib.pyx":773
 *             except ValueError:
 *                 return grb
 *         elif grb.fcstimeunits == '12 hr periods':             # <<<<<<<<<<<<<<
 *             try:
 *                 grb.validDate =\
 */
    }
    __pyx_L26:;

    /* "pygrib.pyx":730
 *         ftime = 0
 *     if ftime is None: ftime = 0. # make sure ftime is not None
 *     if grb.has_key('julianDay'):             # <<<<<<<<<<<<<<
 *         # don't do anything if datetime fails (because of a miscoded julianDay)
 *         try:
 */
  }

  /* "pygrib.pyx":779
 *             except ValueError:
 *                 return grb
 *     return grb             # <<<<<<<<<<<<<<
 * 
 * def reload(gribmessage grb):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_grb));
  __pyx_r = ((PyObject *)__pyx_v_grb);
  goto __pyx_L0;

  /* "pygrib.pyx":702
 *     return setdates(grb)
 * 
 * def setdates(gribmessage grb):             # <<<<<<<<<<<<<<
 *     """
 *     setdates(grb)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_AddTraceback("pygrib.setdates", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_ftime);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pygrib.pyx":781
 *     return grb
 * 
 * def reload(gribmessage grb):             # <<<<<<<<<<<<<<
 *     """
 *     reload(grb)
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pygrib_21reload(PyObject *__pyx_self, PyObject *__pyx_v_grb); /*proto*/
static char __pyx_doc_6pygrib_20reload[] = "\n    reload(grb)\n\n    Recreate gribmessage object, updating all the keys to be consistent\n    with each other.  For example, if the forecastTime key is changed,\n    recreating the gribmessage object with this function will cause\n    the analDate and verifDate keys to be updated accordingly.\n\n    Equivalent to fromstring(grb.tostring())";
static PyMethodDef __pyx_mdef_6pygrib_21reload = {"reload", (PyCFunction)__pyx_pw_6pygrib_21reload, METH_O, __pyx_doc_6pygrib_20reload};
static PyObject *__pyx_pw_6pygrib_21reload(PyObject *__pyx_self, PyObject *__pyx_v_grb) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("reload (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_grb), __pyx_ptype_6pygrib_gribmessage, 1, "grb", 0))) __PYX_ERR(0, 781, __pyx_L1_error)
  __pyx_r = __pyx_pf_6pygrib_20reload(__pyx_self, ((struct __pyx_obj_6pygrib_gribmessage *)__pyx_v_grb));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pygrib_20reload(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_6pygrib_gribmessage *__pyx_v_grb) {
  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;
  __Pyx_RefNannySetupContext("reload", 0);

  /* "pygrib.pyx":791
 * 
 *     Equivalent to fromstring(grb.tostring())"""
 *     return fromstring(grb.tostring())             # <<<<<<<<<<<<<<
 * 
 * cdef class gribmessage(object):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_fromstring); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 791, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_grb), __pyx_n_s_tostring); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 791, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  if (__pyx_t_5) {
    __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 791, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  } else {
    __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 791, __pyx_L1_error)
  }
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  if (!__pyx_t_4) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 791, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_t_3};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 791, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_t_3};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 791, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else
    #endif
    {
      __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 791, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __pyx_t_4 = NULL;
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_t_3);
      __pyx_t_3 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 791, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "pygrib.pyx":781
 *     return grb
 * 
 * def reload(gribmessage grb):             # <<<<<<<<<<<<<<
 *     """
 *     reload(grb)
 */

  /* 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_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("pygrib.reload", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pygrib.pyx":832
 *     cdef public messagenumber, projparams, validDate, analDate,\
 *     expand_reduced, _ro_keys, _all_keys, fcstimeunits
 *     def __init__(self):             # <<<<<<<<<<<<<<
 *         # calling "__new__()" will not call "__init__()" !
 *         raise TypeError("This class cannot be instantiated from Python")
 */

/* Python wrapper */
static int __pyx_pw_6pygrib_11gribmessage_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_6pygrib_11gribmessage_1__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_6pygrib_11gribmessage___init__(((struct __pyx_obj_6pygrib_gribmessage *)__pyx_v_self));

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

static int __pyx_pf_6pygrib_11gribmessage___init__(CYTHON_UNUSED struct __pyx_obj_6pygrib_gribmessage *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "pygrib.pyx":834
 *     def __init__(self):
 *         # calling "__new__()" will not call "__init__()" !
 *         raise TypeError("This class cannot be instantiated from Python")             # <<<<<<<<<<<<<<
 *     def __dealloc__(self):
 *         # finalization (inverse of __cinit__): needed to allow garbage collector to free memory.
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__18, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 834, __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_ERR(0, 834, __pyx_L1_error)

  /* "pygrib.pyx":832
 *     cdef public messagenumber, projparams, validDate, analDate,\
 *     expand_reduced, _ro_keys, _all_keys, fcstimeunits
 *     def __init__(self):             # <<<<<<<<<<<<<<
 *         # calling "__new__()" will not call "__init__()" !
 *         raise TypeError("This class cannot be instantiated from Python")
 */

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

/* "pygrib.pyx":835
 *         # calling "__new__()" will not call "__init__()" !
 *         raise TypeError("This class cannot be instantiated from Python")
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         # finalization (inverse of __cinit__): needed to allow garbage collector to free memory.
 *         cdef int err
 */

/* Python wrapper */
static void __pyx_pw_6pygrib_11gribmessage_3__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_6pygrib_11gribmessage_3__dealloc__(PyObject *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_pf_6pygrib_11gribmessage_2__dealloc__(((struct __pyx_obj_6pygrib_gribmessage *)__pyx_v_self));

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

static void __pyx_pf_6pygrib_11gribmessage_2__dealloc__(struct __pyx_obj_6pygrib_gribmessage *__pyx_v_self) {
  CYTHON_UNUSED int __pyx_v_err;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__", 0);

  /* "pygrib.pyx":838
 *         # finalization (inverse of __cinit__): needed to allow garbage collector to free memory.
 *         cdef int err
 *         err = grib_handle_delete(self._gh)             # <<<<<<<<<<<<<<
 *     def __getattr__(self, item):
 *         # allow gribmessage keys to accessed like attributes.
 */
  __pyx_v_err = grib_handle_delete(__pyx_v_self->_gh);

  /* "pygrib.pyx":835
 *         # calling "__new__()" will not call "__init__()" !
 *         raise TypeError("This class cannot be instantiated from Python")
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         # finalization (inverse of __cinit__): needed to allow garbage collector to free memory.
 *         cdef int err
 */

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

/* "pygrib.pyx":839
 *         cdef int err
 *         err = grib_handle_delete(self._gh)
 *     def __getattr__(self, item):             # <<<<<<<<<<<<<<
 *         # allow gribmessage keys to accessed like attributes.
 *         # this is tried after looking for item in self.__dict__.keys().
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pygrib_11gribmessage_5__getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_item); /*proto*/
static PyObject *__pyx_pw_6pygrib_11gribmessage_5__getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_item) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getattr__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pygrib_11gribmessage_4__getattr__(((struct __pyx_obj_6pygrib_gribmessage *)__pyx_v_self), ((PyObject *)__pyx_v_item));

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

static PyObject *__pyx_pf_6pygrib_11gribmessage_4__getattr__(struct __pyx_obj_6pygrib_gribmessage *__pyx_v_self, PyObject *__pyx_v_item) {
  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;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  __Pyx_RefNannySetupContext("__getattr__", 0);

  /* "pygrib.pyx":842
 *         # allow gribmessage keys to accessed like attributes.
 *         # this is tried after looking for item in self.__dict__.keys().
 *         try:             # <<<<<<<<<<<<<<
 *             return self.__getitem__(item)
 *         except KeyError:
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __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:*/ {

      /* "pygrib.pyx":843
 *         # this is tried after looking for item in self.__dict__.keys().
 *         try:
 *             return self.__getitem__(item)             # <<<<<<<<<<<<<<
 *         except KeyError:
 *             raise AttributeError(item)
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getitem); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 843, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
        __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
        if (likely(__pyx_t_6)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
          __Pyx_INCREF(__pyx_t_6);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_5, function);
        }
      }
      if (!__pyx_t_6) {
        __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_item); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 843, __pyx_L3_error)
        __Pyx_GOTREF(__pyx_t_4);
      } else {
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_5)) {
          PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_v_item};
          __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 843, __pyx_L3_error)
          __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_GOTREF(__pyx_t_4);
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
          PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_v_item};
          __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 843, __pyx_L3_error)
          __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_GOTREF(__pyx_t_4);
        } else
        #endif
        {
          __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 843, __pyx_L3_error)
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_6); __pyx_t_6 = NULL;
          __Pyx_INCREF(__pyx_v_item);
          __Pyx_GIVEREF(__pyx_v_item);
          PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_v_item);
          __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_7, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 843, __pyx_L3_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        }
      }
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_r = __pyx_t_4;
      __pyx_t_4 = 0;
      goto __pyx_L7_try_return;

      /* "pygrib.pyx":842
 *         # allow gribmessage keys to accessed like attributes.
 *         # this is tried after looking for item in self.__dict__.keys().
 *         try:             # <<<<<<<<<<<<<<
 *             return self.__getitem__(item)
 *         except KeyError:
 */
    }
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "pygrib.pyx":844
 *         try:
 *             return self.__getitem__(item)
 *         except KeyError:             # <<<<<<<<<<<<<<
 *             raise AttributeError(item)
 *     def __setattr__(self, name, value):
 */
    __pyx_t_8 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_KeyError);
    if (__pyx_t_8) {
      __Pyx_AddTraceback("pygrib.gribmessage.__getattr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_5, &__pyx_t_7) < 0) __PYX_ERR(0, 844, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GOTREF(__pyx_t_7);

      /* "pygrib.pyx":845
 *             return self.__getitem__(item)
 *         except KeyError:
 *             raise AttributeError(item)             # <<<<<<<<<<<<<<
 *     def __setattr__(self, name, value):
 *         # allow gribmessage keys to be set like attributes.
 */
      __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_builtin_AttributeError, __pyx_v_item); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 845, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_Raise(__pyx_t_6, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __PYX_ERR(0, 845, __pyx_L5_except_error)
    }
    goto __pyx_L5_except_error;
    __pyx_L5_except_error:;

    /* "pygrib.pyx":842
 *         # allow gribmessage keys to accessed like attributes.
 *         # this is tried after looking for item in self.__dict__.keys().
 *         try:             # <<<<<<<<<<<<<<
 *             return self.__getitem__(item)
 *         except KeyError:
 */
    __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;
  }

  /* "pygrib.pyx":839
 *         cdef int err
 *         err = grib_handle_delete(self._gh)
 *     def __getattr__(self, item):             # <<<<<<<<<<<<<<
 *         # allow gribmessage keys to accessed like attributes.
 *         # this is tried after looking for item in self.__dict__.keys().
 */

  /* 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_7);
  __Pyx_AddTraceback("pygrib.gribmessage.__getattr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pygrib.pyx":846
 *         except KeyError:
 *             raise AttributeError(item)
 *     def __setattr__(self, name, value):             # <<<<<<<<<<<<<<
 *         # allow gribmessage keys to be set like attributes.
 *         if name not in _private_atts:
 */

/* Python wrapper */
static int __pyx_pw_6pygrib_11gribmessage_7__setattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_6pygrib_11gribmessage_7__setattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setattr__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pygrib_11gribmessage_6__setattr__(((struct __pyx_obj_6pygrib_gribmessage *)__pyx_v_self), ((PyObject *)__pyx_v_name), ((PyObject *)__pyx_v_value));

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

static int __pyx_pf_6pygrib_11gribmessage_6__setattr__(struct __pyx_obj_6pygrib_gribmessage *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("__setattr__", 0);

  /* "pygrib.pyx":848
 *     def __setattr__(self, name, value):
 *         # allow gribmessage keys to be set like attributes.
 *         if name not in _private_atts:             # <<<<<<<<<<<<<<
 *             # these are grib message keys
 *             self[name] = value
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_private_atts); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 848, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_v_name, __pyx_t_1, Py_NE)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 848, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "pygrib.pyx":850
 *         if name not in _private_atts:
 *             # these are grib message keys
 *             self[name] = value             # <<<<<<<<<<<<<<
 *         else:
 *             # these are python attributes.
 */
    if (unlikely(PyObject_SetItem(((PyObject *)__pyx_v_self), __pyx_v_name, __pyx_v_value) < 0)) __PYX_ERR(0, 850, __pyx_L1_error)

    /* "pygrib.pyx":848
 *     def __setattr__(self, name, value):
 *         # allow gribmessage keys to be set like attributes.
 *         if name not in _private_atts:             # <<<<<<<<<<<<<<
 *             # these are grib message keys
 *             self[name] = value
 */
    goto __pyx_L3;
  }

  /* "pygrib.pyx":853
 *         else:
 *             # these are python attributes.
 *             self.__dict__[name]=value             # <<<<<<<<<<<<<<
 *     def __repr__(self):
 *         """prints a short inventory of the grib message"""
 */
  /*else*/ {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_dict); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 853, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (unlikely(PyObject_SetItem(__pyx_t_1, __pyx_v_name, __pyx_v_value) < 0)) __PYX_ERR(0, 853, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }
  __pyx_L3:;

  /* "pygrib.pyx":846
 *         except KeyError:
 *             raise AttributeError(item)
 *     def __setattr__(self, name, value):             # <<<<<<<<<<<<<<
 *         # allow gribmessage keys to be set like attributes.
 *         if name not in _private_atts:
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pygrib.gribmessage.__setattr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pygrib.pyx":854
 *             # these are python attributes.
 *             self.__dict__[name]=value
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         """prints a short inventory of the grib message"""
 *         inventory = []
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pygrib_11gribmessage_9__repr__(PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_6pygrib_11gribmessage_8__repr__[] = "prints a short inventory of the grib message";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_6pygrib_11gribmessage_8__repr__;
#endif
static PyObject *__pyx_pw_6pygrib_11gribmessage_9__repr__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pygrib_11gribmessage_8__repr__(((struct __pyx_obj_6pygrib_gribmessage *)__pyx_v_self));

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

static PyObject *__pyx_pf_6pygrib_11gribmessage_8__repr__(struct __pyx_obj_6pygrib_gribmessage *__pyx_v_self) {
  PyObject *__pyx_v_inventory = NULL;
  PyObject *__pyx_v_toplev = NULL;
  PyObject *__pyx_v_botlev = NULL;
  PyObject *__pyx_v_levunits = NULL;
  PyObject *__pyx_v_levstring = NULL;
  PyObject *__pyx_v_ftime = NULL;
  PyObject *__pyx_v_ens_type = NULL;
  PyObject *__pyx_v_pert_num = NULL;
  PyObject *__pyx_v_lowerlim = NULL;
  PyObject *__pyx_v_upperlim = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_t_11;
  __Pyx_RefNannySetupContext("__repr__", 0);

  /* "pygrib.pyx":856
 *     def __repr__(self):
 *         """prints a short inventory of the grib message"""
 *         inventory = []             # <<<<<<<<<<<<<<
 *         if self.valid_key('name'):
 *             if self['name'] != 'unknown':
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 856, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_inventory = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pygrib.pyx":857
 *         """prints a short inventory of the grib message"""
 *         inventory = []
 *         if self.valid_key('name'):             # <<<<<<<<<<<<<<
 *             if self['name'] != 'unknown':
 *                 inventory.append(repr(self.messagenumber)+':'+self['name'])
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_valid_key); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 857, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__19, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 857, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 857, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_3) {

    /* "pygrib.pyx":858
 *         inventory = []
 *         if self.valid_key('name'):
 *             if self['name'] != 'unknown':             # <<<<<<<<<<<<<<
 *                 inventory.append(repr(self.messagenumber)+':'+self['name'])
 *             elif self.valid_key('parameterName'):
 */
    __pyx_t_2 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_name); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 858, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = (__Pyx_PyString_Equals(__pyx_t_2, __pyx_n_s_unknown, Py_NE)); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 858, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__pyx_t_3) {

      /* "pygrib.pyx":859
 *         if self.valid_key('name'):
 *             if self['name'] != 'unknown':
 *                 inventory.append(repr(self.messagenumber)+':'+self['name'])             # <<<<<<<<<<<<<<
 *             elif self.valid_key('parameterName'):
 *                 inventory.append(repr(self.messagenumber)+':'+self['parameterName'])
 */
      __pyx_t_2 = __pyx_v_self->messagenumber;
      __Pyx_INCREF(__pyx_t_2);
      __pyx_t_1 = PyObject_Repr(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 859, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = PyNumber_Add(__pyx_t_1, __pyx_kp_s__20); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 859, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 859, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_4 = PyNumber_Add(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 859, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_5 = __Pyx_PyList_Append(__pyx_v_inventory, __pyx_t_4); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 859, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "pygrib.pyx":858
 *         inventory = []
 *         if self.valid_key('name'):
 *             if self['name'] != 'unknown':             # <<<<<<<<<<<<<<
 *                 inventory.append(repr(self.messagenumber)+':'+self['name'])
 *             elif self.valid_key('parameterName'):
 */
      goto __pyx_L4;
    }

    /* "pygrib.pyx":860
 *             if self['name'] != 'unknown':
 *                 inventory.append(repr(self.messagenumber)+':'+self['name'])
 *             elif self.valid_key('parameterName'):             # <<<<<<<<<<<<<<
 *                 inventory.append(repr(self.messagenumber)+':'+self['parameterName'])
 *         if self.valid_key('units'):
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_valid_key); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 860, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_tuple__21, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 860, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 860, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (__pyx_t_3) {

      /* "pygrib.pyx":861
 *                 inventory.append(repr(self.messagenumber)+':'+self['name'])
 *             elif self.valid_key('parameterName'):
 *                 inventory.append(repr(self.messagenumber)+':'+self['parameterName'])             # <<<<<<<<<<<<<<
 *         if self.valid_key('units'):
 *             if self['units'] != 'unknown':
 */
      __pyx_t_1 = __pyx_v_self->messagenumber;
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_4 = PyObject_Repr(__pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 861, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = PyNumber_Add(__pyx_t_4, __pyx_kp_s__20); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 861, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_parameterName); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 861, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_2 = PyNumber_Add(__pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 861, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_5 = __Pyx_PyList_Append(__pyx_v_inventory, __pyx_t_2); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 861, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "pygrib.pyx":860
 *             if self['name'] != 'unknown':
 *                 inventory.append(repr(self.messagenumber)+':'+self['name'])
 *             elif self.valid_key('parameterName'):             # <<<<<<<<<<<<<<
 *                 inventory.append(repr(self.messagenumber)+':'+self['parameterName'])
 *         if self.valid_key('units'):
 */
    }
    __pyx_L4:;

    /* "pygrib.pyx":857
 *         """prints a short inventory of the grib message"""
 *         inventory = []
 *         if self.valid_key('name'):             # <<<<<<<<<<<<<<
 *             if self['name'] != 'unknown':
 *                 inventory.append(repr(self.messagenumber)+':'+self['name'])
 */
  }

  /* "pygrib.pyx":862
 *             elif self.valid_key('parameterName'):
 *                 inventory.append(repr(self.messagenumber)+':'+self['parameterName'])
 *         if self.valid_key('units'):             # <<<<<<<<<<<<<<
 *             if self['units'] != 'unknown':
 *                 inventory.append(':'+self['units'])
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_valid_key); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 862, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__22, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 862, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 862, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__pyx_t_3) {

    /* "pygrib.pyx":863
 *                 inventory.append(repr(self.messagenumber)+':'+self['parameterName'])
 *         if self.valid_key('units'):
 *             if self['units'] != 'unknown':             # <<<<<<<<<<<<<<
 *                 inventory.append(':'+self['units'])
 *             elif self.valid_key('parameterUnits'):
 */
    __pyx_t_4 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_units); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 863, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = (__Pyx_PyString_Equals(__pyx_t_4, __pyx_n_s_unknown, Py_NE)); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 863, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (__pyx_t_3) {

      /* "pygrib.pyx":864
 *         if self.valid_key('units'):
 *             if self['units'] != 'unknown':
 *                 inventory.append(':'+self['units'])             # <<<<<<<<<<<<<<
 *             elif self.valid_key('parameterUnits'):
 *                 inventory.append(':'+self['parameterUnits'])
 */
      __pyx_t_4 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_units); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 864, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_2 = PyNumber_Add(__pyx_kp_s__20, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 864, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_5 = __Pyx_PyList_Append(__pyx_v_inventory, __pyx_t_2); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 864, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "pygrib.pyx":863
 *                 inventory.append(repr(self.messagenumber)+':'+self['parameterName'])
 *         if self.valid_key('units'):
 *             if self['units'] != 'unknown':             # <<<<<<<<<<<<<<
 *                 inventory.append(':'+self['units'])
 *             elif self.valid_key('parameterUnits'):
 */
      goto __pyx_L6;
    }

    /* "pygrib.pyx":865
 *             if self['units'] != 'unknown':
 *                 inventory.append(':'+self['units'])
 *             elif self.valid_key('parameterUnits'):             # <<<<<<<<<<<<<<
 *                 inventory.append(':'+self['parameterUnits'])
 *         if self.valid_key('stepType'):
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_valid_key); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 865, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__23, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 865, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 865, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (__pyx_t_3) {

      /* "pygrib.pyx":866
 *                 inventory.append(':'+self['units'])
 *             elif self.valid_key('parameterUnits'):
 *                 inventory.append(':'+self['parameterUnits'])             # <<<<<<<<<<<<<<
 *         if self.valid_key('stepType'):
 *             inventory.append(' ('+self['stepType']+')')
 */
      __pyx_t_4 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_parameterUnits); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 866, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_2 = PyNumber_Add(__pyx_kp_s__20, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 866, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_5 = __Pyx_PyList_Append(__pyx_v_inventory, __pyx_t_2); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 866, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "pygrib.pyx":865
 *             if self['units'] != 'unknown':
 *                 inventory.append(':'+self['units'])
 *             elif self.valid_key('parameterUnits'):             # <<<<<<<<<<<<<<
 *                 inventory.append(':'+self['parameterUnits'])
 *         if self.valid_key('stepType'):
 */
    }
    __pyx_L6:;

    /* "pygrib.pyx":862
 *             elif self.valid_key('parameterName'):
 *                 inventory.append(repr(self.messagenumber)+':'+self['parameterName'])
 *         if self.valid_key('units'):             # <<<<<<<<<<<<<<
 *             if self['units'] != 'unknown':
 *                 inventory.append(':'+self['units'])
 */
  }

  /* "pygrib.pyx":867
 *             elif self.valid_key('parameterUnits'):
 *                 inventory.append(':'+self['parameterUnits'])
 *         if self.valid_key('stepType'):             # <<<<<<<<<<<<<<
 *             inventory.append(' ('+self['stepType']+')')
 *         if self.valid_key('typeOfGrid') or self.valid_key('gridType'):
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_valid_key); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 867, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__24, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 867, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 867, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__pyx_t_3) {

    /* "pygrib.pyx":868
 *                 inventory.append(':'+self['parameterUnits'])
 *         if self.valid_key('stepType'):
 *             inventory.append(' ('+self['stepType']+')')             # <<<<<<<<<<<<<<
 *         if self.valid_key('typeOfGrid') or self.valid_key('gridType'):
 *             if self.valid_key('typeOfGrid'):
 */
    __pyx_t_4 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_stepType); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 868, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_2 = PyNumber_Add(__pyx_kp_s__25, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 868, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyNumber_Add(__pyx_t_2, __pyx_kp_s__26); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 868, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_5 = __Pyx_PyList_Append(__pyx_v_inventory, __pyx_t_4); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 868, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "pygrib.pyx":867
 *             elif self.valid_key('parameterUnits'):
 *                 inventory.append(':'+self['parameterUnits'])
 *         if self.valid_key('stepType'):             # <<<<<<<<<<<<<<
 *             inventory.append(' ('+self['stepType']+')')
 *         if self.valid_key('typeOfGrid') or self.valid_key('gridType'):
 */
  }

  /* "pygrib.pyx":869
 *         if self.valid_key('stepType'):
 *             inventory.append(' ('+self['stepType']+')')
 *         if self.valid_key('typeOfGrid') or self.valid_key('gridType'):             # <<<<<<<<<<<<<<
 *             if self.valid_key('typeOfGrid'):
 *                inventory.append(':'+self['typeOfGrid'])
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_valid_key); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 869, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_tuple__27, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 869, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 869, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!__pyx_t_6) {
  } else {
    __pyx_t_3 = __pyx_t_6;
    goto __pyx_L9_bool_binop_done;
  }
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_valid_key); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 869, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__28, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 869, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 869, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_3 = __pyx_t_6;
  __pyx_L9_bool_binop_done:;
  if (__pyx_t_3) {

    /* "pygrib.pyx":870
 *             inventory.append(' ('+self['stepType']+')')
 *         if self.valid_key('typeOfGrid') or self.valid_key('gridType'):
 *             if self.valid_key('typeOfGrid'):             # <<<<<<<<<<<<<<
 *                inventory.append(':'+self['typeOfGrid'])
 *             else:
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_valid_key); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 870, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_tuple__29, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 870, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 870, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__pyx_t_3) {

      /* "pygrib.pyx":871
 *         if self.valid_key('typeOfGrid') or self.valid_key('gridType'):
 *             if self.valid_key('typeOfGrid'):
 *                inventory.append(':'+self['typeOfGrid'])             # <<<<<<<<<<<<<<
 *             else:
 *                inventory.append(':'+self['gridType'])
 */
      __pyx_t_2 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_typeOfGrid); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 871, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_4 = PyNumber_Add(__pyx_kp_s__20, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 871, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_5 = __Pyx_PyList_Append(__pyx_v_inventory, __pyx_t_4); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 871, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "pygrib.pyx":870
 *             inventory.append(' ('+self['stepType']+')')
 *         if self.valid_key('typeOfGrid') or self.valid_key('gridType'):
 *             if self.valid_key('typeOfGrid'):             # <<<<<<<<<<<<<<
 *                inventory.append(':'+self['typeOfGrid'])
 *             else:
 */
      goto __pyx_L11;
    }

    /* "pygrib.pyx":873
 *                inventory.append(':'+self['typeOfGrid'])
 *             else:
 *                inventory.append(':'+self['gridType'])             # <<<<<<<<<<<<<<
 *         if self.valid_key('typeOfLevel'):
 *             inventory.append(':'+self['typeOfLevel'])
 */
    /*else*/ {
      __pyx_t_4 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_gridType); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 873, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_2 = PyNumber_Add(__pyx_kp_s__20, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 873, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_5 = __Pyx_PyList_Append(__pyx_v_inventory, __pyx_t_2); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 873, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    }
    __pyx_L11:;

    /* "pygrib.pyx":869
 *         if self.valid_key('stepType'):
 *             inventory.append(' ('+self['stepType']+')')
 *         if self.valid_key('typeOfGrid') or self.valid_key('gridType'):             # <<<<<<<<<<<<<<
 *             if self.valid_key('typeOfGrid'):
 *                inventory.append(':'+self['typeOfGrid'])
 */
  }

  /* "pygrib.pyx":874
 *             else:
 *                inventory.append(':'+self['gridType'])
 *         if self.valid_key('typeOfLevel'):             # <<<<<<<<<<<<<<
 *             inventory.append(':'+self['typeOfLevel'])
 *         if self.valid_key('topLevel') and self.valid_key('bottomLevel'):
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_valid_key); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 874, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__30, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 874, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 874, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__pyx_t_3) {

    /* "pygrib.pyx":875
 *                inventory.append(':'+self['gridType'])
 *         if self.valid_key('typeOfLevel'):
 *             inventory.append(':'+self['typeOfLevel'])             # <<<<<<<<<<<<<<
 *         if self.valid_key('topLevel') and self.valid_key('bottomLevel'):
 *             toplev = None; botlev = None
 */
    __pyx_t_4 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_typeOfLevel); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 875, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_2 = PyNumber_Add(__pyx_kp_s__20, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 875, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_5 = __Pyx_PyList_Append(__pyx_v_inventory, __pyx_t_2); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 875, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "pygrib.pyx":874
 *             else:
 *                inventory.append(':'+self['gridType'])
 *         if self.valid_key('typeOfLevel'):             # <<<<<<<<<<<<<<
 *             inventory.append(':'+self['typeOfLevel'])
 *         if self.valid_key('topLevel') and self.valid_key('bottomLevel'):
 */
  }

  /* "pygrib.pyx":876
 *         if self.valid_key('typeOfLevel'):
 *             inventory.append(':'+self['typeOfLevel'])
 *         if self.valid_key('topLevel') and self.valid_key('bottomLevel'):             # <<<<<<<<<<<<<<
 *             toplev = None; botlev = None
 *             levunits = 'unknown'
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_valid_key); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 876, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__31, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 876, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 876, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__pyx_t_6) {
  } else {
    __pyx_t_3 = __pyx_t_6;
    goto __pyx_L14_bool_binop_done;
  }
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_valid_key); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 876, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_tuple__32, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 876, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 876, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_3 = __pyx_t_6;
  __pyx_L14_bool_binop_done:;
  if (__pyx_t_3) {

    /* "pygrib.pyx":877
 *             inventory.append(':'+self['typeOfLevel'])
 *         if self.valid_key('topLevel') and self.valid_key('bottomLevel'):
 *             toplev = None; botlev = None             # <<<<<<<<<<<<<<
 *             levunits = 'unknown'
 *             if self.valid_key('unitsOfFirstFixedSurface'):
 */
    __Pyx_INCREF(Py_None);
    __pyx_v_toplev = Py_None;
    __Pyx_INCREF(Py_None);
    __pyx_v_botlev = Py_None;

    /* "pygrib.pyx":878
 *         if self.valid_key('topLevel') and self.valid_key('bottomLevel'):
 *             toplev = None; botlev = None
 *             levunits = 'unknown'             # <<<<<<<<<<<<<<
 *             if self.valid_key('unitsOfFirstFixedSurface'):
 *                 levunits = self['unitsOfFirstFixedSurface']
 */
    __Pyx_INCREF(__pyx_n_s_unknown);
    __pyx_v_levunits = __pyx_n_s_unknown;

    /* "pygrib.pyx":879
 *             toplev = None; botlev = None
 *             levunits = 'unknown'
 *             if self.valid_key('unitsOfFirstFixedSurface'):             # <<<<<<<<<<<<<<
 *                 levunits = self['unitsOfFirstFixedSurface']
 *             if self.valid_key('typeOfFirstFixedSurface') and self['typeOfFirstFixedSurface'] != 255:
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_valid_key); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 879, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__33, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 879, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 879, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (__pyx_t_3) {

      /* "pygrib.pyx":880
 *             levunits = 'unknown'
 *             if self.valid_key('unitsOfFirstFixedSurface'):
 *                 levunits = self['unitsOfFirstFixedSurface']             # <<<<<<<<<<<<<<
 *             if self.valid_key('typeOfFirstFixedSurface') and self['typeOfFirstFixedSurface'] != 255:
 *                 toplev = self['topLevel']
 */
      __pyx_t_4 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_unitsOfFirstFixedSurface); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 880, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF_SET(__pyx_v_levunits, __pyx_t_4);
      __pyx_t_4 = 0;

      /* "pygrib.pyx":879
 *             toplev = None; botlev = None
 *             levunits = 'unknown'
 *             if self.valid_key('unitsOfFirstFixedSurface'):             # <<<<<<<<<<<<<<
 *                 levunits = self['unitsOfFirstFixedSurface']
 *             if self.valid_key('typeOfFirstFixedSurface') and self['typeOfFirstFixedSurface'] != 255:
 */
    }

    /* "pygrib.pyx":881
 *             if self.valid_key('unitsOfFirstFixedSurface'):
 *                 levunits = self['unitsOfFirstFixedSurface']
 *             if self.valid_key('typeOfFirstFixedSurface') and self['typeOfFirstFixedSurface'] != 255:             # <<<<<<<<<<<<<<
 *                 toplev = self['topLevel']
 *                 if self.valid_key('scaledValueOfFirstFixedSurface') and\
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_valid_key); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 881, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_tuple__34, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 881, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 881, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__pyx_t_6) {
    } else {
      __pyx_t_3 = __pyx_t_6;
      goto __pyx_L18_bool_binop_done;
    }
    __pyx_t_2 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_typeOfFirstFixedSurface); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 881, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = PyObject_RichCompare(__pyx_t_2, __pyx_int_255, Py_NE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 881, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 881, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_3 = __pyx_t_6;
    __pyx_L18_bool_binop_done:;
    if (__pyx_t_3) {

      /* "pygrib.pyx":882
 *                 levunits = self['unitsOfFirstFixedSurface']
 *             if self.valid_key('typeOfFirstFixedSurface') and self['typeOfFirstFixedSurface'] != 255:
 *                 toplev = self['topLevel']             # <<<<<<<<<<<<<<
 *                 if self.valid_key('scaledValueOfFirstFixedSurface') and\
 *                    self.valid_key('scaleFactorOfFirstFixedSurface'):
 */
      __pyx_t_4 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_topLevel); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 882, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF_SET(__pyx_v_toplev, __pyx_t_4);
      __pyx_t_4 = 0;

      /* "pygrib.pyx":883
 *             if self.valid_key('typeOfFirstFixedSurface') and self['typeOfFirstFixedSurface'] != 255:
 *                 toplev = self['topLevel']
 *                 if self.valid_key('scaledValueOfFirstFixedSurface') and\             # <<<<<<<<<<<<<<
 *                    self.valid_key('scaleFactorOfFirstFixedSurface'):
 *                    if self['scaleFactorOfFirstFixedSurface']:
 */
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_valid_key); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 883, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_tuple__35, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 883, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 883, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (__pyx_t_6) {
      } else {
        __pyx_t_3 = __pyx_t_6;
        goto __pyx_L21_bool_binop_done;
      }

      /* "pygrib.pyx":884
 *                 toplev = self['topLevel']
 *                 if self.valid_key('scaledValueOfFirstFixedSurface') and\
 *                    self.valid_key('scaleFactorOfFirstFixedSurface'):             # <<<<<<<<<<<<<<
 *                    if self['scaleFactorOfFirstFixedSurface']:
 *                        toplev = self['scaledValueOfFirstFixedSurface']/\
 */
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_valid_key); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 884, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__36, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 884, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 884, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_3 = __pyx_t_6;
      __pyx_L21_bool_binop_done:;

      /* "pygrib.pyx":883
 *             if self.valid_key('typeOfFirstFixedSurface') and self['typeOfFirstFixedSurface'] != 255:
 *                 toplev = self['topLevel']
 *                 if self.valid_key('scaledValueOfFirstFixedSurface') and\             # <<<<<<<<<<<<<<
 *                    self.valid_key('scaleFactorOfFirstFixedSurface'):
 *                    if self['scaleFactorOfFirstFixedSurface']:
 */
      if (__pyx_t_3) {

        /* "pygrib.pyx":885
 *                 if self.valid_key('scaledValueOfFirstFixedSurface') and\
 *                    self.valid_key('scaleFactorOfFirstFixedSurface'):
 *                    if self['scaleFactorOfFirstFixedSurface']:             # <<<<<<<<<<<<<<
 *                        toplev = self['scaledValueOfFirstFixedSurface']/\
 *                                 np.power(10.0,self['scaleFactorOfFirstFixedSurface'])
 */
        __pyx_t_4 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_scaleFactorOfFirstFixedSurface); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 885, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 885, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (__pyx_t_3) {

          /* "pygrib.pyx":886
 *                    self.valid_key('scaleFactorOfFirstFixedSurface'):
 *                    if self['scaleFactorOfFirstFixedSurface']:
 *                        toplev = self['scaledValueOfFirstFixedSurface']/\             # <<<<<<<<<<<<<<
 *                                 np.power(10.0,self['scaleFactorOfFirstFixedSurface'])
 *                    else:
 */
          __pyx_t_4 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_scaledValueOfFirstFixedSurface); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 886, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);

          /* "pygrib.pyx":887
 *                    if self['scaleFactorOfFirstFixedSurface']:
 *                        toplev = self['scaledValueOfFirstFixedSurface']/\
 *                                 np.power(10.0,self['scaleFactorOfFirstFixedSurface'])             # <<<<<<<<<<<<<<
 *                    else:
 *                        toplev = self['scaledValueOfFirstFixedSurface']
 */
          __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 887, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_power); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 887, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __pyx_t_1 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_scaleFactorOfFirstFixedSurface); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 887, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          __pyx_t_8 = NULL;
          __pyx_t_9 = 0;
          if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
            __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
            if (likely(__pyx_t_8)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
              __Pyx_INCREF(__pyx_t_8);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_7, function);
              __pyx_t_9 = 1;
            }
          }
          #if CYTHON_FAST_PYCALL
          if (PyFunction_Check(__pyx_t_7)) {
            PyObject *__pyx_temp[3] = {__pyx_t_8, __pyx_float_10_0, __pyx_t_1};
            __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 887, __pyx_L1_error)
            __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
            __Pyx_GOTREF(__pyx_t_2);
            __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          } else
          #endif
          #if CYTHON_FAST_PYCCALL
          if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) {
            PyObject *__pyx_temp[3] = {__pyx_t_8, __pyx_float_10_0, __pyx_t_1};
            __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 887, __pyx_L1_error)
            __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
            __Pyx_GOTREF(__pyx_t_2);
            __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          } else
          #endif
          {
            __pyx_t_10 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 887, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_10);
            if (__pyx_t_8) {
              __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_8); __pyx_t_8 = NULL;
            }
            __Pyx_INCREF(__pyx_float_10_0);
            __Pyx_GIVEREF(__pyx_float_10_0);
            PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_9, __pyx_float_10_0);
            __Pyx_GIVEREF(__pyx_t_1);
            PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_9, __pyx_t_1);
            __pyx_t_1 = 0;
            __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_10, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 887, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_2);
            __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
          }
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

          /* "pygrib.pyx":886
 *                    self.valid_key('scaleFactorOfFirstFixedSurface'):
 *                    if self['scaleFactorOfFirstFixedSurface']:
 *                        toplev = self['scaledValueOfFirstFixedSurface']/\             # <<<<<<<<<<<<<<
 *                                 np.power(10.0,self['scaleFactorOfFirstFixedSurface'])
 *                    else:
 */
          __pyx_t_7 = __Pyx_PyNumber_Divide(__pyx_t_4, __pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 886, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_DECREF_SET(__pyx_v_toplev, __pyx_t_7);
          __pyx_t_7 = 0;

          /* "pygrib.pyx":885
 *                 if self.valid_key('scaledValueOfFirstFixedSurface') and\
 *                    self.valid_key('scaleFactorOfFirstFixedSurface'):
 *                    if self['scaleFactorOfFirstFixedSurface']:             # <<<<<<<<<<<<<<
 *                        toplev = self['scaledValueOfFirstFixedSurface']/\
 *                                 np.power(10.0,self['scaleFactorOfFirstFixedSurface'])
 */
          goto __pyx_L23;
        }

        /* "pygrib.pyx":889
 *                                 np.power(10.0,self['scaleFactorOfFirstFixedSurface'])
 *                    else:
 *                        toplev = self['scaledValueOfFirstFixedSurface']             # <<<<<<<<<<<<<<
 *             if self.valid_key('typeOfSecondFixedSurface') and self['typeOfSecondFixedSurface'] != 255:
 *                 botlev = self['bottomLevel']
 */
        /*else*/ {
          __pyx_t_7 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_scaledValueOfFirstFixedSurface); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 889, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_DECREF_SET(__pyx_v_toplev, __pyx_t_7);
          __pyx_t_7 = 0;
        }
        __pyx_L23:;

        /* "pygrib.pyx":883
 *             if self.valid_key('typeOfFirstFixedSurface') and self['typeOfFirstFixedSurface'] != 255:
 *                 toplev = self['topLevel']
 *                 if self.valid_key('scaledValueOfFirstFixedSurface') and\             # <<<<<<<<<<<<<<
 *                    self.valid_key('scaleFactorOfFirstFixedSurface'):
 *                    if self['scaleFactorOfFirstFixedSurface']:
 */
      }

      /* "pygrib.pyx":881
 *             if self.valid_key('unitsOfFirstFixedSurface'):
 *                 levunits = self['unitsOfFirstFixedSurface']
 *             if self.valid_key('typeOfFirstFixedSurface') and self['typeOfFirstFixedSurface'] != 255:             # <<<<<<<<<<<<<<
 *                 toplev = self['topLevel']
 *                 if self.valid_key('scaledValueOfFirstFixedSurface') and\
 */
    }

    /* "pygrib.pyx":890
 *                    else:
 *                        toplev = self['scaledValueOfFirstFixedSurface']
 *             if self.valid_key('typeOfSecondFixedSurface') and self['typeOfSecondFixedSurface'] != 255:             # <<<<<<<<<<<<<<
 *                 botlev = self['bottomLevel']
 *                 if self.valid_key('scaledValueOfSecondFixedSurface') and\
 */
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_valid_key); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 890, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_tuple__37, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 890, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 890, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__pyx_t_6) {
    } else {
      __pyx_t_3 = __pyx_t_6;
      goto __pyx_L25_bool_binop_done;
    }
    __pyx_t_2 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_typeOfSecondFixedSurface); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 890, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_7 = PyObject_RichCompare(__pyx_t_2, __pyx_int_255, Py_NE); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 890, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 890, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_3 = __pyx_t_6;
    __pyx_L25_bool_binop_done:;
    if (__pyx_t_3) {

      /* "pygrib.pyx":891
 *                        toplev = self['scaledValueOfFirstFixedSurface']
 *             if self.valid_key('typeOfSecondFixedSurface') and self['typeOfSecondFixedSurface'] != 255:
 *                 botlev = self['bottomLevel']             # <<<<<<<<<<<<<<
 *                 if self.valid_key('scaledValueOfSecondFixedSurface') and\
 *                    self.valid_key('scaleFactorOfSecondFixedSurface'):
 */
      __pyx_t_7 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_bottomLevel); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 891, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF_SET(__pyx_v_botlev, __pyx_t_7);
      __pyx_t_7 = 0;

      /* "pygrib.pyx":892
 *             if self.valid_key('typeOfSecondFixedSurface') and self['typeOfSecondFixedSurface'] != 255:
 *                 botlev = self['bottomLevel']
 *                 if self.valid_key('scaledValueOfSecondFixedSurface') and\             # <<<<<<<<<<<<<<
 *                    self.valid_key('scaleFactorOfSecondFixedSurface'):
 *                    if self['scaleFactorOfSecondFixedSurface']:
 */
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_valid_key); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 892, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_tuple__38, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 892, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 892, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (__pyx_t_6) {
      } else {
        __pyx_t_3 = __pyx_t_6;
        goto __pyx_L28_bool_binop_done;
      }

      /* "pygrib.pyx":893
 *                 botlev = self['bottomLevel']
 *                 if self.valid_key('scaledValueOfSecondFixedSurface') and\
 *                    self.valid_key('scaleFactorOfSecondFixedSurface'):             # <<<<<<<<<<<<<<
 *                    if self['scaleFactorOfSecondFixedSurface']:
 *                        botlev = self['scaledValueOfSecondFixedSurface']/\
 */
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_valid_key); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 893, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__39, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 893, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 893, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_3 = __pyx_t_6;
      __pyx_L28_bool_binop_done:;

      /* "pygrib.pyx":892
 *             if self.valid_key('typeOfSecondFixedSurface') and self['typeOfSecondFixedSurface'] != 255:
 *                 botlev = self['bottomLevel']
 *                 if self.valid_key('scaledValueOfSecondFixedSurface') and\             # <<<<<<<<<<<<<<
 *                    self.valid_key('scaleFactorOfSecondFixedSurface'):
 *                    if self['scaleFactorOfSecondFixedSurface']:
 */
      if (__pyx_t_3) {

        /* "pygrib.pyx":894
 *                 if self.valid_key('scaledValueOfSecondFixedSurface') and\
 *                    self.valid_key('scaleFactorOfSecondFixedSurface'):
 *                    if self['scaleFactorOfSecondFixedSurface']:             # <<<<<<<<<<<<<<
 *                        botlev = self['scaledValueOfSecondFixedSurface']/\
 *                                 np.power(10.0,self['scaleFactorOfSecondFixedSurface'])
 */
        __pyx_t_7 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_scaleFactorOfSecondFixedSurface); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 894, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 894, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        if (__pyx_t_3) {

          /* "pygrib.pyx":895
 *                    self.valid_key('scaleFactorOfSecondFixedSurface'):
 *                    if self['scaleFactorOfSecondFixedSurface']:
 *                        botlev = self['scaledValueOfSecondFixedSurface']/\             # <<<<<<<<<<<<<<
 *                                 np.power(10.0,self['scaleFactorOfSecondFixedSurface'])
 *                    else:
 */
          __pyx_t_7 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_scaledValueOfSecondFixedSurface); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 895, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);

          /* "pygrib.pyx":896
 *                    if self['scaleFactorOfSecondFixedSurface']:
 *                        botlev = self['scaledValueOfSecondFixedSurface']/\
 *                                 np.power(10.0,self['scaleFactorOfSecondFixedSurface'])             # <<<<<<<<<<<<<<
 *                    else:
 *                        botlev = self['scaledValueOfSecondFixedSurface']
 */
          __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 896, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_power); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 896, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_10);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __pyx_t_4 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_scaleFactorOfSecondFixedSurface); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 896, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __pyx_t_1 = NULL;
          __pyx_t_9 = 0;
          if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_10))) {
            __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_10);
            if (likely(__pyx_t_1)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
              __Pyx_INCREF(__pyx_t_1);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_10, function);
              __pyx_t_9 = 1;
            }
          }
          #if CYTHON_FAST_PYCALL
          if (PyFunction_Check(__pyx_t_10)) {
            PyObject *__pyx_temp[3] = {__pyx_t_1, __pyx_float_10_0, __pyx_t_4};
            __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 896, __pyx_L1_error)
            __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
            __Pyx_GOTREF(__pyx_t_2);
            __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          } else
          #endif
          #if CYTHON_FAST_PYCCALL
          if (__Pyx_PyFastCFunction_Check(__pyx_t_10)) {
            PyObject *__pyx_temp[3] = {__pyx_t_1, __pyx_float_10_0, __pyx_t_4};
            __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 896, __pyx_L1_error)
            __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
            __Pyx_GOTREF(__pyx_t_2);
            __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          } else
          #endif
          {
            __pyx_t_8 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 896, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_8);
            if (__pyx_t_1) {
              __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_1); __pyx_t_1 = NULL;
            }
            __Pyx_INCREF(__pyx_float_10_0);
            __Pyx_GIVEREF(__pyx_float_10_0);
            PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_9, __pyx_float_10_0);
            __Pyx_GIVEREF(__pyx_t_4);
            PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_9, __pyx_t_4);
            __pyx_t_4 = 0;
            __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_8, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 896, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_2);
            __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
          }
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;

          /* "pygrib.pyx":895
 *                    self.valid_key('scaleFactorOfSecondFixedSurface'):
 *                    if self['scaleFactorOfSecondFixedSurface']:
 *                        botlev = self['scaledValueOfSecondFixedSurface']/\             # <<<<<<<<<<<<<<
 *                                 np.power(10.0,self['scaleFactorOfSecondFixedSurface'])
 *                    else:
 */
          __pyx_t_10 = __Pyx_PyNumber_Divide(__pyx_t_7, __pyx_t_2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 895, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_10);
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_DECREF_SET(__pyx_v_botlev, __pyx_t_10);
          __pyx_t_10 = 0;

          /* "pygrib.pyx":894
 *                 if self.valid_key('scaledValueOfSecondFixedSurface') and\
 *                    self.valid_key('scaleFactorOfSecondFixedSurface'):
 *                    if self['scaleFactorOfSecondFixedSurface']:             # <<<<<<<<<<<<<<
 *                        botlev = self['scaledValueOfSecondFixedSurface']/\
 *                                 np.power(10.0,self['scaleFactorOfSecondFixedSurface'])
 */
          goto __pyx_L30;
        }

        /* "pygrib.pyx":898
 *                                 np.power(10.0,self['scaleFactorOfSecondFixedSurface'])
 *                    else:
 *                        botlev = self['scaledValueOfSecondFixedSurface']             # <<<<<<<<<<<<<<
 *             levstring = None
 *             if botlev is None or toplev == botlev:
 */
        /*else*/ {
          __pyx_t_10 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_scaledValueOfSecondFixedSurface); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 898, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_10);
          __Pyx_DECREF_SET(__pyx_v_botlev, __pyx_t_10);
          __pyx_t_10 = 0;
        }
        __pyx_L30:;

        /* "pygrib.pyx":892
 *             if self.valid_key('typeOfSecondFixedSurface') and self['typeOfSecondFixedSurface'] != 255:
 *                 botlev = self['bottomLevel']
 *                 if self.valid_key('scaledValueOfSecondFixedSurface') and\             # <<<<<<<<<<<<<<
 *                    self.valid_key('scaleFactorOfSecondFixedSurface'):
 *                    if self['scaleFactorOfSecondFixedSurface']:
 */
      }

      /* "pygrib.pyx":890
 *                    else:
 *                        toplev = self['scaledValueOfFirstFixedSurface']
 *             if self.valid_key('typeOfSecondFixedSurface') and self['typeOfSecondFixedSurface'] != 255:             # <<<<<<<<<<<<<<
 *                 botlev = self['bottomLevel']
 *                 if self.valid_key('scaledValueOfSecondFixedSurface') and\
 */
    }

    /* "pygrib.pyx":899
 *                    else:
 *                        botlev = self['scaledValueOfSecondFixedSurface']
 *             levstring = None             # <<<<<<<<<<<<<<
 *             if botlev is None or toplev == botlev:
 *                 levstring = ':level %s' % toplev
 */
    __Pyx_INCREF(Py_None);
    __pyx_v_levstring = ((PyObject*)Py_None);

    /* "pygrib.pyx":900
 *                        botlev = self['scaledValueOfSecondFixedSurface']
 *             levstring = None
 *             if botlev is None or toplev == botlev:             # <<<<<<<<<<<<<<
 *                 levstring = ':level %s' % toplev
 *             else:
 */
    __pyx_t_6 = (__pyx_v_botlev == Py_None);
    __pyx_t_11 = (__pyx_t_6 != 0);
    if (!__pyx_t_11) {
    } else {
      __pyx_t_3 = __pyx_t_11;
      goto __pyx_L32_bool_binop_done;
    }
    __pyx_t_10 = PyObject_RichCompare(__pyx_v_toplev, __pyx_v_botlev, Py_EQ); __Pyx_XGOTREF(__pyx_t_10); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 900, __pyx_L1_error)
    __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 900, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __pyx_t_3 = __pyx_t_11;
    __pyx_L32_bool_binop_done:;
    if (__pyx_t_3) {

      /* "pygrib.pyx":901
 *             levstring = None
 *             if botlev is None or toplev == botlev:
 *                 levstring = ':level %s' % toplev             # <<<<<<<<<<<<<<
 *             else:
 *                 levstring = ':levels %s-%s' % (toplev,botlev)
 */
      __pyx_t_10 = __Pyx_PyString_Format(__pyx_kp_s_level_s, __pyx_v_toplev); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 901, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF_SET(__pyx_v_levstring, ((PyObject*)__pyx_t_10));
      __pyx_t_10 = 0;

      /* "pygrib.pyx":900
 *                        botlev = self['scaledValueOfSecondFixedSurface']
 *             levstring = None
 *             if botlev is None or toplev == botlev:             # <<<<<<<<<<<<<<
 *                 levstring = ':level %s' % toplev
 *             else:
 */
      goto __pyx_L31;
    }

    /* "pygrib.pyx":903
 *                 levstring = ':level %s' % toplev
 *             else:
 *                 levstring = ':levels %s-%s' % (toplev,botlev)             # <<<<<<<<<<<<<<
 *             if levunits != 'unknown':
 *                 levstring = levstring+' %s' % levunits
 */
    /*else*/ {
      __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 903, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_INCREF(__pyx_v_toplev);
      __Pyx_GIVEREF(__pyx_v_toplev);
      PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_v_toplev);
      __Pyx_INCREF(__pyx_v_botlev);
      __Pyx_GIVEREF(__pyx_v_botlev);
      PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_v_botlev);
      __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_levels_s_s, __pyx_t_10); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 903, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_DECREF_SET(__pyx_v_levstring, ((PyObject*)__pyx_t_2));
      __pyx_t_2 = 0;
    }
    __pyx_L31:;

    /* "pygrib.pyx":904
 *             else:
 *                 levstring = ':levels %s-%s' % (toplev,botlev)
 *             if levunits != 'unknown':             # <<<<<<<<<<<<<<
 *                 levstring = levstring+' %s' % levunits
 *             if levstring is not None:
 */
    __pyx_t_3 = (__Pyx_PyString_Equals(__pyx_v_levunits, __pyx_n_s_unknown, Py_NE)); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 904, __pyx_L1_error)
    if (__pyx_t_3) {

      /* "pygrib.pyx":905
 *                 levstring = ':levels %s-%s' % (toplev,botlev)
 *             if levunits != 'unknown':
 *                 levstring = levstring+' %s' % levunits             # <<<<<<<<<<<<<<
 *             if levstring is not None:
 *                 inventory.append(levstring)
 */
      __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_s, __pyx_v_levunits); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 905, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_10 = PyNumber_Add(__pyx_v_levstring, __pyx_t_2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 905, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF_SET(__pyx_v_levstring, ((PyObject*)__pyx_t_10));
      __pyx_t_10 = 0;

      /* "pygrib.pyx":904
 *             else:
 *                 levstring = ':levels %s-%s' % (toplev,botlev)
 *             if levunits != 'unknown':             # <<<<<<<<<<<<<<
 *                 levstring = levstring+' %s' % levunits
 *             if levstring is not None:
 */
    }

    /* "pygrib.pyx":906
 *             if levunits != 'unknown':
 *                 levstring = levstring+' %s' % levunits
 *             if levstring is not None:             # <<<<<<<<<<<<<<
 *                 inventory.append(levstring)
 *         elif self.valid_key('level'):
 */
    __pyx_t_3 = (__pyx_v_levstring != ((PyObject*)Py_None));
    __pyx_t_11 = (__pyx_t_3 != 0);
    if (__pyx_t_11) {

      /* "pygrib.pyx":907
 *                 levstring = levstring+' %s' % levunits
 *             if levstring is not None:
 *                 inventory.append(levstring)             # <<<<<<<<<<<<<<
 *         elif self.valid_key('level'):
 *             inventory.append(':level %s' % self['level'])
 */
      __pyx_t_5 = __Pyx_PyList_Append(__pyx_v_inventory, __pyx_v_levstring); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 907, __pyx_L1_error)

      /* "pygrib.pyx":906
 *             if levunits != 'unknown':
 *                 levstring = levstring+' %s' % levunits
 *             if levstring is not None:             # <<<<<<<<<<<<<<
 *                 inventory.append(levstring)
 *         elif self.valid_key('level'):
 */
    }

    /* "pygrib.pyx":876
 *         if self.valid_key('typeOfLevel'):
 *             inventory.append(':'+self['typeOfLevel'])
 *         if self.valid_key('topLevel') and self.valid_key('bottomLevel'):             # <<<<<<<<<<<<<<
 *             toplev = None; botlev = None
 *             levunits = 'unknown'
 */
    goto __pyx_L13;
  }

  /* "pygrib.pyx":908
 *             if levstring is not None:
 *                 inventory.append(levstring)
 *         elif self.valid_key('level'):             # <<<<<<<<<<<<<<
 *             inventory.append(':level %s' % self['level'])
 *         if self.has_key('stepRange'):
 */
  __pyx_t_10 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_valid_key); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 908, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_tuple__40, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 908, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 908, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_11) {

    /* "pygrib.pyx":909
 *                 inventory.append(levstring)
 *         elif self.valid_key('level'):
 *             inventory.append(':level %s' % self['level'])             # <<<<<<<<<<<<<<
 *         if self.has_key('stepRange'):
 *             ftime = self['stepRange'] # computed key, uses stepUnits
 */
    __pyx_t_2 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_level); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 909, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_10 = __Pyx_PyString_Format(__pyx_kp_s_level_s, __pyx_t_2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 909, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_5 = __Pyx_PyList_Append(__pyx_v_inventory, __pyx_t_10); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 909, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;

    /* "pygrib.pyx":908
 *             if levstring is not None:
 *                 inventory.append(levstring)
 *         elif self.valid_key('level'):             # <<<<<<<<<<<<<<
 *             inventory.append(':level %s' % self['level'])
 *         if self.has_key('stepRange'):
 */
  }
  __pyx_L13:;

  /* "pygrib.pyx":910
 *         elif self.valid_key('level'):
 *             inventory.append(':level %s' % self['level'])
 *         if self.has_key('stepRange'):             # <<<<<<<<<<<<<<
 *             ftime = self['stepRange'] # computed key, uses stepUnits
 *             if self.valid_key('stepType') and self['stepType'] != 'instant':
 */
  __pyx_t_10 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_has_key); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 910, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_tuple__41, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 910, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 910, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_11) {

    /* "pygrib.pyx":911
 *             inventory.append(':level %s' % self['level'])
 *         if self.has_key('stepRange'):
 *             ftime = self['stepRange'] # computed key, uses stepUnits             # <<<<<<<<<<<<<<
 *             if self.valid_key('stepType') and self['stepType'] != 'instant':
 *                 inventory.append(':fcst time %s %s (%s)'%\
 */
    __pyx_t_2 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_stepRange); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 911, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_v_ftime = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "pygrib.pyx":912
 *         if self.has_key('stepRange'):
 *             ftime = self['stepRange'] # computed key, uses stepUnits
 *             if self.valid_key('stepType') and self['stepType'] != 'instant':             # <<<<<<<<<<<<<<
 *                 inventory.append(':fcst time %s %s (%s)'%\
 *                     (ftime,self.fcstimeunits,self.stepType))
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_valid_key); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 912, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__42, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 912, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 912, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    if (__pyx_t_3) {
    } else {
      __pyx_t_11 = __pyx_t_3;
      goto __pyx_L38_bool_binop_done;
    }
    __pyx_t_10 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_stepType); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 912, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_3 = (__Pyx_PyString_Equals(__pyx_t_10, __pyx_n_s_instant, Py_NE)); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 912, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __pyx_t_11 = __pyx_t_3;
    __pyx_L38_bool_binop_done:;
    if (__pyx_t_11) {

      /* "pygrib.pyx":914
 *             if self.valid_key('stepType') and self['stepType'] != 'instant':
 *                 inventory.append(':fcst time %s %s (%s)'%\
 *                     (ftime,self.fcstimeunits,self.stepType))             # <<<<<<<<<<<<<<
 *             else:
 *                 inventory.append(':fcst time %s %s'% (ftime,self.fcstimeunits))
 */
      __pyx_t_10 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_stepType); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 914, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 914, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_INCREF(__pyx_v_ftime);
      __Pyx_GIVEREF(__pyx_v_ftime);
      PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_ftime);
      __Pyx_INCREF(__pyx_v_self->fcstimeunits);
      __Pyx_GIVEREF(__pyx_v_self->fcstimeunits);
      PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_self->fcstimeunits);
      __Pyx_GIVEREF(__pyx_t_10);
      PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_10);
      __pyx_t_10 = 0;

      /* "pygrib.pyx":913
 *             ftime = self['stepRange'] # computed key, uses stepUnits
 *             if self.valid_key('stepType') and self['stepType'] != 'instant':
 *                 inventory.append(':fcst time %s %s (%s)'%\             # <<<<<<<<<<<<<<
 *                     (ftime,self.fcstimeunits,self.stepType))
 *             else:
 */
      __pyx_t_10 = __Pyx_PyString_Format(__pyx_kp_s_fcst_time_s_s_s, __pyx_t_2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 913, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_5 = __Pyx_PyList_Append(__pyx_v_inventory, __pyx_t_10); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 913, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;

      /* "pygrib.pyx":912
 *         if self.has_key('stepRange'):
 *             ftime = self['stepRange'] # computed key, uses stepUnits
 *             if self.valid_key('stepType') and self['stepType'] != 'instant':             # <<<<<<<<<<<<<<
 *                 inventory.append(':fcst time %s %s (%s)'%\
 *                     (ftime,self.fcstimeunits,self.stepType))
 */
      goto __pyx_L37;
    }

    /* "pygrib.pyx":916
 *                     (ftime,self.fcstimeunits,self.stepType))
 *             else:
 *                 inventory.append(':fcst time %s %s'% (ftime,self.fcstimeunits))             # <<<<<<<<<<<<<<
 *         elif self.valid_key('forecastTime'):
 *             ftime = repr(self['forecastTime'])
 */
    /*else*/ {
      __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 916, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_INCREF(__pyx_v_ftime);
      __Pyx_GIVEREF(__pyx_v_ftime);
      PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_v_ftime);
      __Pyx_INCREF(__pyx_v_self->fcstimeunits);
      __Pyx_GIVEREF(__pyx_v_self->fcstimeunits);
      PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_v_self->fcstimeunits);
      __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_fcst_time_s_s, __pyx_t_10); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 916, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __pyx_t_5 = __Pyx_PyList_Append(__pyx_v_inventory, __pyx_t_2); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 916, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    }
    __pyx_L37:;

    /* "pygrib.pyx":910
 *         elif self.valid_key('level'):
 *             inventory.append(':level %s' % self['level'])
 *         if self.has_key('stepRange'):             # <<<<<<<<<<<<<<
 *             ftime = self['stepRange'] # computed key, uses stepUnits
 *             if self.valid_key('stepType') and self['stepType'] != 'instant':
 */
    goto __pyx_L36;
  }

  /* "pygrib.pyx":917
 *             else:
 *                 inventory.append(':fcst time %s %s'% (ftime,self.fcstimeunits))
 *         elif self.valid_key('forecastTime'):             # <<<<<<<<<<<<<<
 *             ftime = repr(self['forecastTime'])
 *             inventory.append(':fcst time %s %s'% (ftime,self.fcstimeunits))
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_valid_key); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 917, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__43, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 917, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 917, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  if (__pyx_t_11) {

    /* "pygrib.pyx":918
 *                 inventory.append(':fcst time %s %s'% (ftime,self.fcstimeunits))
 *         elif self.valid_key('forecastTime'):
 *             ftime = repr(self['forecastTime'])             # <<<<<<<<<<<<<<
 *             inventory.append(':fcst time %s %s'% (ftime,self.fcstimeunits))
 *         if self.valid_key('dataDate') and self.valid_key('dataTime'):
 */
    __pyx_t_10 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_forecastTime); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 918, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_2 = PyObject_Repr(__pyx_t_10); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 918, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __pyx_v_ftime = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "pygrib.pyx":919
 *         elif self.valid_key('forecastTime'):
 *             ftime = repr(self['forecastTime'])
 *             inventory.append(':fcst time %s %s'% (ftime,self.fcstimeunits))             # <<<<<<<<<<<<<<
 *         if self.valid_key('dataDate') and self.valid_key('dataTime'):
 *             inventory.append(
 */
    __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 919, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_v_ftime);
    __Pyx_GIVEREF(__pyx_v_ftime);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_ftime);
    __Pyx_INCREF(__pyx_v_self->fcstimeunits);
    __Pyx_GIVEREF(__pyx_v_self->fcstimeunits);
    PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_self->fcstimeunits);
    __pyx_t_10 = __Pyx_PyString_Format(__pyx_kp_s_fcst_time_s_s, __pyx_t_2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 919, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_5 = __Pyx_PyList_Append(__pyx_v_inventory, __pyx_t_10); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 919, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;

    /* "pygrib.pyx":917
 *             else:
 *                 inventory.append(':fcst time %s %s'% (ftime,self.fcstimeunits))
 *         elif self.valid_key('forecastTime'):             # <<<<<<<<<<<<<<
 *             ftime = repr(self['forecastTime'])
 *             inventory.append(':fcst time %s %s'% (ftime,self.fcstimeunits))
 */
  }
  __pyx_L36:;

  /* "pygrib.pyx":920
 *             ftime = repr(self['forecastTime'])
 *             inventory.append(':fcst time %s %s'% (ftime,self.fcstimeunits))
 *         if self.valid_key('dataDate') and self.valid_key('dataTime'):             # <<<<<<<<<<<<<<
 *             inventory.append(
 *             ':from '+repr(self['dataDate'])+'%04i' % self['dataTime'])
 */
  __pyx_t_10 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_valid_key); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 920, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_tuple__44, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 920, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 920, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_3) {
  } else {
    __pyx_t_11 = __pyx_t_3;
    goto __pyx_L41_bool_binop_done;
  }
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_valid_key); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 920, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__45, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 920, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 920, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_t_11 = __pyx_t_3;
  __pyx_L41_bool_binop_done:;
  if (__pyx_t_11) {

    /* "pygrib.pyx":922
 *         if self.valid_key('dataDate') and self.valid_key('dataTime'):
 *             inventory.append(
 *             ':from '+repr(self['dataDate'])+'%04i' % self['dataTime'])             # <<<<<<<<<<<<<<
 *         #if self.valid_key('validityDate') and self.valid_key('validityTime'):
 *         #    inventory.append(
 */
    __pyx_t_10 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_dataDate); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 922, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_2 = PyObject_Repr(__pyx_t_10); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 922, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __pyx_t_10 = PyNumber_Add(__pyx_kp_s_from, __pyx_t_2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 922, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_dataTime); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 922, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_7 = __Pyx_PyString_Format(__pyx_kp_s_04i, __pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 922, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyNumber_Add(__pyx_t_10, __pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 922, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

    /* "pygrib.pyx":921
 *             inventory.append(':fcst time %s %s'% (ftime,self.fcstimeunits))
 *         if self.valid_key('dataDate') and self.valid_key('dataTime'):
 *             inventory.append(             # <<<<<<<<<<<<<<
 *             ':from '+repr(self['dataDate'])+'%04i' % self['dataTime'])
 *         #if self.valid_key('validityDate') and self.valid_key('validityTime'):
 */
    __pyx_t_5 = __Pyx_PyList_Append(__pyx_v_inventory, __pyx_t_2); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 921, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "pygrib.pyx":920
 *             ftime = repr(self['forecastTime'])
 *             inventory.append(':fcst time %s %s'% (ftime,self.fcstimeunits))
 *         if self.valid_key('dataDate') and self.valid_key('dataTime'):             # <<<<<<<<<<<<<<
 *             inventory.append(
 *             ':from '+repr(self['dataDate'])+'%04i' % self['dataTime'])
 */
  }

  /* "pygrib.pyx":926
 *         #    inventory.append(
 *         #    ':valid '+repr(self['validityDate'])+repr(self['validityTime']))
 *         if self.valid_key('perturbationNumber') and\             # <<<<<<<<<<<<<<
 *            self.valid_key('typeOfEnsembleForecast'):
 *             ens_type = self['typeOfEnsembleForecast']
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_valid_key); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 926, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__46, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 926, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 926, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (__pyx_t_3) {
  } else {
    __pyx_t_11 = __pyx_t_3;
    goto __pyx_L44_bool_binop_done;
  }

  /* "pygrib.pyx":927
 *         #    ':valid '+repr(self['validityDate'])+repr(self['validityTime']))
 *         if self.valid_key('perturbationNumber') and\
 *            self.valid_key('typeOfEnsembleForecast'):             # <<<<<<<<<<<<<<
 *             ens_type = self['typeOfEnsembleForecast']
 *             pert_num = self['perturbationNumber']
 */
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_valid_key); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 927, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_tuple__47, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 927, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 927, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_11 = __pyx_t_3;
  __pyx_L44_bool_binop_done:;

  /* "pygrib.pyx":926
 *         #    inventory.append(
 *         #    ':valid '+repr(self['validityDate'])+repr(self['validityTime']))
 *         if self.valid_key('perturbationNumber') and\             # <<<<<<<<<<<<<<
 *            self.valid_key('typeOfEnsembleForecast'):
 *             ens_type = self['typeOfEnsembleForecast']
 */
  if (__pyx_t_11) {

    /* "pygrib.pyx":928
 *         if self.valid_key('perturbationNumber') and\
 *            self.valid_key('typeOfEnsembleForecast'):
 *             ens_type = self['typeOfEnsembleForecast']             # <<<<<<<<<<<<<<
 *             pert_num = self['perturbationNumber']
 *             if ens_type == 0:
 */
    __pyx_t_2 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_typeOfEnsembleForecast); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 928, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_v_ens_type = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "pygrib.pyx":929
 *            self.valid_key('typeOfEnsembleForecast'):
 *             ens_type = self['typeOfEnsembleForecast']
 *             pert_num = self['perturbationNumber']             # <<<<<<<<<<<<<<
 *             if ens_type == 0:
 *                inventory.append(":lo res cntl fcst")
 */
    __pyx_t_2 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_perturbationNumber); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 929, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_v_pert_num = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "pygrib.pyx":930
 *             ens_type = self['typeOfEnsembleForecast']
 *             pert_num = self['perturbationNumber']
 *             if ens_type == 0:             # <<<<<<<<<<<<<<
 *                inventory.append(":lo res cntl fcst")
 *             elif ens_type == 1:
 */
    __pyx_t_2 = __Pyx_PyInt_EqObjC(__pyx_v_ens_type, __pyx_int_0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 930, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 930, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__pyx_t_11) {

      /* "pygrib.pyx":931
 *             pert_num = self['perturbationNumber']
 *             if ens_type == 0:
 *                inventory.append(":lo res cntl fcst")             # <<<<<<<<<<<<<<
 *             elif ens_type == 1:
 *                inventory.append(":hi res cntl fcst")
 */
      __pyx_t_5 = __Pyx_PyList_Append(__pyx_v_inventory, __pyx_kp_s_lo_res_cntl_fcst); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 931, __pyx_L1_error)

      /* "pygrib.pyx":930
 *             ens_type = self['typeOfEnsembleForecast']
 *             pert_num = self['perturbationNumber']
 *             if ens_type == 0:             # <<<<<<<<<<<<<<
 *                inventory.append(":lo res cntl fcst")
 *             elif ens_type == 1:
 */
      goto __pyx_L46;
    }

    /* "pygrib.pyx":932
 *             if ens_type == 0:
 *                inventory.append(":lo res cntl fcst")
 *             elif ens_type == 1:             # <<<<<<<<<<<<<<
 *                inventory.append(":hi res cntl fcst")
 *             elif ens_type == 2:
 */
    __pyx_t_2 = __Pyx_PyInt_EqObjC(__pyx_v_ens_type, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 932, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 932, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__pyx_t_11) {

      /* "pygrib.pyx":933
 *                inventory.append(":lo res cntl fcst")
 *             elif ens_type == 1:
 *                inventory.append(":hi res cntl fcst")             # <<<<<<<<<<<<<<
 *             elif ens_type == 2:
 *                inventory.append(":neg ens pert %d" % pert_num)
 */
      __pyx_t_5 = __Pyx_PyList_Append(__pyx_v_inventory, __pyx_kp_s_hi_res_cntl_fcst); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 933, __pyx_L1_error)

      /* "pygrib.pyx":932
 *             if ens_type == 0:
 *                inventory.append(":lo res cntl fcst")
 *             elif ens_type == 1:             # <<<<<<<<<<<<<<
 *                inventory.append(":hi res cntl fcst")
 *             elif ens_type == 2:
 */
      goto __pyx_L46;
    }

    /* "pygrib.pyx":934
 *             elif ens_type == 1:
 *                inventory.append(":hi res cntl fcst")
 *             elif ens_type == 2:             # <<<<<<<<<<<<<<
 *                inventory.append(":neg ens pert %d" % pert_num)
 *             elif ens_type == 3:
 */
    __pyx_t_2 = __Pyx_PyInt_EqObjC(__pyx_v_ens_type, __pyx_int_2, 2, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 934, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 934, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__pyx_t_11) {

      /* "pygrib.pyx":935
 *                inventory.append(":hi res cntl fcst")
 *             elif ens_type == 2:
 *                inventory.append(":neg ens pert %d" % pert_num)             # <<<<<<<<<<<<<<
 *             elif ens_type == 3:
 *                inventory.append(":pos ens pert %d" % pert_num)
 */
      __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_neg_ens_pert_d, __pyx_v_pert_num); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 935, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_5 = __Pyx_PyList_Append(__pyx_v_inventory, __pyx_t_2); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 935, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "pygrib.pyx":934
 *             elif ens_type == 1:
 *                inventory.append(":hi res cntl fcst")
 *             elif ens_type == 2:             # <<<<<<<<<<<<<<
 *                inventory.append(":neg ens pert %d" % pert_num)
 *             elif ens_type == 3:
 */
      goto __pyx_L46;
    }

    /* "pygrib.pyx":936
 *             elif ens_type == 2:
 *                inventory.append(":neg ens pert %d" % pert_num)
 *             elif ens_type == 3:             # <<<<<<<<<<<<<<
 *                inventory.append(":pos ens pert %d" % pert_num)
 *         if self.valid_key('derivedForecast'):
 */
    __pyx_t_2 = __Pyx_PyInt_EqObjC(__pyx_v_ens_type, __pyx_int_3, 3, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 936, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 936, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__pyx_t_11) {

      /* "pygrib.pyx":937
 *                inventory.append(":neg ens pert %d" % pert_num)
 *             elif ens_type == 3:
 *                inventory.append(":pos ens pert %d" % pert_num)             # <<<<<<<<<<<<<<
 *         if self.valid_key('derivedForecast'):
 *             if self['derivedForecast'] == 0:
 */
      __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_pos_ens_pert_d, __pyx_v_pert_num); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 937, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_5 = __Pyx_PyList_Append(__pyx_v_inventory, __pyx_t_2); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 937, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "pygrib.pyx":936
 *             elif ens_type == 2:
 *                inventory.append(":neg ens pert %d" % pert_num)
 *             elif ens_type == 3:             # <<<<<<<<<<<<<<
 *                inventory.append(":pos ens pert %d" % pert_num)
 *         if self.valid_key('derivedForecast'):
 */
    }
    __pyx_L46:;

    /* "pygrib.pyx":926
 *         #    inventory.append(
 *         #    ':valid '+repr(self['validityDate'])+repr(self['validityTime']))
 *         if self.valid_key('perturbationNumber') and\             # <<<<<<<<<<<<<<
 *            self.valid_key('typeOfEnsembleForecast'):
 *             ens_type = self['typeOfEnsembleForecast']
 */
  }

  /* "pygrib.pyx":938
 *             elif ens_type == 3:
 *                inventory.append(":pos ens pert %d" % pert_num)
 *         if self.valid_key('derivedForecast'):             # <<<<<<<<<<<<<<
 *             if self['derivedForecast'] == 0:
 *                 inventory.append(":ens mean")
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_valid_key); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 938, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__48, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 938, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 938, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (__pyx_t_11) {

    /* "pygrib.pyx":939
 *                inventory.append(":pos ens pert %d" % pert_num)
 *         if self.valid_key('derivedForecast'):
 *             if self['derivedForecast'] == 0:             # <<<<<<<<<<<<<<
 *                 inventory.append(":ens mean")
 *             elif self['derivedForecast'] == 1:
 */
    __pyx_t_7 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_derivedForecast); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 939, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_2 = __Pyx_PyInt_EqObjC(__pyx_t_7, __pyx_int_0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 939, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 939, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__pyx_t_11) {

      /* "pygrib.pyx":940
 *         if self.valid_key('derivedForecast'):
 *             if self['derivedForecast'] == 0:
 *                 inventory.append(":ens mean")             # <<<<<<<<<<<<<<
 *             elif self['derivedForecast'] == 1:
 *                 inventory.append(":weighted ens mean")
 */
      __pyx_t_5 = __Pyx_PyList_Append(__pyx_v_inventory, __pyx_kp_s_ens_mean); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 940, __pyx_L1_error)

      /* "pygrib.pyx":939
 *                inventory.append(":pos ens pert %d" % pert_num)
 *         if self.valid_key('derivedForecast'):
 *             if self['derivedForecast'] == 0:             # <<<<<<<<<<<<<<
 *                 inventory.append(":ens mean")
 *             elif self['derivedForecast'] == 1:
 */
      goto __pyx_L48;
    }

    /* "pygrib.pyx":941
 *             if self['derivedForecast'] == 0:
 *                 inventory.append(":ens mean")
 *             elif self['derivedForecast'] == 1:             # <<<<<<<<<<<<<<
 *                 inventory.append(":weighted ens mean")
 *             elif self['derivedForecast'] == 2:
 */
    __pyx_t_2 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_derivedForecast); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 941, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_7 = __Pyx_PyInt_EqObjC(__pyx_t_2, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 941, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 941, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (__pyx_t_11) {

      /* "pygrib.pyx":942
 *                 inventory.append(":ens mean")
 *             elif self['derivedForecast'] == 1:
 *                 inventory.append(":weighted ens mean")             # <<<<<<<<<<<<<<
 *             elif self['derivedForecast'] == 2:
 *                 inventory.append(":ens std dev")
 */
      __pyx_t_5 = __Pyx_PyList_Append(__pyx_v_inventory, __pyx_kp_s_weighted_ens_mean); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 942, __pyx_L1_error)

      /* "pygrib.pyx":941
 *             if self['derivedForecast'] == 0:
 *                 inventory.append(":ens mean")
 *             elif self['derivedForecast'] == 1:             # <<<<<<<<<<<<<<
 *                 inventory.append(":weighted ens mean")
 *             elif self['derivedForecast'] == 2:
 */
      goto __pyx_L48;
    }

    /* "pygrib.pyx":943
 *             elif self['derivedForecast'] == 1:
 *                 inventory.append(":weighted ens mean")
 *             elif self['derivedForecast'] == 2:             # <<<<<<<<<<<<<<
 *                 inventory.append(":ens std dev")
 *             elif self['derivedForecast'] == 3:
 */
    __pyx_t_7 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_derivedForecast); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 943, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_2 = __Pyx_PyInt_EqObjC(__pyx_t_7, __pyx_int_2, 2, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 943, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 943, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__pyx_t_11) {

      /* "pygrib.pyx":944
 *                 inventory.append(":weighted ens mean")
 *             elif self['derivedForecast'] == 2:
 *                 inventory.append(":ens std dev")             # <<<<<<<<<<<<<<
 *             elif self['derivedForecast'] == 3:
 *                 inventory.append(":normalized ens std dev")
 */
      __pyx_t_5 = __Pyx_PyList_Append(__pyx_v_inventory, __pyx_kp_s_ens_std_dev); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 944, __pyx_L1_error)

      /* "pygrib.pyx":943
 *             elif self['derivedForecast'] == 1:
 *                 inventory.append(":weighted ens mean")
 *             elif self['derivedForecast'] == 2:             # <<<<<<<<<<<<<<
 *                 inventory.append(":ens std dev")
 *             elif self['derivedForecast'] == 3:
 */
      goto __pyx_L48;
    }

    /* "pygrib.pyx":945
 *             elif self['derivedForecast'] == 2:
 *                 inventory.append(":ens std dev")
 *             elif self['derivedForecast'] == 3:             # <<<<<<<<<<<<<<
 *                 inventory.append(":normalized ens std dev")
 *             elif self['derivedForecast'] == 4:
 */
    __pyx_t_2 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_derivedForecast); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 945, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_7 = __Pyx_PyInt_EqObjC(__pyx_t_2, __pyx_int_3, 3, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 945, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 945, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (__pyx_t_11) {

      /* "pygrib.pyx":946
 *                 inventory.append(":ens std dev")
 *             elif self['derivedForecast'] == 3:
 *                 inventory.append(":normalized ens std dev")             # <<<<<<<<<<<<<<
 *             elif self['derivedForecast'] == 4:
 *                 inventory.append(":ens spread")
 */
      __pyx_t_5 = __Pyx_PyList_Append(__pyx_v_inventory, __pyx_kp_s_normalized_ens_std_dev); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 946, __pyx_L1_error)

      /* "pygrib.pyx":945
 *             elif self['derivedForecast'] == 2:
 *                 inventory.append(":ens std dev")
 *             elif self['derivedForecast'] == 3:             # <<<<<<<<<<<<<<
 *                 inventory.append(":normalized ens std dev")
 *             elif self['derivedForecast'] == 4:
 */
      goto __pyx_L48;
    }

    /* "pygrib.pyx":947
 *             elif self['derivedForecast'] == 3:
 *                 inventory.append(":normalized ens std dev")
 *             elif self['derivedForecast'] == 4:             # <<<<<<<<<<<<<<
 *                 inventory.append(":ens spread")
 *             elif self['derivedForecast'] == 5:
 */
    __pyx_t_7 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_derivedForecast); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 947, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_2 = __Pyx_PyInt_EqObjC(__pyx_t_7, __pyx_int_4, 4, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 947, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 947, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__pyx_t_11) {

      /* "pygrib.pyx":948
 *                 inventory.append(":normalized ens std dev")
 *             elif self['derivedForecast'] == 4:
 *                 inventory.append(":ens spread")             # <<<<<<<<<<<<<<
 *             elif self['derivedForecast'] == 5:
 *                 inventory.append(":ens large anomaly index")
 */
      __pyx_t_5 = __Pyx_PyList_Append(__pyx_v_inventory, __pyx_kp_s_ens_spread); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 948, __pyx_L1_error)

      /* "pygrib.pyx":947
 *             elif self['derivedForecast'] == 3:
 *                 inventory.append(":normalized ens std dev")
 *             elif self['derivedForecast'] == 4:             # <<<<<<<<<<<<<<
 *                 inventory.append(":ens spread")
 *             elif self['derivedForecast'] == 5:
 */
      goto __pyx_L48;
    }

    /* "pygrib.pyx":949
 *             elif self['derivedForecast'] == 4:
 *                 inventory.append(":ens spread")
 *             elif self['derivedForecast'] == 5:             # <<<<<<<<<<<<<<
 *                 inventory.append(":ens large anomaly index")
 *             elif self['derivedForecast'] == 6:
 */
    __pyx_t_2 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_derivedForecast); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 949, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_7 = __Pyx_PyInt_EqObjC(__pyx_t_2, __pyx_int_5, 5, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 949, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 949, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (__pyx_t_11) {

      /* "pygrib.pyx":950
 *                 inventory.append(":ens spread")
 *             elif self['derivedForecast'] == 5:
 *                 inventory.append(":ens large anomaly index")             # <<<<<<<<<<<<<<
 *             elif self['derivedForecast'] == 6:
 *                 inventory.append(":ens mean of cluster")
 */
      __pyx_t_5 = __Pyx_PyList_Append(__pyx_v_inventory, __pyx_kp_s_ens_large_anomaly_index); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 950, __pyx_L1_error)

      /* "pygrib.pyx":949
 *             elif self['derivedForecast'] == 4:
 *                 inventory.append(":ens spread")
 *             elif self['derivedForecast'] == 5:             # <<<<<<<<<<<<<<
 *                 inventory.append(":ens large anomaly index")
 *             elif self['derivedForecast'] == 6:
 */
      goto __pyx_L48;
    }

    /* "pygrib.pyx":951
 *             elif self['derivedForecast'] == 5:
 *                 inventory.append(":ens large anomaly index")
 *             elif self['derivedForecast'] == 6:             # <<<<<<<<<<<<<<
 *                 inventory.append(":ens mean of cluster")
 *         if self.valid_key('probabilityTypeName'):
 */
    __pyx_t_7 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_derivedForecast); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 951, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_2 = __Pyx_PyInt_EqObjC(__pyx_t_7, __pyx_int_6, 6, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 951, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 951, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__pyx_t_11) {

      /* "pygrib.pyx":952
 *                 inventory.append(":ens large anomaly index")
 *             elif self['derivedForecast'] == 6:
 *                 inventory.append(":ens mean of cluster")             # <<<<<<<<<<<<<<
 *         if self.valid_key('probabilityTypeName'):
 *             inventory.append(":"+self['probabilityTypeName'])
 */
      __pyx_t_5 = __Pyx_PyList_Append(__pyx_v_inventory, __pyx_kp_s_ens_mean_of_cluster); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 952, __pyx_L1_error)

      /* "pygrib.pyx":951
 *             elif self['derivedForecast'] == 5:
 *                 inventory.append(":ens large anomaly index")
 *             elif self['derivedForecast'] == 6:             # <<<<<<<<<<<<<<
 *                 inventory.append(":ens mean of cluster")
 *         if self.valid_key('probabilityTypeName'):
 */
    }
    __pyx_L48:;

    /* "pygrib.pyx":938
 *             elif ens_type == 3:
 *                inventory.append(":pos ens pert %d" % pert_num)
 *         if self.valid_key('derivedForecast'):             # <<<<<<<<<<<<<<
 *             if self['derivedForecast'] == 0:
 *                 inventory.append(":ens mean")
 */
  }

  /* "pygrib.pyx":953
 *             elif self['derivedForecast'] == 6:
 *                 inventory.append(":ens mean of cluster")
 *         if self.valid_key('probabilityTypeName'):             # <<<<<<<<<<<<<<
 *             inventory.append(":"+self['probabilityTypeName'])
 *             lowerlim = None
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_valid_key); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 953, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__49, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 953, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 953, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (__pyx_t_11) {

    /* "pygrib.pyx":954
 *                 inventory.append(":ens mean of cluster")
 *         if self.valid_key('probabilityTypeName'):
 *             inventory.append(":"+self['probabilityTypeName'])             # <<<<<<<<<<<<<<
 *             lowerlim = None
 *             if self.valid_key('scaledValueOfLowerLimit') and\
 */
    __pyx_t_7 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_probabilityTypeName); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 954, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_2 = PyNumber_Add(__pyx_kp_s__20, __pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 954, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_5 = __Pyx_PyList_Append(__pyx_v_inventory, __pyx_t_2); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 954, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "pygrib.pyx":955
 *         if self.valid_key('probabilityTypeName'):
 *             inventory.append(":"+self['probabilityTypeName'])
 *             lowerlim = None             # <<<<<<<<<<<<<<
 *             if self.valid_key('scaledValueOfLowerLimit') and\
 *                self.valid_key('scaleFactorOfLowerLimit'):
 */
    __Pyx_INCREF(Py_None);
    __pyx_v_lowerlim = Py_None;

    /* "pygrib.pyx":956
 *             inventory.append(":"+self['probabilityTypeName'])
 *             lowerlim = None
 *             if self.valid_key('scaledValueOfLowerLimit') and\             # <<<<<<<<<<<<<<
 *                self.valid_key('scaleFactorOfLowerLimit'):
 *                if self['scaledValueOfLowerLimit'] and\
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_valid_key); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 956, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__50, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 956, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 956, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (__pyx_t_3) {
    } else {
      __pyx_t_11 = __pyx_t_3;
      goto __pyx_L51_bool_binop_done;
    }

    /* "pygrib.pyx":957
 *             lowerlim = None
 *             if self.valid_key('scaledValueOfLowerLimit') and\
 *                self.valid_key('scaleFactorOfLowerLimit'):             # <<<<<<<<<<<<<<
 *                if self['scaledValueOfLowerLimit'] and\
 *                   self['scaleFactorOfLowerLimit']:
 */
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_valid_key); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 957, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_tuple__51, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 957, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 957, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_11 = __pyx_t_3;
    __pyx_L51_bool_binop_done:;

    /* "pygrib.pyx":956
 *             inventory.append(":"+self['probabilityTypeName'])
 *             lowerlim = None
 *             if self.valid_key('scaledValueOfLowerLimit') and\             # <<<<<<<<<<<<<<
 *                self.valid_key('scaleFactorOfLowerLimit'):
 *                if self['scaledValueOfLowerLimit'] and\
 */
    if (__pyx_t_11) {

      /* "pygrib.pyx":958
 *             if self.valid_key('scaledValueOfLowerLimit') and\
 *                self.valid_key('scaleFactorOfLowerLimit'):
 *                if self['scaledValueOfLowerLimit'] and\             # <<<<<<<<<<<<<<
 *                   self['scaleFactorOfLowerLimit']:
 *                    lowerlim = self['scaledValueOfLowerLimit']/\
 */
      __pyx_t_2 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_scaledValueOfLowerLimit); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 958, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 958, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (__pyx_t_3) {
      } else {
        __pyx_t_11 = __pyx_t_3;
        goto __pyx_L54_bool_binop_done;
      }

      /* "pygrib.pyx":959
 *                self.valid_key('scaleFactorOfLowerLimit'):
 *                if self['scaledValueOfLowerLimit'] and\
 *                   self['scaleFactorOfLowerLimit']:             # <<<<<<<<<<<<<<
 *                    lowerlim = self['scaledValueOfLowerLimit']/\
 *                               np.power(10.0,self['scaleFactorOfLowerLimit'])
 */
      __pyx_t_2 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_scaleFactorOfLowerLimit); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 959, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 959, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_11 = __pyx_t_3;
      __pyx_L54_bool_binop_done:;

      /* "pygrib.pyx":958
 *             if self.valid_key('scaledValueOfLowerLimit') and\
 *                self.valid_key('scaleFactorOfLowerLimit'):
 *                if self['scaledValueOfLowerLimit'] and\             # <<<<<<<<<<<<<<
 *                   self['scaleFactorOfLowerLimit']:
 *                    lowerlim = self['scaledValueOfLowerLimit']/\
 */
      if (__pyx_t_11) {

        /* "pygrib.pyx":960
 *                if self['scaledValueOfLowerLimit'] and\
 *                   self['scaleFactorOfLowerLimit']:
 *                    lowerlim = self['scaledValueOfLowerLimit']/\             # <<<<<<<<<<<<<<
 *                               np.power(10.0,self['scaleFactorOfLowerLimit'])
 *             upperlim = None
 */
        __pyx_t_2 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_scaledValueOfLowerLimit); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 960, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);

        /* "pygrib.pyx":961
 *                   self['scaleFactorOfLowerLimit']:
 *                    lowerlim = self['scaledValueOfLowerLimit']/\
 *                               np.power(10.0,self['scaleFactorOfLowerLimit'])             # <<<<<<<<<<<<<<
 *             upperlim = None
 *             if self.valid_key('scaledValueOfUpperLimit') and\
 */
        __pyx_t_10 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 961, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_power); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 961, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __pyx_t_10 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_scaleFactorOfLowerLimit); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 961, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        __pyx_t_4 = NULL;
        __pyx_t_9 = 0;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_8);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_8, function);
            __pyx_t_9 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_8)) {
          PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_float_10_0, __pyx_t_10};
          __pyx_t_7 = __Pyx_PyFunction_FastCall(__pyx_t_8, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 961, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_8)) {
          PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_float_10_0, __pyx_t_10};
          __pyx_t_7 = __Pyx_PyCFunction_FastCall(__pyx_t_8, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 961, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        } else
        #endif
        {
          __pyx_t_1 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 961, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          if (__pyx_t_4) {
            __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4); __pyx_t_4 = NULL;
          }
          __Pyx_INCREF(__pyx_float_10_0);
          __Pyx_GIVEREF(__pyx_float_10_0);
          PyTuple_SET_ITEM(__pyx_t_1, 0+__pyx_t_9, __pyx_float_10_0);
          __Pyx_GIVEREF(__pyx_t_10);
          PyTuple_SET_ITEM(__pyx_t_1, 1+__pyx_t_9, __pyx_t_10);
          __pyx_t_10 = 0;
          __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_1, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 961, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        }
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

        /* "pygrib.pyx":960
 *                if self['scaledValueOfLowerLimit'] and\
 *                   self['scaleFactorOfLowerLimit']:
 *                    lowerlim = self['scaledValueOfLowerLimit']/\             # <<<<<<<<<<<<<<
 *                               np.power(10.0,self['scaleFactorOfLowerLimit'])
 *             upperlim = None
 */
        __pyx_t_8 = __Pyx_PyNumber_Divide(__pyx_t_2, __pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 960, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF_SET(__pyx_v_lowerlim, __pyx_t_8);
        __pyx_t_8 = 0;

        /* "pygrib.pyx":958
 *             if self.valid_key('scaledValueOfLowerLimit') and\
 *                self.valid_key('scaleFactorOfLowerLimit'):
 *                if self['scaledValueOfLowerLimit'] and\             # <<<<<<<<<<<<<<
 *                   self['scaleFactorOfLowerLimit']:
 *                    lowerlim = self['scaledValueOfLowerLimit']/\
 */
      }

      /* "pygrib.pyx":956
 *             inventory.append(":"+self['probabilityTypeName'])
 *             lowerlim = None
 *             if self.valid_key('scaledValueOfLowerLimit') and\             # <<<<<<<<<<<<<<
 *                self.valid_key('scaleFactorOfLowerLimit'):
 *                if self['scaledValueOfLowerLimit'] and\
 */
    }

    /* "pygrib.pyx":962
 *                    lowerlim = self['scaledValueOfLowerLimit']/\
 *                               np.power(10.0,self['scaleFactorOfLowerLimit'])
 *             upperlim = None             # <<<<<<<<<<<<<<
 *             if self.valid_key('scaledValueOfUpperLimit') and\
 *                self.valid_key('scaleFactorOfUpperLimit'):
 */
    __Pyx_INCREF(Py_None);
    __pyx_v_upperlim = Py_None;

    /* "pygrib.pyx":963
 *                               np.power(10.0,self['scaleFactorOfLowerLimit'])
 *             upperlim = None
 *             if self.valid_key('scaledValueOfUpperLimit') and\             # <<<<<<<<<<<<<<
 *                self.valid_key('scaleFactorOfUpperLimit'):
 *                if self['scaledValueOfUpperLimit'] and\
 */
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_valid_key); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 963, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_tuple__52, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 963, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 963, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (__pyx_t_3) {
    } else {
      __pyx_t_11 = __pyx_t_3;
      goto __pyx_L57_bool_binop_done;
    }

    /* "pygrib.pyx":964
 *             upperlim = None
 *             if self.valid_key('scaledValueOfUpperLimit') and\
 *                self.valid_key('scaleFactorOfUpperLimit'):             # <<<<<<<<<<<<<<
 *                if self['scaledValueOfUpperLimit'] and\
 *                   self['scaleFactorOfUpperLimit']:
 */
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_valid_key); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 964, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_tuple__53, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 964, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 964, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_11 = __pyx_t_3;
    __pyx_L57_bool_binop_done:;

    /* "pygrib.pyx":963
 *                               np.power(10.0,self['scaleFactorOfLowerLimit'])
 *             upperlim = None
 *             if self.valid_key('scaledValueOfUpperLimit') and\             # <<<<<<<<<<<<<<
 *                self.valid_key('scaleFactorOfUpperLimit'):
 *                if self['scaledValueOfUpperLimit'] and\
 */
    if (__pyx_t_11) {

      /* "pygrib.pyx":965
 *             if self.valid_key('scaledValueOfUpperLimit') and\
 *                self.valid_key('scaleFactorOfUpperLimit'):
 *                if self['scaledValueOfUpperLimit'] and\             # <<<<<<<<<<<<<<
 *                   self['scaleFactorOfUpperLimit']:
 *                    upperlim = self['scaledValueOfUpperLimit']/\
 */
      __pyx_t_8 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_scaledValueOfUpperLimit); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 965, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 965, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (__pyx_t_3) {
      } else {
        __pyx_t_11 = __pyx_t_3;
        goto __pyx_L60_bool_binop_done;
      }

      /* "pygrib.pyx":966
 *                self.valid_key('scaleFactorOfUpperLimit'):
 *                if self['scaledValueOfUpperLimit'] and\
 *                   self['scaleFactorOfUpperLimit']:             # <<<<<<<<<<<<<<
 *                    upperlim = self['scaledValueOfUpperLimit']/\
 *                               np.power(10.0,self['scaleFactorOfUpperLimit'])
 */
      __pyx_t_8 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_scaleFactorOfUpperLimit); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 966, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 966, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_11 = __pyx_t_3;
      __pyx_L60_bool_binop_done:;

      /* "pygrib.pyx":965
 *             if self.valid_key('scaledValueOfUpperLimit') and\
 *                self.valid_key('scaleFactorOfUpperLimit'):
 *                if self['scaledValueOfUpperLimit'] and\             # <<<<<<<<<<<<<<
 *                   self['scaleFactorOfUpperLimit']:
 *                    upperlim = self['scaledValueOfUpperLimit']/\
 */
      if (__pyx_t_11) {

        /* "pygrib.pyx":967
 *                if self['scaledValueOfUpperLimit'] and\
 *                   self['scaleFactorOfUpperLimit']:
 *                    upperlim = self['scaledValueOfUpperLimit']/\             # <<<<<<<<<<<<<<
 *                               np.power(10.0,self['scaleFactorOfUpperLimit'])
 *             if upperlim is not None and lowerlim is not None:
 */
        __pyx_t_8 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_scaledValueOfUpperLimit); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 967, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);

        /* "pygrib.pyx":968
 *                   self['scaleFactorOfUpperLimit']:
 *                    upperlim = self['scaledValueOfUpperLimit']/\
 *                               np.power(10.0,self['scaleFactorOfUpperLimit'])             # <<<<<<<<<<<<<<
 *             if upperlim is not None and lowerlim is not None:
 *                 inventory.append(" (%s-%s)" % (upperlim,lowerlim))
 */
        __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 968, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_power); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 968, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_2 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_scaleFactorOfUpperLimit); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 968, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_10 = NULL;
        __pyx_t_9 = 0;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
          __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_1);
          if (likely(__pyx_t_10)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
            __Pyx_INCREF(__pyx_t_10);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_1, function);
            __pyx_t_9 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_1)) {
          PyObject *__pyx_temp[3] = {__pyx_t_10, __pyx_float_10_0, __pyx_t_2};
          __pyx_t_7 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 968, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
          PyObject *__pyx_temp[3] = {__pyx_t_10, __pyx_float_10_0, __pyx_t_2};
          __pyx_t_7 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 968, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        } else
        #endif
        {
          __pyx_t_4 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 968, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          if (__pyx_t_10) {
            __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_10); __pyx_t_10 = NULL;
          }
          __Pyx_INCREF(__pyx_float_10_0);
          __Pyx_GIVEREF(__pyx_float_10_0);
          PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_9, __pyx_float_10_0);
          __Pyx_GIVEREF(__pyx_t_2);
          PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_9, __pyx_t_2);
          __pyx_t_2 = 0;
          __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_4, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 968, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        }
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

        /* "pygrib.pyx":967
 *                if self['scaledValueOfUpperLimit'] and\
 *                   self['scaleFactorOfUpperLimit']:
 *                    upperlim = self['scaledValueOfUpperLimit']/\             # <<<<<<<<<<<<<<
 *                               np.power(10.0,self['scaleFactorOfUpperLimit'])
 *             if upperlim is not None and lowerlim is not None:
 */
        __pyx_t_1 = __Pyx_PyNumber_Divide(__pyx_t_8, __pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 967, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF_SET(__pyx_v_upperlim, __pyx_t_1);
        __pyx_t_1 = 0;

        /* "pygrib.pyx":965
 *             if self.valid_key('scaledValueOfUpperLimit') and\
 *                self.valid_key('scaleFactorOfUpperLimit'):
 *                if self['scaledValueOfUpperLimit'] and\             # <<<<<<<<<<<<<<
 *                   self['scaleFactorOfUpperLimit']:
 *                    upperlim = self['scaledValueOfUpperLimit']/\
 */
      }

      /* "pygrib.pyx":963
 *                               np.power(10.0,self['scaleFactorOfLowerLimit'])
 *             upperlim = None
 *             if self.valid_key('scaledValueOfUpperLimit') and\             # <<<<<<<<<<<<<<
 *                self.valid_key('scaleFactorOfUpperLimit'):
 *                if self['scaledValueOfUpperLimit'] and\
 */
    }

    /* "pygrib.pyx":969
 *                    upperlim = self['scaledValueOfUpperLimit']/\
 *                               np.power(10.0,self['scaleFactorOfUpperLimit'])
 *             if upperlim is not None and lowerlim is not None:             # <<<<<<<<<<<<<<
 *                 inventory.append(" (%s-%s)" % (upperlim,lowerlim))
 *             elif upperlim is not None:
 */
    __pyx_t_3 = (__pyx_v_upperlim != Py_None);
    __pyx_t_6 = (__pyx_t_3 != 0);
    if (__pyx_t_6) {
    } else {
      __pyx_t_11 = __pyx_t_6;
      goto __pyx_L63_bool_binop_done;
    }
    __pyx_t_6 = (__pyx_v_lowerlim != Py_None);
    __pyx_t_3 = (__pyx_t_6 != 0);
    __pyx_t_11 = __pyx_t_3;
    __pyx_L63_bool_binop_done:;
    if (__pyx_t_11) {

      /* "pygrib.pyx":970
 *                               np.power(10.0,self['scaleFactorOfUpperLimit'])
 *             if upperlim is not None and lowerlim is not None:
 *                 inventory.append(" (%s-%s)" % (upperlim,lowerlim))             # <<<<<<<<<<<<<<
 *             elif upperlim is not None:
 *                 inventory.append(" (> %s)" % upperlim)
 */
      __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 970, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_INCREF(__pyx_v_upperlim);
      __Pyx_GIVEREF(__pyx_v_upperlim);
      PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_upperlim);
      __Pyx_INCREF(__pyx_v_lowerlim);
      __Pyx_GIVEREF(__pyx_v_lowerlim);
      PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_lowerlim);
      __pyx_t_7 = __Pyx_PyString_Format(__pyx_kp_s_s_s, __pyx_t_1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 970, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_5 = __Pyx_PyList_Append(__pyx_v_inventory, __pyx_t_7); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 970, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

      /* "pygrib.pyx":969
 *                    upperlim = self['scaledValueOfUpperLimit']/\
 *                               np.power(10.0,self['scaleFactorOfUpperLimit'])
 *             if upperlim is not None and lowerlim is not None:             # <<<<<<<<<<<<<<
 *                 inventory.append(" (%s-%s)" % (upperlim,lowerlim))
 *             elif upperlim is not None:
 */
      goto __pyx_L62;
    }

    /* "pygrib.pyx":971
 *             if upperlim is not None and lowerlim is not None:
 *                 inventory.append(" (%s-%s)" % (upperlim,lowerlim))
 *             elif upperlim is not None:             # <<<<<<<<<<<<<<
 *                 inventory.append(" (> %s)" % upperlim)
 *             elif lowerlim is not None:
 */
    __pyx_t_11 = (__pyx_v_upperlim != Py_None);
    __pyx_t_3 = (__pyx_t_11 != 0);
    if (__pyx_t_3) {

      /* "pygrib.pyx":972
 *                 inventory.append(" (%s-%s)" % (upperlim,lowerlim))
 *             elif upperlim is not None:
 *                 inventory.append(" (> %s)" % upperlim)             # <<<<<<<<<<<<<<
 *             elif lowerlim is not None:
 *                 inventory.append(" (< %s)" % lowerlim)
 */
      __pyx_t_7 = __Pyx_PyString_Format(__pyx_kp_s_s_2, __pyx_v_upperlim); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 972, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_5 = __Pyx_PyList_Append(__pyx_v_inventory, __pyx_t_7); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 972, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

      /* "pygrib.pyx":971
 *             if upperlim is not None and lowerlim is not None:
 *                 inventory.append(" (%s-%s)" % (upperlim,lowerlim))
 *             elif upperlim is not None:             # <<<<<<<<<<<<<<
 *                 inventory.append(" (> %s)" % upperlim)
 *             elif lowerlim is not None:
 */
      goto __pyx_L62;
    }

    /* "pygrib.pyx":973
 *             elif upperlim is not None:
 *                 inventory.append(" (> %s)" % upperlim)
 *             elif lowerlim is not None:             # <<<<<<<<<<<<<<
 *                 inventory.append(" (< %s)" % lowerlim)
 *         return ''.join(inventory)
 */
    __pyx_t_3 = (__pyx_v_lowerlim != Py_None);
    __pyx_t_11 = (__pyx_t_3 != 0);
    if (__pyx_t_11) {

      /* "pygrib.pyx":974
 *                 inventory.append(" (> %s)" % upperlim)
 *             elif lowerlim is not None:
 *                 inventory.append(" (< %s)" % lowerlim)             # <<<<<<<<<<<<<<
 *         return ''.join(inventory)
 * 
 */
      __pyx_t_7 = __Pyx_PyString_Format(__pyx_kp_s_s_3, __pyx_v_lowerlim); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 974, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_5 = __Pyx_PyList_Append(__pyx_v_inventory, __pyx_t_7); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 974, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

      /* "pygrib.pyx":973
 *             elif upperlim is not None:
 *                 inventory.append(" (> %s)" % upperlim)
 *             elif lowerlim is not None:             # <<<<<<<<<<<<<<
 *                 inventory.append(" (< %s)" % lowerlim)
 *         return ''.join(inventory)
 */
    }
    __pyx_L62:;

    /* "pygrib.pyx":953
 *             elif self['derivedForecast'] == 6:
 *                 inventory.append(":ens mean of cluster")
 *         if self.valid_key('probabilityTypeName'):             # <<<<<<<<<<<<<<
 *             inventory.append(":"+self['probabilityTypeName'])
 *             lowerlim = None
 */
  }

  /* "pygrib.pyx":975
 *             elif lowerlim is not None:
 *                 inventory.append(" (< %s)" % lowerlim)
 *         return ''.join(inventory)             # <<<<<<<<<<<<<<
 * 
 *     def _get_key(self, key, default=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_7 = __Pyx_PyString_Join(__pyx_kp_s__10, __pyx_v_inventory); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 975, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_r = __pyx_t_7;
  __pyx_t_7 = 0;
  goto __pyx_L0;

  /* "pygrib.pyx":854
 *             # these are python attributes.
 *             self.__dict__[name]=value
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         """prints a short inventory of the grib message"""
 *         inventory = []
 */

  /* 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_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("pygrib.gribmessage.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_inventory);
  __Pyx_XDECREF(__pyx_v_toplev);
  __Pyx_XDECREF(__pyx_v_botlev);
  __Pyx_XDECREF(__pyx_v_levunits);
  __Pyx_XDECREF(__pyx_v_levstring);
  __Pyx_XDECREF(__pyx_v_ftime);
  __Pyx_XDECREF(__pyx_v_ens_type);
  __Pyx_XDECREF(__pyx_v_pert_num);
  __Pyx_XDECREF(__pyx_v_lowerlim);
  __Pyx_XDECREF(__pyx_v_upperlim);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pygrib.pyx":977
 *         return ''.join(inventory)
 * 
 *     def _get_key(self, key, default=None):             # <<<<<<<<<<<<<<
 *         """get key if it exists, otherwise return default value (default None)"""
 *         if self.has_key(key):
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pygrib_11gribmessage_11_get_key(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6pygrib_11gribmessage_10_get_key[] = "get key if it exists, otherwise return default value (default None)";
static PyObject *__pyx_pw_6pygrib_11gribmessage_11_get_key(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_key = 0;
  PyObject *__pyx_v_default = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_get_key (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_key,&__pyx_n_s_default,0};
    PyObject* values[2] = {0,0};
    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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_key)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_default);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_get_key") < 0)) __PYX_ERR(0, 977, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_key = values[0];
    __pyx_v_default = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_get_key", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 977, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pygrib.gribmessage._get_key", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pygrib_11gribmessage_10_get_key(((struct __pyx_obj_6pygrib_gribmessage *)__pyx_v_self), __pyx_v_key, __pyx_v_default);

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

static PyObject *__pyx_pf_6pygrib_11gribmessage_10_get_key(struct __pyx_obj_6pygrib_gribmessage *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_default) {
  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;
  __Pyx_RefNannySetupContext("_get_key", 0);

  /* "pygrib.pyx":979
 *     def _get_key(self, key, default=None):
 *         """get key if it exists, otherwise return default value (default None)"""
 *         if self.has_key(key):             # <<<<<<<<<<<<<<
 *             return self[key]
 *         else:
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_has_key); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 979, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  if (!__pyx_t_3) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_key); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 979, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_key};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 979, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_GOTREF(__pyx_t_1);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_key};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 979, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_GOTREF(__pyx_t_1);
    } else
    #endif
    {
      __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 979, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __pyx_t_3 = NULL;
      __Pyx_INCREF(__pyx_v_key);
      __Pyx_GIVEREF(__pyx_v_key);
      PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_key);
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 979, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 979, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_5) {

    /* "pygrib.pyx":980
 *         """get key if it exists, otherwise return default value (default None)"""
 *         if self.has_key(key):
 *             return self[key]             # <<<<<<<<<<<<<<
 *         else:
 *             return default
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_key); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 980, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;

    /* "pygrib.pyx":979
 *     def _get_key(self, key, default=None):
 *         """get key if it exists, otherwise return default value (default None)"""
 *         if self.has_key(key):             # <<<<<<<<<<<<<<
 *             return self[key]
 *         else:
 */
  }

  /* "pygrib.pyx":982
 *             return self[key]
 *         else:
 *             return default             # <<<<<<<<<<<<<<
 * 
 *     def expand_grid(self,expand_reduced):
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_default);
    __pyx_r = __pyx_v_default;
    goto __pyx_L0;
  }

  /* "pygrib.pyx":977
 *         return ''.join(inventory)
 * 
 *     def _get_key(self, key, default=None):             # <<<<<<<<<<<<<<
 *         """get key if it exists, otherwise return default value (default None)"""
 *         if self.has_key(key):
 */

  /* 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("pygrib.gribmessage._get_key", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pygrib.pyx":984
 *             return default
 * 
 *     def expand_grid(self,expand_reduced):             # <<<<<<<<<<<<<<
 *         """toggle expansion of 1D reduced grid data to a regular (2D) grid"""
 *         self.expand_reduced = expand_reduced
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pygrib_11gribmessage_13expand_grid(PyObject *__pyx_v_self, PyObject *__pyx_v_expand_reduced); /*proto*/
static char __pyx_doc_6pygrib_11gribmessage_12expand_grid[] = "toggle expansion of 1D reduced grid data to a regular (2D) grid";
static PyObject *__pyx_pw_6pygrib_11gribmessage_13expand_grid(PyObject *__pyx_v_self, PyObject *__pyx_v_expand_reduced) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("expand_grid (wrapper)", 0);
  __pyx_r = __pyx_pf_6pygrib_11gribmessage_12expand_grid(((struct __pyx_obj_6pygrib_gribmessage *)__pyx_v_self), ((PyObject *)__pyx_v_expand_reduced));

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

static PyObject *__pyx_pf_6pygrib_11gribmessage_12expand_grid(struct __pyx_obj_6pygrib_gribmessage *__pyx_v_self, PyObject *__pyx_v_expand_reduced) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("expand_grid", 0);

  /* "pygrib.pyx":986
 *     def expand_grid(self,expand_reduced):
 *         """toggle expansion of 1D reduced grid data to a regular (2D) grid"""
 *         self.expand_reduced = expand_reduced             # <<<<<<<<<<<<<<
 * 
 *     def is_missing(self,key):
 */
  __Pyx_INCREF(__pyx_v_expand_reduced);
  __Pyx_GIVEREF(__pyx_v_expand_reduced);
  __Pyx_GOTREF(__pyx_v_self->expand_reduced);
  __Pyx_DECREF(__pyx_v_self->expand_reduced);
  __pyx_v_self->expand_reduced = __pyx_v_expand_reduced;

  /* "pygrib.pyx":984
 *             return default
 * 
 *     def expand_grid(self,expand_reduced):             # <<<<<<<<<<<<<<
 *         """toggle expansion of 1D reduced grid data to a regular (2D) grid"""
 *         self.expand_reduced = expand_reduced
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pygrib.pyx":988
 *         self.expand_reduced = expand_reduced
 * 
 *     def is_missing(self,key):             # <<<<<<<<<<<<<<
 *         """
 *         is_missing(key)
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pygrib_11gribmessage_15is_missing(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/
static char __pyx_doc_6pygrib_11gribmessage_14is_missing[] = "\n        is_missing(key)\n\n        returns True if key is invalid or value associated with key is equal\n        to grib missing value flag (False otherwise)";
static PyObject *__pyx_pw_6pygrib_11gribmessage_15is_missing(PyObject *__pyx_v_self, PyObject *__pyx_v_key) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("is_missing (wrapper)", 0);
  __pyx_r = __pyx_pf_6pygrib_11gribmessage_14is_missing(((struct __pyx_obj_6pygrib_gribmessage *)__pyx_v_self), ((PyObject *)__pyx_v_key));

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

static PyObject *__pyx_pf_6pygrib_11gribmessage_14is_missing(struct __pyx_obj_6pygrib_gribmessage *__pyx_v_self, PyObject *__pyx_v_key) {
  int __pyx_v_err;
  int __pyx_v_miss;
  char *__pyx_v_name;
  PyObject *__pyx_v_bytestr = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  char *__pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("is_missing", 0);

  /* "pygrib.pyx":996
 *         cdef int err,miss
 *         cdef char *name
 *         bytestr = _strencode(key)             # <<<<<<<<<<<<<<
 *         name = bytestr
 *         miss = grib_is_missing(self._gh, name, &err)
 */
  __pyx_t_1 = __pyx_f_6pygrib__strencode(__pyx_v_key, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 996, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_bytestr = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pygrib.pyx":997
 *         cdef char *name
 *         bytestr = _strencode(key)
 *         name = bytestr             # <<<<<<<<<<<<<<
 *         miss = grib_is_missing(self._gh, name, &err)
 *         if miss or err:
 */
  __pyx_t_2 = __Pyx_PyObject_AsWritableString(__pyx_v_bytestr); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 997, __pyx_L1_error)
  __pyx_v_name = __pyx_t_2;

  /* "pygrib.pyx":998
 *         bytestr = _strencode(key)
 *         name = bytestr
 *         miss = grib_is_missing(self._gh, name, &err)             # <<<<<<<<<<<<<<
 *         if miss or err:
 *             return True
 */
  __pyx_v_miss = grib_is_missing(__pyx_v_self->_gh, __pyx_v_name, (&__pyx_v_err));

  /* "pygrib.pyx":999
 *         name = bytestr
 *         miss = grib_is_missing(self._gh, name, &err)
 *         if miss or err:             # <<<<<<<<<<<<<<
 *             return True
 *         else:
 */
  __pyx_t_4 = (__pyx_v_miss != 0);
  if (!__pyx_t_4) {
  } else {
    __pyx_t_3 = __pyx_t_4;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_4 = (__pyx_v_err != 0);
  __pyx_t_3 = __pyx_t_4;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_3) {

    /* "pygrib.pyx":1000
 *         miss = grib_is_missing(self._gh, name, &err)
 *         if miss or err:
 *             return True             # <<<<<<<<<<<<<<
 *         else:
 *             return False
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_True);
    __pyx_r = Py_True;
    goto __pyx_L0;

    /* "pygrib.pyx":999
 *         name = bytestr
 *         miss = grib_is_missing(self._gh, name, &err)
 *         if miss or err:             # <<<<<<<<<<<<<<
 *             return True
 *         else:
 */
  }

  /* "pygrib.pyx":1002
 *             return True
 *         else:
 *             return False             # <<<<<<<<<<<<<<
 *     def keys(self):
 *         """
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_False);
    __pyx_r = Py_False;
    goto __pyx_L0;
  }

  /* "pygrib.pyx":988
 *         self.expand_reduced = expand_reduced
 * 
 *     def is_missing(self,key):             # <<<<<<<<<<<<<<
 *         """
 *         is_missing(key)
 */

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

/* "pygrib.pyx":1003
 *         else:
 *             return False
 *     def keys(self):             # <<<<<<<<<<<<<<
 *         """
 *         keys()
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pygrib_11gribmessage_17keys(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6pygrib_11gribmessage_16keys[] = "\n        keys()\n\n        return keys associated with a grib message (a dictionary-like object)\n        ";
static PyObject *__pyx_pw_6pygrib_11gribmessage_17keys(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("keys (wrapper)", 0);
  __pyx_r = __pyx_pf_6pygrib_11gribmessage_16keys(((struct __pyx_obj_6pygrib_gribmessage *)__pyx_v_self));

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

static PyObject *__pyx_pf_6pygrib_11gribmessage_16keys(struct __pyx_obj_6pygrib_gribmessage *__pyx_v_self) {
  grib_keys_iterator *__pyx_v_gi;
  int __pyx_v_err;
  int __pyx_v_typ;
  char *__pyx_v_name;
  PyObject *__pyx_v_keys = NULL;
  PyObject *__pyx_v_key = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("keys", 0);

  /* "pygrib.pyx":1013
 *         cdef char *name
 *         # use cached keys if they exist.
 *         if self._all_keys is not None: return self._all_keys             # <<<<<<<<<<<<<<
 *         # if not, get keys from grib file.
 *         gi = grib_keys_iterator_new(self._gh,\
 */
  __pyx_t_1 = (__pyx_v_self->_all_keys != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_self->_all_keys);
    __pyx_r = __pyx_v_self->_all_keys;
    goto __pyx_L0;
  }

  /* "pygrib.pyx":1015
 *         if self._all_keys is not None: return self._all_keys
 *         # if not, get keys from grib file.
 *         gi = grib_keys_iterator_new(self._gh,\             # <<<<<<<<<<<<<<
 *                 GRIB_KEYS_ITERATOR_ALL_KEYS, NULL)
 *         keys = []
 */
  __pyx_v_gi = grib_keys_iterator_new(__pyx_v_self->_gh, GRIB_KEYS_ITERATOR_ALL_KEYS, NULL);

  /* "pygrib.pyx":1017
 *         gi = grib_keys_iterator_new(self._gh,\
 *                 GRIB_KEYS_ITERATOR_ALL_KEYS, NULL)
 *         keys = []             # <<<<<<<<<<<<<<
 *         while grib_keys_iterator_next(gi):
 *             name = grib_keys_iterator_get_name(gi)
 */
  __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1017, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_keys = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "pygrib.pyx":1018
 *                 GRIB_KEYS_ITERATOR_ALL_KEYS, NULL)
 *         keys = []
 *         while grib_keys_iterator_next(gi):             # <<<<<<<<<<<<<<
 *             name = grib_keys_iterator_get_name(gi)
 *             key = name.decode('ascii')
 */
  while (1) {
    __pyx_t_2 = (grib_keys_iterator_next(__pyx_v_gi) != 0);
    if (!__pyx_t_2) break;

    /* "pygrib.pyx":1019
 *         keys = []
 *         while grib_keys_iterator_next(gi):
 *             name = grib_keys_iterator_get_name(gi)             # <<<<<<<<<<<<<<
 *             key = name.decode('ascii')
 *             # ignore these keys.
 */
    __pyx_v_name = grib_keys_iterator_get_name(__pyx_v_gi);

    /* "pygrib.pyx":1020
 *         while grib_keys_iterator_next(gi):
 *             name = grib_keys_iterator_get_name(gi)
 *             key = name.decode('ascii')             # <<<<<<<<<<<<<<
 *             # ignore these keys.
 *             if key in ["zero","one","eight","eleven","false","thousand","file",
 */
    __pyx_t_3 = __Pyx_decode_c_string(__pyx_v_name, 0, strlen(__pyx_v_name), NULL, NULL, PyUnicode_DecodeASCII); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1020, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_XDECREF_SET(__pyx_v_key, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "pygrib.pyx":1022
 *             key = name.decode('ascii')
 *             # ignore these keys.
 *             if key in ["zero","one","eight","eleven","false","thousand","file",             # <<<<<<<<<<<<<<
 *                        "localDir","7777","oneThousand"]:
 *                 continue
 */
    __Pyx_INCREF(__pyx_v_key);
    __pyx_t_3 = __pyx_v_key;
    __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_t_3, __pyx_n_s_zero, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1022, __pyx_L1_error)
    if (!__pyx_t_1) {
    } else {
      __pyx_t_2 = __pyx_t_1;
      goto __pyx_L7_bool_binop_done;
    }
    __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_t_3, __pyx_n_s_one, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1022, __pyx_L1_error)
    if (!__pyx_t_1) {
    } else {
      __pyx_t_2 = __pyx_t_1;
      goto __pyx_L7_bool_binop_done;
    }
    __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_t_3, __pyx_n_s_eight, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1022, __pyx_L1_error)
    if (!__pyx_t_1) {
    } else {
      __pyx_t_2 = __pyx_t_1;
      goto __pyx_L7_bool_binop_done;
    }
    __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_t_3, __pyx_n_s_eleven, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1022, __pyx_L1_error)
    if (!__pyx_t_1) {
    } else {
      __pyx_t_2 = __pyx_t_1;
      goto __pyx_L7_bool_binop_done;
    }
    __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_t_3, __pyx_n_s_false, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1022, __pyx_L1_error)
    if (!__pyx_t_1) {
    } else {
      __pyx_t_2 = __pyx_t_1;
      goto __pyx_L7_bool_binop_done;
    }
    __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_t_3, __pyx_n_s_thousand, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1022, __pyx_L1_error)
    if (!__pyx_t_1) {
    } else {
      __pyx_t_2 = __pyx_t_1;
      goto __pyx_L7_bool_binop_done;
    }
    __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_t_3, __pyx_n_s_file, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1022, __pyx_L1_error)
    if (!__pyx_t_1) {
    } else {
      __pyx_t_2 = __pyx_t_1;
      goto __pyx_L7_bool_binop_done;
    }
    __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_t_3, __pyx_n_s_localDir, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1022, __pyx_L1_error)
    if (!__pyx_t_1) {
    } else {
      __pyx_t_2 = __pyx_t_1;
      goto __pyx_L7_bool_binop_done;
    }
    __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_t_3, __pyx_kp_s_7777, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1022, __pyx_L1_error)
    if (!__pyx_t_1) {
    } else {
      __pyx_t_2 = __pyx_t_1;
      goto __pyx_L7_bool_binop_done;
    }
    __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_t_3, __pyx_n_s_oneThousand, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1022, __pyx_L1_error)
    __pyx_t_2 = __pyx_t_1;
    __pyx_L7_bool_binop_done:;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_1 = (__pyx_t_2 != 0);
    if (__pyx_t_1) {

      /* "pygrib.pyx":1024
 *             if key in ["zero","one","eight","eleven","false","thousand","file",
 *                        "localDir","7777","oneThousand"]:
 *                 continue             # <<<<<<<<<<<<<<
 *             err = grib_get_native_type(self._gh, name, &typ)
 *             if err: # skip unreadable keys
 */
      goto __pyx_L4_continue;

      /* "pygrib.pyx":1022
 *             key = name.decode('ascii')
 *             # ignore these keys.
 *             if key in ["zero","one","eight","eleven","false","thousand","file",             # <<<<<<<<<<<<<<
 *                        "localDir","7777","oneThousand"]:
 *                 continue
 */
    }

    /* "pygrib.pyx":1025
 *                        "localDir","7777","oneThousand"]:
 *                 continue
 *             err = grib_get_native_type(self._gh, name, &typ)             # <<<<<<<<<<<<<<
 *             if err: # skip unreadable keys
 *                 continue
 */
    __pyx_v_err = grib_get_native_type(__pyx_v_self->_gh, __pyx_v_name, (&__pyx_v_typ));

    /* "pygrib.pyx":1026
 *                 continue
 *             err = grib_get_native_type(self._gh, name, &typ)
 *             if err: # skip unreadable keys             # <<<<<<<<<<<<<<
 *                 continue
 *             # keys with these types are ignored.
 */
    __pyx_t_1 = (__pyx_v_err != 0);
    if (__pyx_t_1) {

      /* "pygrib.pyx":1027
 *             err = grib_get_native_type(self._gh, name, &typ)
 *             if err: # skip unreadable keys
 *                 continue             # <<<<<<<<<<<<<<
 *             # keys with these types are ignored.
 *             if typ not in\
 */
      goto __pyx_L4_continue;

      /* "pygrib.pyx":1026
 *                 continue
 *             err = grib_get_native_type(self._gh, name, &typ)
 *             if err: # skip unreadable keys             # <<<<<<<<<<<<<<
 *                 continue
 *             # keys with these types are ignored.
 */
    }

    /* "pygrib.pyx":1029
 *                 continue
 *             # keys with these types are ignored.
 *             if typ not in\             # <<<<<<<<<<<<<<
 *             [GRIB_TYPE_UNDEFINED,GRIB_TYPE_SECTION,GRIB_TYPE_BYTES,GRIB_TYPE_LABEL,GRIB_TYPE_MISSING]:
 *                 keys.append(key)
 */
    switch (__pyx_v_typ) {

      /* "pygrib.pyx":1030
 *             # keys with these types are ignored.
 *             if typ not in\
 *             [GRIB_TYPE_UNDEFINED,GRIB_TYPE_SECTION,GRIB_TYPE_BYTES,GRIB_TYPE_LABEL,GRIB_TYPE_MISSING]:             # <<<<<<<<<<<<<<
 *                 keys.append(key)
 *         err = grib_keys_iterator_delete(gi)
 */
      case GRIB_TYPE_UNDEFINED:
      case GRIB_TYPE_SECTION:
      case GRIB_TYPE_BYTES:
      case GRIB_TYPE_LABEL:
      case GRIB_TYPE_MISSING:

      /* "pygrib.pyx":1029
 *                 continue
 *             # keys with these types are ignored.
 *             if typ not in\             # <<<<<<<<<<<<<<
 *             [GRIB_TYPE_UNDEFINED,GRIB_TYPE_SECTION,GRIB_TYPE_BYTES,GRIB_TYPE_LABEL,GRIB_TYPE_MISSING]:
 *                 keys.append(key)
 */
      __pyx_t_1 = 0;
      break;
      default:
      __pyx_t_1 = 1;
      break;
    }
    __pyx_t_2 = (__pyx_t_1 != 0);
    if (__pyx_t_2) {

      /* "pygrib.pyx":1031
 *             if typ not in\
 *             [GRIB_TYPE_UNDEFINED,GRIB_TYPE_SECTION,GRIB_TYPE_BYTES,GRIB_TYPE_LABEL,GRIB_TYPE_MISSING]:
 *                 keys.append(key)             # <<<<<<<<<<<<<<
 *         err = grib_keys_iterator_delete(gi)
 *         if err:
 */
      __pyx_t_4 = __Pyx_PyList_Append(__pyx_v_keys, __pyx_v_key); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 1031, __pyx_L1_error)

      /* "pygrib.pyx":1029
 *                 continue
 *             # keys with these types are ignored.
 *             if typ not in\             # <<<<<<<<<<<<<<
 *             [GRIB_TYPE_UNDEFINED,GRIB_TYPE_SECTION,GRIB_TYPE_BYTES,GRIB_TYPE_LABEL,GRIB_TYPE_MISSING]:
 *                 keys.append(key)
 */
    }
    __pyx_L4_continue:;
  }

  /* "pygrib.pyx":1032
 *             [GRIB_TYPE_UNDEFINED,GRIB_TYPE_SECTION,GRIB_TYPE_BYTES,GRIB_TYPE_LABEL,GRIB_TYPE_MISSING]:
 *                 keys.append(key)
 *         err = grib_keys_iterator_delete(gi)             # <<<<<<<<<<<<<<
 *         if err:
 *             raise RuntimeError(grib_get_error_message(err))
 */
  __pyx_v_err = grib_keys_iterator_delete(__pyx_v_gi);

  /* "pygrib.pyx":1033
 *                 keys.append(key)
 *         err = grib_keys_iterator_delete(gi)
 *         if err:             # <<<<<<<<<<<<<<
 *             raise RuntimeError(grib_get_error_message(err))
 *         # add extra python keys.
 */
  __pyx_t_2 = (__pyx_v_err != 0);
  if (unlikely(__pyx_t_2)) {

    /* "pygrib.pyx":1034
 *         err = grib_keys_iterator_delete(gi)
 *         if err:
 *             raise RuntimeError(grib_get_error_message(err))             # <<<<<<<<<<<<<<
 *         # add extra python keys.
 *         if hasattr(self,'analDate'): keys.append('analDate')
 */
    __pyx_t_3 = __Pyx_PyBytes_FromString(grib_get_error_message(__pyx_v_err)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1034, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_builtin_RuntimeError, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1034, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_t_5, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __PYX_ERR(0, 1034, __pyx_L1_error)

    /* "pygrib.pyx":1033
 *                 keys.append(key)
 *         err = grib_keys_iterator_delete(gi)
 *         if err:             # <<<<<<<<<<<<<<
 *             raise RuntimeError(grib_get_error_message(err))
 *         # add extra python keys.
 */
  }

  /* "pygrib.pyx":1036
 *             raise RuntimeError(grib_get_error_message(err))
 *         # add extra python keys.
 *         if hasattr(self,'analDate'): keys.append('analDate')             # <<<<<<<<<<<<<<
 *         if hasattr(self,'validDate'): keys.append('validDate')
 *         return keys
 */
  __pyx_t_2 = __Pyx_HasAttr(((PyObject *)__pyx_v_self), __pyx_n_s_analDate); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 1036, __pyx_L1_error)
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {
    __pyx_t_4 = __Pyx_PyList_Append(__pyx_v_keys, __pyx_n_s_analDate); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 1036, __pyx_L1_error)
  }

  /* "pygrib.pyx":1037
 *         # add extra python keys.
 *         if hasattr(self,'analDate'): keys.append('analDate')
 *         if hasattr(self,'validDate'): keys.append('validDate')             # <<<<<<<<<<<<<<
 *         return keys
 *     def _read_only_keys(self):
 */
  __pyx_t_1 = __Pyx_HasAttr(((PyObject *)__pyx_v_self), __pyx_n_s_validDate); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 1037, __pyx_L1_error)
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {
    __pyx_t_4 = __Pyx_PyList_Append(__pyx_v_keys, __pyx_n_s_validDate); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 1037, __pyx_L1_error)
  }

  /* "pygrib.pyx":1038
 *         if hasattr(self,'analDate'): keys.append('analDate')
 *         if hasattr(self,'validDate'): keys.append('validDate')
 *         return keys             # <<<<<<<<<<<<<<
 *     def _read_only_keys(self):
 *         """
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_keys);
  __pyx_r = __pyx_v_keys;
  goto __pyx_L0;

  /* "pygrib.pyx":1003
 *         else:
 *             return False
 *     def keys(self):             # <<<<<<<<<<<<<<
 *         """
 *         keys()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("pygrib.gribmessage.keys", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_keys);
  __Pyx_XDECREF(__pyx_v_key);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pygrib.pyx":1039
 *         if hasattr(self,'validDate'): keys.append('validDate')
 *         return keys
 *     def _read_only_keys(self):             # <<<<<<<<<<<<<<
 *         """
 *         _read_only_keys()
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pygrib_11gribmessage_19_read_only_keys(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6pygrib_11gribmessage_18_read_only_keys[] = "\n        _read_only_keys()\n\n        return read-only keys associated with a grib message (a dictionary-like object)\n        ";
static PyObject *__pyx_pw_6pygrib_11gribmessage_19_read_only_keys(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_read_only_keys (wrapper)", 0);
  __pyx_r = __pyx_pf_6pygrib_11gribmessage_18_read_only_keys(((struct __pyx_obj_6pygrib_gribmessage *)__pyx_v_self));

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

static PyObject *__pyx_pf_6pygrib_11gribmessage_18_read_only_keys(struct __pyx_obj_6pygrib_gribmessage *__pyx_v_self) {
  grib_keys_iterator *__pyx_v_gi;
  int __pyx_v_err;
  char *__pyx_v_name;
  PyObject *__pyx_v_keys_noro = NULL;
  PyObject *__pyx_v_key = NULL;
  PyObject *__pyx_v_keys_ro = NULL;
  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_t_6;
  Py_ssize_t __pyx_t_7;
  PyObject *(*__pyx_t_8)(PyObject *);
  __Pyx_RefNannySetupContext("_read_only_keys", 0);

  /* "pygrib.pyx":1048
 *         cdef int err, typ
 *         cdef char *name
 *         if self._all_keys is None:             # <<<<<<<<<<<<<<
 *             self._all_keys = self.keys()
 *         gi = grib_keys_iterator_new(self._gh,\
 */
  __pyx_t_1 = (__pyx_v_self->_all_keys == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "pygrib.pyx":1049
 *         cdef char *name
 *         if self._all_keys is None:
 *             self._all_keys = self.keys()             # <<<<<<<<<<<<<<
 *         gi = grib_keys_iterator_new(self._gh,\
 *                 GRIB_KEYS_ITERATOR_SKIP_READ_ONLY, NULL)
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_keys); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1049, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    if (__pyx_t_5) {
      __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1049, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else {
      __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1049, __pyx_L1_error)
    }
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GIVEREF(__pyx_t_3);
    __Pyx_GOTREF(__pyx_v_self->_all_keys);
    __Pyx_DECREF(__pyx_v_self->_all_keys);
    __pyx_v_self->_all_keys = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "pygrib.pyx":1048
 *         cdef int err, typ
 *         cdef char *name
 *         if self._all_keys is None:             # <<<<<<<<<<<<<<
 *             self._all_keys = self.keys()
 *         gi = grib_keys_iterator_new(self._gh,\
 */
  }

  /* "pygrib.pyx":1050
 *         if self._all_keys is None:
 *             self._all_keys = self.keys()
 *         gi = grib_keys_iterator_new(self._gh,\             # <<<<<<<<<<<<<<
 *                 GRIB_KEYS_ITERATOR_SKIP_READ_ONLY, NULL)
 *         keys_noro = []
 */
  __pyx_v_gi = grib_keys_iterator_new(__pyx_v_self->_gh, GRIB_KEYS_ITERATOR_SKIP_READ_ONLY, NULL);

  /* "pygrib.pyx":1052
 *         gi = grib_keys_iterator_new(self._gh,\
 *                 GRIB_KEYS_ITERATOR_SKIP_READ_ONLY, NULL)
 *         keys_noro = []             # <<<<<<<<<<<<<<
 *         while grib_keys_iterator_next(gi):
 *             name = grib_keys_iterator_get_name(gi)
 */
  __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1052, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_keys_noro = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "pygrib.pyx":1053
 *                 GRIB_KEYS_ITERATOR_SKIP_READ_ONLY, NULL)
 *         keys_noro = []
 *         while grib_keys_iterator_next(gi):             # <<<<<<<<<<<<<<
 *             name = grib_keys_iterator_get_name(gi)
 *             key = name.decode('ascii')
 */
  while (1) {
    __pyx_t_2 = (grib_keys_iterator_next(__pyx_v_gi) != 0);
    if (!__pyx_t_2) break;

    /* "pygrib.pyx":1054
 *         keys_noro = []
 *         while grib_keys_iterator_next(gi):
 *             name = grib_keys_iterator_get_name(gi)             # <<<<<<<<<<<<<<
 *             key = name.decode('ascii')
 *             keys_noro.append(key)
 */
    __pyx_v_name = grib_keys_iterator_get_name(__pyx_v_gi);

    /* "pygrib.pyx":1055
 *         while grib_keys_iterator_next(gi):
 *             name = grib_keys_iterator_get_name(gi)
 *             key = name.decode('ascii')             # <<<<<<<<<<<<<<
 *             keys_noro.append(key)
 *         err = grib_keys_iterator_delete(gi)
 */
    __pyx_t_3 = __Pyx_decode_c_string(__pyx_v_name, 0, strlen(__pyx_v_name), NULL, NULL, PyUnicode_DecodeASCII); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1055, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_XDECREF_SET(__pyx_v_key, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "pygrib.pyx":1056
 *             name = grib_keys_iterator_get_name(gi)
 *             key = name.decode('ascii')
 *             keys_noro.append(key)             # <<<<<<<<<<<<<<
 *         err = grib_keys_iterator_delete(gi)
 *         if err:
 */
    __pyx_t_6 = __Pyx_PyList_Append(__pyx_v_keys_noro, __pyx_v_key); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(0, 1056, __pyx_L1_error)
  }

  /* "pygrib.pyx":1057
 *             key = name.decode('ascii')
 *             keys_noro.append(key)
 *         err = grib_keys_iterator_delete(gi)             # <<<<<<<<<<<<<<
 *         if err:
 *             raise RuntimeError(grib_get_error_message(err))
 */
  __pyx_v_err = grib_keys_iterator_delete(__pyx_v_gi);

  /* "pygrib.pyx":1058
 *             keys_noro.append(key)
 *         err = grib_keys_iterator_delete(gi)
 *         if err:             # <<<<<<<<<<<<<<
 *             raise RuntimeError(grib_get_error_message(err))
 *         keys_ro = []
 */
  __pyx_t_2 = (__pyx_v_err != 0);
  if (unlikely(__pyx_t_2)) {

    /* "pygrib.pyx":1059
 *         err = grib_keys_iterator_delete(gi)
 *         if err:
 *             raise RuntimeError(grib_get_error_message(err))             # <<<<<<<<<<<<<<
 *         keys_ro = []
 *         for key in self._all_keys:
 */
    __pyx_t_3 = __Pyx_PyBytes_FromString(grib_get_error_message(__pyx_v_err)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1059, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_RuntimeError, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1059, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_t_4, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __PYX_ERR(0, 1059, __pyx_L1_error)

    /* "pygrib.pyx":1058
 *             keys_noro.append(key)
 *         err = grib_keys_iterator_delete(gi)
 *         if err:             # <<<<<<<<<<<<<<
 *             raise RuntimeError(grib_get_error_message(err))
 *         keys_ro = []
 */
  }

  /* "pygrib.pyx":1060
 *         if err:
 *             raise RuntimeError(grib_get_error_message(err))
 *         keys_ro = []             # <<<<<<<<<<<<<<
 *         for key in self._all_keys:
 *             if key not in keys_noro:
 */
  __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1060, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_v_keys_ro = ((PyObject*)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "pygrib.pyx":1061
 *             raise RuntimeError(grib_get_error_message(err))
 *         keys_ro = []
 *         for key in self._all_keys:             # <<<<<<<<<<<<<<
 *             if key not in keys_noro:
 *                 keys_ro.append(key)
 */
  if (likely(PyList_CheckExact(__pyx_v_self->_all_keys)) || PyTuple_CheckExact(__pyx_v_self->_all_keys)) {
    __pyx_t_4 = __pyx_v_self->_all_keys; __Pyx_INCREF(__pyx_t_4); __pyx_t_7 = 0;
    __pyx_t_8 = NULL;
  } else {
    __pyx_t_7 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_self->_all_keys); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1061, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_8 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1061, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_8)) {
      if (likely(PyList_CheckExact(__pyx_t_4))) {
        if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_4)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_3 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_7); __Pyx_INCREF(__pyx_t_3); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 1061, __pyx_L1_error)
        #else
        __pyx_t_3 = PySequence_ITEM(__pyx_t_4, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1061, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        #endif
      } else {
        if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_7); __Pyx_INCREF(__pyx_t_3); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 1061, __pyx_L1_error)
        #else
        __pyx_t_3 = PySequence_ITEM(__pyx_t_4, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1061, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        #endif
      }
    } else {
      __pyx_t_3 = __pyx_t_8(__pyx_t_4);
      if (unlikely(!__pyx_t_3)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 1061, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_3);
    }
    __Pyx_XDECREF_SET(__pyx_v_key, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "pygrib.pyx":1062
 *         keys_ro = []
 *         for key in self._all_keys:
 *             if key not in keys_noro:             # <<<<<<<<<<<<<<
 *                 keys_ro.append(key)
 *         return keys_ro
 */
    __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_v_key, __pyx_v_keys_noro, Py_NE)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 1062, __pyx_L1_error)
    __pyx_t_1 = (__pyx_t_2 != 0);
    if (__pyx_t_1) {

      /* "pygrib.pyx":1063
 *         for key in self._all_keys:
 *             if key not in keys_noro:
 *                 keys_ro.append(key)             # <<<<<<<<<<<<<<
 *         return keys_ro
 *     def data(self,lat1=None,lat2=None,lon1=None,lon2=None):
 */
      __pyx_t_6 = __Pyx_PyList_Append(__pyx_v_keys_ro, __pyx_v_key); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(0, 1063, __pyx_L1_error)

      /* "pygrib.pyx":1062
 *         keys_ro = []
 *         for key in self._all_keys:
 *             if key not in keys_noro:             # <<<<<<<<<<<<<<
 *                 keys_ro.append(key)
 *         return keys_ro
 */
    }

    /* "pygrib.pyx":1061
 *             raise RuntimeError(grib_get_error_message(err))
 *         keys_ro = []
 *         for key in self._all_keys:             # <<<<<<<<<<<<<<
 *             if key not in keys_noro:
 *                 keys_ro.append(key)
 */
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pygrib.pyx":1064
 *             if key not in keys_noro:
 *                 keys_ro.append(key)
 *         return keys_ro             # <<<<<<<<<<<<<<
 *     def data(self,lat1=None,lat2=None,lon1=None,lon2=None):
 *         """
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_keys_ro);
  __pyx_r = __pyx_v_keys_ro;
  goto __pyx_L0;

  /* "pygrib.pyx":1039
 *         if hasattr(self,'validDate'): keys.append('validDate')
 *         return keys
 *     def _read_only_keys(self):             # <<<<<<<<<<<<<<
 *         """
 *         _read_only_keys()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("pygrib.gribmessage._read_only_keys", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_keys_noro);
  __Pyx_XDECREF(__pyx_v_key);
  __Pyx_XDECREF(__pyx_v_keys_ro);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pygrib.pyx":1065
 *                 keys_ro.append(key)
 *         return keys_ro
 *     def data(self,lat1=None,lat2=None,lon1=None,lon2=None):             # <<<<<<<<<<<<<<
 *         """
 * 	data(lat1=None,lat2=None,lon1=None,lon2=None)
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pygrib_11gribmessage_21data(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6pygrib_11gribmessage_20data[] = "\n\tdata(lat1=None,lat2=None,lon1=None,lon2=None)\n\n\textract data, lats and lons for a subset region defined\n\tby the keywords lat1,lat2,lon1,lon2.\n\n        The default values of lat1,lat2,lon1,lon2 are None, which\n        means the entire grid is returned.\n\n        If the grid type is unprojected lat/lon and a geographic\n        subset is requested (by using the lat1,lat2,lon1,lon2 keywords),\n        then 2-d arrays are returned, otherwise 1-d arrays are returned.\n\t";
static PyObject *__pyx_pw_6pygrib_11gribmessage_21data(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_lat1 = 0;
  PyObject *__pyx_v_lat2 = 0;
  PyObject *__pyx_v_lon1 = 0;
  PyObject *__pyx_v_lon2 = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("data (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_lat1,&__pyx_n_s_lat2,&__pyx_n_s_lon1,&__pyx_n_s_lon2,0};
    PyObject* values[4] = {0,0,0,0};
    values[0] = ((PyObject *)Py_None);
    values[1] = ((PyObject *)Py_None);
    values[2] = ((PyObject *)Py_None);
    values[3] = ((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  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        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 = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_lat1);
          if (value) { values[0] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_lat2);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_lon1);
          if (value) { values[2] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_lon2);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "data") < 0)) __PYX_ERR(0, 1065, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_lat1 = values[0];
    __pyx_v_lat2 = values[1];
    __pyx_v_lon1 = values[2];
    __pyx_v_lon2 = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("data", 0, 0, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1065, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pygrib.gribmessage.data", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pygrib_11gribmessage_20data(((struct __pyx_obj_6pygrib_gribmessage *)__pyx_v_self), __pyx_v_lat1, __pyx_v_lat2, __pyx_v_lon1, __pyx_v_lon2);

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

static PyObject *__pyx_pf_6pygrib_11gribmessage_20data(struct __pyx_obj_6pygrib_gribmessage *__pyx_v_self, PyObject *__pyx_v_lat1, PyObject *__pyx_v_lat2, PyObject *__pyx_v_lon1, PyObject *__pyx_v_lon2) {
  PyObject *__pyx_v_data = NULL;
  PyObject *__pyx_v_lats = NULL;
  PyObject *__pyx_v_lons = NULL;
  PyObject *__pyx_v_datsubset = NULL;
  PyObject *__pyx_v_lonsubset = NULL;
  PyObject *__pyx_v_latsubset = NULL;
  PyObject *__pyx_v_masklat = NULL;
  PyObject *__pyx_v_masklon = NULL;
  PyObject *__pyx_v_mask = NULL;
  PyObject *__pyx_v_reduced_expand = NULL;
  PyObject *__pyx_v_nlats = NULL;
  PyObject *__pyx_v_nlons = NULL;
  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)(PyObject *);
  int __pyx_t_6;
  int __pyx_t_7;
  int __pyx_t_8;
  int __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  __Pyx_RefNannySetupContext("data", 0);
  __Pyx_INCREF(__pyx_v_lat1);
  __Pyx_INCREF(__pyx_v_lat2);
  __Pyx_INCREF(__pyx_v_lon1);
  __Pyx_INCREF(__pyx_v_lon2);

  /* "pygrib.pyx":1079
 *         then 2-d arrays are returned, otherwise 1-d arrays are returned.
 * 	"""
 *         data = self.values             # <<<<<<<<<<<<<<
 *         lats, lons = self.latlons()
 *         if lon1==lon2==lat1==lat2==None:
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_values); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1079, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_data = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pygrib.pyx":1080
 * 	"""
 *         data = self.values
 *         lats, lons = self.latlons()             # <<<<<<<<<<<<<<
 *         if lon1==lon2==lat1==lat2==None:
 *             datsubset = data; lonsubset = lons; latsubset = lats
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_latlons); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1080, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  if (__pyx_t_3) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1080, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else {
    __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1080, __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;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 1080, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_3);
    #else
    __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1080, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1080, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_4 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1080, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_5 = Py_TYPE(__pyx_t_4)->tp_iternext;
    index = 0; __pyx_t_2 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    index = 1; __pyx_t_3 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_4), 2) < 0) __PYX_ERR(0, 1080, __pyx_L1_error)
    __pyx_t_5 = NULL;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_5 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 1080, __pyx_L1_error)
    __pyx_L4_unpacking_done:;
  }
  __pyx_v_lats = __pyx_t_2;
  __pyx_t_2 = 0;
  __pyx_v_lons = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "pygrib.pyx":1081
 *         data = self.values
 *         lats, lons = self.latlons()
 *         if lon1==lon2==lat1==lat2==None:             # <<<<<<<<<<<<<<
 *             datsubset = data; lonsubset = lons; latsubset = lats
 *         else:
 */
  __pyx_t_1 = PyObject_RichCompare(__pyx_v_lon1, __pyx_v_lon2, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1081, __pyx_L1_error)
  if (__Pyx_PyObject_IsTrue(__pyx_t_1)) {
    __Pyx_DECREF(__pyx_t_1);
    __pyx_t_1 = PyObject_RichCompare(__pyx_v_lon2, __pyx_v_lat1, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1081, __pyx_L1_error)
    if (__Pyx_PyObject_IsTrue(__pyx_t_1)) {
      __Pyx_DECREF(__pyx_t_1);
      __pyx_t_1 = PyObject_RichCompare(__pyx_v_lat1, __pyx_v_lat2, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1081, __pyx_L1_error)
      if (__Pyx_PyObject_IsTrue(__pyx_t_1)) {
        __Pyx_DECREF(__pyx_t_1);
        __pyx_t_1 = PyObject_RichCompare(__pyx_v_lat2, Py_None, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1081, __pyx_L1_error)
      }
    }
  }
  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 1081, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_6) {

    /* "pygrib.pyx":1082
 *         lats, lons = self.latlons()
 *         if lon1==lon2==lat1==lat2==None:
 *             datsubset = data; lonsubset = lons; latsubset = lats             # <<<<<<<<<<<<<<
 *         else:
 *             if lat1 is None: lat1 = lats.min()
 */
    __Pyx_INCREF(__pyx_v_data);
    __pyx_v_datsubset = __pyx_v_data;
    __Pyx_INCREF(__pyx_v_lons);
    __pyx_v_lonsubset = __pyx_v_lons;
    __Pyx_INCREF(__pyx_v_lats);
    __pyx_v_latsubset = __pyx_v_lats;

    /* "pygrib.pyx":1081
 *         data = self.values
 *         lats, lons = self.latlons()
 *         if lon1==lon2==lat1==lat2==None:             # <<<<<<<<<<<<<<
 *             datsubset = data; lonsubset = lons; latsubset = lats
 *         else:
 */
    goto __pyx_L5;
  }

  /* "pygrib.pyx":1084
 *             datsubset = data; lonsubset = lons; latsubset = lats
 *         else:
 *             if lat1 is None: lat1 = lats.min()             # <<<<<<<<<<<<<<
 *             if lat2 is None: lat2 = lats.max()
 *             if lon1 is None: lon1 = lons.min()
 */
  /*else*/ {
    __pyx_t_6 = (__pyx_v_lat1 == Py_None);
    __pyx_t_7 = (__pyx_t_6 != 0);
    if (__pyx_t_7) {
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_lats, __pyx_n_s_min); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1084, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_2 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
        __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
        if (likely(__pyx_t_2)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
          __Pyx_INCREF(__pyx_t_2);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_3, function);
        }
      }
      if (__pyx_t_2) {
        __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1084, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      } else {
        __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1084, __pyx_L1_error)
      }
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF_SET(__pyx_v_lat1, __pyx_t_1);
      __pyx_t_1 = 0;
    }

    /* "pygrib.pyx":1085
 *         else:
 *             if lat1 is None: lat1 = lats.min()
 *             if lat2 is None: lat2 = lats.max()             # <<<<<<<<<<<<<<
 *             if lon1 is None: lon1 = lons.min()
 *             if lon2 is None: lon2 = lons.max()
 */
    __pyx_t_7 = (__pyx_v_lat2 == Py_None);
    __pyx_t_6 = (__pyx_t_7 != 0);
    if (__pyx_t_6) {
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_lats, __pyx_n_s_max); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1085, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_2 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
        __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
        if (likely(__pyx_t_2)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
          __Pyx_INCREF(__pyx_t_2);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_3, function);
        }
      }
      if (__pyx_t_2) {
        __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1085, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      } else {
        __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1085, __pyx_L1_error)
      }
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF_SET(__pyx_v_lat2, __pyx_t_1);
      __pyx_t_1 = 0;
    }

    /* "pygrib.pyx":1086
 *             if lat1 is None: lat1 = lats.min()
 *             if lat2 is None: lat2 = lats.max()
 *             if lon1 is None: lon1 = lons.min()             # <<<<<<<<<<<<<<
 *             if lon2 is None: lon2 = lons.max()
 *             masklat = (lats >= lat1) & (lats <= lat2)
 */
    __pyx_t_6 = (__pyx_v_lon1 == Py_None);
    __pyx_t_7 = (__pyx_t_6 != 0);
    if (__pyx_t_7) {
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_lons, __pyx_n_s_min); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1086, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_2 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
        __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
        if (likely(__pyx_t_2)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
          __Pyx_INCREF(__pyx_t_2);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_3, function);
        }
      }
      if (__pyx_t_2) {
        __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1086, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      } else {
        __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1086, __pyx_L1_error)
      }
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF_SET(__pyx_v_lon1, __pyx_t_1);
      __pyx_t_1 = 0;
    }

    /* "pygrib.pyx":1087
 *             if lat2 is None: lat2 = lats.max()
 *             if lon1 is None: lon1 = lons.min()
 *             if lon2 is None: lon2 = lons.max()             # <<<<<<<<<<<<<<
 *             masklat = (lats >= lat1) & (lats <= lat2)
 *             masklon = (lons >= lon1) & (lons <= lon2)
 */
    __pyx_t_7 = (__pyx_v_lon2 == Py_None);
    __pyx_t_6 = (__pyx_t_7 != 0);
    if (__pyx_t_6) {
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_lons, __pyx_n_s_max); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1087, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_2 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
        __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
        if (likely(__pyx_t_2)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
          __Pyx_INCREF(__pyx_t_2);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_3, function);
        }
      }
      if (__pyx_t_2) {
        __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1087, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      } else {
        __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1087, __pyx_L1_error)
      }
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF_SET(__pyx_v_lon2, __pyx_t_1);
      __pyx_t_1 = 0;
    }

    /* "pygrib.pyx":1088
 *             if lon1 is None: lon1 = lons.min()
 *             if lon2 is None: lon2 = lons.max()
 *             masklat = (lats >= lat1) & (lats <= lat2)             # <<<<<<<<<<<<<<
 *             masklon = (lons >= lon1) & (lons <= lon2)
 *             mask = masklat & masklon
 */
    __pyx_t_1 = PyObject_RichCompare(__pyx_v_lats, __pyx_v_lat1, Py_GE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1088, __pyx_L1_error)
    __pyx_t_3 = PyObject_RichCompare(__pyx_v_lats, __pyx_v_lat2, Py_LE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1088, __pyx_L1_error)
    __pyx_t_2 = PyNumber_And(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1088, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_masklat = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "pygrib.pyx":1089
 *             if lon2 is None: lon2 = lons.max()
 *             masklat = (lats >= lat1) & (lats <= lat2)
 *             masklon = (lons >= lon1) & (lons <= lon2)             # <<<<<<<<<<<<<<
 *             mask = masklat & masklon
 *             datsubset = data[mask]
 */
    __pyx_t_2 = PyObject_RichCompare(__pyx_v_lons, __pyx_v_lon1, Py_GE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1089, __pyx_L1_error)
    __pyx_t_3 = PyObject_RichCompare(__pyx_v_lons, __pyx_v_lon2, Py_LE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1089, __pyx_L1_error)
    __pyx_t_1 = PyNumber_And(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1089, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_masklon = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "pygrib.pyx":1090
 *             masklat = (lats >= lat1) & (lats <= lat2)
 *             masklon = (lons >= lon1) & (lons <= lon2)
 *             mask = masklat & masklon             # <<<<<<<<<<<<<<
 *             datsubset = data[mask]
 *             latsubset = lats[mask]
 */
    __pyx_t_1 = PyNumber_And(__pyx_v_masklat, __pyx_v_masklon); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1090, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_mask = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "pygrib.pyx":1091
 *             masklon = (lons >= lon1) & (lons <= lon2)
 *             mask = masklat & masklon
 *             datsubset = data[mask]             # <<<<<<<<<<<<<<
 *             latsubset = lats[mask]
 *             lonsubset = lons[mask]
 */
    __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_v_data, __pyx_v_mask); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1091, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_datsubset = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "pygrib.pyx":1092
 *             mask = masklat & masklon
 *             datsubset = data[mask]
 *             latsubset = lats[mask]             # <<<<<<<<<<<<<<
 *             lonsubset = lons[mask]
 *             # reshape lat/lon grids so returned arrays are 2-d instead of 1-d
 */
    __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_v_lats, __pyx_v_mask); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1092, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_latsubset = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "pygrib.pyx":1093
 *             datsubset = data[mask]
 *             latsubset = lats[mask]
 *             lonsubset = lons[mask]             # <<<<<<<<<<<<<<
 *             # reshape lat/lon grids so returned arrays are 2-d instead of 1-d
 *             reduced_expand = self['gridType'] in ['reduced_ll','reduced_gg'] and self.expand_reduced
 */
    __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_v_lons, __pyx_v_mask); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1093, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_lonsubset = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "pygrib.pyx":1095
 *             lonsubset = lons[mask]
 *             # reshape lat/lon grids so returned arrays are 2-d instead of 1-d
 *             reduced_expand = self['gridType'] in ['reduced_ll','reduced_gg'] and self.expand_reduced             # <<<<<<<<<<<<<<
 *             if self['gridType'] in ['regular_gg','regular_ll'] or reduced_expand:
 *                 nlats = masklat[:,0].sum()
 */
    __pyx_t_3 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_gridType); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1095, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_7 = (__Pyx_PyString_Equals(__pyx_t_3, __pyx_n_s_reduced_ll, Py_EQ)); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 1095, __pyx_L1_error)
    if (!__pyx_t_7) {
    } else {
      __pyx_t_6 = __pyx_t_7;
      goto __pyx_L12_bool_binop_done;
    }
    __pyx_t_7 = (__Pyx_PyString_Equals(__pyx_t_3, __pyx_n_s_reduced_gg, Py_EQ)); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 1095, __pyx_L1_error)
    __pyx_t_6 = __pyx_t_7;
    __pyx_L12_bool_binop_done:;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_7 = __pyx_t_6;
    if (__pyx_t_7) {
    } else {
      __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1095, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_1 = __pyx_t_3;
      __pyx_t_3 = 0;
      goto __pyx_L10_bool_binop_done;
    }
    __Pyx_INCREF(__pyx_v_self->expand_reduced);
    __pyx_t_1 = __pyx_v_self->expand_reduced;
    __pyx_L10_bool_binop_done:;
    __pyx_v_reduced_expand = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "pygrib.pyx":1096
 *             # reshape lat/lon grids so returned arrays are 2-d instead of 1-d
 *             reduced_expand = self['gridType'] in ['reduced_ll','reduced_gg'] and self.expand_reduced
 *             if self['gridType'] in ['regular_gg','regular_ll'] or reduced_expand:             # <<<<<<<<<<<<<<
 *                 nlats = masklat[:,0].sum()
 *                 nlons = masklon[0,:].sum()
 */
    __pyx_t_1 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_gridType); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1096, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_8 = (__Pyx_PyString_Equals(__pyx_t_1, __pyx_n_s_regular_gg, Py_EQ)); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 1096, __pyx_L1_error)
    if (!__pyx_t_8) {
    } else {
      __pyx_t_6 = __pyx_t_8;
      goto __pyx_L17_bool_binop_done;
    }
    __pyx_t_8 = (__Pyx_PyString_Equals(__pyx_t_1, __pyx_n_s_regular_ll, Py_EQ)); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 1096, __pyx_L1_error)
    __pyx_t_6 = __pyx_t_8;
    __pyx_L17_bool_binop_done:;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_8 = (__pyx_t_6 != 0);
    if (!__pyx_t_8) {
    } else {
      __pyx_t_7 = __pyx_t_8;
      goto __pyx_L15_bool_binop_done;
    }
    __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_v_reduced_expand); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 1096, __pyx_L1_error)
    __pyx_t_7 = __pyx_t_8;
    __pyx_L15_bool_binop_done:;
    if (__pyx_t_7) {

      /* "pygrib.pyx":1097
 *             reduced_expand = self['gridType'] in ['reduced_ll','reduced_gg'] and self.expand_reduced
 *             if self['gridType'] in ['regular_gg','regular_ll'] or reduced_expand:
 *                 nlats = masklat[:,0].sum()             # <<<<<<<<<<<<<<
 *                 nlons = masklon[0,:].sum()
 *                 if ma.isMA(datsubset):
 */
      __pyx_t_3 = __Pyx_PyObject_GetItem(__pyx_v_masklat, __pyx_tuple__55); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1097, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_sum); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1097, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
        __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
        if (likely(__pyx_t_3)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
          __Pyx_INCREF(__pyx_t_3);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_2, function);
        }
      }
      if (__pyx_t_3) {
        __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1097, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      } else {
        __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1097, __pyx_L1_error)
      }
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_v_nlats = __pyx_t_1;
      __pyx_t_1 = 0;

      /* "pygrib.pyx":1098
 *             if self['gridType'] in ['regular_gg','regular_ll'] or reduced_expand:
 *                 nlats = masklat[:,0].sum()
 *                 nlons = masklon[0,:].sum()             # <<<<<<<<<<<<<<
 *                 if ma.isMA(datsubset):
 *                     datsubset = ma.reshape(datsubset,(nlats,nlons))
 */
      __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_v_masklon, __pyx_tuple__57); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1098, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_sum); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1098, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
        __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
        if (likely(__pyx_t_2)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
          __Pyx_INCREF(__pyx_t_2);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_3, function);
        }
      }
      if (__pyx_t_2) {
        __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1098, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      } else {
        __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1098, __pyx_L1_error)
      }
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_v_nlons = __pyx_t_1;
      __pyx_t_1 = 0;

      /* "pygrib.pyx":1099
 *                 nlats = masklat[:,0].sum()
 *                 nlons = masklon[0,:].sum()
 *                 if ma.isMA(datsubset):             # <<<<<<<<<<<<<<
 *                     datsubset = ma.reshape(datsubset,(nlats,nlons))
 *                 else:
 */
      __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_ma); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1099, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_isMA); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1099, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
        __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
        if (likely(__pyx_t_3)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
          __Pyx_INCREF(__pyx_t_3);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_2, function);
        }
      }
      if (!__pyx_t_3) {
        __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_datsubset); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1099, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
      } else {
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_2)) {
          PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_datsubset};
          __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1099, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_GOTREF(__pyx_t_1);
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
          PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_datsubset};
          __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1099, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_GOTREF(__pyx_t_1);
        } else
        #endif
        {
          __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1099, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __pyx_t_3 = NULL;
          __Pyx_INCREF(__pyx_v_datsubset);
          __Pyx_GIVEREF(__pyx_v_datsubset);
          PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_datsubset);
          __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1099, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        }
      }
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 1099, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (__pyx_t_7) {

        /* "pygrib.pyx":1100
 *                 nlons = masklon[0,:].sum()
 *                 if ma.isMA(datsubset):
 *                     datsubset = ma.reshape(datsubset,(nlats,nlons))             # <<<<<<<<<<<<<<
 *                 else:
 *                     datsubset = np.reshape(datsubset,(nlats,nlons))
 */
        __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_ma); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1100, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_reshape); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1100, __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_ERR(0, 1100, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_INCREF(__pyx_v_nlats);
        __Pyx_GIVEREF(__pyx_v_nlats);
        PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_nlats);
        __Pyx_INCREF(__pyx_v_nlons);
        __Pyx_GIVEREF(__pyx_v_nlons);
        PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_nlons);
        __pyx_t_3 = NULL;
        __pyx_t_9 = 0;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
          __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
          if (likely(__pyx_t_3)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
            __Pyx_INCREF(__pyx_t_3);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_4, function);
            __pyx_t_9 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_4)) {
          PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_datsubset, __pyx_t_2};
          __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1100, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
          PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_datsubset, __pyx_t_2};
          __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1100, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        } else
        #endif
        {
          __pyx_t_10 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1100, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_10);
          if (__pyx_t_3) {
            __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_3); __pyx_t_3 = NULL;
          }
          __Pyx_INCREF(__pyx_v_datsubset);
          __Pyx_GIVEREF(__pyx_v_datsubset);
          PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_9, __pyx_v_datsubset);
          __Pyx_GIVEREF(__pyx_t_2);
          PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_9, __pyx_t_2);
          __pyx_t_2 = 0;
          __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_10, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1100, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        }
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF_SET(__pyx_v_datsubset, __pyx_t_1);
        __pyx_t_1 = 0;

        /* "pygrib.pyx":1099
 *                 nlats = masklat[:,0].sum()
 *                 nlons = masklon[0,:].sum()
 *                 if ma.isMA(datsubset):             # <<<<<<<<<<<<<<
 *                     datsubset = ma.reshape(datsubset,(nlats,nlons))
 *                 else:
 */
        goto __pyx_L19;
      }

      /* "pygrib.pyx":1102
 *                     datsubset = ma.reshape(datsubset,(nlats,nlons))
 *                 else:
 *                     datsubset = np.reshape(datsubset,(nlats,nlons))             # <<<<<<<<<<<<<<
 *                 latsubset = np.reshape(latsubset,(nlats,nlons))
 *                 lonsubset = np.reshape(lonsubset,(nlats,nlons))
 */
      /*else*/ {
        __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1102, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_reshape); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1102, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1102, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_INCREF(__pyx_v_nlats);
        __Pyx_GIVEREF(__pyx_v_nlats);
        PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_nlats);
        __Pyx_INCREF(__pyx_v_nlons);
        __Pyx_GIVEREF(__pyx_v_nlons);
        PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_nlons);
        __pyx_t_2 = NULL;
        __pyx_t_9 = 0;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_10))) {
          __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_10);
          if (likely(__pyx_t_2)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
            __Pyx_INCREF(__pyx_t_2);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_10, function);
            __pyx_t_9 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_10)) {
          PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_v_datsubset, __pyx_t_4};
          __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1102, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_10)) {
          PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_v_datsubset, __pyx_t_4};
          __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1102, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        } else
        #endif
        {
          __pyx_t_3 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1102, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          if (__pyx_t_2) {
            __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); __pyx_t_2 = NULL;
          }
          __Pyx_INCREF(__pyx_v_datsubset);
          __Pyx_GIVEREF(__pyx_v_datsubset);
          PyTuple_SET_ITEM(__pyx_t_3, 0+__pyx_t_9, __pyx_v_datsubset);
          __Pyx_GIVEREF(__pyx_t_4);
          PyTuple_SET_ITEM(__pyx_t_3, 1+__pyx_t_9, __pyx_t_4);
          __pyx_t_4 = 0;
          __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1102, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        }
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_DECREF_SET(__pyx_v_datsubset, __pyx_t_1);
        __pyx_t_1 = 0;
      }
      __pyx_L19:;

      /* "pygrib.pyx":1103
 *                 else:
 *                     datsubset = np.reshape(datsubset,(nlats,nlons))
 *                 latsubset = np.reshape(latsubset,(nlats,nlons))             # <<<<<<<<<<<<<<
 *                 lonsubset = np.reshape(lonsubset,(nlats,nlons))
 *         return datsubset,latsubset, lonsubset
 */
      __pyx_t_10 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1103, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_reshape); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1103, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1103, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_INCREF(__pyx_v_nlats);
      __Pyx_GIVEREF(__pyx_v_nlats);
      PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_v_nlats);
      __Pyx_INCREF(__pyx_v_nlons);
      __Pyx_GIVEREF(__pyx_v_nlons);
      PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_v_nlons);
      __pyx_t_4 = NULL;
      __pyx_t_9 = 0;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
        __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
        if (likely(__pyx_t_4)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
          __Pyx_INCREF(__pyx_t_4);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_3, function);
          __pyx_t_9 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_3)) {
        PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_latsubset, __pyx_t_10};
        __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1103, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
        PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_latsubset, __pyx_t_10};
        __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1103, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      } else
      #endif
      {
        __pyx_t_2 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1103, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        if (__pyx_t_4) {
          __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_4); __pyx_t_4 = NULL;
        }
        __Pyx_INCREF(__pyx_v_latsubset);
        __Pyx_GIVEREF(__pyx_v_latsubset);
        PyTuple_SET_ITEM(__pyx_t_2, 0+__pyx_t_9, __pyx_v_latsubset);
        __Pyx_GIVEREF(__pyx_t_10);
        PyTuple_SET_ITEM(__pyx_t_2, 1+__pyx_t_9, __pyx_t_10);
        __pyx_t_10 = 0;
        __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1103, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      }
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF_SET(__pyx_v_latsubset, __pyx_t_1);
      __pyx_t_1 = 0;

      /* "pygrib.pyx":1104
 *                     datsubset = np.reshape(datsubset,(nlats,nlons))
 *                 latsubset = np.reshape(latsubset,(nlats,nlons))
 *                 lonsubset = np.reshape(lonsubset,(nlats,nlons))             # <<<<<<<<<<<<<<
 *         return datsubset,latsubset, lonsubset
 *     def __setitem__(self, key, value):
 */
      __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1104, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_reshape); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1104, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1104, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_v_nlats);
      __Pyx_GIVEREF(__pyx_v_nlats);
      PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_nlats);
      __Pyx_INCREF(__pyx_v_nlons);
      __Pyx_GIVEREF(__pyx_v_nlons);
      PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_nlons);
      __pyx_t_10 = NULL;
      __pyx_t_9 = 0;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
        __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_2);
        if (likely(__pyx_t_10)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
          __Pyx_INCREF(__pyx_t_10);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_2, function);
          __pyx_t_9 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_2)) {
        PyObject *__pyx_temp[3] = {__pyx_t_10, __pyx_v_lonsubset, __pyx_t_3};
        __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1104, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
        PyObject *__pyx_temp[3] = {__pyx_t_10, __pyx_v_lonsubset, __pyx_t_3};
        __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1104, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      } else
      #endif
      {
        __pyx_t_4 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1104, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        if (__pyx_t_10) {
          __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_10); __pyx_t_10 = NULL;
        }
        __Pyx_INCREF(__pyx_v_lonsubset);
        __Pyx_GIVEREF(__pyx_v_lonsubset);
        PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_9, __pyx_v_lonsubset);
        __Pyx_GIVEREF(__pyx_t_3);
        PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_9, __pyx_t_3);
        __pyx_t_3 = 0;
        __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1104, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      }
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF_SET(__pyx_v_lonsubset, __pyx_t_1);
      __pyx_t_1 = 0;

      /* "pygrib.pyx":1096
 *             # reshape lat/lon grids so returned arrays are 2-d instead of 1-d
 *             reduced_expand = self['gridType'] in ['reduced_ll','reduced_gg'] and self.expand_reduced
 *             if self['gridType'] in ['regular_gg','regular_ll'] or reduced_expand:             # <<<<<<<<<<<<<<
 *                 nlats = masklat[:,0].sum()
 *                 nlons = masklon[0,:].sum()
 */
    }
  }
  __pyx_L5:;

  /* "pygrib.pyx":1105
 *                 latsubset = np.reshape(latsubset,(nlats,nlons))
 *                 lonsubset = np.reshape(lonsubset,(nlats,nlons))
 *         return datsubset,latsubset, lonsubset             # <<<<<<<<<<<<<<
 *     def __setitem__(self, key, value):
 *         """
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1105, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_datsubset);
  __Pyx_GIVEREF(__pyx_v_datsubset);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_datsubset);
  __Pyx_INCREF(__pyx_v_latsubset);
  __Pyx_GIVEREF(__pyx_v_latsubset);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_latsubset);
  __Pyx_INCREF(__pyx_v_lonsubset);
  __Pyx_GIVEREF(__pyx_v_lonsubset);
  PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_lonsubset);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "pygrib.pyx":1065
 *                 keys_ro.append(key)
 *         return keys_ro
 *     def data(self,lat1=None,lat2=None,lon1=None,lon2=None):             # <<<<<<<<<<<<<<
 *         """
 * 	data(lat1=None,lat2=None,lon1=None,lon2=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_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("pygrib.gribmessage.data", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_data);
  __Pyx_XDECREF(__pyx_v_lats);
  __Pyx_XDECREF(__pyx_v_lons);
  __Pyx_XDECREF(__pyx_v_datsubset);
  __Pyx_XDECREF(__pyx_v_lonsubset);
  __Pyx_XDECREF(__pyx_v_latsubset);
  __Pyx_XDECREF(__pyx_v_masklat);
  __Pyx_XDECREF(__pyx_v_masklon);
  __Pyx_XDECREF(__pyx_v_mask);
  __Pyx_XDECREF(__pyx_v_reduced_expand);
  __Pyx_XDECREF(__pyx_v_nlats);
  __Pyx_XDECREF(__pyx_v_nlons);
  __Pyx_XDECREF(__pyx_v_lat1);
  __Pyx_XDECREF(__pyx_v_lat2);
  __Pyx_XDECREF(__pyx_v_lon1);
  __Pyx_XDECREF(__pyx_v_lon2);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pygrib.pyx":1106
 *                 lonsubset = np.reshape(lonsubset,(nlats,nlons))
 *         return datsubset,latsubset, lonsubset
 *     def __setitem__(self, key, value):             # <<<<<<<<<<<<<<
 *         """
 *         change values associated with existing grib keys.
 */

/* Python wrapper */
static int __pyx_pw_6pygrib_11gribmessage_23__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_value); /*proto*/
static char __pyx_doc_6pygrib_11gribmessage_22__setitem__[] = "\n        change values associated with existing grib keys.\n        ";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_6pygrib_11gribmessage_22__setitem__;
#endif
static int __pyx_pw_6pygrib_11gribmessage_23__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pygrib_11gribmessage_22__setitem__(((struct __pyx_obj_6pygrib_gribmessage *)__pyx_v_self), ((PyObject *)__pyx_v_key), ((PyObject *)__pyx_v_value));

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

static int __pyx_pf_6pygrib_11gribmessage_22__setitem__(struct __pyx_obj_6pygrib_gribmessage *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_value) {
  int __pyx_v_err;
  int __pyx_v_typ;
  size_t __pyx_v_size;
  char *__pyx_v_name;
  long __pyx_v_longval;
  double __pyx_v_doubleval;
  PyArrayObject *__pyx_v_datarr = 0;
  char *__pyx_v_strdata;
  PyObject *__pyx_v_bytestr = NULL;
  int __pyx_v_is_array;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  char *__pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  long __pyx_t_10;
  size_t __pyx_t_11;
  double __pyx_t_12;
  Py_ssize_t __pyx_t_13;
  __Pyx_RefNannySetupContext("__setitem__", 0);

  /* "pygrib.pyx":1117
 *         cdef ndarray datarr
 *         cdef char *strdata
 *         if key in self._ro_keys:             # <<<<<<<<<<<<<<
 *             raise KeyError('key "%s" is read only' % key)
 *         if key not in self._all_keys:
 */
  __pyx_t_1 = (__Pyx_PySequence_ContainsTF(__pyx_v_key, __pyx_v_self->_ro_keys, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1117, __pyx_L1_error)
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (unlikely(__pyx_t_2)) {

    /* "pygrib.pyx":1118
 *         cdef char *strdata
 *         if key in self._ro_keys:
 *             raise KeyError('key "%s" is read only' % key)             # <<<<<<<<<<<<<<
 *         if key not in self._all_keys:
 *             raise KeyError('can only modify existing grib keys (key "%s" not found)'
 */
    __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_key_s_is_read_only, __pyx_v_key); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1118, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_KeyError, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1118, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_t_4, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __PYX_ERR(0, 1118, __pyx_L1_error)

    /* "pygrib.pyx":1117
 *         cdef ndarray datarr
 *         cdef char *strdata
 *         if key in self._ro_keys:             # <<<<<<<<<<<<<<
 *             raise KeyError('key "%s" is read only' % key)
 *         if key not in self._all_keys:
 */
  }

  /* "pygrib.pyx":1119
 *         if key in self._ro_keys:
 *             raise KeyError('key "%s" is read only' % key)
 *         if key not in self._all_keys:             # <<<<<<<<<<<<<<
 *             raise KeyError('can only modify existing grib keys (key "%s" not found)'
 *                     % key )
 */
  __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_v_key, __pyx_v_self->_all_keys, Py_NE)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 1119, __pyx_L1_error)
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (unlikely(__pyx_t_1)) {

    /* "pygrib.pyx":1121
 *         if key not in self._all_keys:
 *             raise KeyError('can only modify existing grib keys (key "%s" not found)'
 *                     % key )             # <<<<<<<<<<<<<<
 *         bytestr = _strencode(key)
 *         name = bytestr
 */
    __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_can_only_modify_existing_grib_ke, __pyx_v_key); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1121, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);

    /* "pygrib.pyx":1120
 *             raise KeyError('key "%s" is read only' % key)
 *         if key not in self._all_keys:
 *             raise KeyError('can only modify existing grib keys (key "%s" not found)'             # <<<<<<<<<<<<<<
 *                     % key )
 *         bytestr = _strencode(key)
 */
    __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_KeyError, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1120, __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_ERR(0, 1120, __pyx_L1_error)

    /* "pygrib.pyx":1119
 *         if key in self._ro_keys:
 *             raise KeyError('key "%s" is read only' % key)
 *         if key not in self._all_keys:             # <<<<<<<<<<<<<<
 *             raise KeyError('can only modify existing grib keys (key "%s" not found)'
 *                     % key )
 */
  }

  /* "pygrib.pyx":1122
 *             raise KeyError('can only modify existing grib keys (key "%s" not found)'
 *                     % key )
 *         bytestr = _strencode(key)             # <<<<<<<<<<<<<<
 *         name = bytestr
 *         err = grib_get_native_type(self._gh, name, &typ)
 */
  __pyx_t_3 = __pyx_f_6pygrib__strencode(__pyx_v_key, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1122, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_bytestr = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "pygrib.pyx":1123
 *                     % key )
 *         bytestr = _strencode(key)
 *         name = bytestr             # <<<<<<<<<<<<<<
 *         err = grib_get_native_type(self._gh, name, &typ)
 *         if err:
 */
  __pyx_t_5 = __Pyx_PyObject_AsWritableString(__pyx_v_bytestr); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) __PYX_ERR(0, 1123, __pyx_L1_error)
  __pyx_v_name = __pyx_t_5;

  /* "pygrib.pyx":1124
 *         bytestr = _strencode(key)
 *         name = bytestr
 *         err = grib_get_native_type(self._gh, name, &typ)             # <<<<<<<<<<<<<<
 *         if err:
 *             raise RuntimeError(grib_get_error_message(err))
 */
  __pyx_v_err = grib_get_native_type(__pyx_v_self->_gh, __pyx_v_name, (&__pyx_v_typ));

  /* "pygrib.pyx":1125
 *         name = bytestr
 *         err = grib_get_native_type(self._gh, name, &typ)
 *         if err:             # <<<<<<<<<<<<<<
 *             raise RuntimeError(grib_get_error_message(err))
 *         elif typ == GRIB_TYPE_LONG:
 */
  __pyx_t_1 = (__pyx_v_err != 0);
  if (unlikely(__pyx_t_1)) {

    /* "pygrib.pyx":1126
 *         err = grib_get_native_type(self._gh, name, &typ)
 *         if err:
 *             raise RuntimeError(grib_get_error_message(err))             # <<<<<<<<<<<<<<
 *         elif typ == GRIB_TYPE_LONG:
 *             # is value an array or a scalar?
 */
    __pyx_t_3 = __Pyx_PyBytes_FromString(grib_get_error_message(__pyx_v_err)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1126, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_RuntimeError, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1126, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_t_4, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __PYX_ERR(0, 1126, __pyx_L1_error)

    /* "pygrib.pyx":1125
 *         name = bytestr
 *         err = grib_get_native_type(self._gh, name, &typ)
 *         if err:             # <<<<<<<<<<<<<<
 *             raise RuntimeError(grib_get_error_message(err))
 *         elif typ == GRIB_TYPE_LONG:
 */
  }

  /* "pygrib.pyx":1127
 *         if err:
 *             raise RuntimeError(grib_get_error_message(err))
 *         elif typ == GRIB_TYPE_LONG:             # <<<<<<<<<<<<<<
 *             # is value an array or a scalar?
 *             datarr = np.asarray(value, np.int)
 */
  __pyx_t_1 = ((__pyx_v_typ == GRIB_TYPE_LONG) != 0);
  if (__pyx_t_1) {

    /* "pygrib.pyx":1129
 *         elif typ == GRIB_TYPE_LONG:
 *             # is value an array or a scalar?
 *             datarr = np.asarray(value, np.int)             # <<<<<<<<<<<<<<
 *             is_array = False
 *             if datarr.shape:
 */
    __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1129, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_asarray); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1129, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1129, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_int); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1129, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = NULL;
    __pyx_t_8 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_6);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_6, function);
        __pyx_t_8 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_6)) {
      PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_value, __pyx_t_7};
      __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1129, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
      PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_value, __pyx_t_7};
      __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1129, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    } else
    #endif
    {
      __pyx_t_9 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1129, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      if (__pyx_t_3) {
        __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_3); __pyx_t_3 = NULL;
      }
      __Pyx_INCREF(__pyx_v_value);
      __Pyx_GIVEREF(__pyx_v_value);
      PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_v_value);
      __Pyx_GIVEREF(__pyx_t_7);
      PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_t_7);
      __pyx_t_7 = 0;
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_9, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1129, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    }
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_6pygrib_ndarray))))) __PYX_ERR(0, 1129, __pyx_L1_error)
    __pyx_v_datarr = ((PyArrayObject *)__pyx_t_4);
    __pyx_t_4 = 0;

    /* "pygrib.pyx":1130
 *             # is value an array or a scalar?
 *             datarr = np.asarray(value, np.int)
 *             is_array = False             # <<<<<<<<<<<<<<
 *             if datarr.shape:
 *                 is_array = True
 */
    __pyx_v_is_array = 0;

    /* "pygrib.pyx":1131
 *             datarr = np.asarray(value, np.int)
 *             is_array = False
 *             if datarr.shape:             # <<<<<<<<<<<<<<
 *                 is_array = True
 *             if not is_array: # scalar
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_datarr), __pyx_n_s_shape); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1131, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1131, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (__pyx_t_1) {

      /* "pygrib.pyx":1132
 *             is_array = False
 *             if datarr.shape:
 *                 is_array = True             # <<<<<<<<<<<<<<
 *             if not is_array: # scalar
 *                 longval = value
 */
      __pyx_v_is_array = 1;

      /* "pygrib.pyx":1131
 *             datarr = np.asarray(value, np.int)
 *             is_array = False
 *             if datarr.shape:             # <<<<<<<<<<<<<<
 *                 is_array = True
 *             if not is_array: # scalar
 */
    }

    /* "pygrib.pyx":1133
 *             if datarr.shape:
 *                 is_array = True
 *             if not is_array: # scalar             # <<<<<<<<<<<<<<
 *                 longval = value
 *                 err = grib_set_long(self._gh, name, longval)
 */
    __pyx_t_1 = ((!(__pyx_v_is_array != 0)) != 0);
    if (__pyx_t_1) {

      /* "pygrib.pyx":1134
 *                 is_array = True
 *             if not is_array: # scalar
 *                 longval = value             # <<<<<<<<<<<<<<
 *                 err = grib_set_long(self._gh, name, longval)
 *                 if err:
 */
      __pyx_t_10 = __Pyx_PyInt_As_long(__pyx_v_value); if (unlikely((__pyx_t_10 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 1134, __pyx_L1_error)
      __pyx_v_longval = __pyx_t_10;

      /* "pygrib.pyx":1135
 *             if not is_array: # scalar
 *                 longval = value
 *                 err = grib_set_long(self._gh, name, longval)             # <<<<<<<<<<<<<<
 *                 if err:
 *                     raise RuntimeError(grib_get_error_message(err))
 */
      __pyx_v_err = grib_set_long(__pyx_v_self->_gh, __pyx_v_name, __pyx_v_longval);

      /* "pygrib.pyx":1136
 *                 longval = value
 *                 err = grib_set_long(self._gh, name, longval)
 *                 if err:             # <<<<<<<<<<<<<<
 *                     raise RuntimeError(grib_get_error_message(err))
 *             else:
 */
      __pyx_t_1 = (__pyx_v_err != 0);
      if (unlikely(__pyx_t_1)) {

        /* "pygrib.pyx":1137
 *                 err = grib_set_long(self._gh, name, longval)
 *                 if err:
 *                     raise RuntimeError(grib_get_error_message(err))             # <<<<<<<<<<<<<<
 *             else:
 *                 if key == 'values':
 */
        __pyx_t_4 = __Pyx_PyBytes_FromString(grib_get_error_message(__pyx_v_err)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1137, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_builtin_RuntimeError, __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1137, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_Raise(__pyx_t_6, 0, 0, 0);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __PYX_ERR(0, 1137, __pyx_L1_error)

        /* "pygrib.pyx":1136
 *                 longval = value
 *                 err = grib_set_long(self._gh, name, longval)
 *                 if err:             # <<<<<<<<<<<<<<
 *                     raise RuntimeError(grib_get_error_message(err))
 *             else:
 */
      }

      /* "pygrib.pyx":1133
 *             if datarr.shape:
 *                 is_array = True
 *             if not is_array: # scalar             # <<<<<<<<<<<<<<
 *                 longval = value
 *                 err = grib_set_long(self._gh, name, longval)
 */
      goto __pyx_L7;
    }

    /* "pygrib.pyx":1139
 *                     raise RuntimeError(grib_get_error_message(err))
 *             else:
 *                 if key == 'values':             # <<<<<<<<<<<<<<
 *                     datarr = self._unshape_mask(datarr)
 *                 if not PyArray_ISCONTIGUOUS(datarr):
 */
    /*else*/ {
      __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_v_key, __pyx_n_s_values, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1139, __pyx_L1_error)
      if (__pyx_t_1) {

        /* "pygrib.pyx":1140
 *             else:
 *                 if key == 'values':
 *                     datarr = self._unshape_mask(datarr)             # <<<<<<<<<<<<<<
 *                 if not PyArray_ISCONTIGUOUS(datarr):
 *                     datarr = datarr.copy()
 */
        __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_unshape_mask); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1140, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_9 = NULL;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
          __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_4);
          if (likely(__pyx_t_9)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
            __Pyx_INCREF(__pyx_t_9);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_4, function);
          }
        }
        if (!__pyx_t_9) {
          __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_t_4, ((PyObject *)__pyx_v_datarr)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1140, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
        } else {
          #if CYTHON_FAST_PYCALL
          if (PyFunction_Check(__pyx_t_4)) {
            PyObject *__pyx_temp[2] = {__pyx_t_9, ((PyObject *)__pyx_v_datarr)};
            __pyx_t_6 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1140, __pyx_L1_error)
            __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
            __Pyx_GOTREF(__pyx_t_6);
          } else
          #endif
          #if CYTHON_FAST_PYCCALL
          if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
            PyObject *__pyx_temp[2] = {__pyx_t_9, ((PyObject *)__pyx_v_datarr)};
            __pyx_t_6 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1140, __pyx_L1_error)
            __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
            __Pyx_GOTREF(__pyx_t_6);
          } else
          #endif
          {
            __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1140, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_7);
            __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_9); __pyx_t_9 = NULL;
            __Pyx_INCREF(((PyObject *)__pyx_v_datarr));
            __Pyx_GIVEREF(((PyObject *)__pyx_v_datarr));
            PyTuple_SET_ITEM(__pyx_t_7, 0+1, ((PyObject *)__pyx_v_datarr));
            __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_7, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1140, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_6);
            __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          }
        }
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_6pygrib_ndarray))))) __PYX_ERR(0, 1140, __pyx_L1_error)
        __Pyx_DECREF_SET(__pyx_v_datarr, ((PyArrayObject *)__pyx_t_6));
        __pyx_t_6 = 0;

        /* "pygrib.pyx":1139
 *                     raise RuntimeError(grib_get_error_message(err))
 *             else:
 *                 if key == 'values':             # <<<<<<<<<<<<<<
 *                     datarr = self._unshape_mask(datarr)
 *                 if not PyArray_ISCONTIGUOUS(datarr):
 */
      }

      /* "pygrib.pyx":1141
 *                 if key == 'values':
 *                     datarr = self._unshape_mask(datarr)
 *                 if not PyArray_ISCONTIGUOUS(datarr):             # <<<<<<<<<<<<<<
 *                     datarr = datarr.copy()
 *                 size = datarr.size
 */
      __pyx_t_1 = ((!(PyArray_ISCONTIGUOUS(__pyx_v_datarr) != 0)) != 0);
      if (__pyx_t_1) {

        /* "pygrib.pyx":1142
 *                     datarr = self._unshape_mask(datarr)
 *                 if not PyArray_ISCONTIGUOUS(datarr):
 *                     datarr = datarr.copy()             # <<<<<<<<<<<<<<
 *                 size = datarr.size
 *                 err = grib_set_long_array(self._gh, name, <long *>datarr.data, size)
 */
        __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_datarr), __pyx_n_s_copy); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1142, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_7 = NULL;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
          __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_4);
          if (likely(__pyx_t_7)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
            __Pyx_INCREF(__pyx_t_7);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_4, function);
          }
        }
        if (__pyx_t_7) {
          __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1142, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        } else {
          __pyx_t_6 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1142, __pyx_L1_error)
        }
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_6pygrib_ndarray))))) __PYX_ERR(0, 1142, __pyx_L1_error)
        __Pyx_DECREF_SET(__pyx_v_datarr, ((PyArrayObject *)__pyx_t_6));
        __pyx_t_6 = 0;

        /* "pygrib.pyx":1141
 *                 if key == 'values':
 *                     datarr = self._unshape_mask(datarr)
 *                 if not PyArray_ISCONTIGUOUS(datarr):             # <<<<<<<<<<<<<<
 *                     datarr = datarr.copy()
 *                 size = datarr.size
 */
      }

      /* "pygrib.pyx":1143
 *                 if not PyArray_ISCONTIGUOUS(datarr):
 *                     datarr = datarr.copy()
 *                 size = datarr.size             # <<<<<<<<<<<<<<
 *                 err = grib_set_long_array(self._gh, name, <long *>datarr.data, size)
 *                 if err:
 */
      __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_datarr), __pyx_n_s_size); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1143, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_11 = __Pyx_PyInt_As_size_t(__pyx_t_6); if (unlikely((__pyx_t_11 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1143, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_v_size = __pyx_t_11;

      /* "pygrib.pyx":1144
 *                     datarr = datarr.copy()
 *                 size = datarr.size
 *                 err = grib_set_long_array(self._gh, name, <long *>datarr.data, size)             # <<<<<<<<<<<<<<
 *                 if err:
 *                     raise RuntimeError(grib_get_error_message(err))
 */
      __pyx_v_err = grib_set_long_array(__pyx_v_self->_gh, __pyx_v_name, ((long *)__pyx_v_datarr->data), __pyx_v_size);

      /* "pygrib.pyx":1145
 *                 size = datarr.size
 *                 err = grib_set_long_array(self._gh, name, <long *>datarr.data, size)
 *                 if err:             # <<<<<<<<<<<<<<
 *                     raise RuntimeError(grib_get_error_message(err))
 *         elif typ == GRIB_TYPE_DOUBLE:
 */
      __pyx_t_1 = (__pyx_v_err != 0);
      if (unlikely(__pyx_t_1)) {

        /* "pygrib.pyx":1146
 *                 err = grib_set_long_array(self._gh, name, <long *>datarr.data, size)
 *                 if err:
 *                     raise RuntimeError(grib_get_error_message(err))             # <<<<<<<<<<<<<<
 *         elif typ == GRIB_TYPE_DOUBLE:
 *             # is value an array or a scalar?
 */
        __pyx_t_6 = __Pyx_PyBytes_FromString(grib_get_error_message(__pyx_v_err)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1146, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_RuntimeError, __pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1146, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_Raise(__pyx_t_4, 0, 0, 0);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __PYX_ERR(0, 1146, __pyx_L1_error)

        /* "pygrib.pyx":1145
 *                 size = datarr.size
 *                 err = grib_set_long_array(self._gh, name, <long *>datarr.data, size)
 *                 if err:             # <<<<<<<<<<<<<<
 *                     raise RuntimeError(grib_get_error_message(err))
 *         elif typ == GRIB_TYPE_DOUBLE:
 */
      }
    }
    __pyx_L7:;

    /* "pygrib.pyx":1127
 *         if err:
 *             raise RuntimeError(grib_get_error_message(err))
 *         elif typ == GRIB_TYPE_LONG:             # <<<<<<<<<<<<<<
 *             # is value an array or a scalar?
 *             datarr = np.asarray(value, np.int)
 */
    goto __pyx_L5;
  }

  /* "pygrib.pyx":1147
 *                 if err:
 *                     raise RuntimeError(grib_get_error_message(err))
 *         elif typ == GRIB_TYPE_DOUBLE:             # <<<<<<<<<<<<<<
 *             # is value an array or a scalar?
 *             datarr = np.asarray(value, np.float)
 */
  __pyx_t_1 = ((__pyx_v_typ == GRIB_TYPE_DOUBLE) != 0);
  if (__pyx_t_1) {

    /* "pygrib.pyx":1149
 *         elif typ == GRIB_TYPE_DOUBLE:
 *             # is value an array or a scalar?
 *             datarr = np.asarray(value, np.float)             # <<<<<<<<<<<<<<
 *             is_array = False
 *             if datarr.shape:
 */
    __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1149, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_asarray); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1149, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1149, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_float); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1149, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = NULL;
    __pyx_t_8 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_7);
      if (likely(__pyx_t_6)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_7, function);
        __pyx_t_8 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_7)) {
      PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_v_value, __pyx_t_9};
      __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1149, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) {
      PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_v_value, __pyx_t_9};
      __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1149, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    } else
    #endif
    {
      __pyx_t_3 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1149, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (__pyx_t_6) {
        __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_6); __pyx_t_6 = NULL;
      }
      __Pyx_INCREF(__pyx_v_value);
      __Pyx_GIVEREF(__pyx_v_value);
      PyTuple_SET_ITEM(__pyx_t_3, 0+__pyx_t_8, __pyx_v_value);
      __Pyx_GIVEREF(__pyx_t_9);
      PyTuple_SET_ITEM(__pyx_t_3, 1+__pyx_t_8, __pyx_t_9);
      __pyx_t_9 = 0;
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1149, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_6pygrib_ndarray))))) __PYX_ERR(0, 1149, __pyx_L1_error)
    __pyx_v_datarr = ((PyArrayObject *)__pyx_t_4);
    __pyx_t_4 = 0;

    /* "pygrib.pyx":1150
 *             # is value an array or a scalar?
 *             datarr = np.asarray(value, np.float)
 *             is_array = False             # <<<<<<<<<<<<<<
 *             if datarr.shape:
 *                 is_array = True
 */
    __pyx_v_is_array = 0;

    /* "pygrib.pyx":1151
 *             datarr = np.asarray(value, np.float)
 *             is_array = False
 *             if datarr.shape:             # <<<<<<<<<<<<<<
 *                 is_array = True
 *             if not is_array: # scalar
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_datarr), __pyx_n_s_shape); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1151, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1151, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (__pyx_t_1) {

      /* "pygrib.pyx":1152
 *             is_array = False
 *             if datarr.shape:
 *                 is_array = True             # <<<<<<<<<<<<<<
 *             if not is_array: # scalar
 *                 doubleval = value
 */
      __pyx_v_is_array = 1;

      /* "pygrib.pyx":1151
 *             datarr = np.asarray(value, np.float)
 *             is_array = False
 *             if datarr.shape:             # <<<<<<<<<<<<<<
 *                 is_array = True
 *             if not is_array: # scalar
 */
    }

    /* "pygrib.pyx":1153
 *             if datarr.shape:
 *                 is_array = True
 *             if not is_array: # scalar             # <<<<<<<<<<<<<<
 *                 doubleval = value
 *                 err = grib_set_double(self._gh, name, doubleval)
 */
    __pyx_t_1 = ((!(__pyx_v_is_array != 0)) != 0);
    if (__pyx_t_1) {

      /* "pygrib.pyx":1154
 *                 is_array = True
 *             if not is_array: # scalar
 *                 doubleval = value             # <<<<<<<<<<<<<<
 *                 err = grib_set_double(self._gh, name, doubleval)
 *                 if err:
 */
      __pyx_t_12 = __pyx_PyFloat_AsDouble(__pyx_v_value); if (unlikely((__pyx_t_12 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1154, __pyx_L1_error)
      __pyx_v_doubleval = __pyx_t_12;

      /* "pygrib.pyx":1155
 *             if not is_array: # scalar
 *                 doubleval = value
 *                 err = grib_set_double(self._gh, name, doubleval)             # <<<<<<<<<<<<<<
 *                 if err:
 *                     raise RuntimeError(grib_get_error_message(err))
 */
      __pyx_v_err = grib_set_double(__pyx_v_self->_gh, __pyx_v_name, __pyx_v_doubleval);

      /* "pygrib.pyx":1156
 *                 doubleval = value
 *                 err = grib_set_double(self._gh, name, doubleval)
 *                 if err:             # <<<<<<<<<<<<<<
 *                     raise RuntimeError(grib_get_error_message(err))
 *             else:
 */
      __pyx_t_1 = (__pyx_v_err != 0);
      if (unlikely(__pyx_t_1)) {

        /* "pygrib.pyx":1157
 *                 err = grib_set_double(self._gh, name, doubleval)
 *                 if err:
 *                     raise RuntimeError(grib_get_error_message(err))             # <<<<<<<<<<<<<<
 *             else:
 *                 if key == 'values':
 */
        __pyx_t_4 = __Pyx_PyBytes_FromString(grib_get_error_message(__pyx_v_err)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1157, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_builtin_RuntimeError, __pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1157, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_Raise(__pyx_t_7, 0, 0, 0);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __PYX_ERR(0, 1157, __pyx_L1_error)

        /* "pygrib.pyx":1156
 *                 doubleval = value
 *                 err = grib_set_double(self._gh, name, doubleval)
 *                 if err:             # <<<<<<<<<<<<<<
 *                     raise RuntimeError(grib_get_error_message(err))
 *             else:
 */
      }

      /* "pygrib.pyx":1153
 *             if datarr.shape:
 *                 is_array = True
 *             if not is_array: # scalar             # <<<<<<<<<<<<<<
 *                 doubleval = value
 *                 err = grib_set_double(self._gh, name, doubleval)
 */
      goto __pyx_L13;
    }

    /* "pygrib.pyx":1159
 *                     raise RuntimeError(grib_get_error_message(err))
 *             else:
 *                 if key == 'values':             # <<<<<<<<<<<<<<
 *                     datarr = self._unshape_mask(datarr)
 *                 if not PyArray_ISCONTIGUOUS(datarr):
 */
    /*else*/ {
      __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_v_key, __pyx_n_s_values, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1159, __pyx_L1_error)
      if (__pyx_t_1) {

        /* "pygrib.pyx":1160
 *             else:
 *                 if key == 'values':
 *                     datarr = self._unshape_mask(datarr)             # <<<<<<<<<<<<<<
 *                 if not PyArray_ISCONTIGUOUS(datarr):
 *                     datarr = datarr.copy()
 */
        __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_unshape_mask); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1160, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_3 = NULL;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
          __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
          if (likely(__pyx_t_3)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
            __Pyx_INCREF(__pyx_t_3);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_4, function);
          }
        }
        if (!__pyx_t_3) {
          __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_t_4, ((PyObject *)__pyx_v_datarr)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1160, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
        } else {
          #if CYTHON_FAST_PYCALL
          if (PyFunction_Check(__pyx_t_4)) {
            PyObject *__pyx_temp[2] = {__pyx_t_3, ((PyObject *)__pyx_v_datarr)};
            __pyx_t_7 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1160, __pyx_L1_error)
            __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
            __Pyx_GOTREF(__pyx_t_7);
          } else
          #endif
          #if CYTHON_FAST_PYCCALL
          if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
            PyObject *__pyx_temp[2] = {__pyx_t_3, ((PyObject *)__pyx_v_datarr)};
            __pyx_t_7 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1160, __pyx_L1_error)
            __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
            __Pyx_GOTREF(__pyx_t_7);
          } else
          #endif
          {
            __pyx_t_9 = PyTuple_New(1+1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1160, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_9);
            __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_3); __pyx_t_3 = NULL;
            __Pyx_INCREF(((PyObject *)__pyx_v_datarr));
            __Pyx_GIVEREF(((PyObject *)__pyx_v_datarr));
            PyTuple_SET_ITEM(__pyx_t_9, 0+1, ((PyObject *)__pyx_v_datarr));
            __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_9, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1160, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_7);
            __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          }
        }
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_6pygrib_ndarray))))) __PYX_ERR(0, 1160, __pyx_L1_error)
        __Pyx_DECREF_SET(__pyx_v_datarr, ((PyArrayObject *)__pyx_t_7));
        __pyx_t_7 = 0;

        /* "pygrib.pyx":1159
 *                     raise RuntimeError(grib_get_error_message(err))
 *             else:
 *                 if key == 'values':             # <<<<<<<<<<<<<<
 *                     datarr = self._unshape_mask(datarr)
 *                 if not PyArray_ISCONTIGUOUS(datarr):
 */
      }

      /* "pygrib.pyx":1161
 *                 if key == 'values':
 *                     datarr = self._unshape_mask(datarr)
 *                 if not PyArray_ISCONTIGUOUS(datarr):             # <<<<<<<<<<<<<<
 *                     datarr = datarr.copy()
 *                 size = datarr.size
 */
      __pyx_t_1 = ((!(PyArray_ISCONTIGUOUS(__pyx_v_datarr) != 0)) != 0);
      if (__pyx_t_1) {

        /* "pygrib.pyx":1162
 *                     datarr = self._unshape_mask(datarr)
 *                 if not PyArray_ISCONTIGUOUS(datarr):
 *                     datarr = datarr.copy()             # <<<<<<<<<<<<<<
 *                 size = datarr.size
 *                 err = grib_set_double_array(self._gh, name, <double *>datarr.data, size)
 */
        __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_datarr), __pyx_n_s_copy); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1162, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_9 = NULL;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
          __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_4);
          if (likely(__pyx_t_9)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
            __Pyx_INCREF(__pyx_t_9);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_4, function);
          }
        }
        if (__pyx_t_9) {
          __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_9); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1162, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        } else {
          __pyx_t_7 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1162, __pyx_L1_error)
        }
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_6pygrib_ndarray))))) __PYX_ERR(0, 1162, __pyx_L1_error)
        __Pyx_DECREF_SET(__pyx_v_datarr, ((PyArrayObject *)__pyx_t_7));
        __pyx_t_7 = 0;

        /* "pygrib.pyx":1161
 *                 if key == 'values':
 *                     datarr = self._unshape_mask(datarr)
 *                 if not PyArray_ISCONTIGUOUS(datarr):             # <<<<<<<<<<<<<<
 *                     datarr = datarr.copy()
 *                 size = datarr.size
 */
      }

      /* "pygrib.pyx":1163
 *                 if not PyArray_ISCONTIGUOUS(datarr):
 *                     datarr = datarr.copy()
 *                 size = datarr.size             # <<<<<<<<<<<<<<
 *                 err = grib_set_double_array(self._gh, name, <double *>datarr.data, size)
 *                 if err:
 */
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_datarr), __pyx_n_s_size); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1163, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_11 = __Pyx_PyInt_As_size_t(__pyx_t_7); if (unlikely((__pyx_t_11 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1163, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_v_size = __pyx_t_11;

      /* "pygrib.pyx":1164
 *                     datarr = datarr.copy()
 *                 size = datarr.size
 *                 err = grib_set_double_array(self._gh, name, <double *>datarr.data, size)             # <<<<<<<<<<<<<<
 *                 if err:
 *                     raise RuntimeError(grib_get_error_message(err))
 */
      __pyx_v_err = grib_set_double_array(__pyx_v_self->_gh, __pyx_v_name, ((double *)__pyx_v_datarr->data), __pyx_v_size);

      /* "pygrib.pyx":1165
 *                 size = datarr.size
 *                 err = grib_set_double_array(self._gh, name, <double *>datarr.data, size)
 *                 if err:             # <<<<<<<<<<<<<<
 *                     raise RuntimeError(grib_get_error_message(err))
 *         elif typ == GRIB_TYPE_STRING:
 */
      __pyx_t_1 = (__pyx_v_err != 0);
      if (unlikely(__pyx_t_1)) {

        /* "pygrib.pyx":1166
 *                 err = grib_set_double_array(self._gh, name, <double *>datarr.data, size)
 *                 if err:
 *                     raise RuntimeError(grib_get_error_message(err))             # <<<<<<<<<<<<<<
 *         elif typ == GRIB_TYPE_STRING:
 *             size=len(value)
 */
        __pyx_t_7 = __Pyx_PyBytes_FromString(grib_get_error_message(__pyx_v_err)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1166, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_RuntimeError, __pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1166, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_Raise(__pyx_t_4, 0, 0, 0);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __PYX_ERR(0, 1166, __pyx_L1_error)

        /* "pygrib.pyx":1165
 *                 size = datarr.size
 *                 err = grib_set_double_array(self._gh, name, <double *>datarr.data, size)
 *                 if err:             # <<<<<<<<<<<<<<
 *                     raise RuntimeError(grib_get_error_message(err))
 *         elif typ == GRIB_TYPE_STRING:
 */
      }
    }
    __pyx_L13:;

    /* "pygrib.pyx":1147
 *                 if err:
 *                     raise RuntimeError(grib_get_error_message(err))
 *         elif typ == GRIB_TYPE_DOUBLE:             # <<<<<<<<<<<<<<
 *             # is value an array or a scalar?
 *             datarr = np.asarray(value, np.float)
 */
    goto __pyx_L5;
  }

  /* "pygrib.pyx":1167
 *                 if err:
 *                     raise RuntimeError(grib_get_error_message(err))
 *         elif typ == GRIB_TYPE_STRING:             # <<<<<<<<<<<<<<
 *             size=len(value)
 *             bytestr = _strencode(value)
 */
  __pyx_t_1 = ((__pyx_v_typ == GRIB_TYPE_STRING) != 0);
  if (likely(__pyx_t_1)) {

    /* "pygrib.pyx":1168
 *                     raise RuntimeError(grib_get_error_message(err))
 *         elif typ == GRIB_TYPE_STRING:
 *             size=len(value)             # <<<<<<<<<<<<<<
 *             bytestr = _strencode(value)
 *             strdata = bytestr
 */
    __pyx_t_13 = PyObject_Length(__pyx_v_value); if (unlikely(__pyx_t_13 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1168, __pyx_L1_error)
    __pyx_v_size = __pyx_t_13;

    /* "pygrib.pyx":1169
 *         elif typ == GRIB_TYPE_STRING:
 *             size=len(value)
 *             bytestr = _strencode(value)             # <<<<<<<<<<<<<<
 *             strdata = bytestr
 *             err = grib_set_string(self._gh, name, strdata, &size)
 */
    __pyx_t_4 = __pyx_f_6pygrib__strencode(__pyx_v_value, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1169, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF_SET(__pyx_v_bytestr, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "pygrib.pyx":1170
 *             size=len(value)
 *             bytestr = _strencode(value)
 *             strdata = bytestr             # <<<<<<<<<<<<<<
 *             err = grib_set_string(self._gh, name, strdata, &size)
 *             if err:
 */
    __pyx_t_5 = __Pyx_PyObject_AsWritableString(__pyx_v_bytestr); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) __PYX_ERR(0, 1170, __pyx_L1_error)
    __pyx_v_strdata = __pyx_t_5;

    /* "pygrib.pyx":1171
 *             bytestr = _strencode(value)
 *             strdata = bytestr
 *             err = grib_set_string(self._gh, name, strdata, &size)             # <<<<<<<<<<<<<<
 *             if err:
 *                 raise RuntimeError(grib_get_error_message(err))
 */
    __pyx_v_err = grib_set_string(__pyx_v_self->_gh, __pyx_v_name, __pyx_v_strdata, (&__pyx_v_size));

    /* "pygrib.pyx":1172
 *             strdata = bytestr
 *             err = grib_set_string(self._gh, name, strdata, &size)
 *             if err:             # <<<<<<<<<<<<<<
 *                 raise RuntimeError(grib_get_error_message(err))
 *         else:
 */
    __pyx_t_1 = (__pyx_v_err != 0);
    if (unlikely(__pyx_t_1)) {

      /* "pygrib.pyx":1173
 *             err = grib_set_string(self._gh, name, strdata, &size)
 *             if err:
 *                 raise RuntimeError(grib_get_error_message(err))             # <<<<<<<<<<<<<<
 *         else:
 *             raise ValueError("unrecognized grib type % d" % typ)
 */
      __pyx_t_4 = __Pyx_PyBytes_FromString(grib_get_error_message(__pyx_v_err)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1173, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_builtin_RuntimeError, __pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1173, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_Raise(__pyx_t_7, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __PYX_ERR(0, 1173, __pyx_L1_error)

      /* "pygrib.pyx":1172
 *             strdata = bytestr
 *             err = grib_set_string(self._gh, name, strdata, &size)
 *             if err:             # <<<<<<<<<<<<<<
 *                 raise RuntimeError(grib_get_error_message(err))
 *         else:
 */
    }

    /* "pygrib.pyx":1167
 *                 if err:
 *                     raise RuntimeError(grib_get_error_message(err))
 *         elif typ == GRIB_TYPE_STRING:             # <<<<<<<<<<<<<<
 *             size=len(value)
 *             bytestr = _strencode(value)
 */
    goto __pyx_L5;
  }

  /* "pygrib.pyx":1175
 *                 raise RuntimeError(grib_get_error_message(err))
 *         else:
 *             raise ValueError("unrecognized grib type % d" % typ)             # <<<<<<<<<<<<<<
 *     def __getitem__(self, key):
 *         """
 */
  /*else*/ {
    __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_typ); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1175, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_unrecognized_grib_type_d, __pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1175, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1175, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_Raise(__pyx_t_7, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __PYX_ERR(0, 1175, __pyx_L1_error)
  }
  __pyx_L5:;

  /* "pygrib.pyx":1106
 *                 lonsubset = np.reshape(lonsubset,(nlats,nlons))
 *         return datsubset,latsubset, lonsubset
 *     def __setitem__(self, key, value):             # <<<<<<<<<<<<<<
 *         """
 *         change values associated with existing grib keys.
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("pygrib.gribmessage.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_datarr);
  __Pyx_XDECREF(__pyx_v_bytestr);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pygrib.pyx":1176
 *         else:
 *             raise ValueError("unrecognized grib type % d" % typ)
 *     def __getitem__(self, key):             # <<<<<<<<<<<<<<
 *         """
 *         access values associated with grib keys.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pygrib_11gribmessage_25__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/
static char __pyx_doc_6pygrib_11gribmessage_24__getitem__[] = "\n        access values associated with grib keys.\n        \n        The key \"values\" will return the data associated with the grib message.\n        The data is returned as a numpy array, or if missing values or a bitmap\n        are present, a numpy masked array.  Reduced lat/lon or gaussian grid\n        data is automatically expanded to a regular grid using linear\n        interpolation (nearest neighbor if an adjacent grid point is a missing\n        value).";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_6pygrib_11gribmessage_24__getitem__;
#endif
static PyObject *__pyx_pw_6pygrib_11gribmessage_25__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pygrib_11gribmessage_24__getitem__(((struct __pyx_obj_6pygrib_gribmessage *)__pyx_v_self), ((PyObject *)__pyx_v_key));

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

static PyObject *__pyx_pf_6pygrib_11gribmessage_24__getitem__(struct __pyx_obj_6pygrib_gribmessage *__pyx_v_self, PyObject *__pyx_v_key) {
  int __pyx_v_err;
  int __pyx_v_typ;
  size_t __pyx_v_size;
  char *__pyx_v_name;
  long __pyx_v_longval;
  double __pyx_v_doubleval;
  PyArrayObject *__pyx_v_datarr = 0;
  char __pyx_v_strdata[0x400];
  PyObject *__pyx_v_bytestr = NULL;
  PyObject *__pyx_v_usenceplib = NULL;
  PyObject *__pyx_v_storageorder = NULL;
  PyObject *__pyx_v_grb = NULL;
  PyObject *__pyx_v_msg = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  char *__pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  size_t __pyx_t_6;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  __Pyx_RefNannySetupContext("__getitem__", 0);

  /* "pygrib.pyx":1193
 *         cdef ndarray datarr
 *         cdef char strdata[1024]
 *         bytestr = _strencode(key)             # <<<<<<<<<<<<<<
 *         name = bytestr
 *         usenceplib = key == 'values' and self.packingType.startswith('grid_complex')
 */
  __pyx_t_1 = __pyx_f_6pygrib__strencode(__pyx_v_key, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1193, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_bytestr = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pygrib.pyx":1194
 *         cdef char strdata[1024]
 *         bytestr = _strencode(key)
 *         name = bytestr             # <<<<<<<<<<<<<<
 *         usenceplib = key == 'values' and self.packingType.startswith('grid_complex')
 *         # this workaround only needed for grib_api < 1.9.16.
 */
  __pyx_t_2 = __Pyx_PyObject_AsWritableString(__pyx_v_bytestr); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 1194, __pyx_L1_error)
  __pyx_v_name = __pyx_t_2;

  /* "pygrib.pyx":1195
 *         bytestr = _strencode(key)
 *         name = bytestr
 *         usenceplib = key == 'values' and self.packingType.startswith('grid_complex')             # <<<<<<<<<<<<<<
 *         # this workaround only needed for grib_api < 1.9.16.
 *         if usenceplib:
 */
  __pyx_t_3 = PyObject_RichCompare(__pyx_v_key, __pyx_n_s_values, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1195, __pyx_L1_error)
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 1195, __pyx_L1_error)
  if (__pyx_t_4) {
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else {
    __Pyx_INCREF(__pyx_t_3);
    __pyx_t_1 = __pyx_t_3;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L3_bool_binop_done;
  }
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_packingType); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1195, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_startswith); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1195, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_tuple__58, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1195, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_INCREF(__pyx_t_3);
  __pyx_t_1 = __pyx_t_3;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_L3_bool_binop_done:;
  __pyx_v_usenceplib = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pygrib.pyx":1197
 *         usenceplib = key == 'values' and self.packingType.startswith('grid_complex')
 *         # this workaround only needed for grib_api < 1.9.16.
 *         if usenceplib:             # <<<<<<<<<<<<<<
 *             size = self.numberOfValues
 *         else:
 */
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_usenceplib); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 1197, __pyx_L1_error)
  if (__pyx_t_4) {

    /* "pygrib.pyx":1198
 *         # this workaround only needed for grib_api < 1.9.16.
 *         if usenceplib:
 *             size = self.numberOfValues             # <<<<<<<<<<<<<<
 *         else:
 *             err = grib_get_size(self._gh, name, &size)
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_numberOfValues); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1198, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_6 = __Pyx_PyInt_As_size_t(__pyx_t_1); if (unlikely((__pyx_t_6 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1198, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_v_size = __pyx_t_6;

    /* "pygrib.pyx":1197
 *         usenceplib = key == 'values' and self.packingType.startswith('grid_complex')
 *         # this workaround only needed for grib_api < 1.9.16.
 *         if usenceplib:             # <<<<<<<<<<<<<<
 *             size = self.numberOfValues
 *         else:
 */
    goto __pyx_L5;
  }

  /* "pygrib.pyx":1200
 *             size = self.numberOfValues
 *         else:
 *             err = grib_get_size(self._gh, name, &size)             # <<<<<<<<<<<<<<
 *             if err:
 *                 if tolerate_badgrib:
 */
  /*else*/ {
    __pyx_v_err = grib_get_size(__pyx_v_self->_gh, __pyx_v_name, (&__pyx_v_size));

    /* "pygrib.pyx":1201
 *         else:
 *             err = grib_get_size(self._gh, name, &size)
 *             if err:             # <<<<<<<<<<<<<<
 *                 if tolerate_badgrib:
 *                     return None
 */
    __pyx_t_4 = (__pyx_v_err != 0);
    if (__pyx_t_4) {

      /* "pygrib.pyx":1202
 *             err = grib_get_size(self._gh, name, &size)
 *             if err:
 *                 if tolerate_badgrib:             # <<<<<<<<<<<<<<
 *                     return None
 *                 else:
 */
      __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_tolerate_badgrib); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1202, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 1202, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (likely(__pyx_t_4)) {

        /* "pygrib.pyx":1203
 *             if err:
 *                 if tolerate_badgrib:
 *                     return None             # <<<<<<<<<<<<<<
 *                 else:
 *                     raise RuntimeError(grib_get_error_message(err))
 */
        __Pyx_XDECREF(__pyx_r);
        __pyx_r = Py_None; __Pyx_INCREF(Py_None);
        goto __pyx_L0;

        /* "pygrib.pyx":1202
 *             err = grib_get_size(self._gh, name, &size)
 *             if err:
 *                 if tolerate_badgrib:             # <<<<<<<<<<<<<<
 *                     return None
 *                 else:
 */
      }

      /* "pygrib.pyx":1205
 *                     return None
 *                 else:
 *                     raise RuntimeError(grib_get_error_message(err))             # <<<<<<<<<<<<<<
 *         # this workaround only needed for grib_api < 1.9.16.
 *         if usenceplib:
 */
      /*else*/ {
        __pyx_t_1 = __Pyx_PyBytes_FromString(grib_get_error_message(__pyx_v_err)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1205, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_RuntimeError, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1205, __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_ERR(0, 1205, __pyx_L1_error)
      }

      /* "pygrib.pyx":1201
 *         else:
 *             err = grib_get_size(self._gh, name, &size)
 *             if err:             # <<<<<<<<<<<<<<
 *                 if tolerate_badgrib:
 *                     return None
 */
    }
  }
  __pyx_L5:;

  /* "pygrib.pyx":1207
 *                     raise RuntimeError(grib_get_error_message(err))
 *         # this workaround only needed for grib_api < 1.9.16.
 *         if usenceplib:             # <<<<<<<<<<<<<<
 *             typ = 2
 *             err = 0
 */
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_usenceplib); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 1207, __pyx_L1_error)
  if (__pyx_t_4) {

    /* "pygrib.pyx":1208
 *         # this workaround only needed for grib_api < 1.9.16.
 *         if usenceplib:
 *             typ = 2             # <<<<<<<<<<<<<<
 *             err = 0
 *         else:
 */
    __pyx_v_typ = 2;

    /* "pygrib.pyx":1209
 *         if usenceplib:
 *             typ = 2
 *             err = 0             # <<<<<<<<<<<<<<
 *         else:
 *             err = grib_get_native_type(self._gh, name, &typ)
 */
    __pyx_v_err = 0;

    /* "pygrib.pyx":1207
 *                     raise RuntimeError(grib_get_error_message(err))
 *         # this workaround only needed for grib_api < 1.9.16.
 *         if usenceplib:             # <<<<<<<<<<<<<<
 *             typ = 2
 *             err = 0
 */
    goto __pyx_L8;
  }

  /* "pygrib.pyx":1211
 *             err = 0
 *         else:
 *             err = grib_get_native_type(self._gh, name, &typ)             # <<<<<<<<<<<<<<
 *         # force 'paramId' to be size 1 (it returns a size of 7,
 *         # which is a relic from earlier versions of grib_api in which
 */
  /*else*/ {
    __pyx_v_err = grib_get_native_type(__pyx_v_self->_gh, __pyx_v_name, (&__pyx_v_typ));
  }
  __pyx_L8:;

  /* "pygrib.pyx":1215
 *         # which is a relic from earlier versions of grib_api in which
 *         # paramId was a string and not an integer)
 *         if key=='paramId' and typ == GRIB_TYPE_LONG: size=1             # <<<<<<<<<<<<<<
 *         if err:
 *             raise RuntimeError(grib_get_error_message(err))
 */
  __pyx_t_7 = (__Pyx_PyString_Equals(__pyx_v_key, __pyx_n_s_paramId, Py_EQ)); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 1215, __pyx_L1_error)
  if (__pyx_t_7) {
  } else {
    __pyx_t_4 = __pyx_t_7;
    goto __pyx_L10_bool_binop_done;
  }
  __pyx_t_7 = ((__pyx_v_typ == GRIB_TYPE_LONG) != 0);
  __pyx_t_4 = __pyx_t_7;
  __pyx_L10_bool_binop_done:;
  if (__pyx_t_4) {
    __pyx_v_size = 1;
  }

  /* "pygrib.pyx":1216
 *         # paramId was a string and not an integer)
 *         if key=='paramId' and typ == GRIB_TYPE_LONG: size=1
 *         if err:             # <<<<<<<<<<<<<<
 *             raise RuntimeError(grib_get_error_message(err))
 *         elif typ == GRIB_TYPE_LONG:
 */
  __pyx_t_4 = (__pyx_v_err != 0);
  if (unlikely(__pyx_t_4)) {

    /* "pygrib.pyx":1217
 *         if key=='paramId' and typ == GRIB_TYPE_LONG: size=1
 *         if err:
 *             raise RuntimeError(grib_get_error_message(err))             # <<<<<<<<<<<<<<
 *         elif typ == GRIB_TYPE_LONG:
 *             if size == 1: # scalar
 */
    __pyx_t_3 = __Pyx_PyBytes_FromString(grib_get_error_message(__pyx_v_err)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1217, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_RuntimeError, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1217, __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_ERR(0, 1217, __pyx_L1_error)

    /* "pygrib.pyx":1216
 *         # paramId was a string and not an integer)
 *         if key=='paramId' and typ == GRIB_TYPE_LONG: size=1
 *         if err:             # <<<<<<<<<<<<<<
 *             raise RuntimeError(grib_get_error_message(err))
 *         elif typ == GRIB_TYPE_LONG:
 */
  }

  /* "pygrib.pyx":1218
 *         if err:
 *             raise RuntimeError(grib_get_error_message(err))
 *         elif typ == GRIB_TYPE_LONG:             # <<<<<<<<<<<<<<
 *             if size == 1: # scalar
 *                 err = grib_get_long(self._gh, name, &longval)
 */
  __pyx_t_4 = ((__pyx_v_typ == GRIB_TYPE_LONG) != 0);
  if (__pyx_t_4) {

    /* "pygrib.pyx":1219
 *             raise RuntimeError(grib_get_error_message(err))
 *         elif typ == GRIB_TYPE_LONG:
 *             if size == 1: # scalar             # <<<<<<<<<<<<<<
 *                 err = grib_get_long(self._gh, name, &longval)
 *                 if err:
 */
    __pyx_t_4 = ((__pyx_v_size == 1) != 0);
    if (__pyx_t_4) {

      /* "pygrib.pyx":1220
 *         elif typ == GRIB_TYPE_LONG:
 *             if size == 1: # scalar
 *                 err = grib_get_long(self._gh, name, &longval)             # <<<<<<<<<<<<<<
 *                 if err:
 *                     raise RuntimeError(grib_get_error_message(err))
 */
      __pyx_v_err = grib_get_long(__pyx_v_self->_gh, __pyx_v_name, (&__pyx_v_longval));

      /* "pygrib.pyx":1221
 *             if size == 1: # scalar
 *                 err = grib_get_long(self._gh, name, &longval)
 *                 if err:             # <<<<<<<<<<<<<<
 *                     raise RuntimeError(grib_get_error_message(err))
 *                 return longval
 */
      __pyx_t_4 = (__pyx_v_err != 0);
      if (unlikely(__pyx_t_4)) {

        /* "pygrib.pyx":1222
 *                 err = grib_get_long(self._gh, name, &longval)
 *                 if err:
 *                     raise RuntimeError(grib_get_error_message(err))             # <<<<<<<<<<<<<<
 *                 return longval
 *             else: # array
 */
        __pyx_t_1 = __Pyx_PyBytes_FromString(grib_get_error_message(__pyx_v_err)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1222, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_RuntimeError, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1222, __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_ERR(0, 1222, __pyx_L1_error)

        /* "pygrib.pyx":1221
 *             if size == 1: # scalar
 *                 err = grib_get_long(self._gh, name, &longval)
 *                 if err:             # <<<<<<<<<<<<<<
 *                     raise RuntimeError(grib_get_error_message(err))
 *                 return longval
 */
      }

      /* "pygrib.pyx":1223
 *                 if err:
 *                     raise RuntimeError(grib_get_error_message(err))
 *                 return longval             # <<<<<<<<<<<<<<
 *             else: # array
 *                 if self.has_key('jPointsAreConsecutive') and\
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_3 = __Pyx_PyInt_From_long(__pyx_v_longval); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1223, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_r = __pyx_t_3;
      __pyx_t_3 = 0;
      goto __pyx_L0;

      /* "pygrib.pyx":1219
 *             raise RuntimeError(grib_get_error_message(err))
 *         elif typ == GRIB_TYPE_LONG:
 *             if size == 1: # scalar             # <<<<<<<<<<<<<<
 *                 err = grib_get_long(self._gh, name, &longval)
 *                 if err:
 */
    }

    /* "pygrib.pyx":1225
 *                 return longval
 *             else: # array
 *                 if self.has_key('jPointsAreConsecutive') and\             # <<<<<<<<<<<<<<
 *                    self['jPointsAreConsecutive']:
 *                     storageorder='F'
 */
    /*else*/ {
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_has_key); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1225, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__59, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1225, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 1225, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (__pyx_t_7) {
      } else {
        __pyx_t_4 = __pyx_t_7;
        goto __pyx_L16_bool_binop_done;
      }

      /* "pygrib.pyx":1226
 *             else: # array
 *                 if self.has_key('jPointsAreConsecutive') and\
 *                    self['jPointsAreConsecutive']:             # <<<<<<<<<<<<<<
 *                     storageorder='F'
 *                 else:
 */
      __pyx_t_1 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_jPointsAreConsecutive); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1226, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 1226, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_4 = __pyx_t_7;
      __pyx_L16_bool_binop_done:;

      /* "pygrib.pyx":1225
 *                 return longval
 *             else: # array
 *                 if self.has_key('jPointsAreConsecutive') and\             # <<<<<<<<<<<<<<
 *                    self['jPointsAreConsecutive']:
 *                     storageorder='F'
 */
      if (__pyx_t_4) {

        /* "pygrib.pyx":1227
 *                 if self.has_key('jPointsAreConsecutive') and\
 *                    self['jPointsAreConsecutive']:
 *                     storageorder='F'             # <<<<<<<<<<<<<<
 *                 else:
 *                     storageorder='C'
 */
        __Pyx_INCREF(__pyx_n_s_F);
        __pyx_v_storageorder = __pyx_n_s_F;

        /* "pygrib.pyx":1225
 *                 return longval
 *             else: # array
 *                 if self.has_key('jPointsAreConsecutive') and\             # <<<<<<<<<<<<<<
 *                    self['jPointsAreConsecutive']:
 *                     storageorder='F'
 */
        goto __pyx_L15;
      }

      /* "pygrib.pyx":1229
 *                     storageorder='F'
 *                 else:
 *                     storageorder='C'             # <<<<<<<<<<<<<<
 *                 datarr = np.zeros(size, np.int, order=storageorder)
 *                 err = grib_get_long_array(self._gh, name, <long *>datarr.data, &size)
 */
      /*else*/ {
        __Pyx_INCREF(__pyx_n_s_C);
        __pyx_v_storageorder = __pyx_n_s_C;
      }
      __pyx_L15:;

      /* "pygrib.pyx":1230
 *                 else:
 *                     storageorder='C'
 *                 datarr = np.zeros(size, np.int, order=storageorder)             # <<<<<<<<<<<<<<
 *                 err = grib_get_long_array(self._gh, name, <long *>datarr.data, &size)
 *                 if err:
 */
      __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1230, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1230, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = __Pyx_PyInt_FromSize_t(__pyx_v_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1230, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1230, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_int); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1230, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1230, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_1);
      PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1);
      __Pyx_GIVEREF(__pyx_t_8);
      PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_8);
      __pyx_t_1 = 0;
      __pyx_t_8 = 0;
      __pyx_t_8 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1230, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_order, __pyx_v_storageorder) < 0) __PYX_ERR(0, 1230, __pyx_L1_error)
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, __pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1230, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_6pygrib_ndarray))))) __PYX_ERR(0, 1230, __pyx_L1_error)
      __pyx_v_datarr = ((PyArrayObject *)__pyx_t_1);
      __pyx_t_1 = 0;

      /* "pygrib.pyx":1231
 *                     storageorder='C'
 *                 datarr = np.zeros(size, np.int, order=storageorder)
 *                 err = grib_get_long_array(self._gh, name, <long *>datarr.data, &size)             # <<<<<<<<<<<<<<
 *                 if err:
 *                     raise RuntimeError(grib_get_error_message(err))
 */
      __pyx_v_err = grib_get_long_array(__pyx_v_self->_gh, __pyx_v_name, ((long *)__pyx_v_datarr->data), (&__pyx_v_size));

      /* "pygrib.pyx":1232
 *                 datarr = np.zeros(size, np.int, order=storageorder)
 *                 err = grib_get_long_array(self._gh, name, <long *>datarr.data, &size)
 *                 if err:             # <<<<<<<<<<<<<<
 *                     raise RuntimeError(grib_get_error_message(err))
 *                 if key == 'values':
 */
      __pyx_t_4 = (__pyx_v_err != 0);
      if (unlikely(__pyx_t_4)) {

        /* "pygrib.pyx":1233
 *                 err = grib_get_long_array(self._gh, name, <long *>datarr.data, &size)
 *                 if err:
 *                     raise RuntimeError(grib_get_error_message(err))             # <<<<<<<<<<<<<<
 *                 if key == 'values':
 *                     return self._reshape_mask(datarr)
 */
        __pyx_t_1 = __Pyx_PyBytes_FromString(grib_get_error_message(__pyx_v_err)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1233, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_8 = __Pyx_PyObject_CallOneArg(__pyx_builtin_RuntimeError, __pyx_t_1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1233, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_Raise(__pyx_t_8, 0, 0, 0);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __PYX_ERR(0, 1233, __pyx_L1_error)

        /* "pygrib.pyx":1232
 *                 datarr = np.zeros(size, np.int, order=storageorder)
 *                 err = grib_get_long_array(self._gh, name, <long *>datarr.data, &size)
 *                 if err:             # <<<<<<<<<<<<<<
 *                     raise RuntimeError(grib_get_error_message(err))
 *                 if key == 'values':
 */
      }

      /* "pygrib.pyx":1234
 *                 if err:
 *                     raise RuntimeError(grib_get_error_message(err))
 *                 if key == 'values':             # <<<<<<<<<<<<<<
 *                     return self._reshape_mask(datarr)
 *                 else:
 */
      __pyx_t_4 = (__Pyx_PyString_Equals(__pyx_v_key, __pyx_n_s_values, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 1234, __pyx_L1_error)
      if (__pyx_t_4) {

        /* "pygrib.pyx":1235
 *                     raise RuntimeError(grib_get_error_message(err))
 *                 if key == 'values':
 *                     return self._reshape_mask(datarr)             # <<<<<<<<<<<<<<
 *                 else:
 *                     return datarr
 */
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_reshape_mask); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1235, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_5 = NULL;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
          __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1);
          if (likely(__pyx_t_5)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
            __Pyx_INCREF(__pyx_t_5);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_1, function);
          }
        }
        if (!__pyx_t_5) {
          __pyx_t_8 = __Pyx_PyObject_CallOneArg(__pyx_t_1, ((PyObject *)__pyx_v_datarr)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1235, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_8);
        } else {
          #if CYTHON_FAST_PYCALL
          if (PyFunction_Check(__pyx_t_1)) {
            PyObject *__pyx_temp[2] = {__pyx_t_5, ((PyObject *)__pyx_v_datarr)};
            __pyx_t_8 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1235, __pyx_L1_error)
            __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
            __Pyx_GOTREF(__pyx_t_8);
          } else
          #endif
          #if CYTHON_FAST_PYCCALL
          if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
            PyObject *__pyx_temp[2] = {__pyx_t_5, ((PyObject *)__pyx_v_datarr)};
            __pyx_t_8 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1235, __pyx_L1_error)
            __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
            __Pyx_GOTREF(__pyx_t_8);
          } else
          #endif
          {
            __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1235, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_3);
            __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5); __pyx_t_5 = NULL;
            __Pyx_INCREF(((PyObject *)__pyx_v_datarr));
            __Pyx_GIVEREF(((PyObject *)__pyx_v_datarr));
            PyTuple_SET_ITEM(__pyx_t_3, 0+1, ((PyObject *)__pyx_v_datarr));
            __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1235, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_8);
            __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          }
        }
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_r = __pyx_t_8;
        __pyx_t_8 = 0;
        goto __pyx_L0;

        /* "pygrib.pyx":1234
 *                 if err:
 *                     raise RuntimeError(grib_get_error_message(err))
 *                 if key == 'values':             # <<<<<<<<<<<<<<
 *                     return self._reshape_mask(datarr)
 *                 else:
 */
      }

      /* "pygrib.pyx":1237
 *                     return self._reshape_mask(datarr)
 *                 else:
 *                     return datarr             # <<<<<<<<<<<<<<
 *         elif typ == GRIB_TYPE_DOUBLE:
 *             if size == 1: # scalar
 */
      /*else*/ {
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(((PyObject *)__pyx_v_datarr));
        __pyx_r = ((PyObject *)__pyx_v_datarr);
        goto __pyx_L0;
      }
    }

    /* "pygrib.pyx":1218
 *         if err:
 *             raise RuntimeError(grib_get_error_message(err))
 *         elif typ == GRIB_TYPE_LONG:             # <<<<<<<<<<<<<<
 *             if size == 1: # scalar
 *                 err = grib_get_long(self._gh, name, &longval)
 */
  }

  /* "pygrib.pyx":1238
 *                 else:
 *                     return datarr
 *         elif typ == GRIB_TYPE_DOUBLE:             # <<<<<<<<<<<<<<
 *             if size == 1: # scalar
 *                 err = grib_get_double(self._gh, name, &doubleval)
 */
  __pyx_t_4 = ((__pyx_v_typ == GRIB_TYPE_DOUBLE) != 0);
  if (__pyx_t_4) {

    /* "pygrib.pyx":1239
 *                     return datarr
 *         elif typ == GRIB_TYPE_DOUBLE:
 *             if size == 1: # scalar             # <<<<<<<<<<<<<<
 *                 err = grib_get_double(self._gh, name, &doubleval)
 *                 if err:
 */
    __pyx_t_4 = ((__pyx_v_size == 1) != 0);
    if (__pyx_t_4) {

      /* "pygrib.pyx":1240
 *         elif typ == GRIB_TYPE_DOUBLE:
 *             if size == 1: # scalar
 *                 err = grib_get_double(self._gh, name, &doubleval)             # <<<<<<<<<<<<<<
 *                 if err:
 *                     raise RuntimeError(grib_get_error_message(err))
 */
      __pyx_v_err = grib_get_double(__pyx_v_self->_gh, __pyx_v_name, (&__pyx_v_doubleval));

      /* "pygrib.pyx":1241
 *             if size == 1: # scalar
 *                 err = grib_get_double(self._gh, name, &doubleval)
 *                 if err:             # <<<<<<<<<<<<<<
 *                     raise RuntimeError(grib_get_error_message(err))
 *                 return doubleval
 */
      __pyx_t_4 = (__pyx_v_err != 0);
      if (unlikely(__pyx_t_4)) {

        /* "pygrib.pyx":1242
 *                 err = grib_get_double(self._gh, name, &doubleval)
 *                 if err:
 *                     raise RuntimeError(grib_get_error_message(err))             # <<<<<<<<<<<<<<
 *                 return doubleval
 *             else: # array
 */
        __pyx_t_8 = __Pyx_PyBytes_FromString(grib_get_error_message(__pyx_v_err)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1242, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_RuntimeError, __pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1242, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_Raise(__pyx_t_1, 0, 0, 0);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __PYX_ERR(0, 1242, __pyx_L1_error)

        /* "pygrib.pyx":1241
 *             if size == 1: # scalar
 *                 err = grib_get_double(self._gh, name, &doubleval)
 *                 if err:             # <<<<<<<<<<<<<<
 *                     raise RuntimeError(grib_get_error_message(err))
 *                 return doubleval
 */
      }

      /* "pygrib.pyx":1243
 *                 if err:
 *                     raise RuntimeError(grib_get_error_message(err))
 *                 return doubleval             # <<<<<<<<<<<<<<
 *             else: # array
 *                 if self.has_key('jPointsAreConsecutive') and\
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = PyFloat_FromDouble(__pyx_v_doubleval); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1243, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_r = __pyx_t_1;
      __pyx_t_1 = 0;
      goto __pyx_L0;

      /* "pygrib.pyx":1239
 *                     return datarr
 *         elif typ == GRIB_TYPE_DOUBLE:
 *             if size == 1: # scalar             # <<<<<<<<<<<<<<
 *                 err = grib_get_double(self._gh, name, &doubleval)
 *                 if err:
 */
    }

    /* "pygrib.pyx":1245
 *                 return doubleval
 *             else: # array
 *                 if self.has_key('jPointsAreConsecutive') and\             # <<<<<<<<<<<<<<
 *                    self['jPointsAreConsecutive']:
 *                     storageorder='F'
 */
    /*else*/ {
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_has_key); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1245, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__60, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1245, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 1245, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (__pyx_t_7) {
      } else {
        __pyx_t_4 = __pyx_t_7;
        goto __pyx_L23_bool_binop_done;
      }

      /* "pygrib.pyx":1246
 *             else: # array
 *                 if self.has_key('jPointsAreConsecutive') and\
 *                    self['jPointsAreConsecutive']:             # <<<<<<<<<<<<<<
 *                     storageorder='F'
 *                 else:
 */
      __pyx_t_8 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_jPointsAreConsecutive); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1246, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 1246, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_4 = __pyx_t_7;
      __pyx_L23_bool_binop_done:;

      /* "pygrib.pyx":1245
 *                 return doubleval
 *             else: # array
 *                 if self.has_key('jPointsAreConsecutive') and\             # <<<<<<<<<<<<<<
 *                    self['jPointsAreConsecutive']:
 *                     storageorder='F'
 */
      if (__pyx_t_4) {

        /* "pygrib.pyx":1247
 *                 if self.has_key('jPointsAreConsecutive') and\
 *                    self['jPointsAreConsecutive']:
 *                     storageorder='F'             # <<<<<<<<<<<<<<
 *                 else:
 *                     storageorder='C'
 */
        __Pyx_INCREF(__pyx_n_s_F);
        __pyx_v_storageorder = __pyx_n_s_F;

        /* "pygrib.pyx":1245
 *                 return doubleval
 *             else: # array
 *                 if self.has_key('jPointsAreConsecutive') and\             # <<<<<<<<<<<<<<
 *                    self['jPointsAreConsecutive']:
 *                     storageorder='F'
 */
        goto __pyx_L22;
      }

      /* "pygrib.pyx":1249
 *                     storageorder='F'
 *                 else:
 *                     storageorder='C'             # <<<<<<<<<<<<<<
 *                 if usenceplib:
 *                     # use ncep lib to decode data (workaround for grib_api
 */
      /*else*/ {
        __Pyx_INCREF(__pyx_n_s_C);
        __pyx_v_storageorder = __pyx_n_s_C;
      }
      __pyx_L22:;

      /* "pygrib.pyx":1250
 *                 else:
 *                     storageorder='C'
 *                 if usenceplib:             # <<<<<<<<<<<<<<
 *                     # use ncep lib to decode data (workaround for grib_api
 *                     # bug with second-order complex packing).
 */
      __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_usenceplib); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 1250, __pyx_L1_error)
      if (__pyx_t_4) {

        /* "pygrib.pyx":1253
 *                     # use ncep lib to decode data (workaround for grib_api
 *                     # bug with second-order complex packing).
 *                     grb = Grib2Decode(self.tostring(), gribmsg=True)             # <<<<<<<<<<<<<<
 *                     return grb.data()
 *                 else:
 */
        __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_Grib2Decode); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1253, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_tostring); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1253, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_5 = NULL;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_5)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_5);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
          }
        }
        if (__pyx_t_5) {
          __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1253, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        } else {
          __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1253, __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_ERR(0, 1253, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_GIVEREF(__pyx_t_1);
        PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
        __pyx_t_1 = 0;
        __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1253, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_gribmsg, Py_True) < 0) __PYX_ERR(0, 1253, __pyx_L1_error)
        __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1253, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_v_grb = __pyx_t_5;
        __pyx_t_5 = 0;

        /* "pygrib.pyx":1254
 *                     # bug with second-order complex packing).
 *                     grb = Grib2Decode(self.tostring(), gribmsg=True)
 *                     return grb.data()             # <<<<<<<<<<<<<<
 *                 else:
 *                     datarr = np.zeros(size, np.double, order=storageorder)
 */
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_grb, __pyx_n_s_data); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1254, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_3 = NULL;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
          __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1);
          if (likely(__pyx_t_3)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
            __Pyx_INCREF(__pyx_t_3);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_1, function);
          }
        }
        if (__pyx_t_3) {
          __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1254, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        } else {
          __pyx_t_5 = __Pyx_PyObject_CallNoArg(__pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1254, __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;

        /* "pygrib.pyx":1250
 *                 else:
 *                     storageorder='C'
 *                 if usenceplib:             # <<<<<<<<<<<<<<
 *                     # use ncep lib to decode data (workaround for grib_api
 *                     # bug with second-order complex packing).
 */
      }

      /* "pygrib.pyx":1256
 *                     return grb.data()
 *                 else:
 *                     datarr = np.zeros(size, np.double, order=storageorder)             # <<<<<<<<<<<<<<
 *                     err = grib_get_double_array(self._gh, name, <double *>datarr.data, &size)
 *                     if err:
 */
      /*else*/ {
        __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1256, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_zeros); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1256, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_t_5 = __Pyx_PyInt_FromSize_t(__pyx_v_size); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1256, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1256, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_double); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1256, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1256, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_GIVEREF(__pyx_t_5);
        PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5);
        __Pyx_GIVEREF(__pyx_t_8);
        PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_8);
        __pyx_t_5 = 0;
        __pyx_t_8 = 0;
        __pyx_t_8 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1256, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_order, __pyx_v_storageorder) < 0) __PYX_ERR(0, 1256, __pyx_L1_error)
        __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, __pyx_t_8); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1256, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_6pygrib_ndarray))))) __PYX_ERR(0, 1256, __pyx_L1_error)
        __pyx_v_datarr = ((PyArrayObject *)__pyx_t_5);
        __pyx_t_5 = 0;

        /* "pygrib.pyx":1257
 *                 else:
 *                     datarr = np.zeros(size, np.double, order=storageorder)
 *                     err = grib_get_double_array(self._gh, name, <double *>datarr.data, &size)             # <<<<<<<<<<<<<<
 *                     if err:
 *                         raise RuntimeError(grib_get_error_message(err))
 */
        __pyx_v_err = grib_get_double_array(__pyx_v_self->_gh, __pyx_v_name, ((double *)__pyx_v_datarr->data), (&__pyx_v_size));

        /* "pygrib.pyx":1258
 *                     datarr = np.zeros(size, np.double, order=storageorder)
 *                     err = grib_get_double_array(self._gh, name, <double *>datarr.data, &size)
 *                     if err:             # <<<<<<<<<<<<<<
 *                         raise RuntimeError(grib_get_error_message(err))
 *                     if key == 'values':
 */
        __pyx_t_4 = (__pyx_v_err != 0);
        if (unlikely(__pyx_t_4)) {

          /* "pygrib.pyx":1259
 *                     err = grib_get_double_array(self._gh, name, <double *>datarr.data, &size)
 *                     if err:
 *                         raise RuntimeError(grib_get_error_message(err))             # <<<<<<<<<<<<<<
 *                     if key == 'values':
 *                         return self._reshape_mask(datarr)
 */
          __pyx_t_5 = __Pyx_PyBytes_FromString(grib_get_error_message(__pyx_v_err)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1259, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_5);
          __pyx_t_8 = __Pyx_PyObject_CallOneArg(__pyx_builtin_RuntimeError, __pyx_t_5); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1259, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_8);
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_Raise(__pyx_t_8, 0, 0, 0);
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
          __PYX_ERR(0, 1259, __pyx_L1_error)

          /* "pygrib.pyx":1258
 *                     datarr = np.zeros(size, np.double, order=storageorder)
 *                     err = grib_get_double_array(self._gh, name, <double *>datarr.data, &size)
 *                     if err:             # <<<<<<<<<<<<<<
 *                         raise RuntimeError(grib_get_error_message(err))
 *                     if key == 'values':
 */
        }

        /* "pygrib.pyx":1260
 *                     if err:
 *                         raise RuntimeError(grib_get_error_message(err))
 *                     if key == 'values':             # <<<<<<<<<<<<<<
 *                         return self._reshape_mask(datarr)
 *                     else:
 */
        __pyx_t_4 = (__Pyx_PyString_Equals(__pyx_v_key, __pyx_n_s_values, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 1260, __pyx_L1_error)
        if (__pyx_t_4) {

          /* "pygrib.pyx":1261
 *                         raise RuntimeError(grib_get_error_message(err))
 *                     if key == 'values':
 *                         return self._reshape_mask(datarr)             # <<<<<<<<<<<<<<
 *                     else:
 *                         return datarr
 */
          __Pyx_XDECREF(__pyx_r);
          __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_reshape_mask); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1261, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_5);
          __pyx_t_3 = NULL;
          if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
            __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5);
            if (likely(__pyx_t_3)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
              __Pyx_INCREF(__pyx_t_3);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_5, function);
            }
          }
          if (!__pyx_t_3) {
            __pyx_t_8 = __Pyx_PyObject_CallOneArg(__pyx_t_5, ((PyObject *)__pyx_v_datarr)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1261, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_8);
          } else {
            #if CYTHON_FAST_PYCALL
            if (PyFunction_Check(__pyx_t_5)) {
              PyObject *__pyx_temp[2] = {__pyx_t_3, ((PyObject *)__pyx_v_datarr)};
              __pyx_t_8 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1261, __pyx_L1_error)
              __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
              __Pyx_GOTREF(__pyx_t_8);
            } else
            #endif
            #if CYTHON_FAST_PYCCALL
            if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
              PyObject *__pyx_temp[2] = {__pyx_t_3, ((PyObject *)__pyx_v_datarr)};
              __pyx_t_8 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1261, __pyx_L1_error)
              __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
              __Pyx_GOTREF(__pyx_t_8);
            } else
            #endif
            {
              __pyx_t_1 = PyTuple_New(1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1261, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_1);
              __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3); __pyx_t_3 = NULL;
              __Pyx_INCREF(((PyObject *)__pyx_v_datarr));
              __Pyx_GIVEREF(((PyObject *)__pyx_v_datarr));
              PyTuple_SET_ITEM(__pyx_t_1, 0+1, ((PyObject *)__pyx_v_datarr));
              __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_1, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1261, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_8);
              __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
            }
          }
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          __pyx_r = __pyx_t_8;
          __pyx_t_8 = 0;
          goto __pyx_L0;

          /* "pygrib.pyx":1260
 *                     if err:
 *                         raise RuntimeError(grib_get_error_message(err))
 *                     if key == 'values':             # <<<<<<<<<<<<<<
 *                         return self._reshape_mask(datarr)
 *                     else:
 */
        }

        /* "pygrib.pyx":1263
 *                         return self._reshape_mask(datarr)
 *                     else:
 *                         return datarr             # <<<<<<<<<<<<<<
 *         elif typ == GRIB_TYPE_STRING:
 *             size=1024 # grib_get_size returns 1 ?
 */
        /*else*/ {
          __Pyx_XDECREF(__pyx_r);
          __Pyx_INCREF(((PyObject *)__pyx_v_datarr));
          __pyx_r = ((PyObject *)__pyx_v_datarr);
          goto __pyx_L0;
        }
      }
    }

    /* "pygrib.pyx":1238
 *                 else:
 *                     return datarr
 *         elif typ == GRIB_TYPE_DOUBLE:             # <<<<<<<<<<<<<<
 *             if size == 1: # scalar
 *                 err = grib_get_double(self._gh, name, &doubleval)
 */
  }

  /* "pygrib.pyx":1264
 *                     else:
 *                         return datarr
 *         elif typ == GRIB_TYPE_STRING:             # <<<<<<<<<<<<<<
 *             size=1024 # grib_get_size returns 1 ?
 *             err = grib_get_string(self._gh, name, strdata, &size)
 */
  __pyx_t_4 = ((__pyx_v_typ == GRIB_TYPE_STRING) != 0);
  if (likely(__pyx_t_4)) {

    /* "pygrib.pyx":1265
 *                         return datarr
 *         elif typ == GRIB_TYPE_STRING:
 *             size=1024 # grib_get_size returns 1 ?             # <<<<<<<<<<<<<<
 *             err = grib_get_string(self._gh, name, strdata, &size)
 *             if err:
 */
    __pyx_v_size = 0x400;

    /* "pygrib.pyx":1266
 *         elif typ == GRIB_TYPE_STRING:
 *             size=1024 # grib_get_size returns 1 ?
 *             err = grib_get_string(self._gh, name, strdata, &size)             # <<<<<<<<<<<<<<
 *             if err:
 *                 raise RuntimeError(grib_get_error_message(err))
 */
    __pyx_v_err = grib_get_string(__pyx_v_self->_gh, __pyx_v_name, __pyx_v_strdata, (&__pyx_v_size));

    /* "pygrib.pyx":1267
 *             size=1024 # grib_get_size returns 1 ?
 *             err = grib_get_string(self._gh, name, strdata, &size)
 *             if err:             # <<<<<<<<<<<<<<
 *                 raise RuntimeError(grib_get_error_message(err))
 *             msg = strdata.decode(default_encoding)
 */
    __pyx_t_4 = (__pyx_v_err != 0);
    if (unlikely(__pyx_t_4)) {

      /* "pygrib.pyx":1268
 *             err = grib_get_string(self._gh, name, strdata, &size)
 *             if err:
 *                 raise RuntimeError(grib_get_error_message(err))             # <<<<<<<<<<<<<<
 *             msg = strdata.decode(default_encoding)
 *             return msg.rstrip()
 */
      __pyx_t_8 = __Pyx_PyBytes_FromString(grib_get_error_message(__pyx_v_err)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1268, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_builtin_RuntimeError, __pyx_t_8); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1268, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_Raise(__pyx_t_5, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __PYX_ERR(0, 1268, __pyx_L1_error)

      /* "pygrib.pyx":1267
 *             size=1024 # grib_get_size returns 1 ?
 *             err = grib_get_string(self._gh, name, strdata, &size)
 *             if err:             # <<<<<<<<<<<<<<
 *                 raise RuntimeError(grib_get_error_message(err))
 *             msg = strdata.decode(default_encoding)
 */
    }

    /* "pygrib.pyx":1269
 *             if err:
 *                 raise RuntimeError(grib_get_error_message(err))
 *             msg = strdata.decode(default_encoding)             # <<<<<<<<<<<<<<
 *             return msg.rstrip()
 *         else:
 */
    __pyx_t_8 = __Pyx_PyObject_FromString(__pyx_v_strdata); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1269, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_decode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1269, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_default_encoding); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1269, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_1, function);
      }
    }
    if (!__pyx_t_3) {
      __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_8); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1269, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_GOTREF(__pyx_t_5);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_1)) {
        PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_8};
        __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1269, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
        PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_8};
        __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1269, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      } else
      #endif
      {
        __pyx_t_9 = PyTuple_New(1+1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1269, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_3); __pyx_t_3 = NULL;
        __Pyx_GIVEREF(__pyx_t_8);
        PyTuple_SET_ITEM(__pyx_t_9, 0+1, __pyx_t_8);
        __pyx_t_8 = 0;
        __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_9, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1269, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_v_msg = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "pygrib.pyx":1270
 *                 raise RuntimeError(grib_get_error_message(err))
 *             msg = strdata.decode(default_encoding)
 *             return msg.rstrip()             # <<<<<<<<<<<<<<
 *         else:
 *             raise ValueError("unrecognized grib type % d" % typ)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_msg, __pyx_n_s_rstrip); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1270, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_9 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
      __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_1);
      if (likely(__pyx_t_9)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_9);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_1, function);
      }
    }
    if (__pyx_t_9) {
      __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_9); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1270, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    } else {
      __pyx_t_5 = __Pyx_PyObject_CallNoArg(__pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1270, __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;

    /* "pygrib.pyx":1264
 *                     else:
 *                         return datarr
 *         elif typ == GRIB_TYPE_STRING:             # <<<<<<<<<<<<<<
 *             size=1024 # grib_get_size returns 1 ?
 *             err = grib_get_string(self._gh, name, strdata, &size)
 */
  }

  /* "pygrib.pyx":1272
 *             return msg.rstrip()
 *         else:
 *             raise ValueError("unrecognized grib type % d" % typ)             # <<<<<<<<<<<<<<
 *     def has_key(self,key):
 *         """
 */
  /*else*/ {
    __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_typ); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1272, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_unrecognized_grib_type_d, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1272, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1272, __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_ERR(0, 1272, __pyx_L1_error)
  }

  /* "pygrib.pyx":1176
 *         else:
 *             raise ValueError("unrecognized grib type % d" % typ)
 *     def __getitem__(self, key):             # <<<<<<<<<<<<<<
 *         """
 *         access values associated with grib keys.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("pygrib.gribmessage.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_datarr);
  __Pyx_XDECREF(__pyx_v_bytestr);
  __Pyx_XDECREF(__pyx_v_usenceplib);
  __Pyx_XDECREF(__pyx_v_storageorder);
  __Pyx_XDECREF(__pyx_v_grb);
  __Pyx_XDECREF(__pyx_v_msg);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pygrib.pyx":1273
 *         else:
 *             raise ValueError("unrecognized grib type % d" % typ)
 *     def has_key(self,key):             # <<<<<<<<<<<<<<
 *         """
 *         has_key(key)
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pygrib_11gribmessage_27has_key(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/
static char __pyx_doc_6pygrib_11gribmessage_26has_key[] = "\n        has_key(key)\n\n        tests whether a grib message object has a specified key.\n        ";
static PyObject *__pyx_pw_6pygrib_11gribmessage_27has_key(PyObject *__pyx_v_self, PyObject *__pyx_v_key) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("has_key (wrapper)", 0);
  __pyx_r = __pyx_pf_6pygrib_11gribmessage_26has_key(((struct __pyx_obj_6pygrib_gribmessage *)__pyx_v_self), ((PyObject *)__pyx_v_key));

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

static PyObject *__pyx_pf_6pygrib_11gribmessage_26has_key(struct __pyx_obj_6pygrib_gribmessage *__pyx_v_self, PyObject *__pyx_v_key) {
  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;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  __Pyx_RefNannySetupContext("has_key", 0);

  /* "pygrib.pyx":1279
 *         tests whether a grib message object has a specified key.
 *         """
 *         if key in self._all_keys:             # <<<<<<<<<<<<<<
 *             return True
 *         try:
 */
  __pyx_t_1 = (__Pyx_PySequence_ContainsTF(__pyx_v_key, __pyx_v_self->_all_keys, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1279, __pyx_L1_error)
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "pygrib.pyx":1280
 *         """
 *         if key in self._all_keys:
 *             return True             # <<<<<<<<<<<<<<
 *         try:
 *             self[key]
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_True);
    __pyx_r = Py_True;
    goto __pyx_L0;

    /* "pygrib.pyx":1279
 *         tests whether a grib message object has a specified key.
 *         """
 *         if key in self._all_keys:             # <<<<<<<<<<<<<<
 *             return True
 *         try:
 */
  }

  /* "pygrib.pyx":1281
 *         if key in self._all_keys:
 *             return True
 *         try:             # <<<<<<<<<<<<<<
 *             self[key]
 *         except:
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5);
    __Pyx_XGOTREF(__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_4);
    __Pyx_XGOTREF(__pyx_t_5);
    /*try:*/ {

      /* "pygrib.pyx":1282
 *             return True
 *         try:
 *             self[key]             # <<<<<<<<<<<<<<
 *         except:
 *             return False
 */
      __pyx_t_6 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_key); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1282, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

      /* "pygrib.pyx":1281
 *         if key in self._all_keys:
 *             return True
 *         try:             # <<<<<<<<<<<<<<
 *             self[key]
 *         except:
 */
    }

    /* "pygrib.pyx":1286
 *             return False
 *         else:
 *             return True             # <<<<<<<<<<<<<<
 *     def valid_key(self,key):
 *         """
 */
    /*else:*/ {
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(Py_True);
      __pyx_r = Py_True;
      goto __pyx_L7_except_return;
    }
    __pyx_L4_error:;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "pygrib.pyx":1283
 *         try:
 *             self[key]
 *         except:             # <<<<<<<<<<<<<<
 *             return False
 *         else:
 */
    /*except:*/ {
      __Pyx_AddTraceback("pygrib.gribmessage.has_key", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8) < 0) __PYX_ERR(0, 1283, __pyx_L6_except_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_GOTREF(__pyx_t_8);

      /* "pygrib.pyx":1284
 *             self[key]
 *         except:
 *             return False             # <<<<<<<<<<<<<<
 *         else:
 *             return True
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(Py_False);
      __pyx_r = Py_False;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      goto __pyx_L7_except_return;
    }
    __pyx_L6_except_error:;

    /* "pygrib.pyx":1281
 *         if key in self._all_keys:
 *             return True
 *         try:             # <<<<<<<<<<<<<<
 *             self[key]
 *         except:
 */
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
    goto __pyx_L1_error;
    __pyx_L7_except_return:;
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
    goto __pyx_L0;
  }

  /* "pygrib.pyx":1273
 *         else:
 *             raise ValueError("unrecognized grib type % d" % typ)
 *     def has_key(self,key):             # <<<<<<<<<<<<<<
 *         """
 *         has_key(key)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("pygrib.gribmessage.has_key", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pygrib.pyx":1287
 *         else:
 *             return True
 *     def valid_key(self,key):             # <<<<<<<<<<<<<<
 *         """
 *         valid_key(key)
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pygrib_11gribmessage_29valid_key(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/
static char __pyx_doc_6pygrib_11gribmessage_28valid_key[] = "\n        valid_key(key)\n\n        tests whether a grib message object has a specified key,\n        it is not missing and it has a value that can be read.\n        ";
static PyObject *__pyx_pw_6pygrib_11gribmessage_29valid_key(PyObject *__pyx_v_self, PyObject *__pyx_v_key) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("valid_key (wrapper)", 0);
  __pyx_r = __pyx_pf_6pygrib_11gribmessage_28valid_key(((struct __pyx_obj_6pygrib_gribmessage *)__pyx_v_self), ((PyObject *)__pyx_v_key));

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

static PyObject *__pyx_pf_6pygrib_11gribmessage_28valid_key(struct __pyx_obj_6pygrib_gribmessage *__pyx_v_self, PyObject *__pyx_v_key) {
  PyObject *__pyx_v_ret = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  __Pyx_RefNannySetupContext("valid_key", 0);

  /* "pygrib.pyx":1294
 *         it is not missing and it has a value that can be read.
 *         """
 *         ret =  key in self._all_keys             # <<<<<<<<<<<<<<
 *         # if key exists, but value is missing, return False.
 *         if ret and self.is_missing(key): ret = False
 */
  __pyx_t_1 = (__Pyx_PySequence_ContainsTF(__pyx_v_key, __pyx_v_self->_all_keys, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1294, __pyx_L1_error)
  __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1294, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_ret = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "pygrib.pyx":1296
 *         ret =  key in self._all_keys
 *         # if key exists, but value is missing, return False.
 *         if ret and self.is_missing(key): ret = False             # <<<<<<<<<<<<<<
 *         if ret:
 *             try:
 */
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_ret); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 1296, __pyx_L1_error)
  if (__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_is_missing); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1296, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  if (!__pyx_t_5) {
    __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_key); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1296, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_v_key};
      __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1296, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_2);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_v_key};
      __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1296, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_2);
    } else
    #endif
    {
      __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1296, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); __pyx_t_5 = NULL;
      __Pyx_INCREF(__pyx_v_key);
      __Pyx_GIVEREF(__pyx_v_key);
      PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_v_key);
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1296, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 1296, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_1 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {
    __Pyx_INCREF(Py_False);
    __Pyx_DECREF_SET(__pyx_v_ret, Py_False);
  }

  /* "pygrib.pyx":1297
 *         # if key exists, but value is missing, return False.
 *         if ret and self.is_missing(key): ret = False
 *         if ret:             # <<<<<<<<<<<<<<
 *             try:
 *                 self[key]
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_ret); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1297, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "pygrib.pyx":1298
 *         if ret and self.is_missing(key): ret = False
 *         if ret:
 *             try:             # <<<<<<<<<<<<<<
 *                 self[key]
 *             except:
 */
    {
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __Pyx_ExceptionSave(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9);
      __Pyx_XGOTREF(__pyx_t_7);
      __Pyx_XGOTREF(__pyx_t_8);
      __Pyx_XGOTREF(__pyx_t_9);
      /*try:*/ {

        /* "pygrib.pyx":1299
 *         if ret:
 *             try:
 *                 self[key]             # <<<<<<<<<<<<<<
 *             except:
 *                 ret = False
 */
        __pyx_t_2 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_key); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1299, __pyx_L7_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

        /* "pygrib.pyx":1298
 *         if ret and self.is_missing(key): ret = False
 *         if ret:
 *             try:             # <<<<<<<<<<<<<<
 *                 self[key]
 *             except:
 */
      }
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      goto __pyx_L12_try_end;
      __pyx_L7_error:;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "pygrib.pyx":1300
 *             try:
 *                 self[key]
 *             except:             # <<<<<<<<<<<<<<
 *                 ret = False
 *         return ret
 */
      /*except:*/ {
        __Pyx_AddTraceback("pygrib.gribmessage.valid_key", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_4, &__pyx_t_6) < 0) __PYX_ERR(0, 1300, __pyx_L9_except_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_GOTREF(__pyx_t_6);

        /* "pygrib.pyx":1301
 *                 self[key]
 *             except:
 *                 ret = False             # <<<<<<<<<<<<<<
 *         return ret
 *     def tostring(self):
 */
        __Pyx_INCREF(Py_False);
        __Pyx_DECREF_SET(__pyx_v_ret, Py_False);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        goto __pyx_L8_exception_handled;
      }
      __pyx_L9_except_error:;

      /* "pygrib.pyx":1298
 *         if ret and self.is_missing(key): ret = False
 *         if ret:
 *             try:             # <<<<<<<<<<<<<<
 *                 self[key]
 *             except:
 */
      __Pyx_XGIVEREF(__pyx_t_7);
      __Pyx_XGIVEREF(__pyx_t_8);
      __Pyx_XGIVEREF(__pyx_t_9);
      __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9);
      goto __pyx_L1_error;
      __pyx_L8_exception_handled:;
      __Pyx_XGIVEREF(__pyx_t_7);
      __Pyx_XGIVEREF(__pyx_t_8);
      __Pyx_XGIVEREF(__pyx_t_9);
      __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9);
      __pyx_L12_try_end:;
    }

    /* "pygrib.pyx":1297
 *         # if key exists, but value is missing, return False.
 *         if ret and self.is_missing(key): ret = False
 *         if ret:             # <<<<<<<<<<<<<<
 *             try:
 *                 self[key]
 */
  }

  /* "pygrib.pyx":1302
 *             except:
 *                 ret = False
 *         return ret             # <<<<<<<<<<<<<<
 *     def tostring(self):
 *         """
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_ret);
  __pyx_r = __pyx_v_ret;
  goto __pyx_L0;

  /* "pygrib.pyx":1287
 *         else:
 *             return True
 *     def valid_key(self,key):             # <<<<<<<<<<<<<<
 *         """
 *         valid_key(key)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("pygrib.gribmessage.valid_key", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_ret);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pygrib.pyx":1303
 *                 ret = False
 *         return ret
 *     def tostring(self):             # <<<<<<<<<<<<<<
 *         """
 *         tostring()
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pygrib_11gribmessage_31tostring(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6pygrib_11gribmessage_30tostring[] = "\n        tostring()\n\n        return coded grib message in a binary string.\n        ";
static PyObject *__pyx_pw_6pygrib_11gribmessage_31tostring(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("tostring (wrapper)", 0);
  __pyx_r = __pyx_pf_6pygrib_11gribmessage_30tostring(((struct __pyx_obj_6pygrib_gribmessage *)__pyx_v_self));

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

static PyObject *__pyx_pf_6pygrib_11gribmessage_30tostring(struct __pyx_obj_6pygrib_gribmessage *__pyx_v_self) {
  int __pyx_v_err;
  size_t __pyx_v_size;
  void *__pyx_v_message;
  char *__pyx_v_name;
  PyObject *__pyx_v_bytestr = NULL;
  PyObject *__pyx_v_usenceplib = NULL;
  PyObject *__pyx_v_msg = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  char *__pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  size_t __pyx_t_5;
  __Pyx_RefNannySetupContext("tostring", 0);

  /* "pygrib.pyx":1314
 *         cdef char *name
 *         cdef FILE *out
 *         bytestr = b'values'             # <<<<<<<<<<<<<<
 *         name = bytestr
 *         usenceplib = self.packingType.startswith('grid_complex')
 */
  __Pyx_INCREF(__pyx_n_b_values);
  __pyx_v_bytestr = __pyx_n_b_values;

  /* "pygrib.pyx":1315
 *         cdef FILE *out
 *         bytestr = b'values'
 *         name = bytestr             # <<<<<<<<<<<<<<
 *         usenceplib = self.packingType.startswith('grid_complex')
 *         # this workaround only needed for grib_api < 1.9.16.
 */
  __pyx_t_1 = __Pyx_PyBytes_AsWritableString(__pyx_v_bytestr); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) __PYX_ERR(0, 1315, __pyx_L1_error)
  __pyx_v_name = __pyx_t_1;

  /* "pygrib.pyx":1316
 *         bytestr = b'values'
 *         name = bytestr
 *         usenceplib = self.packingType.startswith('grid_complex')             # <<<<<<<<<<<<<<
 *         # this workaround only needed for grib_api < 1.9.16.
 *         if usenceplib:
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_packingType); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1316, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_startswith); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1316, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__61, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1316, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_usenceplib = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "pygrib.pyx":1318
 *         usenceplib = self.packingType.startswith('grid_complex')
 *         # this workaround only needed for grib_api < 1.9.16.
 *         if usenceplib:             # <<<<<<<<<<<<<<
 *             size = self.numberOfValues
 *         else:
 */
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_usenceplib); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 1318, __pyx_L1_error)
  if (__pyx_t_4) {

    /* "pygrib.pyx":1319
 *         # this workaround only needed for grib_api < 1.9.16.
 *         if usenceplib:
 *             size = self.numberOfValues             # <<<<<<<<<<<<<<
 *         else:
 *             err = grib_get_size(self._gh, name, &size)
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_numberOfValues); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1319, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = __Pyx_PyInt_As_size_t(__pyx_t_2); if (unlikely((__pyx_t_5 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1319, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_size = __pyx_t_5;

    /* "pygrib.pyx":1318
 *         usenceplib = self.packingType.startswith('grid_complex')
 *         # this workaround only needed for grib_api < 1.9.16.
 *         if usenceplib:             # <<<<<<<<<<<<<<
 *             size = self.numberOfValues
 *         else:
 */
    goto __pyx_L3;
  }

  /* "pygrib.pyx":1321
 *             size = self.numberOfValues
 *         else:
 *             err = grib_get_size(self._gh, name, &size)             # <<<<<<<<<<<<<<
 *             if err:
 *                 raise RuntimeError(grib_get_error_message(err))
 */
  /*else*/ {
    __pyx_v_err = grib_get_size(__pyx_v_self->_gh, __pyx_v_name, (&__pyx_v_size));

    /* "pygrib.pyx":1322
 *         else:
 *             err = grib_get_size(self._gh, name, &size)
 *             if err:             # <<<<<<<<<<<<<<
 *                 raise RuntimeError(grib_get_error_message(err))
 *         err = grib_get_message(self._gh, &message, &size)
 */
    __pyx_t_4 = (__pyx_v_err != 0);
    if (unlikely(__pyx_t_4)) {

      /* "pygrib.pyx":1323
 *             err = grib_get_size(self._gh, name, &size)
 *             if err:
 *                 raise RuntimeError(grib_get_error_message(err))             # <<<<<<<<<<<<<<
 *         err = grib_get_message(self._gh, &message, &size)
 *         if err:
 */
      __pyx_t_2 = __Pyx_PyBytes_FromString(grib_get_error_message(__pyx_v_err)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1323, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_RuntimeError, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1323, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_Raise(__pyx_t_3, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __PYX_ERR(0, 1323, __pyx_L1_error)

      /* "pygrib.pyx":1322
 *         else:
 *             err = grib_get_size(self._gh, name, &size)
 *             if err:             # <<<<<<<<<<<<<<
 *                 raise RuntimeError(grib_get_error_message(err))
 *         err = grib_get_message(self._gh, &message, &size)
 */
    }
  }
  __pyx_L3:;

  /* "pygrib.pyx":1324
 *             if err:
 *                 raise RuntimeError(grib_get_error_message(err))
 *         err = grib_get_message(self._gh, &message, &size)             # <<<<<<<<<<<<<<
 *         if err:
 *             raise RuntimeError(grib_get_error_message(err))
 */
  __pyx_v_err = grib_get_message(__pyx_v_self->_gh, (&__pyx_v_message), (&__pyx_v_size));

  /* "pygrib.pyx":1325
 *                 raise RuntimeError(grib_get_error_message(err))
 *         err = grib_get_message(self._gh, &message, &size)
 *         if err:             # <<<<<<<<<<<<<<
 *             raise RuntimeError(grib_get_error_message(err))
 *         msg = PyBytes_FromStringAndSize(<char *>message, size)
 */
  __pyx_t_4 = (__pyx_v_err != 0);
  if (unlikely(__pyx_t_4)) {

    /* "pygrib.pyx":1326
 *         err = grib_get_message(self._gh, &message, &size)
 *         if err:
 *             raise RuntimeError(grib_get_error_message(err))             # <<<<<<<<<<<<<<
 *         msg = PyBytes_FromStringAndSize(<char *>message, size)
 *         return msg
 */
    __pyx_t_3 = __Pyx_PyBytes_FromString(grib_get_error_message(__pyx_v_err)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1326, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_RuntimeError, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1326, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(0, 1326, __pyx_L1_error)

    /* "pygrib.pyx":1325
 *                 raise RuntimeError(grib_get_error_message(err))
 *         err = grib_get_message(self._gh, &message, &size)
 *         if err:             # <<<<<<<<<<<<<<
 *             raise RuntimeError(grib_get_error_message(err))
 *         msg = PyBytes_FromStringAndSize(<char *>message, size)
 */
  }

  /* "pygrib.pyx":1327
 *         if err:
 *             raise RuntimeError(grib_get_error_message(err))
 *         msg = PyBytes_FromStringAndSize(<char *>message, size)             # <<<<<<<<<<<<<<
 *         return msg
 *     def _unshape_mask(self, datarr):
 */
  __pyx_t_2 = PyBytes_FromStringAndSize(((char *)__pyx_v_message), __pyx_v_size); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1327, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_msg = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "pygrib.pyx":1328
 *             raise RuntimeError(grib_get_error_message(err))
 *         msg = PyBytes_FromStringAndSize(<char *>message, size)
 *         return msg             # <<<<<<<<<<<<<<
 *     def _unshape_mask(self, datarr):
 *         """private method for reshaping and removing mask from "values" array"""
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_msg);
  __pyx_r = __pyx_v_msg;
  goto __pyx_L0;

  /* "pygrib.pyx":1303
 *                 ret = False
 *         return ret
 *     def tostring(self):             # <<<<<<<<<<<<<<
 *         """
 *         tostring()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("pygrib.gribmessage.tostring", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_bytestr);
  __Pyx_XDECREF(__pyx_v_usenceplib);
  __Pyx_XDECREF(__pyx_v_msg);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pygrib.pyx":1329
 *         msg = PyBytes_FromStringAndSize(<char *>message, size)
 *         return msg
 *     def _unshape_mask(self, datarr):             # <<<<<<<<<<<<<<
 *         """private method for reshaping and removing mask from "values" array"""
 *         if datarr.ndim > 2:
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pygrib_11gribmessage_33_unshape_mask(PyObject *__pyx_v_self, PyObject *__pyx_v_datarr); /*proto*/
static char __pyx_doc_6pygrib_11gribmessage_32_unshape_mask[] = "private method for reshaping and removing mask from \"values\" array";
static PyObject *__pyx_pw_6pygrib_11gribmessage_33_unshape_mask(PyObject *__pyx_v_self, PyObject *__pyx_v_datarr) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_unshape_mask (wrapper)", 0);
  __pyx_r = __pyx_pf_6pygrib_11gribmessage_32_unshape_mask(((struct __pyx_obj_6pygrib_gribmessage *)__pyx_v_self), ((PyObject *)__pyx_v_datarr));

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

static PyObject *__pyx_pf_6pygrib_11gribmessage_32_unshape_mask(struct __pyx_obj_6pygrib_gribmessage *__pyx_v_self, PyObject *__pyx_v_datarr) {
  PyObject *__pyx_v_datsave = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("_unshape_mask", 0);
  __Pyx_INCREF(__pyx_v_datarr);

  /* "pygrib.pyx":1331
 *     def _unshape_mask(self, datarr):
 *         """private method for reshaping and removing mask from "values" array"""
 *         if datarr.ndim > 2:             # <<<<<<<<<<<<<<
 *             raise ValueError('array must be 1d or 2d')
 *         # if array is masked, put in masked values and convert to plain numpy array.
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_datarr, __pyx_n_s_ndim); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1331, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_int_2, Py_GT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1331, __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 < 0)) __PYX_ERR(0, 1331, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(__pyx_t_3)) {

    /* "pygrib.pyx":1332
 *         """private method for reshaping and removing mask from "values" array"""
 *         if datarr.ndim > 2:
 *             raise ValueError('array must be 1d or 2d')             # <<<<<<<<<<<<<<
 *         # if array is masked, put in masked values and convert to plain numpy array.
 *         if ma.isMA(datarr):
 */
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__62, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1332, __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_ERR(0, 1332, __pyx_L1_error)

    /* "pygrib.pyx":1331
 *     def _unshape_mask(self, datarr):
 *         """private method for reshaping and removing mask from "values" array"""
 *         if datarr.ndim > 2:             # <<<<<<<<<<<<<<
 *             raise ValueError('array must be 1d or 2d')
 *         # if array is masked, put in masked values and convert to plain numpy array.
 */
  }

  /* "pygrib.pyx":1334
 *             raise ValueError('array must be 1d or 2d')
 *         # if array is masked, put in masked values and convert to plain numpy array.
 *         if ma.isMA(datarr):             # <<<<<<<<<<<<<<
 *             datarr = datarr.filled()
 *         # raise error is expanded reduced grid array is supplied.
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_ma); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1334, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_isMA); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1334, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_1)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  if (!__pyx_t_1) {
    __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_datarr); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1334, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[2] = {__pyx_t_1, __pyx_v_datarr};
      __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1334, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_GOTREF(__pyx_t_2);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[2] = {__pyx_t_1, __pyx_v_datarr};
      __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1334, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_GOTREF(__pyx_t_2);
    } else
    #endif
    {
      __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1334, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1); __pyx_t_1 = NULL;
      __Pyx_INCREF(__pyx_v_datarr);
      __Pyx_GIVEREF(__pyx_v_datarr);
      PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_v_datarr);
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1334, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 1334, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_3) {

    /* "pygrib.pyx":1335
 *         # if array is masked, put in masked values and convert to plain numpy array.
 *         if ma.isMA(datarr):
 *             datarr = datarr.filled()             # <<<<<<<<<<<<<<
 *         # raise error is expanded reduced grid array is supplied.
 *         if self['gridType'].startswith('reduced'):
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_datarr, __pyx_n_s_filled); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1335, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    if (__pyx_t_5) {
      __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1335, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else {
      __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1335, __pyx_L1_error)
    }
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF_SET(__pyx_v_datarr, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "pygrib.pyx":1334
 *             raise ValueError('array must be 1d or 2d')
 *         # if array is masked, put in masked values and convert to plain numpy array.
 *         if ma.isMA(datarr):             # <<<<<<<<<<<<<<
 *             datarr = datarr.filled()
 *         # raise error is expanded reduced grid array is supplied.
 */
  }

  /* "pygrib.pyx":1337
 *             datarr = datarr.filled()
 *         # raise error is expanded reduced grid array is supplied.
 *         if self['gridType'].startswith('reduced'):             # <<<<<<<<<<<<<<
 *             if datarr.ndim != 1:
 *                 raise ValueError("reduced grid data array must be 1d")
 */
  __pyx_t_2 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_gridType); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1337, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_startswith); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1337, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_tuple__63, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1337, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 1337, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_3) {

    /* "pygrib.pyx":1338
 *         # raise error is expanded reduced grid array is supplied.
 *         if self['gridType'].startswith('reduced'):
 *             if datarr.ndim != 1:             # <<<<<<<<<<<<<<
 *                 raise ValueError("reduced grid data array must be 1d")
 *         if datarr.ndim == 2:
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_datarr, __pyx_n_s_ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1338, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = PyObject_RichCompare(__pyx_t_2, __pyx_int_1, Py_NE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1338, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 1338, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(__pyx_t_3)) {

      /* "pygrib.pyx":1339
 *         if self['gridType'].startswith('reduced'):
 *             if datarr.ndim != 1:
 *                 raise ValueError("reduced grid data array must be 1d")             # <<<<<<<<<<<<<<
 *         if datarr.ndim == 2:
 *             # check scan modes for rect grids.
 */
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__64, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1339, __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_ERR(0, 1339, __pyx_L1_error)

      /* "pygrib.pyx":1338
 *         # raise error is expanded reduced grid array is supplied.
 *         if self['gridType'].startswith('reduced'):
 *             if datarr.ndim != 1:             # <<<<<<<<<<<<<<
 *                 raise ValueError("reduced grid data array must be 1d")
 *         if datarr.ndim == 2:
 */
    }

    /* "pygrib.pyx":1337
 *             datarr = datarr.filled()
 *         # raise error is expanded reduced grid array is supplied.
 *         if self['gridType'].startswith('reduced'):             # <<<<<<<<<<<<<<
 *             if datarr.ndim != 1:
 *                 raise ValueError("reduced grid data array must be 1d")
 */
  }

  /* "pygrib.pyx":1340
 *             if datarr.ndim != 1:
 *                 raise ValueError("reduced grid data array must be 1d")
 *         if datarr.ndim == 2:             # <<<<<<<<<<<<<<
 *             # check scan modes for rect grids.
 *             # columns scan in the -y direction (so flip)
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_datarr, __pyx_n_s_ndim); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1340, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_2 = __Pyx_PyInt_EqObjC(__pyx_t_4, __pyx_int_2, 2, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1340, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 1340, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_3) {

    /* "pygrib.pyx":1352
 *             # adjacent rows scan in opposite direction.
 *             # (flip every other row)
 *             if self['alternativeRowScanning']:             # <<<<<<<<<<<<<<
 *                 datsave = datarr.copy()
 *                 datarr[1::2,::-1] = datsave[1::2,:]
 */
    __pyx_t_2 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_alternativeRowScanning); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1352, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 1352, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__pyx_t_3) {

      /* "pygrib.pyx":1353
 *             # (flip every other row)
 *             if self['alternativeRowScanning']:
 *                 datsave = datarr.copy()             # <<<<<<<<<<<<<<
 *                 datarr[1::2,::-1] = datsave[1::2,:]
 *         return datarr
 */
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_datarr, __pyx_n_s_copy); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1353, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
        __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
        if (likely(__pyx_t_5)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_5);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_4, function);
        }
      }
      if (__pyx_t_5) {
        __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1353, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      } else {
        __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1353, __pyx_L1_error)
      }
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_v_datsave = __pyx_t_2;
      __pyx_t_2 = 0;

      /* "pygrib.pyx":1354
 *             if self['alternativeRowScanning']:
 *                 datsave = datarr.copy()
 *                 datarr[1::2,::-1] = datsave[1::2,:]             # <<<<<<<<<<<<<<
 *         return datarr
 *     def _reshape_mask(self, datarr):
 */
      __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_v_datsave, __pyx_tuple__67); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1354, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      if (unlikely(PyObject_SetItem(__pyx_v_datarr, __pyx_tuple__70, __pyx_t_2) < 0)) __PYX_ERR(0, 1354, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "pygrib.pyx":1352
 *             # adjacent rows scan in opposite direction.
 *             # (flip every other row)
 *             if self['alternativeRowScanning']:             # <<<<<<<<<<<<<<
 *                 datsave = datarr.copy()
 *                 datarr[1::2,::-1] = datsave[1::2,:]
 */
    }

    /* "pygrib.pyx":1340
 *             if datarr.ndim != 1:
 *                 raise ValueError("reduced grid data array must be 1d")
 *         if datarr.ndim == 2:             # <<<<<<<<<<<<<<
 *             # check scan modes for rect grids.
 *             # columns scan in the -y direction (so flip)
 */
  }

  /* "pygrib.pyx":1355
 *                 datsave = datarr.copy()
 *                 datarr[1::2,::-1] = datsave[1::2,:]
 *         return datarr             # <<<<<<<<<<<<<<
 *     def _reshape_mask(self, datarr):
 *         """private method for reshaping and adding mask to "values" array"""
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_datarr);
  __pyx_r = __pyx_v_datarr;
  goto __pyx_L0;

  /* "pygrib.pyx":1329
 *         msg = PyBytes_FromStringAndSize(<char *>message, size)
 *         return msg
 *     def _unshape_mask(self, datarr):             # <<<<<<<<<<<<<<
 *         """private method for reshaping and removing mask from "values" array"""
 *         if datarr.ndim > 2:
 */

  /* 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_AddTraceback("pygrib.gribmessage._unshape_mask", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_datsave);
  __Pyx_XDECREF(__pyx_v_datarr);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pygrib.pyx":1356
 *                 datarr[1::2,::-1] = datsave[1::2,:]
 *         return datarr
 *     def _reshape_mask(self, datarr):             # <<<<<<<<<<<<<<
 *         """private method for reshaping and adding mask to "values" array"""
 *         cdef double missval
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pygrib_11gribmessage_35_reshape_mask(PyObject *__pyx_v_self, PyObject *__pyx_v_datarr); /*proto*/
static char __pyx_doc_6pygrib_11gribmessage_34_reshape_mask[] = "private method for reshaping and adding mask to \"values\" array";
static PyObject *__pyx_pw_6pygrib_11gribmessage_35_reshape_mask(PyObject *__pyx_v_self, PyObject *__pyx_v_datarr) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_reshape_mask (wrapper)", 0);
  __pyx_r = __pyx_pf_6pygrib_11gribmessage_34_reshape_mask(((struct __pyx_obj_6pygrib_gribmessage *)__pyx_v_self), ((PyObject *)__pyx_v_datarr));

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

static PyObject *__pyx_pf_6pygrib_11gribmessage_34_reshape_mask(struct __pyx_obj_6pygrib_gribmessage *__pyx_v_self, PyObject *__pyx_v_datarr) {
  double __pyx_v_missval;
  PyObject *__pyx_v__redtoreg = NULL;
  PyObject *__pyx_v_ny = NULL;
  PyObject *__pyx_v_nx = NULL;
  PyObject *__pyx_v_datsave = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  double __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  int __pyx_t_12;
  PyObject *__pyx_t_13 = NULL;
  int __pyx_t_14;
  __Pyx_RefNannySetupContext("_reshape_mask", 0);
  __Pyx_INCREF(__pyx_v_datarr);

  /* "pygrib.pyx":1359
 *         """private method for reshaping and adding mask to "values" array"""
 *         cdef double missval
 *         from redtoreg import _redtoreg             # <<<<<<<<<<<<<<
 *         if datarr.ndim > 2:
 *             raise ValueError('array must be 1d or 2d')
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1359, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_redtoreg_2);
  __Pyx_GIVEREF(__pyx_n_s_redtoreg_2);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_redtoreg_2);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_redtoreg, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1359, __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_redtoreg_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1359, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v__redtoreg = __pyx_t_1;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pygrib.pyx":1360
 *         cdef double missval
 *         from redtoreg import _redtoreg
 *         if datarr.ndim > 2:             # <<<<<<<<<<<<<<
 *             raise ValueError('array must be 1d or 2d')
 *         # reduced grid.
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_datarr, __pyx_n_s_ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1360, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, __pyx_int_2, Py_GT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1360, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 1360, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(__pyx_t_3)) {

    /* "pygrib.pyx":1361
 *         from redtoreg import _redtoreg
 *         if datarr.ndim > 2:
 *             raise ValueError('array must be 1d or 2d')             # <<<<<<<<<<<<<<
 *         # reduced grid.
 *         if self['gridType'].startswith('reduced'):
 */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__71, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1361, __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_ERR(0, 1361, __pyx_L1_error)

    /* "pygrib.pyx":1360
 *         cdef double missval
 *         from redtoreg import _redtoreg
 *         if datarr.ndim > 2:             # <<<<<<<<<<<<<<
 *             raise ValueError('array must be 1d or 2d')
 *         # reduced grid.
 */
  }

  /* "pygrib.pyx":1363
 *             raise ValueError('array must be 1d or 2d')
 *         # reduced grid.
 *         if self['gridType'].startswith('reduced'):             # <<<<<<<<<<<<<<
 *             try:
 *                 ny = self['Ny']
 */
  __pyx_t_1 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_gridType); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1363, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_startswith); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1363, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__72, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1363, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 1363, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_3) {

    /* "pygrib.pyx":1364
 *         # reduced grid.
 *         if self['gridType'].startswith('reduced'):
 *             try:             # <<<<<<<<<<<<<<
 *                 ny = self['Ny']
 *             except:
 */
    {
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __Pyx_ExceptionSave(&__pyx_t_4, &__pyx_t_5, &__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_5);
      __Pyx_XGOTREF(__pyx_t_6);
      /*try:*/ {

        /* "pygrib.pyx":1365
 *         if self['gridType'].startswith('reduced'):
 *             try:
 *                 ny = self['Ny']             # <<<<<<<<<<<<<<
 *             except:
 *                 ny = self['Nj']
 */
        __pyx_t_1 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_Ny); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1365, __pyx_L5_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_v_ny = __pyx_t_1;
        __pyx_t_1 = 0;

        /* "pygrib.pyx":1364
 *         # reduced grid.
 *         if self['gridType'].startswith('reduced'):
 *             try:             # <<<<<<<<<<<<<<
 *                 ny = self['Ny']
 *             except:
 */
      }
      __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;
      goto __pyx_L10_try_end;
      __pyx_L5_error:;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "pygrib.pyx":1366
 *             try:
 *                 ny = self['Ny']
 *             except:             # <<<<<<<<<<<<<<
 *                 ny = self['Nj']
 *             if self.has_key('missingValue'):
 */
      /*except:*/ {
        __Pyx_AddTraceback("pygrib.gribmessage._reshape_mask", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_2, &__pyx_t_7) < 0) __PYX_ERR(0, 1366, __pyx_L7_except_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_GOTREF(__pyx_t_7);

        /* "pygrib.pyx":1367
 *                 ny = self['Ny']
 *             except:
 *                 ny = self['Nj']             # <<<<<<<<<<<<<<
 *             if self.has_key('missingValue'):
 *                 missval = self['missingValue']
 */
        __pyx_t_8 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_Nj); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1367, __pyx_L7_except_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_XDECREF_SET(__pyx_v_ny, __pyx_t_8);
        __pyx_t_8 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        goto __pyx_L6_exception_handled;
      }
      __pyx_L7_except_error:;

      /* "pygrib.pyx":1364
 *         # reduced grid.
 *         if self['gridType'].startswith('reduced'):
 *             try:             # <<<<<<<<<<<<<<
 *                 ny = self['Ny']
 *             except:
 */
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_XGIVEREF(__pyx_t_5);
      __Pyx_XGIVEREF(__pyx_t_6);
      __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
      goto __pyx_L1_error;
      __pyx_L6_exception_handled:;
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_XGIVEREF(__pyx_t_5);
      __Pyx_XGIVEREF(__pyx_t_6);
      __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
      __pyx_L10_try_end:;
    }

    /* "pygrib.pyx":1368
 *             except:
 *                 ny = self['Nj']
 *             if self.has_key('missingValue'):             # <<<<<<<<<<<<<<
 *                 missval = self['missingValue']
 *             else:
 */
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_has_key); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1368, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_tuple__73, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1368, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 1368, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__pyx_t_3) {

      /* "pygrib.pyx":1369
 *                 ny = self['Nj']
 *             if self.has_key('missingValue'):
 *                 missval = self['missingValue']             # <<<<<<<<<<<<<<
 *             else:
 *                 missval = 1.e30
 */
      __pyx_t_2 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_missingValue); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1369, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_9 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_9 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1369, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_v_missval = __pyx_t_9;

      /* "pygrib.pyx":1368
 *             except:
 *                 ny = self['Nj']
 *             if self.has_key('missingValue'):             # <<<<<<<<<<<<<<
 *                 missval = self['missingValue']
 *             else:
 */
      goto __pyx_L13;
    }

    /* "pygrib.pyx":1371
 *                 missval = self['missingValue']
 *             else:
 *                 missval = 1.e30             # <<<<<<<<<<<<<<
 *             if self.expand_reduced:
 *                 nx = 2*ny
 */
    /*else*/ {
      __pyx_v_missval = 1.e30;
    }
    __pyx_L13:;

    /* "pygrib.pyx":1372
 *             else:
 *                 missval = 1.e30
 *             if self.expand_reduced:             # <<<<<<<<<<<<<<
 *                 nx = 2*ny
 *                 datarr = _redtoreg(2*ny, self['pl'], datarr, missval)
 */
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_self->expand_reduced); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 1372, __pyx_L1_error)
    if (__pyx_t_3) {

      /* "pygrib.pyx":1373
 *                 missval = 1.e30
 *             if self.expand_reduced:
 *                 nx = 2*ny             # <<<<<<<<<<<<<<
 *                 datarr = _redtoreg(2*ny, self['pl'], datarr, missval)
 *             else:
 */
      __pyx_t_2 = PyNumber_Multiply(__pyx_int_2, __pyx_v_ny); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1373, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_v_nx = __pyx_t_2;
      __pyx_t_2 = 0;

      /* "pygrib.pyx":1374
 *             if self.expand_reduced:
 *                 nx = 2*ny
 *                 datarr = _redtoreg(2*ny, self['pl'], datarr, missval)             # <<<<<<<<<<<<<<
 *             else:
 *                 nx = None
 */
      __pyx_t_7 = PyNumber_Multiply(__pyx_int_2, __pyx_v_ny); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1374, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_1 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_pl); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1374, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_8 = PyFloat_FromDouble(__pyx_v_missval); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1374, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_INCREF(__pyx_v__redtoreg);
      __pyx_t_10 = __pyx_v__redtoreg; __pyx_t_11 = NULL;
      __pyx_t_12 = 0;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_10))) {
        __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_10);
        if (likely(__pyx_t_11)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
          __Pyx_INCREF(__pyx_t_11);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_10, function);
          __pyx_t_12 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_10)) {
        PyObject *__pyx_temp[5] = {__pyx_t_11, __pyx_t_7, __pyx_t_1, __pyx_v_datarr, __pyx_t_8};
        __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_12, 4+__pyx_t_12); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1374, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_10)) {
        PyObject *__pyx_temp[5] = {__pyx_t_11, __pyx_t_7, __pyx_t_1, __pyx_v_datarr, __pyx_t_8};
        __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_12, 4+__pyx_t_12); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1374, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      } else
      #endif
      {
        __pyx_t_13 = PyTuple_New(4+__pyx_t_12); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1374, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_13);
        if (__pyx_t_11) {
          __Pyx_GIVEREF(__pyx_t_11); PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_11); __pyx_t_11 = NULL;
        }
        __Pyx_GIVEREF(__pyx_t_7);
        PyTuple_SET_ITEM(__pyx_t_13, 0+__pyx_t_12, __pyx_t_7);
        __Pyx_GIVEREF(__pyx_t_1);
        PyTuple_SET_ITEM(__pyx_t_13, 1+__pyx_t_12, __pyx_t_1);
        __Pyx_INCREF(__pyx_v_datarr);
        __Pyx_GIVEREF(__pyx_v_datarr);
        PyTuple_SET_ITEM(__pyx_t_13, 2+__pyx_t_12, __pyx_v_datarr);
        __Pyx_GIVEREF(__pyx_t_8);
        PyTuple_SET_ITEM(__pyx_t_13, 3+__pyx_t_12, __pyx_t_8);
        __pyx_t_7 = 0;
        __pyx_t_1 = 0;
        __pyx_t_8 = 0;
        __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_13, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1374, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      }
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_DECREF_SET(__pyx_v_datarr, __pyx_t_2);
      __pyx_t_2 = 0;

      /* "pygrib.pyx":1372
 *             else:
 *                 missval = 1.e30
 *             if self.expand_reduced:             # <<<<<<<<<<<<<<
 *                 nx = 2*ny
 *                 datarr = _redtoreg(2*ny, self['pl'], datarr, missval)
 */
      goto __pyx_L14;
    }

    /* "pygrib.pyx":1376
 *                 datarr = _redtoreg(2*ny, self['pl'], datarr, missval)
 *             else:
 *                 nx = None             # <<<<<<<<<<<<<<
 *         elif self.has_key('Nx') and self.has_key('Ny'):
 *             nx = self['Nx']
 */
    /*else*/ {
      __Pyx_INCREF(Py_None);
      __pyx_v_nx = Py_None;
    }
    __pyx_L14:;

    /* "pygrib.pyx":1363
 *             raise ValueError('array must be 1d or 2d')
 *         # reduced grid.
 *         if self['gridType'].startswith('reduced'):             # <<<<<<<<<<<<<<
 *             try:
 *                 ny = self['Ny']
 */
    goto __pyx_L4;
  }

  /* "pygrib.pyx":1377
 *             else:
 *                 nx = None
 *         elif self.has_key('Nx') and self.has_key('Ny'):             # <<<<<<<<<<<<<<
 *             nx = self['Nx']
 *             ny = self['Ny']
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_has_key); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1377, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__74, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1377, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_14 < 0)) __PYX_ERR(0, 1377, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  if (__pyx_t_14) {
  } else {
    __pyx_t_3 = __pyx_t_14;
    goto __pyx_L15_bool_binop_done;
  }
  __pyx_t_10 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_has_key); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1377, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_tuple__75, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1377, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_14 < 0)) __PYX_ERR(0, 1377, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_3 = __pyx_t_14;
  __pyx_L15_bool_binop_done:;
  if (__pyx_t_3) {

    /* "pygrib.pyx":1378
 *                 nx = None
 *         elif self.has_key('Nx') and self.has_key('Ny'):
 *             nx = self['Nx']             # <<<<<<<<<<<<<<
 *             ny = self['Ny']
 *         # key renamed from Ni to Nx in grib_api 1.8.0.1
 */
    __pyx_t_2 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_Nx); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1378, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_v_nx = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "pygrib.pyx":1379
 *         elif self.has_key('Nx') and self.has_key('Ny'):
 *             nx = self['Nx']
 *             ny = self['Ny']             # <<<<<<<<<<<<<<
 *         # key renamed from Ni to Nx in grib_api 1.8.0.1
 *         elif self.has_key('Ni') and self.has_key('Nj'):
 */
    __pyx_t_2 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_Ny); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1379, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_v_ny = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "pygrib.pyx":1377
 *             else:
 *                 nx = None
 *         elif self.has_key('Nx') and self.has_key('Ny'):             # <<<<<<<<<<<<<<
 *             nx = self['Nx']
 *             ny = self['Ny']
 */
    goto __pyx_L4;
  }

  /* "pygrib.pyx":1381
 *             ny = self['Ny']
 *         # key renamed from Ni to Nx in grib_api 1.8.0.1
 *         elif self.has_key('Ni') and self.has_key('Nj'):             # <<<<<<<<<<<<<<
 *             nx = self['Ni']
 *             ny = self['Nj']
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_has_key); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1381, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__76, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1381, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_14 < 0)) __PYX_ERR(0, 1381, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  if (__pyx_t_14) {
  } else {
    __pyx_t_3 = __pyx_t_14;
    goto __pyx_L17_bool_binop_done;
  }
  __pyx_t_10 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_has_key); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1381, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_tuple__77, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1381, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_14 < 0)) __PYX_ERR(0, 1381, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_3 = __pyx_t_14;
  __pyx_L17_bool_binop_done:;
  if (__pyx_t_3) {

    /* "pygrib.pyx":1382
 *         # key renamed from Ni to Nx in grib_api 1.8.0.1
 *         elif self.has_key('Ni') and self.has_key('Nj'):
 *             nx = self['Ni']             # <<<<<<<<<<<<<<
 *             ny = self['Nj']
 *         else: # probably spectral data.
 */
    __pyx_t_2 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_Ni); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1382, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_v_nx = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "pygrib.pyx":1383
 *         elif self.has_key('Ni') and self.has_key('Nj'):
 *             nx = self['Ni']
 *             ny = self['Nj']             # <<<<<<<<<<<<<<
 *         else: # probably spectral data.
 *             return datarr
 */
    __pyx_t_2 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_Nj); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1383, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_v_ny = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "pygrib.pyx":1381
 *             ny = self['Ny']
 *         # key renamed from Ni to Nx in grib_api 1.8.0.1
 *         elif self.has_key('Ni') and self.has_key('Nj'):             # <<<<<<<<<<<<<<
 *             nx = self['Ni']
 *             ny = self['Nj']
 */
    goto __pyx_L4;
  }

  /* "pygrib.pyx":1385
 *             ny = self['Nj']
 *         else: # probably spectral data.
 *             return datarr             # <<<<<<<<<<<<<<
 *         if ny != GRIB_MISSING_LONG and nx != GRIB_MISSING_LONG and\
 *            self.expand_reduced:
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_datarr);
    __pyx_r = __pyx_v_datarr;
    goto __pyx_L0;
  }
  __pyx_L4:;

  /* "pygrib.pyx":1386
 *         else: # probably spectral data.
 *             return datarr
 *         if ny != GRIB_MISSING_LONG and nx != GRIB_MISSING_LONG and\             # <<<<<<<<<<<<<<
 *            self.expand_reduced:
 *             datarr.shape = (ny,nx)
 */
  __pyx_t_2 = __Pyx_PyInt_From_int(GRIB_MISSING_LONG); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1386, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_10 = PyObject_RichCompare(__pyx_v_ny, __pyx_t_2, Py_NE); __Pyx_XGOTREF(__pyx_t_10); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1386, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_14 < 0)) __PYX_ERR(0, 1386, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  if (__pyx_t_14) {
  } else {
    __pyx_t_3 = __pyx_t_14;
    goto __pyx_L20_bool_binop_done;
  }
  __pyx_t_10 = __Pyx_PyInt_From_int(GRIB_MISSING_LONG); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1386, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_2 = PyObject_RichCompare(__pyx_v_nx, __pyx_t_10, Py_NE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1386, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_14 < 0)) __PYX_ERR(0, 1386, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_14) {
  } else {
    __pyx_t_3 = __pyx_t_14;
    goto __pyx_L20_bool_binop_done;
  }

  /* "pygrib.pyx":1387
 *             return datarr
 *         if ny != GRIB_MISSING_LONG and nx != GRIB_MISSING_LONG and\
 *            self.expand_reduced:             # <<<<<<<<<<<<<<
 *             datarr.shape = (ny,nx)
 *         # check scan modes for rect grids.
 */
  __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_v_self->expand_reduced); if (unlikely(__pyx_t_14 < 0)) __PYX_ERR(0, 1387, __pyx_L1_error)
  __pyx_t_3 = __pyx_t_14;
  __pyx_L20_bool_binop_done:;

  /* "pygrib.pyx":1386
 *         else: # probably spectral data.
 *             return datarr
 *         if ny != GRIB_MISSING_LONG and nx != GRIB_MISSING_LONG and\             # <<<<<<<<<<<<<<
 *            self.expand_reduced:
 *             datarr.shape = (ny,nx)
 */
  if (__pyx_t_3) {

    /* "pygrib.pyx":1388
 *         if ny != GRIB_MISSING_LONG and nx != GRIB_MISSING_LONG and\
 *            self.expand_reduced:
 *             datarr.shape = (ny,nx)             # <<<<<<<<<<<<<<
 *         # check scan modes for rect grids.
 *         if datarr.ndim == 2:
 */
    __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1388, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_v_ny);
    __Pyx_GIVEREF(__pyx_v_ny);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_ny);
    __Pyx_INCREF(__pyx_v_nx);
    __Pyx_GIVEREF(__pyx_v_nx);
    PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_nx);
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_datarr, __pyx_n_s_shape, __pyx_t_2) < 0) __PYX_ERR(0, 1388, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "pygrib.pyx":1386
 *         else: # probably spectral data.
 *             return datarr
 *         if ny != GRIB_MISSING_LONG and nx != GRIB_MISSING_LONG and\             # <<<<<<<<<<<<<<
 *            self.expand_reduced:
 *             datarr.shape = (ny,nx)
 */
  }

  /* "pygrib.pyx":1390
 *             datarr.shape = (ny,nx)
 *         # check scan modes for rect grids.
 *         if datarr.ndim == 2:             # <<<<<<<<<<<<<<
 *            # columns scan in the -y direction (so flip)
 *            #if not self['jScansPositively']:
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_datarr, __pyx_n_s_ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1390, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_10 = __Pyx_PyInt_EqObjC(__pyx_t_2, __pyx_int_2, 2, 0); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1390, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 1390, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  if (__pyx_t_3) {

    /* "pygrib.pyx":1401
 *            # adjacent rows scan in opposite direction.
 *            # (flip every other row)
 *            if self['alternativeRowScanning']:             # <<<<<<<<<<<<<<
 *                datsave = datarr.copy()
 *                datarr[1::2,:] = datsave[1::2,::-1]
 */
    __pyx_t_10 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_alternativeRowScanning); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1401, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 1401, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    if (__pyx_t_3) {

      /* "pygrib.pyx":1402
 *            # (flip every other row)
 *            if self['alternativeRowScanning']:
 *                datsave = datarr.copy()             # <<<<<<<<<<<<<<
 *                datarr[1::2,:] = datsave[1::2,::-1]
 *            # if there is a missingValue, and some values missing,
 */
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_datarr, __pyx_n_s_copy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1402, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_13 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
        __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_2);
        if (likely(__pyx_t_13)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
          __Pyx_INCREF(__pyx_t_13);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_2, function);
        }
      }
      if (__pyx_t_13) {
        __pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_13); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1402, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      } else {
        __pyx_t_10 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1402, __pyx_L1_error)
      }
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_v_datsave = __pyx_t_10;
      __pyx_t_10 = 0;

      /* "pygrib.pyx":1403
 *            if self['alternativeRowScanning']:
 *                datsave = datarr.copy()
 *                datarr[1::2,:] = datsave[1::2,::-1]             # <<<<<<<<<<<<<<
 *            # if there is a missingValue, and some values missing,
 *            # create a masked array.
 */
      __pyx_t_10 = __Pyx_PyObject_GetItem(__pyx_v_datsave, __pyx_tuple__80); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1403, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      if (unlikely(PyObject_SetItem(__pyx_v_datarr, __pyx_tuple__83, __pyx_t_10) < 0)) __PYX_ERR(0, 1403, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;

      /* "pygrib.pyx":1401
 *            # adjacent rows scan in opposite direction.
 *            # (flip every other row)
 *            if self['alternativeRowScanning']:             # <<<<<<<<<<<<<<
 *                datsave = datarr.copy()
 *                datarr[1::2,:] = datsave[1::2,::-1]
 */
    }

    /* "pygrib.pyx":1406
 *            # if there is a missingValue, and some values missing,
 *            # create a masked array.
 *            if self.has_key('missingValue') and self['numberOfMissing']:             # <<<<<<<<<<<<<<
 *                datarr = ma.masked_values(datarr, self['missingValue'])
 *         return datarr
 */
    __pyx_t_10 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_has_key); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1406, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_tuple__84, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1406, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_14 < 0)) __PYX_ERR(0, 1406, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__pyx_t_14) {
    } else {
      __pyx_t_3 = __pyx_t_14;
      goto __pyx_L26_bool_binop_done;
    }
    __pyx_t_2 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_numberOfMissing); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1406, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_14 < 0)) __PYX_ERR(0, 1406, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_3 = __pyx_t_14;
    __pyx_L26_bool_binop_done:;
    if (__pyx_t_3) {

      /* "pygrib.pyx":1407
 *            # create a masked array.
 *            if self.has_key('missingValue') and self['numberOfMissing']:
 *                datarr = ma.masked_values(datarr, self['missingValue'])             # <<<<<<<<<<<<<<
 *         return datarr
 * 
 */
      __pyx_t_10 = __Pyx_GetModuleGlobalName(__pyx_n_s_ma); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1407, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_masked_values); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1407, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_13);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __pyx_t_10 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_missingValue); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1407, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __pyx_t_8 = NULL;
      __pyx_t_12 = 0;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_13))) {
        __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_13);
        if (likely(__pyx_t_8)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_13);
          __Pyx_INCREF(__pyx_t_8);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_13, function);
          __pyx_t_12 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_13)) {
        PyObject *__pyx_temp[3] = {__pyx_t_8, __pyx_v_datarr, __pyx_t_10};
        __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_13, __pyx_temp+1-__pyx_t_12, 2+__pyx_t_12); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1407, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_13)) {
        PyObject *__pyx_temp[3] = {__pyx_t_8, __pyx_v_datarr, __pyx_t_10};
        __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_13, __pyx_temp+1-__pyx_t_12, 2+__pyx_t_12); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1407, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      } else
      #endif
      {
        __pyx_t_1 = PyTuple_New(2+__pyx_t_12); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1407, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        if (__pyx_t_8) {
          __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_8); __pyx_t_8 = NULL;
        }
        __Pyx_INCREF(__pyx_v_datarr);
        __Pyx_GIVEREF(__pyx_v_datarr);
        PyTuple_SET_ITEM(__pyx_t_1, 0+__pyx_t_12, __pyx_v_datarr);
        __Pyx_GIVEREF(__pyx_t_10);
        PyTuple_SET_ITEM(__pyx_t_1, 1+__pyx_t_12, __pyx_t_10);
        __pyx_t_10 = 0;
        __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_13, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1407, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      }
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      __Pyx_DECREF_SET(__pyx_v_datarr, __pyx_t_2);
      __pyx_t_2 = 0;

      /* "pygrib.pyx":1406
 *            # if there is a missingValue, and some values missing,
 *            # create a masked array.
 *            if self.has_key('missingValue') and self['numberOfMissing']:             # <<<<<<<<<<<<<<
 *                datarr = ma.masked_values(datarr, self['missingValue'])
 *         return datarr
 */
    }

    /* "pygrib.pyx":1390
 *             datarr.shape = (ny,nx)
 *         # check scan modes for rect grids.
 *         if datarr.ndim == 2:             # <<<<<<<<<<<<<<
 *            # columns scan in the -y direction (so flip)
 *            #if not self['jScansPositively']:
 */
  }

  /* "pygrib.pyx":1408
 *            if self.has_key('missingValue') and self['numberOfMissing']:
 *                datarr = ma.masked_values(datarr, self['missingValue'])
 *         return datarr             # <<<<<<<<<<<<<<
 * 
 *     def _set_projparams(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_datarr);
  __pyx_r = __pyx_v_datarr;
  goto __pyx_L0;

  /* "pygrib.pyx":1356
 *                 datarr[1::2,::-1] = datsave[1::2,:]
 *         return datarr
 *     def _reshape_mask(self, datarr):             # <<<<<<<<<<<<<<
 *         """private method for reshaping and adding mask to "values" array"""
 *         cdef double missval
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_AddTraceback("pygrib.gribmessage._reshape_mask", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v__redtoreg);
  __Pyx_XDECREF(__pyx_v_ny);
  __Pyx_XDECREF(__pyx_v_nx);
  __Pyx_XDECREF(__pyx_v_datsave);
  __Pyx_XDECREF(__pyx_v_datarr);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pygrib.pyx":1410
 *         return datarr
 * 
 *     def _set_projparams(self):             # <<<<<<<<<<<<<<
 *         """
 *         sets the C{projparams} instance variable to a dictionary containing
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pygrib_11gribmessage_37_set_projparams(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6pygrib_11gribmessage_36_set_projparams[] = "\n        sets the C{projparams} instance variable to a dictionary containing \n        proj4 key/value pairs describing the grid.\n        ";
static PyObject *__pyx_pw_6pygrib_11gribmessage_37_set_projparams(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_set_projparams (wrapper)", 0);
  __pyx_r = __pyx_pf_6pygrib_11gribmessage_36_set_projparams(((struct __pyx_obj_6pygrib_gribmessage *)__pyx_v_self));

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

static PyObject *__pyx_pf_6pygrib_11gribmessage_36_set_projparams(struct __pyx_obj_6pygrib_gribmessage *__pyx_v_self) {
  PyObject *__pyx_v_projparams = NULL;
  PyObject *__pyx_v_scalea = NULL;
  PyObject *__pyx_v_scaleb = NULL;
  PyObject *__pyx_v_projcenterflag = NULL;
  PyObject *__pyx_v_scale = NULL;
  PyObject *__pyx_v_lon1 = NULL;
  PyObject *__pyx_v_lon2 = NULL;
  PyObject *__pyx_v_rot_angle = NULL;
  PyObject *__pyx_v_pole_lat = NULL;
  PyObject *__pyx_v_pole_lon = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  __Pyx_RefNannySetupContext("_set_projparams", 0);

  /* "pygrib.pyx":1415
 *         proj4 key/value pairs describing the grid.
 *         """
 *         projparams = {}             # <<<<<<<<<<<<<<
 * 
 *         # check for radius key, if it exists just use it
 */
  __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1415, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_projparams = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pygrib.pyx":1419
 *         # check for radius key, if it exists just use it
 *         # and don't bother with shapeOfTheEarth
 *         if self.has_key('radius'):             # <<<<<<<<<<<<<<
 *             projparams['a'] = self['radius']
 *             projparams['b'] = self['radius']
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_has_key); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1419, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__85, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1419, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 1419, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_3) {

    /* "pygrib.pyx":1420
 *         # and don't bother with shapeOfTheEarth
 *         if self.has_key('radius'):
 *             projparams['a'] = self['radius']             # <<<<<<<<<<<<<<
 *             projparams['b'] = self['radius']
 *         else:
 */
    __pyx_t_2 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_radius); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1420, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    if (unlikely(PyDict_SetItem(__pyx_v_projparams, __pyx_n_s_a, __pyx_t_2) < 0)) __PYX_ERR(0, 1420, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "pygrib.pyx":1421
 *         if self.has_key('radius'):
 *             projparams['a'] = self['radius']
 *             projparams['b'] = self['radius']             # <<<<<<<<<<<<<<
 *         else:
 *             if self['shapeOfTheEarth'] == 6:
 */
    __pyx_t_2 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_radius); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1421, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    if (unlikely(PyDict_SetItem(__pyx_v_projparams, __pyx_n_s_b, __pyx_t_2) < 0)) __PYX_ERR(0, 1421, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "pygrib.pyx":1419
 *         # check for radius key, if it exists just use it
 *         # and don't bother with shapeOfTheEarth
 *         if self.has_key('radius'):             # <<<<<<<<<<<<<<
 *             projparams['a'] = self['radius']
 *             projparams['b'] = self['radius']
 */
    goto __pyx_L3;
  }

  /* "pygrib.pyx":1423
 *             projparams['b'] = self['radius']
 *         else:
 *             if self['shapeOfTheEarth'] == 6:             # <<<<<<<<<<<<<<
 *                 projparams['a']=6371229.0
 *                 projparams['b']=6371229.0
 */
  /*else*/ {
    __pyx_t_2 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_shapeOfTheEarth); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1423, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = __Pyx_PyInt_EqObjC(__pyx_t_2, __pyx_int_6, 6, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1423, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 1423, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (__pyx_t_3) {

      /* "pygrib.pyx":1424
 *         else:
 *             if self['shapeOfTheEarth'] == 6:
 *                 projparams['a']=6371229.0             # <<<<<<<<<<<<<<
 *                 projparams['b']=6371229.0
 *             elif self['shapeOfTheEarth'] in [3,7]:
 */
      if (unlikely(PyDict_SetItem(__pyx_v_projparams, __pyx_n_s_a, __pyx_float_6371229_0) < 0)) __PYX_ERR(0, 1424, __pyx_L1_error)

      /* "pygrib.pyx":1425
 *             if self['shapeOfTheEarth'] == 6:
 *                 projparams['a']=6371229.0
 *                 projparams['b']=6371229.0             # <<<<<<<<<<<<<<
 *             elif self['shapeOfTheEarth'] in [3,7]:
 *                 if self.has_key('scaleFactorOfMajorAxisOfOblateSpheroidEarth'):
 */
      if (unlikely(PyDict_SetItem(__pyx_v_projparams, __pyx_n_s_b, __pyx_float_6371229_0) < 0)) __PYX_ERR(0, 1425, __pyx_L1_error)

      /* "pygrib.pyx":1423
 *             projparams['b'] = self['radius']
 *         else:
 *             if self['shapeOfTheEarth'] == 6:             # <<<<<<<<<<<<<<
 *                 projparams['a']=6371229.0
 *                 projparams['b']=6371229.0
 */
      goto __pyx_L4;
    }

    /* "pygrib.pyx":1426
 *                 projparams['a']=6371229.0
 *                 projparams['b']=6371229.0
 *             elif self['shapeOfTheEarth'] in [3,7]:             # <<<<<<<<<<<<<<
 *                 if self.has_key('scaleFactorOfMajorAxisOfOblateSpheroidEarth'):
 *                     scalea = self['scaleFactorOfMajorAxisOfOblateSpheroidEarth']
 */
    __pyx_t_1 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_shapeOfTheEarth); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1426, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_PyInt_EqObjC(__pyx_t_1, __pyx_int_3, 3, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1426, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 1426, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (!__pyx_t_4) {
    } else {
      __pyx_t_3 = __pyx_t_4;
      goto __pyx_L5_bool_binop_done;
    }
    __pyx_t_2 = __Pyx_PyInt_EqObjC(__pyx_t_1, __pyx_int_7, 7, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1426, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 1426, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_3 = __pyx_t_4;
    __pyx_L5_bool_binop_done:;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_4 = (__pyx_t_3 != 0);
    if (__pyx_t_4) {

      /* "pygrib.pyx":1427
 *                 projparams['b']=6371229.0
 *             elif self['shapeOfTheEarth'] in [3,7]:
 *                 if self.has_key('scaleFactorOfMajorAxisOfOblateSpheroidEarth'):             # <<<<<<<<<<<<<<
 *                     scalea = self['scaleFactorOfMajorAxisOfOblateSpheroidEarth']
 *                     scaleb = self['scaleFactorOfMinorAxisOfOblateSpheroidEarth']
 */
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_has_key); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1427, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__86, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1427, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 1427, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (__pyx_t_4) {

        /* "pygrib.pyx":1428
 *             elif self['shapeOfTheEarth'] in [3,7]:
 *                 if self.has_key('scaleFactorOfMajorAxisOfOblateSpheroidEarth'):
 *                     scalea = self['scaleFactorOfMajorAxisOfOblateSpheroidEarth']             # <<<<<<<<<<<<<<
 *                     scaleb = self['scaleFactorOfMinorAxisOfOblateSpheroidEarth']
 *                     if scalea and scalea is not missingvalue_int:
 */
        __pyx_t_2 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_scaleFactorOfMajorAxisOfOblateSp); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1428, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_v_scalea = __pyx_t_2;
        __pyx_t_2 = 0;

        /* "pygrib.pyx":1429
 *                 if self.has_key('scaleFactorOfMajorAxisOfOblateSpheroidEarth'):
 *                     scalea = self['scaleFactorOfMajorAxisOfOblateSpheroidEarth']
 *                     scaleb = self['scaleFactorOfMinorAxisOfOblateSpheroidEarth']             # <<<<<<<<<<<<<<
 *                     if scalea and scalea is not missingvalue_int:
 *                         scalea = np.power(10.0,-scalea)
 */
        __pyx_t_2 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_scaleFactorOfMinorAxisOfOblateSp); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1429, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_v_scaleb = __pyx_t_2;
        __pyx_t_2 = 0;

        /* "pygrib.pyx":1430
 *                     scalea = self['scaleFactorOfMajorAxisOfOblateSpheroidEarth']
 *                     scaleb = self['scaleFactorOfMinorAxisOfOblateSpheroidEarth']
 *                     if scalea and scalea is not missingvalue_int:             # <<<<<<<<<<<<<<
 *                         scalea = np.power(10.0,-scalea)
 *                         if self['shapeOfTheEarth'] == 3: # radius in km
 */
        __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_scalea); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 1430, __pyx_L1_error)
        if (__pyx_t_3) {
        } else {
          __pyx_t_4 = __pyx_t_3;
          goto __pyx_L9_bool_binop_done;
        }
        __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_missingvalue_int); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1430, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_3 = (__pyx_v_scalea != __pyx_t_2);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_5 = (__pyx_t_3 != 0);
        __pyx_t_4 = __pyx_t_5;
        __pyx_L9_bool_binop_done:;
        if (__pyx_t_4) {

          /* "pygrib.pyx":1431
 *                     scaleb = self['scaleFactorOfMinorAxisOfOblateSpheroidEarth']
 *                     if scalea and scalea is not missingvalue_int:
 *                         scalea = np.power(10.0,-scalea)             # <<<<<<<<<<<<<<
 *                         if self['shapeOfTheEarth'] == 3: # radius in km
 *                             scalea = 1000.*scalea
 */
          __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1431, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_power); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1431, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __pyx_t_1 = PyNumber_Negative(__pyx_v_scalea); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1431, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          __pyx_t_7 = NULL;
          __pyx_t_8 = 0;
          if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
            __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6);
            if (likely(__pyx_t_7)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
              __Pyx_INCREF(__pyx_t_7);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_6, function);
              __pyx_t_8 = 1;
            }
          }
          #if CYTHON_FAST_PYCALL
          if (PyFunction_Check(__pyx_t_6)) {
            PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_float_10_0, __pyx_t_1};
            __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1431, __pyx_L1_error)
            __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
            __Pyx_GOTREF(__pyx_t_2);
            __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          } else
          #endif
          #if CYTHON_FAST_PYCCALL
          if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
            PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_float_10_0, __pyx_t_1};
            __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1431, __pyx_L1_error)
            __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
            __Pyx_GOTREF(__pyx_t_2);
            __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          } else
          #endif
          {
            __pyx_t_9 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1431, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_9);
            if (__pyx_t_7) {
              __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __pyx_t_7 = NULL;
            }
            __Pyx_INCREF(__pyx_float_10_0);
            __Pyx_GIVEREF(__pyx_float_10_0);
            PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_float_10_0);
            __Pyx_GIVEREF(__pyx_t_1);
            PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_t_1);
            __pyx_t_1 = 0;
            __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_9, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1431, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_2);
            __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          }
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_DECREF_SET(__pyx_v_scalea, __pyx_t_2);
          __pyx_t_2 = 0;

          /* "pygrib.pyx":1432
 *                     if scalea and scalea is not missingvalue_int:
 *                         scalea = np.power(10.0,-scalea)
 *                         if self['shapeOfTheEarth'] == 3: # radius in km             # <<<<<<<<<<<<<<
 *                             scalea = 1000.*scalea
 *                     else:
 */
          __pyx_t_2 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_shapeOfTheEarth); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1432, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_6 = __Pyx_PyInt_EqObjC(__pyx_t_2, __pyx_int_3, 3, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1432, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 1432, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          if (__pyx_t_4) {

            /* "pygrib.pyx":1433
 *                         scalea = np.power(10.0,-scalea)
 *                         if self['shapeOfTheEarth'] == 3: # radius in km
 *                             scalea = 1000.*scalea             # <<<<<<<<<<<<<<
 *                     else:
 *                         scalea = 1
 */
            __pyx_t_6 = PyNumber_Multiply(__pyx_float_1000_, __pyx_v_scalea); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1433, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_6);
            __Pyx_DECREF_SET(__pyx_v_scalea, __pyx_t_6);
            __pyx_t_6 = 0;

            /* "pygrib.pyx":1432
 *                     if scalea and scalea is not missingvalue_int:
 *                         scalea = np.power(10.0,-scalea)
 *                         if self['shapeOfTheEarth'] == 3: # radius in km             # <<<<<<<<<<<<<<
 *                             scalea = 1000.*scalea
 *                     else:
 */
          }

          /* "pygrib.pyx":1430
 *                     scalea = self['scaleFactorOfMajorAxisOfOblateSpheroidEarth']
 *                     scaleb = self['scaleFactorOfMinorAxisOfOblateSpheroidEarth']
 *                     if scalea and scalea is not missingvalue_int:             # <<<<<<<<<<<<<<
 *                         scalea = np.power(10.0,-scalea)
 *                         if self['shapeOfTheEarth'] == 3: # radius in km
 */
          goto __pyx_L8;
        }

        /* "pygrib.pyx":1435
 *                             scalea = 1000.*scalea
 *                     else:
 *                         scalea = 1             # <<<<<<<<<<<<<<
 *                     if scaleb and scaleb is not missingvalue_int:
 *                         scaleb = np.power(10.0,-scaleb)
 */
        /*else*/ {
          __Pyx_INCREF(__pyx_int_1);
          __Pyx_DECREF_SET(__pyx_v_scalea, __pyx_int_1);
        }
        __pyx_L8:;

        /* "pygrib.pyx":1436
 *                     else:
 *                         scalea = 1
 *                     if scaleb and scaleb is not missingvalue_int:             # <<<<<<<<<<<<<<
 *                         scaleb = np.power(10.0,-scaleb)
 *                         if self['shapeOfTheEarth'] == 3: # radius in km
 */
        __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_scaleb); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 1436, __pyx_L1_error)
        if (__pyx_t_5) {
        } else {
          __pyx_t_4 = __pyx_t_5;
          goto __pyx_L13_bool_binop_done;
        }
        __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_missingvalue_int); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1436, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_5 = (__pyx_v_scaleb != __pyx_t_6);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __pyx_t_3 = (__pyx_t_5 != 0);
        __pyx_t_4 = __pyx_t_3;
        __pyx_L13_bool_binop_done:;
        if (__pyx_t_4) {

          /* "pygrib.pyx":1437
 *                         scalea = 1
 *                     if scaleb and scaleb is not missingvalue_int:
 *                         scaleb = np.power(10.0,-scaleb)             # <<<<<<<<<<<<<<
 *                         if self['shapeOfTheEarth'] == 3: # radius in km
 *                             scaleb = 1000.*scaleb
 */
          __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1437, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_power); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1437, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __pyx_t_2 = PyNumber_Negative(__pyx_v_scaleb); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1437, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_1 = NULL;
          __pyx_t_8 = 0;
          if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) {
            __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_9);
            if (likely(__pyx_t_1)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
              __Pyx_INCREF(__pyx_t_1);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_9, function);
              __pyx_t_8 = 1;
            }
          }
          #if CYTHON_FAST_PYCALL
          if (PyFunction_Check(__pyx_t_9)) {
            PyObject *__pyx_temp[3] = {__pyx_t_1, __pyx_float_10_0, __pyx_t_2};
            __pyx_t_6 = __Pyx_PyFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1437, __pyx_L1_error)
            __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
            __Pyx_GOTREF(__pyx_t_6);
            __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          } else
          #endif
          #if CYTHON_FAST_PYCCALL
          if (__Pyx_PyFastCFunction_Check(__pyx_t_9)) {
            PyObject *__pyx_temp[3] = {__pyx_t_1, __pyx_float_10_0, __pyx_t_2};
            __pyx_t_6 = __Pyx_PyCFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1437, __pyx_L1_error)
            __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
            __Pyx_GOTREF(__pyx_t_6);
            __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          } else
          #endif
          {
            __pyx_t_7 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1437, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_7);
            if (__pyx_t_1) {
              __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_1); __pyx_t_1 = NULL;
            }
            __Pyx_INCREF(__pyx_float_10_0);
            __Pyx_GIVEREF(__pyx_float_10_0);
            PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_8, __pyx_float_10_0);
            __Pyx_GIVEREF(__pyx_t_2);
            PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_8, __pyx_t_2);
            __pyx_t_2 = 0;
            __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_7, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1437, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_6);
            __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          }
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __Pyx_DECREF_SET(__pyx_v_scaleb, __pyx_t_6);
          __pyx_t_6 = 0;

          /* "pygrib.pyx":1438
 *                     if scaleb and scaleb is not missingvalue_int:
 *                         scaleb = np.power(10.0,-scaleb)
 *                         if self['shapeOfTheEarth'] == 3: # radius in km             # <<<<<<<<<<<<<<
 *                             scaleb = 1000.*scaleb
 *                     else:
 */
          __pyx_t_6 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_shapeOfTheEarth); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1438, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          __pyx_t_9 = __Pyx_PyInt_EqObjC(__pyx_t_6, __pyx_int_3, 3, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1438, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 1438, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          if (__pyx_t_4) {

            /* "pygrib.pyx":1439
 *                         scaleb = np.power(10.0,-scaleb)
 *                         if self['shapeOfTheEarth'] == 3: # radius in km
 *                             scaleb = 1000.*scaleb             # <<<<<<<<<<<<<<
 *                     else:
 *                         scaleb = 1.
 */
            __pyx_t_9 = PyNumber_Multiply(__pyx_float_1000_, __pyx_v_scaleb); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1439, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_9);
            __Pyx_DECREF_SET(__pyx_v_scaleb, __pyx_t_9);
            __pyx_t_9 = 0;

            /* "pygrib.pyx":1438
 *                     if scaleb and scaleb is not missingvalue_int:
 *                         scaleb = np.power(10.0,-scaleb)
 *                         if self['shapeOfTheEarth'] == 3: # radius in km             # <<<<<<<<<<<<<<
 *                             scaleb = 1000.*scaleb
 *                     else:
 */
          }

          /* "pygrib.pyx":1436
 *                     else:
 *                         scalea = 1
 *                     if scaleb and scaleb is not missingvalue_int:             # <<<<<<<<<<<<<<
 *                         scaleb = np.power(10.0,-scaleb)
 *                         if self['shapeOfTheEarth'] == 3: # radius in km
 */
          goto __pyx_L12;
        }

        /* "pygrib.pyx":1441
 *                             scaleb = 1000.*scaleb
 *                     else:
 *                         scaleb = 1.             # <<<<<<<<<<<<<<
 *                 else:
 *                     scalea = 1.
 */
        /*else*/ {
          __Pyx_INCREF(__pyx_float_1_);
          __Pyx_DECREF_SET(__pyx_v_scaleb, __pyx_float_1_);
        }
        __pyx_L12:;

        /* "pygrib.pyx":1427
 *                 projparams['b']=6371229.0
 *             elif self['shapeOfTheEarth'] in [3,7]:
 *                 if self.has_key('scaleFactorOfMajorAxisOfOblateSpheroidEarth'):             # <<<<<<<<<<<<<<
 *                     scalea = self['scaleFactorOfMajorAxisOfOblateSpheroidEarth']
 *                     scaleb = self['scaleFactorOfMinorAxisOfOblateSpheroidEarth']
 */
        goto __pyx_L7;
      }

      /* "pygrib.pyx":1443
 *                         scaleb = 1.
 *                 else:
 *                     scalea = 1.             # <<<<<<<<<<<<<<
 *                     scaleb = 1.
 *                 if parse_version(grib_api_version) < parse_version('1.9.0'):
 */
      /*else*/ {
        __Pyx_INCREF(__pyx_float_1_);
        __pyx_v_scalea = __pyx_float_1_;

        /* "pygrib.pyx":1444
 *                 else:
 *                     scalea = 1.
 *                     scaleb = 1.             # <<<<<<<<<<<<<<
 *                 if parse_version(grib_api_version) < parse_version('1.9.0'):
 *                     projparams['a']=self['scaledValueOfMajorAxisOfOblateSpheroidEarth']*scalea
 */
        __Pyx_INCREF(__pyx_float_1_);
        __pyx_v_scaleb = __pyx_float_1_;
      }
      __pyx_L7:;

      /* "pygrib.pyx":1445
 *                     scalea = 1.
 *                     scaleb = 1.
 *                 if parse_version(grib_api_version) < parse_version('1.9.0'):             # <<<<<<<<<<<<<<
 *                     projparams['a']=self['scaledValueOfMajorAxisOfOblateSpheroidEarth']*scalea
 *                     projparams['b']=self['scaledValueOfMinorAxisOfOblateSpheroidEarth']*scaleb
 */
      __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_parse_version); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1445, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_grib_api_version); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1445, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_2 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
        __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_6);
        if (likely(__pyx_t_2)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
          __Pyx_INCREF(__pyx_t_2);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_6, function);
        }
      }
      if (!__pyx_t_2) {
        __pyx_t_9 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_7); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1445, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_GOTREF(__pyx_t_9);
      } else {
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_6)) {
          PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_t_7};
          __pyx_t_9 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1445, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
          PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_t_7};
          __pyx_t_9 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1445, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        } else
        #endif
        {
          __pyx_t_1 = PyTuple_New(1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1445, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2); __pyx_t_2 = NULL;
          __Pyx_GIVEREF(__pyx_t_7);
          PyTuple_SET_ITEM(__pyx_t_1, 0+1, __pyx_t_7);
          __pyx_t_7 = 0;
          __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_1, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1445, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        }
      }
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_parse_version); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1445, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_tuple__87, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1445, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = PyObject_RichCompare(__pyx_t_9, __pyx_t_1, Py_LT); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1445, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 1445, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (__pyx_t_4) {

        /* "pygrib.pyx":1446
 *                     scaleb = 1.
 *                 if parse_version(grib_api_version) < parse_version('1.9.0'):
 *                     projparams['a']=self['scaledValueOfMajorAxisOfOblateSpheroidEarth']*scalea             # <<<<<<<<<<<<<<
 *                     projparams['b']=self['scaledValueOfMinorAxisOfOblateSpheroidEarth']*scaleb
 *                 else:
 */
        __pyx_t_6 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_scaledValueOfMajorAxisOfOblateSp); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1446, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_1 = PyNumber_Multiply(__pyx_t_6, __pyx_v_scalea); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1446, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        if (unlikely(PyDict_SetItem(__pyx_v_projparams, __pyx_n_s_a, __pyx_t_1) < 0)) __PYX_ERR(0, 1446, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

        /* "pygrib.pyx":1447
 *                 if parse_version(grib_api_version) < parse_version('1.9.0'):
 *                     projparams['a']=self['scaledValueOfMajorAxisOfOblateSpheroidEarth']*scalea
 *                     projparams['b']=self['scaledValueOfMinorAxisOfOblateSpheroidEarth']*scaleb             # <<<<<<<<<<<<<<
 *                 else:
 *                     projparams['a']=self['scaledValueOfEarthMajorAxis']*scalea
 */
        __pyx_t_1 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_scaledValueOfMinorAxisOfOblateSp); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1447, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_6 = PyNumber_Multiply(__pyx_t_1, __pyx_v_scaleb); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1447, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        if (unlikely(PyDict_SetItem(__pyx_v_projparams, __pyx_n_s_b, __pyx_t_6) < 0)) __PYX_ERR(0, 1447, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

        /* "pygrib.pyx":1445
 *                     scalea = 1.
 *                     scaleb = 1.
 *                 if parse_version(grib_api_version) < parse_version('1.9.0'):             # <<<<<<<<<<<<<<
 *                     projparams['a']=self['scaledValueOfMajorAxisOfOblateSpheroidEarth']*scalea
 *                     projparams['b']=self['scaledValueOfMinorAxisOfOblateSpheroidEarth']*scaleb
 */
        goto __pyx_L16;
      }

      /* "pygrib.pyx":1449
 *                     projparams['b']=self['scaledValueOfMinorAxisOfOblateSpheroidEarth']*scaleb
 *                 else:
 *                     projparams['a']=self['scaledValueOfEarthMajorAxis']*scalea             # <<<<<<<<<<<<<<
 *                     projparams['b']=self['scaledValueOfEarthMinorAxis']*scaleb
 *             elif self['shapeOfTheEarth'] == 2:
 */
      /*else*/ {
        __pyx_t_6 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_scaledValueOfEarthMajorAxis); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1449, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_1 = PyNumber_Multiply(__pyx_t_6, __pyx_v_scalea); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1449, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        if (unlikely(PyDict_SetItem(__pyx_v_projparams, __pyx_n_s_a, __pyx_t_1) < 0)) __PYX_ERR(0, 1449, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

        /* "pygrib.pyx":1450
 *                 else:
 *                     projparams['a']=self['scaledValueOfEarthMajorAxis']*scalea
 *                     projparams['b']=self['scaledValueOfEarthMinorAxis']*scaleb             # <<<<<<<<<<<<<<
 *             elif self['shapeOfTheEarth'] == 2:
 *                 projparams['a']=6378160.0
 */
        __pyx_t_1 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_scaledValueOfEarthMinorAxis); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1450, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_6 = PyNumber_Multiply(__pyx_t_1, __pyx_v_scaleb); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1450, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        if (unlikely(PyDict_SetItem(__pyx_v_projparams, __pyx_n_s_b, __pyx_t_6) < 0)) __PYX_ERR(0, 1450, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      }
      __pyx_L16:;

      /* "pygrib.pyx":1426
 *                 projparams['a']=6371229.0
 *                 projparams['b']=6371229.0
 *             elif self['shapeOfTheEarth'] in [3,7]:             # <<<<<<<<<<<<<<
 *                 if self.has_key('scaleFactorOfMajorAxisOfOblateSpheroidEarth'):
 *                     scalea = self['scaleFactorOfMajorAxisOfOblateSpheroidEarth']
 */
      goto __pyx_L4;
    }

    /* "pygrib.pyx":1451
 *                     projparams['a']=self['scaledValueOfEarthMajorAxis']*scalea
 *                     projparams['b']=self['scaledValueOfEarthMinorAxis']*scaleb
 *             elif self['shapeOfTheEarth'] == 2:             # <<<<<<<<<<<<<<
 *                 projparams['a']=6378160.0
 *                 projparams['b']=6356775.0
 */
    __pyx_t_6 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_shapeOfTheEarth); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1451, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_1 = __Pyx_PyInt_EqObjC(__pyx_t_6, __pyx_int_2, 2, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1451, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 1451, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (__pyx_t_4) {

      /* "pygrib.pyx":1452
 *                     projparams['b']=self['scaledValueOfEarthMinorAxis']*scaleb
 *             elif self['shapeOfTheEarth'] == 2:
 *                 projparams['a']=6378160.0             # <<<<<<<<<<<<<<
 *                 projparams['b']=6356775.0
 *             elif self['shapeOfTheEarth'] == 1:
 */
      if (unlikely(PyDict_SetItem(__pyx_v_projparams, __pyx_n_s_a, __pyx_float_6378160_0) < 0)) __PYX_ERR(0, 1452, __pyx_L1_error)

      /* "pygrib.pyx":1453
 *             elif self['shapeOfTheEarth'] == 2:
 *                 projparams['a']=6378160.0
 *                 projparams['b']=6356775.0             # <<<<<<<<<<<<<<
 *             elif self['shapeOfTheEarth'] == 1:
 *                 if self.has_key('scaleFactorOfRadiusOfSphericalEarth'):
 */
      if (unlikely(PyDict_SetItem(__pyx_v_projparams, __pyx_n_s_b, __pyx_float_6356775_0) < 0)) __PYX_ERR(0, 1453, __pyx_L1_error)

      /* "pygrib.pyx":1451
 *                     projparams['a']=self['scaledValueOfEarthMajorAxis']*scalea
 *                     projparams['b']=self['scaledValueOfEarthMinorAxis']*scaleb
 *             elif self['shapeOfTheEarth'] == 2:             # <<<<<<<<<<<<<<
 *                 projparams['a']=6378160.0
 *                 projparams['b']=6356775.0
 */
      goto __pyx_L4;
    }

    /* "pygrib.pyx":1454
 *                 projparams['a']=6378160.0
 *                 projparams['b']=6356775.0
 *             elif self['shapeOfTheEarth'] == 1:             # <<<<<<<<<<<<<<
 *                 if self.has_key('scaleFactorOfRadiusOfSphericalEarth'):
 *                     scalea = self['scaleFactorOfRadiusOfSphericalEarth']
 */
    __pyx_t_1 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_shapeOfTheEarth); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1454, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_6 = __Pyx_PyInt_EqObjC(__pyx_t_1, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1454, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 1454, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (__pyx_t_4) {

      /* "pygrib.pyx":1455
 *                 projparams['b']=6356775.0
 *             elif self['shapeOfTheEarth'] == 1:
 *                 if self.has_key('scaleFactorOfRadiusOfSphericalEarth'):             # <<<<<<<<<<<<<<
 *                     scalea = self['scaleFactorOfRadiusOfSphericalEarth']
 *                     if scalea and scalea is not missingvalue_int:
 */
      __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_has_key); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1455, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_tuple__88, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1455, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 1455, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (__pyx_t_4) {

        /* "pygrib.pyx":1456
 *             elif self['shapeOfTheEarth'] == 1:
 *                 if self.has_key('scaleFactorOfRadiusOfSphericalEarth'):
 *                     scalea = self['scaleFactorOfRadiusOfSphericalEarth']             # <<<<<<<<<<<<<<
 *                     if scalea and scalea is not missingvalue_int:
 *                         scalea = np.power(10.0,-scalea)
 */
        __pyx_t_1 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_scaleFactorOfRadiusOfSphericalEa); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1456, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_v_scalea = __pyx_t_1;
        __pyx_t_1 = 0;

        /* "pygrib.pyx":1457
 *                 if self.has_key('scaleFactorOfRadiusOfSphericalEarth'):
 *                     scalea = self['scaleFactorOfRadiusOfSphericalEarth']
 *                     if scalea and scalea is not missingvalue_int:             # <<<<<<<<<<<<<<
 *                         scalea = np.power(10.0,-scalea)
 *                     else:
 */
        __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_scalea); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 1457, __pyx_L1_error)
        if (__pyx_t_3) {
        } else {
          __pyx_t_4 = __pyx_t_3;
          goto __pyx_L19_bool_binop_done;
        }
        __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_missingvalue_int); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1457, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_3 = (__pyx_v_scalea != __pyx_t_1);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_5 = (__pyx_t_3 != 0);
        __pyx_t_4 = __pyx_t_5;
        __pyx_L19_bool_binop_done:;
        if (__pyx_t_4) {

          /* "pygrib.pyx":1458
 *                     scalea = self['scaleFactorOfRadiusOfSphericalEarth']
 *                     if scalea and scalea is not missingvalue_int:
 *                         scalea = np.power(10.0,-scalea)             # <<<<<<<<<<<<<<
 *                     else:
 *                         scalea = 1
 */
          __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1458, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_power); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1458, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __pyx_t_6 = PyNumber_Negative(__pyx_v_scalea); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1458, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          __pyx_t_7 = NULL;
          __pyx_t_8 = 0;
          if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) {
            __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_9);
            if (likely(__pyx_t_7)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
              __Pyx_INCREF(__pyx_t_7);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_9, function);
              __pyx_t_8 = 1;
            }
          }
          #if CYTHON_FAST_PYCALL
          if (PyFunction_Check(__pyx_t_9)) {
            PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_float_10_0, __pyx_t_6};
            __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1458, __pyx_L1_error)
            __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
            __Pyx_GOTREF(__pyx_t_1);
            __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          } else
          #endif
          #if CYTHON_FAST_PYCCALL
          if (__Pyx_PyFastCFunction_Check(__pyx_t_9)) {
            PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_float_10_0, __pyx_t_6};
            __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1458, __pyx_L1_error)
            __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
            __Pyx_GOTREF(__pyx_t_1);
            __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          } else
          #endif
          {
            __pyx_t_2 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1458, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_2);
            if (__pyx_t_7) {
              __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_7); __pyx_t_7 = NULL;
            }
            __Pyx_INCREF(__pyx_float_10_0);
            __Pyx_GIVEREF(__pyx_float_10_0);
            PyTuple_SET_ITEM(__pyx_t_2, 0+__pyx_t_8, __pyx_float_10_0);
            __Pyx_GIVEREF(__pyx_t_6);
            PyTuple_SET_ITEM(__pyx_t_2, 1+__pyx_t_8, __pyx_t_6);
            __pyx_t_6 = 0;
            __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1458, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_1);
            __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          }
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __Pyx_DECREF_SET(__pyx_v_scalea, __pyx_t_1);
          __pyx_t_1 = 0;

          /* "pygrib.pyx":1457
 *                 if self.has_key('scaleFactorOfRadiusOfSphericalEarth'):
 *                     scalea = self['scaleFactorOfRadiusOfSphericalEarth']
 *                     if scalea and scalea is not missingvalue_int:             # <<<<<<<<<<<<<<
 *                         scalea = np.power(10.0,-scalea)
 *                     else:
 */
          goto __pyx_L18;
        }

        /* "pygrib.pyx":1460
 *                         scalea = np.power(10.0,-scalea)
 *                     else:
 *                         scalea = 1             # <<<<<<<<<<<<<<
 *                     scaleb = scalea
 *                 else:
 */
        /*else*/ {
          __Pyx_INCREF(__pyx_int_1);
          __Pyx_DECREF_SET(__pyx_v_scalea, __pyx_int_1);
        }
        __pyx_L18:;

        /* "pygrib.pyx":1461
 *                     else:
 *                         scalea = 1
 *                     scaleb = scalea             # <<<<<<<<<<<<<<
 *                 else:
 *                     scalea = 1.
 */
        __Pyx_INCREF(__pyx_v_scalea);
        __pyx_v_scaleb = __pyx_v_scalea;

        /* "pygrib.pyx":1455
 *                 projparams['b']=6356775.0
 *             elif self['shapeOfTheEarth'] == 1:
 *                 if self.has_key('scaleFactorOfRadiusOfSphericalEarth'):             # <<<<<<<<<<<<<<
 *                     scalea = self['scaleFactorOfRadiusOfSphericalEarth']
 *                     if scalea and scalea is not missingvalue_int:
 */
        goto __pyx_L17;
      }

      /* "pygrib.pyx":1463
 *                     scaleb = scalea
 *                 else:
 *                     scalea = 1.             # <<<<<<<<<<<<<<
 *                     scaleb = 1.
 *                 projparams['a']=self['scaledValueOfRadiusOfSphericalEarth']*scalea
 */
      /*else*/ {
        __Pyx_INCREF(__pyx_float_1_);
        __pyx_v_scalea = __pyx_float_1_;

        /* "pygrib.pyx":1464
 *                 else:
 *                     scalea = 1.
 *                     scaleb = 1.             # <<<<<<<<<<<<<<
 *                 projparams['a']=self['scaledValueOfRadiusOfSphericalEarth']*scalea
 *                 projparams['b']=self['scaledValueOfRadiusOfSphericalEarth']*scaleb
 */
        __Pyx_INCREF(__pyx_float_1_);
        __pyx_v_scaleb = __pyx_float_1_;
      }
      __pyx_L17:;

      /* "pygrib.pyx":1465
 *                     scalea = 1.
 *                     scaleb = 1.
 *                 projparams['a']=self['scaledValueOfRadiusOfSphericalEarth']*scalea             # <<<<<<<<<<<<<<
 *                 projparams['b']=self['scaledValueOfRadiusOfSphericalEarth']*scaleb
 *             elif self['shapeOfTheEarth'] == 0:
 */
      __pyx_t_1 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_scaledValueOfRadiusOfSphericalEa); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1465, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_9 = PyNumber_Multiply(__pyx_t_1, __pyx_v_scalea); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1465, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (unlikely(PyDict_SetItem(__pyx_v_projparams, __pyx_n_s_a, __pyx_t_9) < 0)) __PYX_ERR(0, 1465, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

      /* "pygrib.pyx":1466
 *                     scaleb = 1.
 *                 projparams['a']=self['scaledValueOfRadiusOfSphericalEarth']*scalea
 *                 projparams['b']=self['scaledValueOfRadiusOfSphericalEarth']*scaleb             # <<<<<<<<<<<<<<
 *             elif self['shapeOfTheEarth'] == 0:
 *                 projparams['a']=6367470.0
 */
      __pyx_t_9 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_scaledValueOfRadiusOfSphericalEa); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1466, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_1 = PyNumber_Multiply(__pyx_t_9, __pyx_v_scaleb); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1466, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      if (unlikely(PyDict_SetItem(__pyx_v_projparams, __pyx_n_s_b, __pyx_t_1) < 0)) __PYX_ERR(0, 1466, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "pygrib.pyx":1454
 *                 projparams['a']=6378160.0
 *                 projparams['b']=6356775.0
 *             elif self['shapeOfTheEarth'] == 1:             # <<<<<<<<<<<<<<
 *                 if self.has_key('scaleFactorOfRadiusOfSphericalEarth'):
 *                     scalea = self['scaleFactorOfRadiusOfSphericalEarth']
 */
      goto __pyx_L4;
    }

    /* "pygrib.pyx":1467
 *                 projparams['a']=self['scaledValueOfRadiusOfSphericalEarth']*scalea
 *                 projparams['b']=self['scaledValueOfRadiusOfSphericalEarth']*scaleb
 *             elif self['shapeOfTheEarth'] == 0:             # <<<<<<<<<<<<<<
 *                 projparams['a']=6367470.0
 *                 projparams['b']=6367470.0
 */
    __pyx_t_1 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_shapeOfTheEarth); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1467, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_9 = __Pyx_PyInt_EqObjC(__pyx_t_1, __pyx_int_0, 0, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1467, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 1467, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    if (__pyx_t_4) {

      /* "pygrib.pyx":1468
 *                 projparams['b']=self['scaledValueOfRadiusOfSphericalEarth']*scaleb
 *             elif self['shapeOfTheEarth'] == 0:
 *                 projparams['a']=6367470.0             # <<<<<<<<<<<<<<
 *                 projparams['b']=6367470.0
 *             elif self['shapeOfTheEarth'] == 5: # WGS84
 */
      if (unlikely(PyDict_SetItem(__pyx_v_projparams, __pyx_n_s_a, __pyx_float_6367470_0) < 0)) __PYX_ERR(0, 1468, __pyx_L1_error)

      /* "pygrib.pyx":1469
 *             elif self['shapeOfTheEarth'] == 0:
 *                 projparams['a']=6367470.0
 *                 projparams['b']=6367470.0             # <<<<<<<<<<<<<<
 *             elif self['shapeOfTheEarth'] == 5: # WGS84
 *                 projparams['a']=6378137.0
 */
      if (unlikely(PyDict_SetItem(__pyx_v_projparams, __pyx_n_s_b, __pyx_float_6367470_0) < 0)) __PYX_ERR(0, 1469, __pyx_L1_error)

      /* "pygrib.pyx":1467
 *                 projparams['a']=self['scaledValueOfRadiusOfSphericalEarth']*scalea
 *                 projparams['b']=self['scaledValueOfRadiusOfSphericalEarth']*scaleb
 *             elif self['shapeOfTheEarth'] == 0:             # <<<<<<<<<<<<<<
 *                 projparams['a']=6367470.0
 *                 projparams['b']=6367470.0
 */
      goto __pyx_L4;
    }

    /* "pygrib.pyx":1470
 *                 projparams['a']=6367470.0
 *                 projparams['b']=6367470.0
 *             elif self['shapeOfTheEarth'] == 5: # WGS84             # <<<<<<<<<<<<<<
 *                 projparams['a']=6378137.0
 *                 projparams['b']=6356752.3142
 */
    __pyx_t_9 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_shapeOfTheEarth); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1470, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_1 = __Pyx_PyInt_EqObjC(__pyx_t_9, __pyx_int_5, 5, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1470, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 1470, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (__pyx_t_4) {

      /* "pygrib.pyx":1471
 *                 projparams['b']=6367470.0
 *             elif self['shapeOfTheEarth'] == 5: # WGS84
 *                 projparams['a']=6378137.0             # <<<<<<<<<<<<<<
 *                 projparams['b']=6356752.3142
 *             elif self['shapeOfTheEarth'] == 8:
 */
      if (unlikely(PyDict_SetItem(__pyx_v_projparams, __pyx_n_s_a, __pyx_float_6378137_0) < 0)) __PYX_ERR(0, 1471, __pyx_L1_error)

      /* "pygrib.pyx":1472
 *             elif self['shapeOfTheEarth'] == 5: # WGS84
 *                 projparams['a']=6378137.0
 *                 projparams['b']=6356752.3142             # <<<<<<<<<<<<<<
 *             elif self['shapeOfTheEarth'] == 8:
 *                 projparams['a']=6371200.0
 */
      if (unlikely(PyDict_SetItem(__pyx_v_projparams, __pyx_n_s_b, __pyx_float_6356752_3142) < 0)) __PYX_ERR(0, 1472, __pyx_L1_error)

      /* "pygrib.pyx":1470
 *                 projparams['a']=6367470.0
 *                 projparams['b']=6367470.0
 *             elif self['shapeOfTheEarth'] == 5: # WGS84             # <<<<<<<<<<<<<<
 *                 projparams['a']=6378137.0
 *                 projparams['b']=6356752.3142
 */
      goto __pyx_L4;
    }

    /* "pygrib.pyx":1473
 *                 projparams['a']=6378137.0
 *                 projparams['b']=6356752.3142
 *             elif self['shapeOfTheEarth'] == 8:             # <<<<<<<<<<<<<<
 *                 projparams['a']=6371200.0
 *                 projparams['b']=6371200.0
 */
    __pyx_t_1 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_shapeOfTheEarth); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1473, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_9 = __Pyx_PyInt_EqObjC(__pyx_t_1, __pyx_int_8, 8, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1473, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 1473, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    if (__pyx_t_4) {

      /* "pygrib.pyx":1474
 *                 projparams['b']=6356752.3142
 *             elif self['shapeOfTheEarth'] == 8:
 *                 projparams['a']=6371200.0             # <<<<<<<<<<<<<<
 *                 projparams['b']=6371200.0
 *             else:
 */
      if (unlikely(PyDict_SetItem(__pyx_v_projparams, __pyx_n_s_a, __pyx_float_6371200_0) < 0)) __PYX_ERR(0, 1474, __pyx_L1_error)

      /* "pygrib.pyx":1475
 *             elif self['shapeOfTheEarth'] == 8:
 *                 projparams['a']=6371200.0
 *                 projparams['b']=6371200.0             # <<<<<<<<<<<<<<
 *             else:
 *                 if not tolerate_badgrib: raise ValueError('unknown shape of the earth flag')
 */
      if (unlikely(PyDict_SetItem(__pyx_v_projparams, __pyx_n_s_b, __pyx_float_6371200_0) < 0)) __PYX_ERR(0, 1475, __pyx_L1_error)

      /* "pygrib.pyx":1473
 *                 projparams['a']=6378137.0
 *                 projparams['b']=6356752.3142
 *             elif self['shapeOfTheEarth'] == 8:             # <<<<<<<<<<<<<<
 *                 projparams['a']=6371200.0
 *                 projparams['b']=6371200.0
 */
      goto __pyx_L4;
    }

    /* "pygrib.pyx":1477
 *                 projparams['b']=6371200.0
 *             else:
 *                 if not tolerate_badgrib: raise ValueError('unknown shape of the earth flag')             # <<<<<<<<<<<<<<
 * 
 *         if self['gridType'] in ['reduced_gg','reduced_ll','regular_gg','regular_ll']: # regular lat/lon grid
 */
    /*else*/ {
      __pyx_t_9 = __Pyx_GetModuleGlobalName(__pyx_n_s_tolerate_badgrib); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1477, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 1477, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_5 = ((!__pyx_t_4) != 0);
      if (unlikely(__pyx_t_5)) {
        __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__89, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1477, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_Raise(__pyx_t_9, 0, 0, 0);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __PYX_ERR(0, 1477, __pyx_L1_error)
      }
    }
    __pyx_L4:;
  }
  __pyx_L3:;

  /* "pygrib.pyx":1479
 *                 if not tolerate_badgrib: raise ValueError('unknown shape of the earth flag')
 * 
 *         if self['gridType'] in ['reduced_gg','reduced_ll','regular_gg','regular_ll']: # regular lat/lon grid             # <<<<<<<<<<<<<<
 *             projparams['proj']='cyl'
 *         elif self['gridType'] == 'polar_stereographic':
 */
  __pyx_t_9 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_gridType); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1479, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_4 = (__Pyx_PyString_Equals(__pyx_t_9, __pyx_n_s_reduced_gg, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 1479, __pyx_L1_error)
  if (!__pyx_t_4) {
  } else {
    __pyx_t_5 = __pyx_t_4;
    goto __pyx_L23_bool_binop_done;
  }
  __pyx_t_4 = (__Pyx_PyString_Equals(__pyx_t_9, __pyx_n_s_reduced_ll, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 1479, __pyx_L1_error)
  if (!__pyx_t_4) {
  } else {
    __pyx_t_5 = __pyx_t_4;
    goto __pyx_L23_bool_binop_done;
  }
  __pyx_t_4 = (__Pyx_PyString_Equals(__pyx_t_9, __pyx_n_s_regular_gg, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 1479, __pyx_L1_error)
  if (!__pyx_t_4) {
  } else {
    __pyx_t_5 = __pyx_t_4;
    goto __pyx_L23_bool_binop_done;
  }
  __pyx_t_4 = (__Pyx_PyString_Equals(__pyx_t_9, __pyx_n_s_regular_ll, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 1479, __pyx_L1_error)
  __pyx_t_5 = __pyx_t_4;
  __pyx_L23_bool_binop_done:;
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __pyx_t_4 = (__pyx_t_5 != 0);
  if (__pyx_t_4) {

    /* "pygrib.pyx":1480
 * 
 *         if self['gridType'] in ['reduced_gg','reduced_ll','regular_gg','regular_ll']: # regular lat/lon grid
 *             projparams['proj']='cyl'             # <<<<<<<<<<<<<<
 *         elif self['gridType'] == 'polar_stereographic':
 *             projparams['proj']='stere'
 */
    if (unlikely(PyDict_SetItem(__pyx_v_projparams, __pyx_n_s_proj, __pyx_n_s_cyl) < 0)) __PYX_ERR(0, 1480, __pyx_L1_error)

    /* "pygrib.pyx":1479
 *                 if not tolerate_badgrib: raise ValueError('unknown shape of the earth flag')
 * 
 *         if self['gridType'] in ['reduced_gg','reduced_ll','regular_gg','regular_ll']: # regular lat/lon grid             # <<<<<<<<<<<<<<
 *             projparams['proj']='cyl'
 *         elif self['gridType'] == 'polar_stereographic':
 */
    goto __pyx_L22;
  }

  /* "pygrib.pyx":1481
 *         if self['gridType'] in ['reduced_gg','reduced_ll','regular_gg','regular_ll']: # regular lat/lon grid
 *             projparams['proj']='cyl'
 *         elif self['gridType'] == 'polar_stereographic':             # <<<<<<<<<<<<<<
 *             projparams['proj']='stere'
 *             projparams['lat_ts']=self['latitudeWhereDxAndDyAreSpecifiedInDegrees']
 */
  __pyx_t_9 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_gridType); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1481, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_4 = (__Pyx_PyString_Equals(__pyx_t_9, __pyx_n_s_polar_stereographic, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 1481, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  if (__pyx_t_4) {

    /* "pygrib.pyx":1482
 *             projparams['proj']='cyl'
 *         elif self['gridType'] == 'polar_stereographic':
 *             projparams['proj']='stere'             # <<<<<<<<<<<<<<
 *             projparams['lat_ts']=self['latitudeWhereDxAndDyAreSpecifiedInDegrees']
 *             if self.has_key('projectionCentreFlag'):
 */
    if (unlikely(PyDict_SetItem(__pyx_v_projparams, __pyx_n_s_proj, __pyx_n_s_stere) < 0)) __PYX_ERR(0, 1482, __pyx_L1_error)

    /* "pygrib.pyx":1483
 *         elif self['gridType'] == 'polar_stereographic':
 *             projparams['proj']='stere'
 *             projparams['lat_ts']=self['latitudeWhereDxAndDyAreSpecifiedInDegrees']             # <<<<<<<<<<<<<<
 *             if self.has_key('projectionCentreFlag'):
 *                 projcenterflag = self['projectionCentreFlag']
 */
    __pyx_t_9 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_latitudeWhereDxAndDyAreSpecified); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1483, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    if (unlikely(PyDict_SetItem(__pyx_v_projparams, __pyx_n_s_lat_ts, __pyx_t_9) < 0)) __PYX_ERR(0, 1483, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

    /* "pygrib.pyx":1484
 *             projparams['proj']='stere'
 *             projparams['lat_ts']=self['latitudeWhereDxAndDyAreSpecifiedInDegrees']
 *             if self.has_key('projectionCentreFlag'):             # <<<<<<<<<<<<<<
 *                 projcenterflag = self['projectionCentreFlag']
 *             elif self.has_key('projectionCenterFlag'):
 */
    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_has_key); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1484, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_tuple__90, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1484, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 1484, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (__pyx_t_4) {

      /* "pygrib.pyx":1485
 *             projparams['lat_ts']=self['latitudeWhereDxAndDyAreSpecifiedInDegrees']
 *             if self.has_key('projectionCentreFlag'):
 *                 projcenterflag = self['projectionCentreFlag']             # <<<<<<<<<<<<<<
 *             elif self.has_key('projectionCenterFlag'):
 *                 projcenterflag = self['projectionCenterFlag']
 */
      __pyx_t_1 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_projectionCentreFlag); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1485, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_v_projcenterflag = __pyx_t_1;
      __pyx_t_1 = 0;

      /* "pygrib.pyx":1484
 *             projparams['proj']='stere'
 *             projparams['lat_ts']=self['latitudeWhereDxAndDyAreSpecifiedInDegrees']
 *             if self.has_key('projectionCentreFlag'):             # <<<<<<<<<<<<<<
 *                 projcenterflag = self['projectionCentreFlag']
 *             elif self.has_key('projectionCenterFlag'):
 */
      goto __pyx_L27;
    }

    /* "pygrib.pyx":1486
 *             if self.has_key('projectionCentreFlag'):
 *                 projcenterflag = self['projectionCentreFlag']
 *             elif self.has_key('projectionCenterFlag'):             # <<<<<<<<<<<<<<
 *                 projcenterflag = self['projectionCenterFlag']
 *             else:
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_has_key); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1486, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__91, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1486, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 1486, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    if (__pyx_t_4) {

      /* "pygrib.pyx":1487
 *                 projcenterflag = self['projectionCentreFlag']
 *             elif self.has_key('projectionCenterFlag'):
 *                 projcenterflag = self['projectionCenterFlag']             # <<<<<<<<<<<<<<
 *             else:
 *                 if not tolerate_badgrib: raise KeyError('cannot find projection center flag')
 */
      __pyx_t_9 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_projectionCenterFlag); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1487, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_v_projcenterflag = __pyx_t_9;
      __pyx_t_9 = 0;

      /* "pygrib.pyx":1486
 *             if self.has_key('projectionCentreFlag'):
 *                 projcenterflag = self['projectionCentreFlag']
 *             elif self.has_key('projectionCenterFlag'):             # <<<<<<<<<<<<<<
 *                 projcenterflag = self['projectionCenterFlag']
 *             else:
 */
      goto __pyx_L27;
    }

    /* "pygrib.pyx":1489
 *                 projcenterflag = self['projectionCenterFlag']
 *             else:
 *                 if not tolerate_badgrib: raise KeyError('cannot find projection center flag')             # <<<<<<<<<<<<<<
 *             if projcenterflag == 0:
 *                 projparams['lat_0']=90.
 */
    /*else*/ {
      __pyx_t_9 = __Pyx_GetModuleGlobalName(__pyx_n_s_tolerate_badgrib); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1489, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 1489, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_5 = ((!__pyx_t_4) != 0);
      if (unlikely(__pyx_t_5)) {
        __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_KeyError, __pyx_tuple__92, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1489, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_Raise(__pyx_t_9, 0, 0, 0);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __PYX_ERR(0, 1489, __pyx_L1_error)
      }
    }
    __pyx_L27:;

    /* "pygrib.pyx":1490
 *             else:
 *                 if not tolerate_badgrib: raise KeyError('cannot find projection center flag')
 *             if projcenterflag == 0:             # <<<<<<<<<<<<<<
 *                 projparams['lat_0']=90.
 *             else:
 */
    if (unlikely(!__pyx_v_projcenterflag)) { __Pyx_RaiseUnboundLocalError("projcenterflag"); __PYX_ERR(0, 1490, __pyx_L1_error) }
    __pyx_t_9 = __Pyx_PyInt_EqObjC(__pyx_v_projcenterflag, __pyx_int_0, 0, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1490, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 1490, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    if (__pyx_t_5) {

      /* "pygrib.pyx":1491
 *                 if not tolerate_badgrib: raise KeyError('cannot find projection center flag')
 *             if projcenterflag == 0:
 *                 projparams['lat_0']=90.             # <<<<<<<<<<<<<<
 *             else:
 *                 projparams['lat_0']=-90.
 */
      if (unlikely(PyDict_SetItem(__pyx_v_projparams, __pyx_n_s_lat_0, __pyx_float_90_) < 0)) __PYX_ERR(0, 1491, __pyx_L1_error)

      /* "pygrib.pyx":1490
 *             else:
 *                 if not tolerate_badgrib: raise KeyError('cannot find projection center flag')
 *             if projcenterflag == 0:             # <<<<<<<<<<<<<<
 *                 projparams['lat_0']=90.
 *             else:
 */
      goto __pyx_L29;
    }

    /* "pygrib.pyx":1493
 *                 projparams['lat_0']=90.
 *             else:
 *                 projparams['lat_0']=-90.             # <<<<<<<<<<<<<<
 *             projparams['lon_0']=self['orientationOfTheGridInDegrees']
 *         elif self['gridType'] == 'lambert':
 */
    /*else*/ {
      if (unlikely(PyDict_SetItem(__pyx_v_projparams, __pyx_n_s_lat_0, __pyx_float_neg_90_) < 0)) __PYX_ERR(0, 1493, __pyx_L1_error)
    }
    __pyx_L29:;

    /* "pygrib.pyx":1494
 *             else:
 *                 projparams['lat_0']=-90.
 *             projparams['lon_0']=self['orientationOfTheGridInDegrees']             # <<<<<<<<<<<<<<
 *         elif self['gridType'] == 'lambert':
 *             projparams['proj']='lcc'
 */
    __pyx_t_9 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_orientationOfTheGridInDegrees); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1494, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    if (unlikely(PyDict_SetItem(__pyx_v_projparams, __pyx_n_s_lon_0, __pyx_t_9) < 0)) __PYX_ERR(0, 1494, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

    /* "pygrib.pyx":1481
 *         if self['gridType'] in ['reduced_gg','reduced_ll','regular_gg','regular_ll']: # regular lat/lon grid
 *             projparams['proj']='cyl'
 *         elif self['gridType'] == 'polar_stereographic':             # <<<<<<<<<<<<<<
 *             projparams['proj']='stere'
 *             projparams['lat_ts']=self['latitudeWhereDxAndDyAreSpecifiedInDegrees']
 */
    goto __pyx_L22;
  }

  /* "pygrib.pyx":1495
 *                 projparams['lat_0']=-90.
 *             projparams['lon_0']=self['orientationOfTheGridInDegrees']
 *         elif self['gridType'] == 'lambert':             # <<<<<<<<<<<<<<
 *             projparams['proj']='lcc'
 *             projparams['lon_0']=self['LoVInDegrees']
 */
  __pyx_t_9 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_gridType); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1495, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_5 = (__Pyx_PyString_Equals(__pyx_t_9, __pyx_n_s_lambert, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 1495, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  if (__pyx_t_5) {

    /* "pygrib.pyx":1496
 *             projparams['lon_0']=self['orientationOfTheGridInDegrees']
 *         elif self['gridType'] == 'lambert':
 *             projparams['proj']='lcc'             # <<<<<<<<<<<<<<
 *             projparams['lon_0']=self['LoVInDegrees']
 *             projparams['lat_0']=self['LaDInDegrees']
 */
    if (unlikely(PyDict_SetItem(__pyx_v_projparams, __pyx_n_s_proj, __pyx_n_s_lcc) < 0)) __PYX_ERR(0, 1496, __pyx_L1_error)

    /* "pygrib.pyx":1497
 *         elif self['gridType'] == 'lambert':
 *             projparams['proj']='lcc'
 *             projparams['lon_0']=self['LoVInDegrees']             # <<<<<<<<<<<<<<
 *             projparams['lat_0']=self['LaDInDegrees']
 *             projparams['lat_1']=self['Latin1InDegrees']
 */
    __pyx_t_9 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_LoVInDegrees); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1497, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    if (unlikely(PyDict_SetItem(__pyx_v_projparams, __pyx_n_s_lon_0, __pyx_t_9) < 0)) __PYX_ERR(0, 1497, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

    /* "pygrib.pyx":1498
 *             projparams['proj']='lcc'
 *             projparams['lon_0']=self['LoVInDegrees']
 *             projparams['lat_0']=self['LaDInDegrees']             # <<<<<<<<<<<<<<
 *             projparams['lat_1']=self['Latin1InDegrees']
 *             projparams['lat_2']=self['Latin2InDegrees']
 */
    __pyx_t_9 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_LaDInDegrees); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1498, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    if (unlikely(PyDict_SetItem(__pyx_v_projparams, __pyx_n_s_lat_0, __pyx_t_9) < 0)) __PYX_ERR(0, 1498, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

    /* "pygrib.pyx":1499
 *             projparams['lon_0']=self['LoVInDegrees']
 *             projparams['lat_0']=self['LaDInDegrees']
 *             projparams['lat_1']=self['Latin1InDegrees']             # <<<<<<<<<<<<<<
 *             projparams['lat_2']=self['Latin2InDegrees']
 *         elif self['gridType'] =='albers':
 */
    __pyx_t_9 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_Latin1InDegrees); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1499, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    if (unlikely(PyDict_SetItem(__pyx_v_projparams, __pyx_n_s_lat_1, __pyx_t_9) < 0)) __PYX_ERR(0, 1499, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

    /* "pygrib.pyx":1500
 *             projparams['lat_0']=self['LaDInDegrees']
 *             projparams['lat_1']=self['Latin1InDegrees']
 *             projparams['lat_2']=self['Latin2InDegrees']             # <<<<<<<<<<<<<<
 *         elif self['gridType'] =='albers':
 *             projparams['proj']='aea'
 */
    __pyx_t_9 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_Latin2InDegrees); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1500, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    if (unlikely(PyDict_SetItem(__pyx_v_projparams, __pyx_n_s_lat_2, __pyx_t_9) < 0)) __PYX_ERR(0, 1500, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

    /* "pygrib.pyx":1495
 *                 projparams['lat_0']=-90.
 *             projparams['lon_0']=self['orientationOfTheGridInDegrees']
 *         elif self['gridType'] == 'lambert':             # <<<<<<<<<<<<<<
 *             projparams['proj']='lcc'
 *             projparams['lon_0']=self['LoVInDegrees']
 */
    goto __pyx_L22;
  }

  /* "pygrib.pyx":1501
 *             projparams['lat_1']=self['Latin1InDegrees']
 *             projparams['lat_2']=self['Latin2InDegrees']
 *         elif self['gridType'] =='albers':             # <<<<<<<<<<<<<<
 *             projparams['proj']='aea'
 *             scale = float(self['grib2divider'])
 */
  __pyx_t_9 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_gridType); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1501, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_5 = (__Pyx_PyString_Equals(__pyx_t_9, __pyx_n_s_albers, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 1501, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  if (__pyx_t_5) {

    /* "pygrib.pyx":1502
 *             projparams['lat_2']=self['Latin2InDegrees']
 *         elif self['gridType'] =='albers':
 *             projparams['proj']='aea'             # <<<<<<<<<<<<<<
 *             scale = float(self['grib2divider'])
 *             projparams['lon_0']=self['LoV']/scale
 */
    if (unlikely(PyDict_SetItem(__pyx_v_projparams, __pyx_n_s_proj, __pyx_n_s_aea) < 0)) __PYX_ERR(0, 1502, __pyx_L1_error)

    /* "pygrib.pyx":1503
 *         elif self['gridType'] =='albers':
 *             projparams['proj']='aea'
 *             scale = float(self['grib2divider'])             # <<<<<<<<<<<<<<
 *             projparams['lon_0']=self['LoV']/scale
 *             if self['truncateDegrees']:
 */
    __pyx_t_9 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_grib2divider); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1503, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_1 = __Pyx_PyNumber_Float(__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1503, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_v_scale = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "pygrib.pyx":1504
 *             projparams['proj']='aea'
 *             scale = float(self['grib2divider'])
 *             projparams['lon_0']=self['LoV']/scale             # <<<<<<<<<<<<<<
 *             if self['truncateDegrees']:
 *                 projparams['lon_0'] = int(projparams['lon_0'])
 */
    __pyx_t_1 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_LoV); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1504, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_9 = __Pyx_PyNumber_Divide(__pyx_t_1, __pyx_v_scale); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1504, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(PyDict_SetItem(__pyx_v_projparams, __pyx_n_s_lon_0, __pyx_t_9) < 0)) __PYX_ERR(0, 1504, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

    /* "pygrib.pyx":1505
 *             scale = float(self['grib2divider'])
 *             projparams['lon_0']=self['LoV']/scale
 *             if self['truncateDegrees']:             # <<<<<<<<<<<<<<
 *                 projparams['lon_0'] = int(projparams['lon_0'])
 *             projparams['lat_0']=self['LaD']/scale
 */
    __pyx_t_9 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_truncateDegrees); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1505, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 1505, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    if (__pyx_t_5) {

      /* "pygrib.pyx":1506
 *             projparams['lon_0']=self['LoV']/scale
 *             if self['truncateDegrees']:
 *                 projparams['lon_0'] = int(projparams['lon_0'])             # <<<<<<<<<<<<<<
 *             projparams['lat_0']=self['LaD']/scale
 *             if self['truncateDegrees']:
 */
      __pyx_t_9 = __Pyx_PyDict_GetItem(__pyx_v_projparams, __pyx_n_s_lon_0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1506, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_1 = __Pyx_PyNumber_Int(__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1506, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      if (unlikely(PyDict_SetItem(__pyx_v_projparams, __pyx_n_s_lon_0, __pyx_t_1) < 0)) __PYX_ERR(0, 1506, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "pygrib.pyx":1505
 *             scale = float(self['grib2divider'])
 *             projparams['lon_0']=self['LoV']/scale
 *             if self['truncateDegrees']:             # <<<<<<<<<<<<<<
 *                 projparams['lon_0'] = int(projparams['lon_0'])
 *             projparams['lat_0']=self['LaD']/scale
 */
    }

    /* "pygrib.pyx":1507
 *             if self['truncateDegrees']:
 *                 projparams['lon_0'] = int(projparams['lon_0'])
 *             projparams['lat_0']=self['LaD']/scale             # <<<<<<<<<<<<<<
 *             if self['truncateDegrees']:
 *                 projparams['lat_0'] = int(projparams['lat_0'])
 */
    __pyx_t_1 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_LaD); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1507, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_9 = __Pyx_PyNumber_Divide(__pyx_t_1, __pyx_v_scale); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1507, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(PyDict_SetItem(__pyx_v_projparams, __pyx_n_s_lat_0, __pyx_t_9) < 0)) __PYX_ERR(0, 1507, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

    /* "pygrib.pyx":1508
 *                 projparams['lon_0'] = int(projparams['lon_0'])
 *             projparams['lat_0']=self['LaD']/scale
 *             if self['truncateDegrees']:             # <<<<<<<<<<<<<<
 *                 projparams['lat_0'] = int(projparams['lat_0'])
 *             projparams['lat_1']=self['Latin1']/scale
 */
    __pyx_t_9 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_truncateDegrees); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1508, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 1508, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    if (__pyx_t_5) {

      /* "pygrib.pyx":1509
 *             projparams['lat_0']=self['LaD']/scale
 *             if self['truncateDegrees']:
 *                 projparams['lat_0'] = int(projparams['lat_0'])             # <<<<<<<<<<<<<<
 *             projparams['lat_1']=self['Latin1']/scale
 *             if self['truncateDegrees']:
 */
      __pyx_t_9 = __Pyx_PyDict_GetItem(__pyx_v_projparams, __pyx_n_s_lat_0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1509, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_1 = __Pyx_PyNumber_Int(__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1509, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      if (unlikely(PyDict_SetItem(__pyx_v_projparams, __pyx_n_s_lat_0, __pyx_t_1) < 0)) __PYX_ERR(0, 1509, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "pygrib.pyx":1508
 *                 projparams['lon_0'] = int(projparams['lon_0'])
 *             projparams['lat_0']=self['LaD']/scale
 *             if self['truncateDegrees']:             # <<<<<<<<<<<<<<
 *                 projparams['lat_0'] = int(projparams['lat_0'])
 *             projparams['lat_1']=self['Latin1']/scale
 */
    }

    /* "pygrib.pyx":1510
 *             if self['truncateDegrees']:
 *                 projparams['lat_0'] = int(projparams['lat_0'])
 *             projparams['lat_1']=self['Latin1']/scale             # <<<<<<<<<<<<<<
 *             if self['truncateDegrees']:
 *                 projparams['lat_1'] = int(projparams['lat_1'])
 */
    __pyx_t_1 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_Latin1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1510, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_9 = __Pyx_PyNumber_Divide(__pyx_t_1, __pyx_v_scale); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1510, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(PyDict_SetItem(__pyx_v_projparams, __pyx_n_s_lat_1, __pyx_t_9) < 0)) __PYX_ERR(0, 1510, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

    /* "pygrib.pyx":1511
 *                 projparams['lat_0'] = int(projparams['lat_0'])
 *             projparams['lat_1']=self['Latin1']/scale
 *             if self['truncateDegrees']:             # <<<<<<<<<<<<<<
 *                 projparams['lat_1'] = int(projparams['lat_1'])
 *             projparams['lat_2']=self['Latin2']/scale
 */
    __pyx_t_9 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_truncateDegrees); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1511, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 1511, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    if (__pyx_t_5) {

      /* "pygrib.pyx":1512
 *             projparams['lat_1']=self['Latin1']/scale
 *             if self['truncateDegrees']:
 *                 projparams['lat_1'] = int(projparams['lat_1'])             # <<<<<<<<<<<<<<
 *             projparams['lat_2']=self['Latin2']/scale
 *             if self['truncateDegrees']:
 */
      __pyx_t_9 = __Pyx_PyDict_GetItem(__pyx_v_projparams, __pyx_n_s_lat_1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1512, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_1 = __Pyx_PyNumber_Int(__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1512, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      if (unlikely(PyDict_SetItem(__pyx_v_projparams, __pyx_n_s_lat_1, __pyx_t_1) < 0)) __PYX_ERR(0, 1512, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "pygrib.pyx":1511
 *                 projparams['lat_0'] = int(projparams['lat_0'])
 *             projparams['lat_1']=self['Latin1']/scale
 *             if self['truncateDegrees']:             # <<<<<<<<<<<<<<
 *                 projparams['lat_1'] = int(projparams['lat_1'])
 *             projparams['lat_2']=self['Latin2']/scale
 */
    }

    /* "pygrib.pyx":1513
 *             if self['truncateDegrees']:
 *                 projparams['lat_1'] = int(projparams['lat_1'])
 *             projparams['lat_2']=self['Latin2']/scale             # <<<<<<<<<<<<<<
 *             if self['truncateDegrees']:
 *                 projparams['lat_2'] = int(projparams['lat_2'])
 */
    __pyx_t_1 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_Latin2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1513, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_9 = __Pyx_PyNumber_Divide(__pyx_t_1, __pyx_v_scale); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1513, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(PyDict_SetItem(__pyx_v_projparams, __pyx_n_s_lat_2, __pyx_t_9) < 0)) __PYX_ERR(0, 1513, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

    /* "pygrib.pyx":1514
 *                 projparams['lat_1'] = int(projparams['lat_1'])
 *             projparams['lat_2']=self['Latin2']/scale
 *             if self['truncateDegrees']:             # <<<<<<<<<<<<<<
 *                 projparams['lat_2'] = int(projparams['lat_2'])
 *         elif self['gridType'] == 'space_view':
 */
    __pyx_t_9 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_truncateDegrees); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1514, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 1514, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    if (__pyx_t_5) {

      /* "pygrib.pyx":1515
 *             projparams['lat_2']=self['Latin2']/scale
 *             if self['truncateDegrees']:
 *                 projparams['lat_2'] = int(projparams['lat_2'])             # <<<<<<<<<<<<<<
 *         elif self['gridType'] == 'space_view':
 *             projparams['lon_0']=self['longitudeOfSubSatellitePointInDegrees']
 */
      __pyx_t_9 = __Pyx_PyDict_GetItem(__pyx_v_projparams, __pyx_n_s_lat_2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1515, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_1 = __Pyx_PyNumber_Int(__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1515, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      if (unlikely(PyDict_SetItem(__pyx_v_projparams, __pyx_n_s_lat_2, __pyx_t_1) < 0)) __PYX_ERR(0, 1515, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "pygrib.pyx":1514
 *                 projparams['lat_1'] = int(projparams['lat_1'])
 *             projparams['lat_2']=self['Latin2']/scale
 *             if self['truncateDegrees']:             # <<<<<<<<<<<<<<
 *                 projparams['lat_2'] = int(projparams['lat_2'])
 *         elif self['gridType'] == 'space_view':
 */
    }

    /* "pygrib.pyx":1501
 *             projparams['lat_1']=self['Latin1InDegrees']
 *             projparams['lat_2']=self['Latin2InDegrees']
 *         elif self['gridType'] =='albers':             # <<<<<<<<<<<<<<
 *             projparams['proj']='aea'
 *             scale = float(self['grib2divider'])
 */
    goto __pyx_L22;
  }

  /* "pygrib.pyx":1516
 *             if self['truncateDegrees']:
 *                 projparams['lat_2'] = int(projparams['lat_2'])
 *         elif self['gridType'] == 'space_view':             # <<<<<<<<<<<<<<
 *             projparams['lon_0']=self['longitudeOfSubSatellitePointInDegrees']
 *             projparams['lat_0']=self['latitudeOfSubSatellitePointInDegrees']
 */
  __pyx_t_1 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_gridType); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1516, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = (__Pyx_PyString_Equals(__pyx_t_1, __pyx_n_s_space_view, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 1516, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_5) {

    /* "pygrib.pyx":1517
 *                 projparams['lat_2'] = int(projparams['lat_2'])
 *         elif self['gridType'] == 'space_view':
 *             projparams['lon_0']=self['longitudeOfSubSatellitePointInDegrees']             # <<<<<<<<<<<<<<
 *             projparams['lat_0']=self['latitudeOfSubSatellitePointInDegrees']
 *             if projparams['lat_0'] == 0.: # if lat_0 is equator, it's a
 */
    __pyx_t_1 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_longitudeOfSubSatellitePointInDe); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1517, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (unlikely(PyDict_SetItem(__pyx_v_projparams, __pyx_n_s_lon_0, __pyx_t_1) < 0)) __PYX_ERR(0, 1517, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "pygrib.pyx":1518
 *         elif self['gridType'] == 'space_view':
 *             projparams['lon_0']=self['longitudeOfSubSatellitePointInDegrees']
 *             projparams['lat_0']=self['latitudeOfSubSatellitePointInDegrees']             # <<<<<<<<<<<<<<
 *             if projparams['lat_0'] == 0.: # if lat_0 is equator, it's a
 *                 projparams['proj'] = 'geos'
 */
    __pyx_t_1 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_latitudeOfSubSatellitePointInDeg); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1518, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (unlikely(PyDict_SetItem(__pyx_v_projparams, __pyx_n_s_lat_0, __pyx_t_1) < 0)) __PYX_ERR(0, 1518, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "pygrib.pyx":1519
 *             projparams['lon_0']=self['longitudeOfSubSatellitePointInDegrees']
 *             projparams['lat_0']=self['latitudeOfSubSatellitePointInDegrees']
 *             if projparams['lat_0'] == 0.: # if lat_0 is equator, it's a             # <<<<<<<<<<<<<<
 *                 projparams['proj'] = 'geos'
 *             # general case of 'near-side perspective projection' (untested)
 */
    __pyx_t_1 = __Pyx_PyDict_GetItem(__pyx_v_projparams, __pyx_n_s_lat_0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1519, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_9 = __Pyx_PyFloat_EqObjC(__pyx_t_1, __pyx_float_0_, 0., 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1519, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 1519, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    if (__pyx_t_5) {

      /* "pygrib.pyx":1520
 *             projparams['lat_0']=self['latitudeOfSubSatellitePointInDegrees']
 *             if projparams['lat_0'] == 0.: # if lat_0 is equator, it's a
 *                 projparams['proj'] = 'geos'             # <<<<<<<<<<<<<<
 *             # general case of 'near-side perspective projection' (untested)
 *             else:
 */
      if (unlikely(PyDict_SetItem(__pyx_v_projparams, __pyx_n_s_proj, __pyx_n_s_geos) < 0)) __PYX_ERR(0, 1520, __pyx_L1_error)

      /* "pygrib.pyx":1519
 *             projparams['lon_0']=self['longitudeOfSubSatellitePointInDegrees']
 *             projparams['lat_0']=self['latitudeOfSubSatellitePointInDegrees']
 *             if projparams['lat_0'] == 0.: # if lat_0 is equator, it's a             # <<<<<<<<<<<<<<
 *                 projparams['proj'] = 'geos'
 *             # general case of 'near-side perspective projection' (untested)
 */
      goto __pyx_L34;
    }

    /* "pygrib.pyx":1523
 *             # general case of 'near-side perspective projection' (untested)
 *             else:
 *                 projparams['proj'] = 'nsper'             # <<<<<<<<<<<<<<
 *             scale = float(self['grib2divider'])
 *             projparams['h'] = projparams['a'] * self['Nr']/scale
 */
    /*else*/ {
      if (unlikely(PyDict_SetItem(__pyx_v_projparams, __pyx_n_s_proj, __pyx_n_s_nsper) < 0)) __PYX_ERR(0, 1523, __pyx_L1_error)
    }
    __pyx_L34:;

    /* "pygrib.pyx":1524
 *             else:
 *                 projparams['proj'] = 'nsper'
 *             scale = float(self['grib2divider'])             # <<<<<<<<<<<<<<
 *             projparams['h'] = projparams['a'] * self['Nr']/scale
 *             # h is measured from surface of earth at equator.
 */
    __pyx_t_9 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_grib2divider); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1524, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_1 = __Pyx_PyNumber_Float(__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1524, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_v_scale = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "pygrib.pyx":1525
 *                 projparams['proj'] = 'nsper'
 *             scale = float(self['grib2divider'])
 *             projparams['h'] = projparams['a'] * self['Nr']/scale             # <<<<<<<<<<<<<<
 *             # h is measured from surface of earth at equator.
 *             projparams['h'] = projparams['h']-projparams['a']
 */
    __pyx_t_1 = __Pyx_PyDict_GetItem(__pyx_v_projparams, __pyx_n_s_a); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1525, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_9 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_Nr); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1525, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_2 = PyNumber_Multiply(__pyx_t_1, __pyx_t_9); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1525, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_9 = __Pyx_PyNumber_Divide(__pyx_t_2, __pyx_v_scale); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1525, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(PyDict_SetItem(__pyx_v_projparams, __pyx_n_s_h, __pyx_t_9) < 0)) __PYX_ERR(0, 1525, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

    /* "pygrib.pyx":1527
 *             projparams['h'] = projparams['a'] * self['Nr']/scale
 *             # h is measured from surface of earth at equator.
 *             projparams['h'] = projparams['h']-projparams['a']             # <<<<<<<<<<<<<<
 *         elif self['gridType'] == "equatorial_azimuthal_equidistant":
 *             projparams['lat_0'] = self['standardParallel']/1.e6
 */
    __pyx_t_9 = __Pyx_PyDict_GetItem(__pyx_v_projparams, __pyx_n_s_h); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1527, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_2 = __Pyx_PyDict_GetItem(__pyx_v_projparams, __pyx_n_s_a); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1527, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = PyNumber_Subtract(__pyx_t_9, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1527, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(PyDict_SetItem(__pyx_v_projparams, __pyx_n_s_h, __pyx_t_1) < 0)) __PYX_ERR(0, 1527, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "pygrib.pyx":1516
 *             if self['truncateDegrees']:
 *                 projparams['lat_2'] = int(projparams['lat_2'])
 *         elif self['gridType'] == 'space_view':             # <<<<<<<<<<<<<<
 *             projparams['lon_0']=self['longitudeOfSubSatellitePointInDegrees']
 *             projparams['lat_0']=self['latitudeOfSubSatellitePointInDegrees']
 */
    goto __pyx_L22;
  }

  /* "pygrib.pyx":1528
 *             # h is measured from surface of earth at equator.
 *             projparams['h'] = projparams['h']-projparams['a']
 *         elif self['gridType'] == "equatorial_azimuthal_equidistant":             # <<<<<<<<<<<<<<
 *             projparams['lat_0'] = self['standardParallel']/1.e6
 *             projparams['lon_0'] = self['centralLongitude']/1.e6
 */
  __pyx_t_1 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_gridType); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1528, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = (__Pyx_PyString_Equals(__pyx_t_1, __pyx_n_s_equatorial_azimuthal_equidistant, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 1528, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_5) {

    /* "pygrib.pyx":1529
 *             projparams['h'] = projparams['h']-projparams['a']
 *         elif self['gridType'] == "equatorial_azimuthal_equidistant":
 *             projparams['lat_0'] = self['standardParallel']/1.e6             # <<<<<<<<<<<<<<
 *             projparams['lon_0'] = self['centralLongitude']/1.e6
 *             projparams['proj'] = 'aeqd'
 */
    __pyx_t_1 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_standardParallel); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1529, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_PyFloat_DivideObjC(__pyx_t_1, __pyx_float_1_e6, 1.e6, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1529, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(PyDict_SetItem(__pyx_v_projparams, __pyx_n_s_lat_0, __pyx_t_2) < 0)) __PYX_ERR(0, 1529, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "pygrib.pyx":1530
 *         elif self['gridType'] == "equatorial_azimuthal_equidistant":
 *             projparams['lat_0'] = self['standardParallel']/1.e6
 *             projparams['lon_0'] = self['centralLongitude']/1.e6             # <<<<<<<<<<<<<<
 *             projparams['proj'] = 'aeqd'
 *         elif self['gridType'] == "lambert_azimuthal_equal_area":
 */
    __pyx_t_2 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_centralLongitude); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1530, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = __Pyx_PyFloat_DivideObjC(__pyx_t_2, __pyx_float_1_e6, 1.e6, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1530, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(PyDict_SetItem(__pyx_v_projparams, __pyx_n_s_lon_0, __pyx_t_1) < 0)) __PYX_ERR(0, 1530, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "pygrib.pyx":1531
 *             projparams['lat_0'] = self['standardParallel']/1.e6
 *             projparams['lon_0'] = self['centralLongitude']/1.e6
 *             projparams['proj'] = 'aeqd'             # <<<<<<<<<<<<<<
 *         elif self['gridType'] == "lambert_azimuthal_equal_area":
 *             projparams['lat_0'] = self['standardParallel']/1.e6
 */
    if (unlikely(PyDict_SetItem(__pyx_v_projparams, __pyx_n_s_proj, __pyx_n_s_aeqd) < 0)) __PYX_ERR(0, 1531, __pyx_L1_error)

    /* "pygrib.pyx":1528
 *             # h is measured from surface of earth at equator.
 *             projparams['h'] = projparams['h']-projparams['a']
 *         elif self['gridType'] == "equatorial_azimuthal_equidistant":             # <<<<<<<<<<<<<<
 *             projparams['lat_0'] = self['standardParallel']/1.e6
 *             projparams['lon_0'] = self['centralLongitude']/1.e6
 */
    goto __pyx_L22;
  }

  /* "pygrib.pyx":1532
 *             projparams['lon_0'] = self['centralLongitude']/1.e6
 *             projparams['proj'] = 'aeqd'
 *         elif self['gridType'] == "lambert_azimuthal_equal_area":             # <<<<<<<<<<<<<<
 *             projparams['lat_0'] = self['standardParallel']/1.e6
 *             projparams['lon_0'] = self['centralLongitude']/1.e6
 */
  __pyx_t_1 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_gridType); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1532, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = (__Pyx_PyString_Equals(__pyx_t_1, __pyx_n_s_lambert_azimuthal_equal_area, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 1532, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_5) {

    /* "pygrib.pyx":1533
 *             projparams['proj'] = 'aeqd'
 *         elif self['gridType'] == "lambert_azimuthal_equal_area":
 *             projparams['lat_0'] = self['standardParallel']/1.e6             # <<<<<<<<<<<<<<
 *             projparams['lon_0'] = self['centralLongitude']/1.e6
 *             projparams['proj'] = 'laea'
 */
    __pyx_t_1 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_standardParallel); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1533, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_PyFloat_DivideObjC(__pyx_t_1, __pyx_float_1_e6, 1.e6, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1533, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(PyDict_SetItem(__pyx_v_projparams, __pyx_n_s_lat_0, __pyx_t_2) < 0)) __PYX_ERR(0, 1533, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "pygrib.pyx":1534
 *         elif self['gridType'] == "lambert_azimuthal_equal_area":
 *             projparams['lat_0'] = self['standardParallel']/1.e6
 *             projparams['lon_0'] = self['centralLongitude']/1.e6             # <<<<<<<<<<<<<<
 *             projparams['proj'] = 'laea'
 *         elif self['gridType'] == 'mercator':
 */
    __pyx_t_2 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_centralLongitude); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1534, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = __Pyx_PyFloat_DivideObjC(__pyx_t_2, __pyx_float_1_e6, 1.e6, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1534, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(PyDict_SetItem(__pyx_v_projparams, __pyx_n_s_lon_0, __pyx_t_1) < 0)) __PYX_ERR(0, 1534, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "pygrib.pyx":1535
 *             projparams['lat_0'] = self['standardParallel']/1.e6
 *             projparams['lon_0'] = self['centralLongitude']/1.e6
 *             projparams['proj'] = 'laea'             # <<<<<<<<<<<<<<
 *         elif self['gridType'] == 'mercator':
 *             scale = self._get_key('grib2divider',False)
 */
    if (unlikely(PyDict_SetItem(__pyx_v_projparams, __pyx_n_s_proj, __pyx_n_s_laea) < 0)) __PYX_ERR(0, 1535, __pyx_L1_error)

    /* "pygrib.pyx":1532
 *             projparams['lon_0'] = self['centralLongitude']/1.e6
 *             projparams['proj'] = 'aeqd'
 *         elif self['gridType'] == "lambert_azimuthal_equal_area":             # <<<<<<<<<<<<<<
 *             projparams['lat_0'] = self['standardParallel']/1.e6
 *             projparams['lon_0'] = self['centralLongitude']/1.e6
 */
    goto __pyx_L22;
  }

  /* "pygrib.pyx":1536
 *             projparams['lon_0'] = self['centralLongitude']/1.e6
 *             projparams['proj'] = 'laea'
 *         elif self['gridType'] == 'mercator':             # <<<<<<<<<<<<<<
 *             scale = self._get_key('grib2divider',False)
 *             if scale:
 */
  __pyx_t_1 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_gridType); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1536, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = (__Pyx_PyString_Equals(__pyx_t_1, __pyx_n_s_mercator, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 1536, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_5) {

    /* "pygrib.pyx":1537
 *             projparams['proj'] = 'laea'
 *         elif self['gridType'] == 'mercator':
 *             scale = self._get_key('grib2divider',False)             # <<<<<<<<<<<<<<
 *             if scale:
 *                 scale = float(scale)
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_get_key); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1537, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__93, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1537, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_v_scale = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "pygrib.pyx":1538
 *         elif self['gridType'] == 'mercator':
 *             scale = self._get_key('grib2divider',False)
 *             if scale:             # <<<<<<<<<<<<<<
 *                 scale = float(scale)
 *             else:
 */
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_scale); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 1538, __pyx_L1_error)
    if (__pyx_t_5) {

      /* "pygrib.pyx":1539
 *             scale = self._get_key('grib2divider',False)
 *             if scale:
 *                 scale = float(scale)             # <<<<<<<<<<<<<<
 *             else:
 *                 scale = 1000.
 */
      __pyx_t_2 = __Pyx_PyNumber_Float(__pyx_v_scale); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1539, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF_SET(__pyx_v_scale, __pyx_t_2);
      __pyx_t_2 = 0;

      /* "pygrib.pyx":1538
 *         elif self['gridType'] == 'mercator':
 *             scale = self._get_key('grib2divider',False)
 *             if scale:             # <<<<<<<<<<<<<<
 *                 scale = float(scale)
 *             else:
 */
      goto __pyx_L35;
    }

    /* "pygrib.pyx":1541
 *                 scale = float(scale)
 *             else:
 *                 scale = 1000.             # <<<<<<<<<<<<<<
 *             lon1 = self['longitudeOfFirstGridPoint']/scale
 *             lon2 = self['longitudeOfLastGridPoint']/scale
 */
    /*else*/ {
      __Pyx_INCREF(__pyx_float_1000_);
      __Pyx_DECREF_SET(__pyx_v_scale, __pyx_float_1000_);
    }
    __pyx_L35:;

    /* "pygrib.pyx":1542
 *             else:
 *                 scale = 1000.
 *             lon1 = self['longitudeOfFirstGridPoint']/scale             # <<<<<<<<<<<<<<
 *             lon2 = self['longitudeOfLastGridPoint']/scale
 *             if self._get_key('truncateDegrees',False):
 */
    __pyx_t_2 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_longitudeOfFirstGridPoint); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1542, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = __Pyx_PyNumber_Divide(__pyx_t_2, __pyx_v_scale); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1542, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_lon1 = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "pygrib.pyx":1543
 *                 scale = 1000.
 *             lon1 = self['longitudeOfFirstGridPoint']/scale
 *             lon2 = self['longitudeOfLastGridPoint']/scale             # <<<<<<<<<<<<<<
 *             if self._get_key('truncateDegrees',False):
 *                 lon1 = int(lon1)
 */
    __pyx_t_1 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_longitudeOfLastGridPoint); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1543, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_PyNumber_Divide(__pyx_t_1, __pyx_v_scale); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1543, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_v_lon2 = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "pygrib.pyx":1544
 *             lon1 = self['longitudeOfFirstGridPoint']/scale
 *             lon2 = self['longitudeOfLastGridPoint']/scale
 *             if self._get_key('truncateDegrees',False):             # <<<<<<<<<<<<<<
 *                 lon1 = int(lon1)
 *                 lon2 = int(lon2)
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_get_key); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1544, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__94, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1544, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 1544, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (__pyx_t_5) {

      /* "pygrib.pyx":1545
 *             lon2 = self['longitudeOfLastGridPoint']/scale
 *             if self._get_key('truncateDegrees',False):
 *                 lon1 = int(lon1)             # <<<<<<<<<<<<<<
 *                 lon2 = int(lon2)
 *             if self._get_key('LaD',False):
 */
      __pyx_t_1 = __Pyx_PyNumber_Int(__pyx_v_lon1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1545, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF_SET(__pyx_v_lon1, __pyx_t_1);
      __pyx_t_1 = 0;

      /* "pygrib.pyx":1546
 *             if self._get_key('truncateDegrees',False):
 *                 lon1 = int(lon1)
 *                 lon2 = int(lon2)             # <<<<<<<<<<<<<<
 *             if self._get_key('LaD',False):
 *                 projparams['lat_ts'] = self['LaD']/scale
 */
      __pyx_t_1 = __Pyx_PyNumber_Int(__pyx_v_lon2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1546, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF_SET(__pyx_v_lon2, __pyx_t_1);
      __pyx_t_1 = 0;

      /* "pygrib.pyx":1544
 *             lon1 = self['longitudeOfFirstGridPoint']/scale
 *             lon2 = self['longitudeOfLastGridPoint']/scale
 *             if self._get_key('truncateDegrees',False):             # <<<<<<<<<<<<<<
 *                 lon1 = int(lon1)
 *                 lon2 = int(lon2)
 */
    }

    /* "pygrib.pyx":1547
 *                 lon1 = int(lon1)
 *                 lon2 = int(lon2)
 *             if self._get_key('LaD',False):             # <<<<<<<<<<<<<<
 *                 projparams['lat_ts'] = self['LaD']/scale
 *             else:
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_get_key); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1547, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__95, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1547, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 1547, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__pyx_t_5) {

      /* "pygrib.pyx":1548
 *                 lon2 = int(lon2)
 *             if self._get_key('LaD',False):
 *                 projparams['lat_ts'] = self['LaD']/scale             # <<<<<<<<<<<<<<
 *             else:
 *                 projparams['lat_ts'] = self['Latin']/scale
 */
      __pyx_t_2 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_LaD); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1548, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_1 = __Pyx_PyNumber_Divide(__pyx_t_2, __pyx_v_scale); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1548, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(PyDict_SetItem(__pyx_v_projparams, __pyx_n_s_lat_ts, __pyx_t_1) < 0)) __PYX_ERR(0, 1548, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "pygrib.pyx":1547
 *                 lon1 = int(lon1)
 *                 lon2 = int(lon2)
 *             if self._get_key('LaD',False):             # <<<<<<<<<<<<<<
 *                 projparams['lat_ts'] = self['LaD']/scale
 *             else:
 */
      goto __pyx_L37;
    }

    /* "pygrib.pyx":1550
 *                 projparams['lat_ts'] = self['LaD']/scale
 *             else:
 *                 projparams['lat_ts'] = self['Latin']/scale             # <<<<<<<<<<<<<<
 *             if lon2 < lon1: lon2 += 360. # domain crosses Greenwich
 *             projparams['lon_0']=0.5*(lon1+lon2)
 */
    /*else*/ {
      __pyx_t_1 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_Latin); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1550, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = __Pyx_PyNumber_Divide(__pyx_t_1, __pyx_v_scale); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1550, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (unlikely(PyDict_SetItem(__pyx_v_projparams, __pyx_n_s_lat_ts, __pyx_t_2) < 0)) __PYX_ERR(0, 1550, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    }
    __pyx_L37:;

    /* "pygrib.pyx":1551
 *             else:
 *                 projparams['lat_ts'] = self['Latin']/scale
 *             if lon2 < lon1: lon2 += 360. # domain crosses Greenwich             # <<<<<<<<<<<<<<
 *             projparams['lon_0']=0.5*(lon1+lon2)
 *             projparams['proj']='merc'
 */
    __pyx_t_2 = PyObject_RichCompare(__pyx_v_lon2, __pyx_v_lon1, Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1551, __pyx_L1_error)
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 1551, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__pyx_t_5) {
      __pyx_t_2 = __Pyx_PyFloat_AddObjC(__pyx_v_lon2, __pyx_float_360_, 360., 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1551, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF_SET(__pyx_v_lon2, __pyx_t_2);
      __pyx_t_2 = 0;
    }

    /* "pygrib.pyx":1552
 *                 projparams['lat_ts'] = self['Latin']/scale
 *             if lon2 < lon1: lon2 += 360. # domain crosses Greenwich
 *             projparams['lon_0']=0.5*(lon1+lon2)             # <<<<<<<<<<<<<<
 *             projparams['proj']='merc'
 *         elif self['gridType'] in ['rotated_ll','rotated_gg']:
 */
    __pyx_t_2 = PyNumber_Add(__pyx_v_lon1, __pyx_v_lon2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1552, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = PyNumber_Multiply(__pyx_float_0_5, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1552, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(PyDict_SetItem(__pyx_v_projparams, __pyx_n_s_lon_0, __pyx_t_1) < 0)) __PYX_ERR(0, 1552, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "pygrib.pyx":1553
 *             if lon2 < lon1: lon2 += 360. # domain crosses Greenwich
 *             projparams['lon_0']=0.5*(lon1+lon2)
 *             projparams['proj']='merc'             # <<<<<<<<<<<<<<
 *         elif self['gridType'] in ['rotated_ll','rotated_gg']:
 *             rot_angle = self['angleOfRotationInDegrees']
 */
    if (unlikely(PyDict_SetItem(__pyx_v_projparams, __pyx_n_s_proj, __pyx_n_s_merc) < 0)) __PYX_ERR(0, 1553, __pyx_L1_error)

    /* "pygrib.pyx":1536
 *             projparams['lon_0'] = self['centralLongitude']/1.e6
 *             projparams['proj'] = 'laea'
 *         elif self['gridType'] == 'mercator':             # <<<<<<<<<<<<<<
 *             scale = self._get_key('grib2divider',False)
 *             if scale:
 */
    goto __pyx_L22;
  }

  /* "pygrib.pyx":1554
 *             projparams['lon_0']=0.5*(lon1+lon2)
 *             projparams['proj']='merc'
 *         elif self['gridType'] in ['rotated_ll','rotated_gg']:             # <<<<<<<<<<<<<<
 *             rot_angle = self['angleOfRotationInDegrees']
 *             pole_lat = self['latitudeOfSouthernPoleInDegrees']
 */
  __pyx_t_1 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_gridType); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1554, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = (__Pyx_PyString_Equals(__pyx_t_1, __pyx_n_s_rotated_ll, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 1554, __pyx_L1_error)
  if (!__pyx_t_4) {
  } else {
    __pyx_t_5 = __pyx_t_4;
    goto __pyx_L39_bool_binop_done;
  }
  __pyx_t_4 = (__Pyx_PyString_Equals(__pyx_t_1, __pyx_n_s_rotated_gg, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 1554, __pyx_L1_error)
  __pyx_t_5 = __pyx_t_4;
  __pyx_L39_bool_binop_done:;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_4 = (__pyx_t_5 != 0);
  if (__pyx_t_4) {

    /* "pygrib.pyx":1555
 *             projparams['proj']='merc'
 *         elif self['gridType'] in ['rotated_ll','rotated_gg']:
 *             rot_angle = self['angleOfRotationInDegrees']             # <<<<<<<<<<<<<<
 *             pole_lat = self['latitudeOfSouthernPoleInDegrees']
 *             pole_lon = self['longitudeOfSouthernPoleInDegrees']
 */
    __pyx_t_1 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_angleOfRotationInDegrees); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1555, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_rot_angle = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "pygrib.pyx":1556
 *         elif self['gridType'] in ['rotated_ll','rotated_gg']:
 *             rot_angle = self['angleOfRotationInDegrees']
 *             pole_lat = self['latitudeOfSouthernPoleInDegrees']             # <<<<<<<<<<<<<<
 *             pole_lon = self['longitudeOfSouthernPoleInDegrees']
 *             projparams['o_proj']='longlat'
 */
    __pyx_t_1 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_latitudeOfSouthernPoleInDegrees); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1556, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_pole_lat = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "pygrib.pyx":1557
 *             rot_angle = self['angleOfRotationInDegrees']
 *             pole_lat = self['latitudeOfSouthernPoleInDegrees']
 *             pole_lon = self['longitudeOfSouthernPoleInDegrees']             # <<<<<<<<<<<<<<
 *             projparams['o_proj']='longlat'
 *             projparams['proj']='ob_tran'
 */
    __pyx_t_1 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_longitudeOfSouthernPoleInDegrees); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1557, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_pole_lon = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "pygrib.pyx":1558
 *             pole_lat = self['latitudeOfSouthernPoleInDegrees']
 *             pole_lon = self['longitudeOfSouthernPoleInDegrees']
 *             projparams['o_proj']='longlat'             # <<<<<<<<<<<<<<
 *             projparams['proj']='ob_tran'
 *             projparams['o_lat_p']=-pole_lat
 */
    if (unlikely(PyDict_SetItem(__pyx_v_projparams, __pyx_n_s_o_proj, __pyx_n_s_longlat) < 0)) __PYX_ERR(0, 1558, __pyx_L1_error)

    /* "pygrib.pyx":1559
 *             pole_lon = self['longitudeOfSouthernPoleInDegrees']
 *             projparams['o_proj']='longlat'
 *             projparams['proj']='ob_tran'             # <<<<<<<<<<<<<<
 *             projparams['o_lat_p']=-pole_lat
 *             projparams['o_lon_p']=rot_angle
 */
    if (unlikely(PyDict_SetItem(__pyx_v_projparams, __pyx_n_s_proj, __pyx_n_s_ob_tran) < 0)) __PYX_ERR(0, 1559, __pyx_L1_error)

    /* "pygrib.pyx":1560
 *             projparams['o_proj']='longlat'
 *             projparams['proj']='ob_tran'
 *             projparams['o_lat_p']=-pole_lat             # <<<<<<<<<<<<<<
 *             projparams['o_lon_p']=rot_angle
 *             projparams['lon_0']=pole_lon
 */
    __pyx_t_1 = PyNumber_Negative(__pyx_v_pole_lat); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1560, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (unlikely(PyDict_SetItem(__pyx_v_projparams, __pyx_n_s_o_lat_p, __pyx_t_1) < 0)) __PYX_ERR(0, 1560, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "pygrib.pyx":1561
 *             projparams['proj']='ob_tran'
 *             projparams['o_lat_p']=-pole_lat
 *             projparams['o_lon_p']=rot_angle             # <<<<<<<<<<<<<<
 *             projparams['lon_0']=pole_lon
 *         else: # unsupported grid type.
 */
    if (unlikely(PyDict_SetItem(__pyx_v_projparams, __pyx_n_s_o_lon_p, __pyx_v_rot_angle) < 0)) __PYX_ERR(0, 1561, __pyx_L1_error)

    /* "pygrib.pyx":1562
 *             projparams['o_lat_p']=-pole_lat
 *             projparams['o_lon_p']=rot_angle
 *             projparams['lon_0']=pole_lon             # <<<<<<<<<<<<<<
 *         else: # unsupported grid type.
 *             projparams = None
 */
    if (unlikely(PyDict_SetItem(__pyx_v_projparams, __pyx_n_s_lon_0, __pyx_v_pole_lon) < 0)) __PYX_ERR(0, 1562, __pyx_L1_error)

    /* "pygrib.pyx":1554
 *             projparams['lon_0']=0.5*(lon1+lon2)
 *             projparams['proj']='merc'
 *         elif self['gridType'] in ['rotated_ll','rotated_gg']:             # <<<<<<<<<<<<<<
 *             rot_angle = self['angleOfRotationInDegrees']
 *             pole_lat = self['latitudeOfSouthernPoleInDegrees']
 */
    goto __pyx_L22;
  }

  /* "pygrib.pyx":1564
 *             projparams['lon_0']=pole_lon
 *         else: # unsupported grid type.
 *             projparams = None             # <<<<<<<<<<<<<<
 *         self.projparams = projparams
 * 
 */
  /*else*/ {
    __Pyx_INCREF(Py_None);
    __Pyx_DECREF_SET(__pyx_v_projparams, ((PyObject*)Py_None));
  }
  __pyx_L22:;

  /* "pygrib.pyx":1565
 *         else: # unsupported grid type.
 *             projparams = None
 *         self.projparams = projparams             # <<<<<<<<<<<<<<
 * 
 *     def latlons(self):
 */
  __Pyx_INCREF(__pyx_v_projparams);
  __Pyx_GIVEREF(__pyx_v_projparams);
  __Pyx_GOTREF(__pyx_v_self->projparams);
  __Pyx_DECREF(__pyx_v_self->projparams);
  __pyx_v_self->projparams = __pyx_v_projparams;

  /* "pygrib.pyx":1410
 *         return datarr
 * 
 *     def _set_projparams(self):             # <<<<<<<<<<<<<<
 *         """
 *         sets the C{projparams} instance variable to a dictionary containing
 */

  /* 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_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("pygrib.gribmessage._set_projparams", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_projparams);
  __Pyx_XDECREF(__pyx_v_scalea);
  __Pyx_XDECREF(__pyx_v_scaleb);
  __Pyx_XDECREF(__pyx_v_projcenterflag);
  __Pyx_XDECREF(__pyx_v_scale);
  __Pyx_XDECREF(__pyx_v_lon1);
  __Pyx_XDECREF(__pyx_v_lon2);
  __Pyx_XDECREF(__pyx_v_rot_angle);
  __Pyx_XDECREF(__pyx_v_pole_lat);
  __Pyx_XDECREF(__pyx_v_pole_lon);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pygrib.pyx":1567
 *         self.projparams = projparams
 * 
 *     def latlons(self):             # <<<<<<<<<<<<<<
 *         """
 *         latlons()
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pygrib_11gribmessage_39latlons(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6pygrib_11gribmessage_38latlons[] = "\n        latlons()\n\n        compute lats and lons (in degrees) of grid.\n        Currently handles reg. lat/lon, global gaussian, mercator, stereographic,\n        lambert conformal, albers equal-area, space-view, azimuthal \n        equidistant, reduced gaussian, reduced lat/lon,\n        lambert azimuthal equal-area, rotated lat/lon and rotated gaussian grids.\n\n        @return: C{B{lats},B{lons}}, numpy arrays \n        containing latitudes and longitudes of grid (in degrees).\n        ";
static PyObject *__pyx_pw_6pygrib_11gribmessage_39latlons(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("latlons (wrapper)", 0);
  __pyx_r = __pyx_pf_6pygrib_11gribmessage_38latlons(((struct __pyx_obj_6pygrib_gribmessage *)__pyx_v_self));

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

static PyObject *__pyx_pf_6pygrib_11gribmessage_38latlons(struct __pyx_obj_6pygrib_gribmessage *__pyx_v_self) {
  PyObject *__pyx_v_nx = NULL;
  PyObject *__pyx_v_ny = NULL;
  PyObject *__pyx_v_lon1 = NULL;
  PyObject *__pyx_v_lon2 = NULL;
  PyObject *__pyx_v_lat1 = NULL;
  PyObject *__pyx_v_lat2 = NULL;
  PyObject *__pyx_v_lats = NULL;
  PyObject *__pyx_v_lons = NULL;
  PyObject *__pyx_v_dx = NULL;
  PyObject *__pyx_v_dy = NULL;
  PyObject *__pyx_v_pj = NULL;
  PyObject *__pyx_v_llcrnrx = NULL;
  PyObject *__pyx_v_llcrnry = NULL;
  PyObject *__pyx_v_x = NULL;
  PyObject *__pyx_v_y = NULL;
  PyObject *__pyx_v_scale = NULL;
  PyObject *__pyx_v_lon_0 = NULL;
  PyObject *__pyx_v_lat_0 = NULL;
  PyObject *__pyx_v_lonmax = NULL;
  PyObject *__pyx_v_latmax = NULL;
  CYTHON_UNUSED PyObject *__pyx_v_x1 = NULL;
  PyObject *__pyx_v_y1 = NULL;
  PyObject *__pyx_v_x2 = NULL;
  CYTHON_UNUSED PyObject *__pyx_v_y2 = NULL;
  PyObject *__pyx_v_width = NULL;
  PyObject *__pyx_v_height = NULL;
  PyObject *__pyx_v_xmax = NULL;
  PyObject *__pyx_v_ymax = NULL;
  PyObject *__pyx_v_abslons = NULL;
  PyObject *__pyx_v_abslats = NULL;
  PyObject *__pyx_v_urcrnrx = NULL;
  PyObject *__pyx_v_urcrnry = NULL;
  PyObject *__pyx_v_rotatedlats = NULL;
  PyObject *__pyx_v_rotatedlons = NULL;
  PyObject *__pyx_v_d2r = NULL;
  PyObject *__pyx_v_lonsr = NULL;
  PyObject *__pyx_v_latsr = NULL;
  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_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *(*__pyx_t_8)(PyObject *);
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  __Pyx_RefNannySetupContext("latlons", 0);

  /* "pygrib.pyx":1581
 *         """
 * 
 *         if self.projparams is None:             # <<<<<<<<<<<<<<
 *             raise ValueError('unsupported grid %s' % self['gridType'])
 * 
 */
  __pyx_t_1 = (__pyx_v_self->projparams == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (unlikely(__pyx_t_2)) {

    /* "pygrib.pyx":1582
 * 
 *         if self.projparams is None:
 *             raise ValueError('unsupported grid %s' % self['gridType'])             # <<<<<<<<<<<<<<
 * 
 *         if self['gridType'] in ['regular_gg','regular_ll']: # regular lat/lon grid
 */
    __pyx_t_3 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_gridType); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1582, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_unsupported_grid_s, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1582, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1582, __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_ERR(0, 1582, __pyx_L1_error)

    /* "pygrib.pyx":1581
 *         """
 * 
 *         if self.projparams is None:             # <<<<<<<<<<<<<<
 *             raise ValueError('unsupported grid %s' % self['gridType'])
 * 
 */
  }

  /* "pygrib.pyx":1584
 *             raise ValueError('unsupported grid %s' % self['gridType'])
 * 
 *         if self['gridType'] in ['regular_gg','regular_ll']: # regular lat/lon grid             # <<<<<<<<<<<<<<
 *             nx = self['Ni']
 *             ny = self['Nj']
 */
  __pyx_t_3 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_gridType); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1584, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_t_3, __pyx_n_s_regular_gg, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1584, __pyx_L1_error)
  if (!__pyx_t_1) {
  } else {
    __pyx_t_2 = __pyx_t_1;
    goto __pyx_L5_bool_binop_done;
  }
  __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_t_3, __pyx_n_s_regular_ll, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1584, __pyx_L1_error)
  __pyx_t_2 = __pyx_t_1;
  __pyx_L5_bool_binop_done:;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "pygrib.pyx":1585
 * 
 *         if self['gridType'] in ['regular_gg','regular_ll']: # regular lat/lon grid
 *             nx = self['Ni']             # <<<<<<<<<<<<<<
 *             ny = self['Nj']
 *             lon1 = self['longitudeOfFirstGridPointInDegrees']
 */
    __pyx_t_3 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_Ni); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1585, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_v_nx = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "pygrib.pyx":1586
 *         if self['gridType'] in ['regular_gg','regular_ll']: # regular lat/lon grid
 *             nx = self['Ni']
 *             ny = self['Nj']             # <<<<<<<<<<<<<<
 *             lon1 = self['longitudeOfFirstGridPointInDegrees']
 *             lon2 = self['longitudeOfLastGridPointInDegrees']
 */
    __pyx_t_3 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_Nj); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1586, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_v_ny = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "pygrib.pyx":1587
 *             nx = self['Ni']
 *             ny = self['Nj']
 *             lon1 = self['longitudeOfFirstGridPointInDegrees']             # <<<<<<<<<<<<<<
 *             lon2 = self['longitudeOfLastGridPointInDegrees']
 *             if lon1 >= 0 and lon2 < 0 and self.iDirectionIncrement > 0:
 */
    __pyx_t_3 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_longitudeOfFirstGridPointInDegre); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1587, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_v_lon1 = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "pygrib.pyx":1588
 *             ny = self['Nj']
 *             lon1 = self['longitudeOfFirstGridPointInDegrees']
 *             lon2 = self['longitudeOfLastGridPointInDegrees']             # <<<<<<<<<<<<<<
 *             if lon1 >= 0 and lon2 < 0 and self.iDirectionIncrement > 0:
 *                 lon2 = 360+lon2
 */
    __pyx_t_3 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_longitudeOfLastGridPointInDegree); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1588, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_v_lon2 = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "pygrib.pyx":1589
 *             lon1 = self['longitudeOfFirstGridPointInDegrees']
 *             lon2 = self['longitudeOfLastGridPointInDegrees']
 *             if lon1 >= 0 and lon2 < 0 and self.iDirectionIncrement > 0:             # <<<<<<<<<<<<<<
 *                 lon2 = 360+lon2
 *             if lon1 >= 0 and lon2 < lon1 and self.iDirectionIncrement > 0:
 */
    __pyx_t_3 = PyObject_RichCompare(__pyx_v_lon1, __pyx_int_0, Py_GE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1589, __pyx_L1_error)
    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 1589, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (__pyx_t_2) {
    } else {
      __pyx_t_1 = __pyx_t_2;
      goto __pyx_L8_bool_binop_done;
    }
    __pyx_t_3 = PyObject_RichCompare(__pyx_v_lon2, __pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1589, __pyx_L1_error)
    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 1589, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (__pyx_t_2) {
    } else {
      __pyx_t_1 = __pyx_t_2;
      goto __pyx_L8_bool_binop_done;
    }
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_iDirectionIncrement); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1589, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyObject_RichCompare(__pyx_t_3, __pyx_int_0, Py_GT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1589, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 1589, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_1 = __pyx_t_2;
    __pyx_L8_bool_binop_done:;
    if (__pyx_t_1) {

      /* "pygrib.pyx":1590
 *             lon2 = self['longitudeOfLastGridPointInDegrees']
 *             if lon1 >= 0 and lon2 < 0 and self.iDirectionIncrement > 0:
 *                 lon2 = 360+lon2             # <<<<<<<<<<<<<<
 *             if lon1 >= 0 and lon2 < lon1 and self.iDirectionIncrement > 0:
 *                 lon1 = lon1-360
 */
      __pyx_t_4 = __Pyx_PyInt_AddCObj(__pyx_int_360, __pyx_v_lon2, 0x168, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1590, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF_SET(__pyx_v_lon2, __pyx_t_4);
      __pyx_t_4 = 0;

      /* "pygrib.pyx":1589
 *             lon1 = self['longitudeOfFirstGridPointInDegrees']
 *             lon2 = self['longitudeOfLastGridPointInDegrees']
 *             if lon1 >= 0 and lon2 < 0 and self.iDirectionIncrement > 0:             # <<<<<<<<<<<<<<
 *                 lon2 = 360+lon2
 *             if lon1 >= 0 and lon2 < lon1 and self.iDirectionIncrement > 0:
 */
    }

    /* "pygrib.pyx":1591
 *             if lon1 >= 0 and lon2 < 0 and self.iDirectionIncrement > 0:
 *                 lon2 = 360+lon2
 *             if lon1 >= 0 and lon2 < lon1 and self.iDirectionIncrement > 0:             # <<<<<<<<<<<<<<
 *                 lon1 = lon1-360
 *             lat1 = self['latitudeOfFirstGridPointInDegrees']
 */
    __pyx_t_4 = PyObject_RichCompare(__pyx_v_lon1, __pyx_int_0, Py_GE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1591, __pyx_L1_error)
    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 1591, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (__pyx_t_2) {
    } else {
      __pyx_t_1 = __pyx_t_2;
      goto __pyx_L12_bool_binop_done;
    }
    __pyx_t_4 = PyObject_RichCompare(__pyx_v_lon2, __pyx_v_lon1, Py_LT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1591, __pyx_L1_error)
    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 1591, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (__pyx_t_2) {
    } else {
      __pyx_t_1 = __pyx_t_2;
      goto __pyx_L12_bool_binop_done;
    }
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_iDirectionIncrement); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1591, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = PyObject_RichCompare(__pyx_t_4, __pyx_int_0, Py_GT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1591, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 1591, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_1 = __pyx_t_2;
    __pyx_L12_bool_binop_done:;
    if (__pyx_t_1) {

      /* "pygrib.pyx":1592
 *                 lon2 = 360+lon2
 *             if lon1 >= 0 and lon2 < lon1 and self.iDirectionIncrement > 0:
 *                 lon1 = lon1-360             # <<<<<<<<<<<<<<
 *             lat1 = self['latitudeOfFirstGridPointInDegrees']
 *             lat2 = self['latitudeOfLastGridPointInDegrees']
 */
      __pyx_t_3 = __Pyx_PyInt_SubtractObjC(__pyx_v_lon1, __pyx_int_360, 0x168, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1592, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF_SET(__pyx_v_lon1, __pyx_t_3);
      __pyx_t_3 = 0;

      /* "pygrib.pyx":1591
 *             if lon1 >= 0 and lon2 < 0 and self.iDirectionIncrement > 0:
 *                 lon2 = 360+lon2
 *             if lon1 >= 0 and lon2 < lon1 and self.iDirectionIncrement > 0:             # <<<<<<<<<<<<<<
 *                 lon1 = lon1-360
 *             lat1 = self['latitudeOfFirstGridPointInDegrees']
 */
    }

    /* "pygrib.pyx":1593
 *             if lon1 >= 0 and lon2 < lon1 and self.iDirectionIncrement > 0:
 *                 lon1 = lon1-360
 *             lat1 = self['latitudeOfFirstGridPointInDegrees']             # <<<<<<<<<<<<<<
 *             lat2 = self['latitudeOfLastGridPointInDegrees']
 *             # workaround for grib_api bug with complex packing.
 */
    __pyx_t_3 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_latitudeOfFirstGridPointInDegree); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1593, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_v_lat1 = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "pygrib.pyx":1594
 *                 lon1 = lon1-360
 *             lat1 = self['latitudeOfFirstGridPointInDegrees']
 *             lat2 = self['latitudeOfLastGridPointInDegrees']             # <<<<<<<<<<<<<<
 *             # workaround for grib_api bug with complex packing.
 *             # (distinctLongitudes, distinctLatitudes throws error,
 */
    __pyx_t_3 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_latitudeOfLastGridPointInDegrees); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1594, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_v_lat2 = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "pygrib.pyx":1598
 *             # (distinctLongitudes, distinctLatitudes throws error,
 *             #  so use np.linspace to define values)
 *             if self.packingType.startswith('grid_complex'):             # <<<<<<<<<<<<<<
 *                 # this is not strictly correct for gaussian grids,
 *                 # but the error is very small.
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_packingType); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1598, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_startswith); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1598, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_tuple__96, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1598, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1598, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (__pyx_t_1) {

      /* "pygrib.pyx":1601
 *                 # this is not strictly correct for gaussian grids,
 *                 # but the error is very small.
 *                 lats = np.linspace(lat1,lat2,ny)             # <<<<<<<<<<<<<<
 *                 lons = np.linspace(lon1,lon2,nx)
 *             else:
 */
      __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1601, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_linspace); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1601, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = NULL;
      __pyx_t_6 = 0;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
        __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5);
        if (likely(__pyx_t_4)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
          __Pyx_INCREF(__pyx_t_4);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_5, function);
          __pyx_t_6 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_5)) {
        PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_v_lat1, __pyx_v_lat2, __pyx_v_ny};
        __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1601, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_GOTREF(__pyx_t_3);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
        PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_v_lat1, __pyx_v_lat2, __pyx_v_ny};
        __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1601, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_GOTREF(__pyx_t_3);
      } else
      #endif
      {
        __pyx_t_7 = PyTuple_New(3+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1601, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        if (__pyx_t_4) {
          __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_4); __pyx_t_4 = NULL;
        }
        __Pyx_INCREF(__pyx_v_lat1);
        __Pyx_GIVEREF(__pyx_v_lat1);
        PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_v_lat1);
        __Pyx_INCREF(__pyx_v_lat2);
        __Pyx_GIVEREF(__pyx_v_lat2);
        PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_v_lat2);
        __Pyx_INCREF(__pyx_v_ny);
        __Pyx_GIVEREF(__pyx_v_ny);
        PyTuple_SET_ITEM(__pyx_t_7, 2+__pyx_t_6, __pyx_v_ny);
        __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_7, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1601, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      }
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_v_lats = __pyx_t_3;
      __pyx_t_3 = 0;

      /* "pygrib.pyx":1602
 *                 # but the error is very small.
 *                 lats = np.linspace(lat1,lat2,ny)
 *                 lons = np.linspace(lon1,lon2,nx)             # <<<<<<<<<<<<<<
 *             else:
 *                 lats = self['distinctLatitudes']
 */
      __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1602, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_linspace); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1602, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = NULL;
      __pyx_t_6 = 0;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
        __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_7);
        if (likely(__pyx_t_5)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
          __Pyx_INCREF(__pyx_t_5);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_7, function);
          __pyx_t_6 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_7)) {
        PyObject *__pyx_temp[4] = {__pyx_t_5, __pyx_v_lon1, __pyx_v_lon2, __pyx_v_nx};
        __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1602, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_GOTREF(__pyx_t_3);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) {
        PyObject *__pyx_temp[4] = {__pyx_t_5, __pyx_v_lon1, __pyx_v_lon2, __pyx_v_nx};
        __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1602, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_GOTREF(__pyx_t_3);
      } else
      #endif
      {
        __pyx_t_4 = PyTuple_New(3+__pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1602, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        if (__pyx_t_5) {
          __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5); __pyx_t_5 = NULL;
        }
        __Pyx_INCREF(__pyx_v_lon1);
        __Pyx_GIVEREF(__pyx_v_lon1);
        PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_6, __pyx_v_lon1);
        __Pyx_INCREF(__pyx_v_lon2);
        __Pyx_GIVEREF(__pyx_v_lon2);
        PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_6, __pyx_v_lon2);
        __Pyx_INCREF(__pyx_v_nx);
        __Pyx_GIVEREF(__pyx_v_nx);
        PyTuple_SET_ITEM(__pyx_t_4, 2+__pyx_t_6, __pyx_v_nx);
        __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1602, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      }
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_v_lons = __pyx_t_3;
      __pyx_t_3 = 0;

      /* "pygrib.pyx":1598
 *             # (distinctLongitudes, distinctLatitudes throws error,
 *             #  so use np.linspace to define values)
 *             if self.packingType.startswith('grid_complex'):             # <<<<<<<<<<<<<<
 *                 # this is not strictly correct for gaussian grids,
 *                 # but the error is very small.
 */
      goto __pyx_L15;
    }

    /* "pygrib.pyx":1604
 *                 lons = np.linspace(lon1,lon2,nx)
 *             else:
 *                 lats = self['distinctLatitudes']             # <<<<<<<<<<<<<<
 *                 if lat2 < lat1 and lats[-1] > lats[0]: lats = lats[::-1]
 *                 lons = self['distinctLongitudes']
 */
    /*else*/ {
      __pyx_t_3 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_distinctLatitudes); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1604, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_v_lats = __pyx_t_3;
      __pyx_t_3 = 0;

      /* "pygrib.pyx":1605
 *             else:
 *                 lats = self['distinctLatitudes']
 *                 if lat2 < lat1 and lats[-1] > lats[0]: lats = lats[::-1]             # <<<<<<<<<<<<<<
 *                 lons = self['distinctLongitudes']
 *             # don't trust distinctLongitudes
 */
      __pyx_t_3 = PyObject_RichCompare(__pyx_v_lat2, __pyx_v_lat1, Py_LT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1605, __pyx_L1_error)
      __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 1605, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_2) {
      } else {
        __pyx_t_1 = __pyx_t_2;
        goto __pyx_L17_bool_binop_done;
      }
      __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_lats, -1L, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1605, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_lats, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1605, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_4 = PyObject_RichCompare(__pyx_t_3, __pyx_t_7, Py_GT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1605, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 1605, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_1 = __pyx_t_2;
      __pyx_L17_bool_binop_done:;
      if (__pyx_t_1) {
        __pyx_t_4 = __Pyx_PyObject_GetItem(__pyx_v_lats, __pyx_slice__97); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1605, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF_SET(__pyx_v_lats, __pyx_t_4);
        __pyx_t_4 = 0;
      }

      /* "pygrib.pyx":1606
 *                 lats = self['distinctLatitudes']
 *                 if lat2 < lat1 and lats[-1] > lats[0]: lats = lats[::-1]
 *                 lons = self['distinctLongitudes']             # <<<<<<<<<<<<<<
 *             # don't trust distinctLongitudes
 *             # when longitudeOfLastGridPointInDegrees < 0
 */
      __pyx_t_4 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_distinctLongitudes); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1606, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_v_lons = __pyx_t_4;
      __pyx_t_4 = 0;
    }
    __pyx_L15:;

    /* "pygrib.pyx":1610
 *             # when longitudeOfLastGridPointInDegrees < 0
 *             # (bug in grib_api 1.9.16)
 *             if lon2 < 0:             # <<<<<<<<<<<<<<
 *                 lons = np.linspace(lon1,lon2,nx)
 *             lons,lats = np.meshgrid(lons,lats)
 */
    __pyx_t_4 = PyObject_RichCompare(__pyx_v_lon2, __pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1610, __pyx_L1_error)
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1610, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (__pyx_t_1) {

      /* "pygrib.pyx":1611
 *             # (bug in grib_api 1.9.16)
 *             if lon2 < 0:
 *                 lons = np.linspace(lon1,lon2,nx)             # <<<<<<<<<<<<<<
 *             lons,lats = np.meshgrid(lons,lats)
 *         elif self['gridType'] == 'reduced_gg': # reduced global gaussian grid
 */
      __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1611, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_linspace); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1611, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_7 = NULL;
      __pyx_t_6 = 0;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
        __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_3);
        if (likely(__pyx_t_7)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
          __Pyx_INCREF(__pyx_t_7);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_3, function);
          __pyx_t_6 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_3)) {
        PyObject *__pyx_temp[4] = {__pyx_t_7, __pyx_v_lon1, __pyx_v_lon2, __pyx_v_nx};
        __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1611, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_GOTREF(__pyx_t_4);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
        PyObject *__pyx_temp[4] = {__pyx_t_7, __pyx_v_lon1, __pyx_v_lon2, __pyx_v_nx};
        __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1611, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_GOTREF(__pyx_t_4);
      } else
      #endif
      {
        __pyx_t_5 = PyTuple_New(3+__pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1611, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        if (__pyx_t_7) {
          __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_7); __pyx_t_7 = NULL;
        }
        __Pyx_INCREF(__pyx_v_lon1);
        __Pyx_GIVEREF(__pyx_v_lon1);
        PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_6, __pyx_v_lon1);
        __Pyx_INCREF(__pyx_v_lon2);
        __Pyx_GIVEREF(__pyx_v_lon2);
        PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_6, __pyx_v_lon2);
        __Pyx_INCREF(__pyx_v_nx);
        __Pyx_GIVEREF(__pyx_v_nx);
        PyTuple_SET_ITEM(__pyx_t_5, 2+__pyx_t_6, __pyx_v_nx);
        __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1611, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      }
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF_SET(__pyx_v_lons, __pyx_t_4);
      __pyx_t_4 = 0;

      /* "pygrib.pyx":1610
 *             # when longitudeOfLastGridPointInDegrees < 0
 *             # (bug in grib_api 1.9.16)
 *             if lon2 < 0:             # <<<<<<<<<<<<<<
 *                 lons = np.linspace(lon1,lon2,nx)
 *             lons,lats = np.meshgrid(lons,lats)
 */
    }

    /* "pygrib.pyx":1612
 *             if lon2 < 0:
 *                 lons = np.linspace(lon1,lon2,nx)
 *             lons,lats = np.meshgrid(lons,lats)             # <<<<<<<<<<<<<<
 *         elif self['gridType'] == 'reduced_gg': # reduced global gaussian grid
 *             if self.expand_reduced:
 */
    __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1612, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_meshgrid); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1612, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = NULL;
    __pyx_t_6 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
        __pyx_t_6 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_lons, __pyx_v_lats};
      __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1612, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_GOTREF(__pyx_t_4);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_lons, __pyx_v_lats};
      __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1612, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_GOTREF(__pyx_t_4);
    } else
    #endif
    {
      __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1612, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      if (__pyx_t_3) {
        __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_3); __pyx_t_3 = NULL;
      }
      __Pyx_INCREF(__pyx_v_lons);
      __Pyx_GIVEREF(__pyx_v_lons);
      PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_v_lons);
      __Pyx_INCREF(__pyx_v_lats);
      __Pyx_GIVEREF(__pyx_v_lats);
      PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_v_lats);
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_7, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1612, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) {
      PyObject* sequence = __pyx_t_4;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 1612, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_7 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_5 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_7 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_7);
      #else
      __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1612, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_7 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1612, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      #endif
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_3 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1612, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_8 = Py_TYPE(__pyx_t_3)->tp_iternext;
      index = 0; __pyx_t_5 = __pyx_t_8(__pyx_t_3); if (unlikely(!__pyx_t_5)) goto __pyx_L20_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_5);
      index = 1; __pyx_t_7 = __pyx_t_8(__pyx_t_3); if (unlikely(!__pyx_t_7)) goto __pyx_L20_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_7);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_3), 2) < 0) __PYX_ERR(0, 1612, __pyx_L1_error)
      __pyx_t_8 = NULL;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      goto __pyx_L21_unpacking_done;
      __pyx_L20_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_8 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 1612, __pyx_L1_error)
      __pyx_L21_unpacking_done:;
    }
    __Pyx_DECREF_SET(__pyx_v_lons, __pyx_t_5);
    __pyx_t_5 = 0;
    __Pyx_DECREF_SET(__pyx_v_lats, __pyx_t_7);
    __pyx_t_7 = 0;

    /* "pygrib.pyx":1584
 *             raise ValueError('unsupported grid %s' % self['gridType'])
 * 
 *         if self['gridType'] in ['regular_gg','regular_ll']: # regular lat/lon grid             # <<<<<<<<<<<<<<
 *             nx = self['Ni']
 *             ny = self['Nj']
 */
    goto __pyx_L4;
  }

  /* "pygrib.pyx":1613
 *                 lons = np.linspace(lon1,lon2,nx)
 *             lons,lats = np.meshgrid(lons,lats)
 *         elif self['gridType'] == 'reduced_gg': # reduced global gaussian grid             # <<<<<<<<<<<<<<
 *             if self.expand_reduced:
 *                 lat1 = self['latitudeOfFirstGridPointInDegrees']
 */
  __pyx_t_4 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_gridType); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1613, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_t_4, __pyx_n_s_reduced_gg, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1613, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__pyx_t_1) {

    /* "pygrib.pyx":1614
 *             lons,lats = np.meshgrid(lons,lats)
 *         elif self['gridType'] == 'reduced_gg': # reduced global gaussian grid
 *             if self.expand_reduced:             # <<<<<<<<<<<<<<
 *                 lat1 = self['latitudeOfFirstGridPointInDegrees']
 *                 lat2 = self['latitudeOfLastGridPointInDegrees']
 */
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_self->expand_reduced); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1614, __pyx_L1_error)
    if (__pyx_t_1) {

      /* "pygrib.pyx":1615
 *         elif self['gridType'] == 'reduced_gg': # reduced global gaussian grid
 *             if self.expand_reduced:
 *                 lat1 = self['latitudeOfFirstGridPointInDegrees']             # <<<<<<<<<<<<<<
 *                 lat2 = self['latitudeOfLastGridPointInDegrees']
 *                 lats = self['distinctLatitudes']
 */
      __pyx_t_4 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_latitudeOfFirstGridPointInDegree); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1615, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_v_lat1 = __pyx_t_4;
      __pyx_t_4 = 0;

      /* "pygrib.pyx":1616
 *             if self.expand_reduced:
 *                 lat1 = self['latitudeOfFirstGridPointInDegrees']
 *                 lat2 = self['latitudeOfLastGridPointInDegrees']             # <<<<<<<<<<<<<<
 *                 lats = self['distinctLatitudes']
 *                 if lat2 < lat1 and lats[-1] > lats[0]: lats = lats[::-1]
 */
      __pyx_t_4 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_latitudeOfLastGridPointInDegrees); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1616, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_v_lat2 = __pyx_t_4;
      __pyx_t_4 = 0;

      /* "pygrib.pyx":1617
 *                 lat1 = self['latitudeOfFirstGridPointInDegrees']
 *                 lat2 = self['latitudeOfLastGridPointInDegrees']
 *                 lats = self['distinctLatitudes']             # <<<<<<<<<<<<<<
 *                 if lat2 < lat1 and lats[-1] > lats[0]: lats = lats[::-1]
 *                 ny = self['Nj']
 */
      __pyx_t_4 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_distinctLatitudes); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1617, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_v_lats = __pyx_t_4;
      __pyx_t_4 = 0;

      /* "pygrib.pyx":1618
 *                 lat2 = self['latitudeOfLastGridPointInDegrees']
 *                 lats = self['distinctLatitudes']
 *                 if lat2 < lat1 and lats[-1] > lats[0]: lats = lats[::-1]             # <<<<<<<<<<<<<<
 *                 ny = self['Nj']
 *                 nx = 2*ny
 */
      __pyx_t_4 = PyObject_RichCompare(__pyx_v_lat2, __pyx_v_lat1, Py_LT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1618, __pyx_L1_error)
      __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 1618, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (__pyx_t_2) {
      } else {
        __pyx_t_1 = __pyx_t_2;
        goto __pyx_L24_bool_binop_done;
      }
      __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_lats, -1L, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1618, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_lats, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1618, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_5 = PyObject_RichCompare(__pyx_t_4, __pyx_t_7, Py_GT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1618, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 1618, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_1 = __pyx_t_2;
      __pyx_L24_bool_binop_done:;
      if (__pyx_t_1) {
        __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_v_lats, __pyx_slice__98); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1618, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF_SET(__pyx_v_lats, __pyx_t_5);
        __pyx_t_5 = 0;
      }

      /* "pygrib.pyx":1619
 *                 lats = self['distinctLatitudes']
 *                 if lat2 < lat1 and lats[-1] > lats[0]: lats = lats[::-1]
 *                 ny = self['Nj']             # <<<<<<<<<<<<<<
 *                 nx = 2*ny
 *                 lon1 = self['longitudeOfFirstGridPointInDegrees']
 */
      __pyx_t_5 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_Nj); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1619, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_v_ny = __pyx_t_5;
      __pyx_t_5 = 0;

      /* "pygrib.pyx":1620
 *                 if lat2 < lat1 and lats[-1] > lats[0]: lats = lats[::-1]
 *                 ny = self['Nj']
 *                 nx = 2*ny             # <<<<<<<<<<<<<<
 *                 lon1 = self['longitudeOfFirstGridPointInDegrees']
 *                 lon2 = self['longitudeOfLastGridPointInDegrees']
 */
      __pyx_t_5 = PyNumber_Multiply(__pyx_int_2, __pyx_v_ny); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1620, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_v_nx = __pyx_t_5;
      __pyx_t_5 = 0;

      /* "pygrib.pyx":1621
 *                 ny = self['Nj']
 *                 nx = 2*ny
 *                 lon1 = self['longitudeOfFirstGridPointInDegrees']             # <<<<<<<<<<<<<<
 *                 lon2 = self['longitudeOfLastGridPointInDegrees']
 *                 lons = np.linspace(lon1,lon2,nx)
 */
      __pyx_t_5 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_longitudeOfFirstGridPointInDegre); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1621, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_v_lon1 = __pyx_t_5;
      __pyx_t_5 = 0;

      /* "pygrib.pyx":1622
 *                 nx = 2*ny
 *                 lon1 = self['longitudeOfFirstGridPointInDegrees']
 *                 lon2 = self['longitudeOfLastGridPointInDegrees']             # <<<<<<<<<<<<<<
 *                 lons = np.linspace(lon1,lon2,nx)
 *                 lons,lats = np.meshgrid(lons,lats)
 */
      __pyx_t_5 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_longitudeOfLastGridPointInDegree); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1622, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_v_lon2 = __pyx_t_5;
      __pyx_t_5 = 0;

      /* "pygrib.pyx":1623
 *                 lon1 = self['longitudeOfFirstGridPointInDegrees']
 *                 lon2 = self['longitudeOfLastGridPointInDegrees']
 *                 lons = np.linspace(lon1,lon2,nx)             # <<<<<<<<<<<<<<
 *                 lons,lats = np.meshgrid(lons,lats)
 *             else:
 */
      __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1623, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_linspace); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1623, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_7 = NULL;
      __pyx_t_6 = 0;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
        __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_4);
        if (likely(__pyx_t_7)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_7);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_4, function);
          __pyx_t_6 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_4)) {
        PyObject *__pyx_temp[4] = {__pyx_t_7, __pyx_v_lon1, __pyx_v_lon2, __pyx_v_nx};
        __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1623, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_GOTREF(__pyx_t_5);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
        PyObject *__pyx_temp[4] = {__pyx_t_7, __pyx_v_lon1, __pyx_v_lon2, __pyx_v_nx};
        __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1623, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_GOTREF(__pyx_t_5);
      } else
      #endif
      {
        __pyx_t_3 = PyTuple_New(3+__pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1623, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        if (__pyx_t_7) {
          __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_7); __pyx_t_7 = NULL;
        }
        __Pyx_INCREF(__pyx_v_lon1);
        __Pyx_GIVEREF(__pyx_v_lon1);
        PyTuple_SET_ITEM(__pyx_t_3, 0+__pyx_t_6, __pyx_v_lon1);
        __Pyx_INCREF(__pyx_v_lon2);
        __Pyx_GIVEREF(__pyx_v_lon2);
        PyTuple_SET_ITEM(__pyx_t_3, 1+__pyx_t_6, __pyx_v_lon2);
        __Pyx_INCREF(__pyx_v_nx);
        __Pyx_GIVEREF(__pyx_v_nx);
        PyTuple_SET_ITEM(__pyx_t_3, 2+__pyx_t_6, __pyx_v_nx);
        __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1623, __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;
      __pyx_v_lons = __pyx_t_5;
      __pyx_t_5 = 0;

      /* "pygrib.pyx":1624
 *                 lon2 = self['longitudeOfLastGridPointInDegrees']
 *                 lons = np.linspace(lon1,lon2,nx)
 *                 lons,lats = np.meshgrid(lons,lats)             # <<<<<<<<<<<<<<
 *             else:
 *                 lats = self['latitudes']
 */
      __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1624, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_meshgrid); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1624, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = NULL;
      __pyx_t_6 = 0;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
        __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
        if (likely(__pyx_t_4)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
          __Pyx_INCREF(__pyx_t_4);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_3, function);
          __pyx_t_6 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_3)) {
        PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_lons, __pyx_v_lats};
        __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1624, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_GOTREF(__pyx_t_5);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
        PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_lons, __pyx_v_lats};
        __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1624, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_GOTREF(__pyx_t_5);
      } else
      #endif
      {
        __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1624, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        if (__pyx_t_4) {
          __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_4); __pyx_t_4 = NULL;
        }
        __Pyx_INCREF(__pyx_v_lons);
        __Pyx_GIVEREF(__pyx_v_lons);
        PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_v_lons);
        __Pyx_INCREF(__pyx_v_lats);
        __Pyx_GIVEREF(__pyx_v_lats);
        PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_v_lats);
        __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_7, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1624, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      }
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if ((likely(PyTuple_CheckExact(__pyx_t_5))) || (PyList_CheckExact(__pyx_t_5))) {
        PyObject* sequence = __pyx_t_5;
        Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
        if (unlikely(size != 2)) {
          if (size > 2) __Pyx_RaiseTooManyValuesError(2);
          else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
          __PYX_ERR(0, 1624, __pyx_L1_error)
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        if (likely(PyTuple_CheckExact(sequence))) {
          __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); 
          __pyx_t_7 = PyTuple_GET_ITEM(sequence, 1); 
        } else {
          __pyx_t_3 = PyList_GET_ITEM(sequence, 0); 
          __pyx_t_7 = PyList_GET_ITEM(sequence, 1); 
        }
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_7);
        #else
        __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1624, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_7 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1624, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        #endif
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      } else {
        Py_ssize_t index = -1;
        __pyx_t_4 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1624, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_t_8 = Py_TYPE(__pyx_t_4)->tp_iternext;
        index = 0; __pyx_t_3 = __pyx_t_8(__pyx_t_4); if (unlikely(!__pyx_t_3)) goto __pyx_L26_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_3);
        index = 1; __pyx_t_7 = __pyx_t_8(__pyx_t_4); if (unlikely(!__pyx_t_7)) goto __pyx_L26_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_7);
        if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_4), 2) < 0) __PYX_ERR(0, 1624, __pyx_L1_error)
        __pyx_t_8 = NULL;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        goto __pyx_L27_unpacking_done;
        __pyx_L26_unpacking_failed:;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __pyx_t_8 = NULL;
        if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
        __PYX_ERR(0, 1624, __pyx_L1_error)
        __pyx_L27_unpacking_done:;
      }
      __Pyx_DECREF_SET(__pyx_v_lons, __pyx_t_3);
      __pyx_t_3 = 0;
      __Pyx_DECREF_SET(__pyx_v_lats, __pyx_t_7);
      __pyx_t_7 = 0;

      /* "pygrib.pyx":1614
 *             lons,lats = np.meshgrid(lons,lats)
 *         elif self['gridType'] == 'reduced_gg': # reduced global gaussian grid
 *             if self.expand_reduced:             # <<<<<<<<<<<<<<
 *                 lat1 = self['latitudeOfFirstGridPointInDegrees']
 *                 lat2 = self['latitudeOfLastGridPointInDegrees']
 */
      goto __pyx_L22;
    }

    /* "pygrib.pyx":1626
 *                 lons,lats = np.meshgrid(lons,lats)
 *             else:
 *                 lats = self['latitudes']             # <<<<<<<<<<<<<<
 *                 lons = self['longitudes']
 *         elif self['gridType'] == 'reduced_ll': # reduced lat/lon grid
 */
    /*else*/ {
      __pyx_t_5 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_latitudes); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1626, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_v_lats = __pyx_t_5;
      __pyx_t_5 = 0;

      /* "pygrib.pyx":1627
 *             else:
 *                 lats = self['latitudes']
 *                 lons = self['longitudes']             # <<<<<<<<<<<<<<
 *         elif self['gridType'] == 'reduced_ll': # reduced lat/lon grid
 *             if self.expand_reduced:
 */
      __pyx_t_5 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_longitudes); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1627, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_v_lons = __pyx_t_5;
      __pyx_t_5 = 0;
    }
    __pyx_L22:;

    /* "pygrib.pyx":1613
 *                 lons = np.linspace(lon1,lon2,nx)
 *             lons,lats = np.meshgrid(lons,lats)
 *         elif self['gridType'] == 'reduced_gg': # reduced global gaussian grid             # <<<<<<<<<<<<<<
 *             if self.expand_reduced:
 *                 lat1 = self['latitudeOfFirstGridPointInDegrees']
 */
    goto __pyx_L4;
  }

  /* "pygrib.pyx":1628
 *                 lats = self['latitudes']
 *                 lons = self['longitudes']
 *         elif self['gridType'] == 'reduced_ll': # reduced lat/lon grid             # <<<<<<<<<<<<<<
 *             if self.expand_reduced:
 *                 ny = self['Nj']
 */
  __pyx_t_5 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_gridType); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1628, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_t_5, __pyx_n_s_reduced_ll, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1628, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (__pyx_t_1) {

    /* "pygrib.pyx":1629
 *                 lons = self['longitudes']
 *         elif self['gridType'] == 'reduced_ll': # reduced lat/lon grid
 *             if self.expand_reduced:             # <<<<<<<<<<<<<<
 *                 ny = self['Nj']
 *                 nx = 2*ny
 */
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_self->expand_reduced); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1629, __pyx_L1_error)
    if (__pyx_t_1) {

      /* "pygrib.pyx":1630
 *         elif self['gridType'] == 'reduced_ll': # reduced lat/lon grid
 *             if self.expand_reduced:
 *                 ny = self['Nj']             # <<<<<<<<<<<<<<
 *                 nx = 2*ny
 *                 lat1 = self['latitudeOfFirstGridPointInDegrees']
 */
      __pyx_t_5 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_Nj); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1630, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_v_ny = __pyx_t_5;
      __pyx_t_5 = 0;

      /* "pygrib.pyx":1631
 *             if self.expand_reduced:
 *                 ny = self['Nj']
 *                 nx = 2*ny             # <<<<<<<<<<<<<<
 *                 lat1 = self['latitudeOfFirstGridPointInDegrees']
 *                 lat2 = self['latitudeOfLastGridPointInDegrees']
 */
      __pyx_t_5 = PyNumber_Multiply(__pyx_int_2, __pyx_v_ny); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1631, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_v_nx = __pyx_t_5;
      __pyx_t_5 = 0;

      /* "pygrib.pyx":1632
 *                 ny = self['Nj']
 *                 nx = 2*ny
 *                 lat1 = self['latitudeOfFirstGridPointInDegrees']             # <<<<<<<<<<<<<<
 *                 lat2 = self['latitudeOfLastGridPointInDegrees']
 *                 lon1 = self['longitudeOfFirstGridPointInDegrees']
 */
      __pyx_t_5 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_latitudeOfFirstGridPointInDegree); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1632, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_v_lat1 = __pyx_t_5;
      __pyx_t_5 = 0;

      /* "pygrib.pyx":1633
 *                 nx = 2*ny
 *                 lat1 = self['latitudeOfFirstGridPointInDegrees']
 *                 lat2 = self['latitudeOfLastGridPointInDegrees']             # <<<<<<<<<<<<<<
 *                 lon1 = self['longitudeOfFirstGridPointInDegrees']
 *                 lon2 = self['longitudeOfLastGridPointInDegrees']
 */
      __pyx_t_5 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_latitudeOfLastGridPointInDegrees); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1633, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_v_lat2 = __pyx_t_5;
      __pyx_t_5 = 0;

      /* "pygrib.pyx":1634
 *                 lat1 = self['latitudeOfFirstGridPointInDegrees']
 *                 lat2 = self['latitudeOfLastGridPointInDegrees']
 *                 lon1 = self['longitudeOfFirstGridPointInDegrees']             # <<<<<<<<<<<<<<
 *                 lon2 = self['longitudeOfLastGridPointInDegrees']
 *                 lons = np.linspace(lon1,lon2,nx)
 */
      __pyx_t_5 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_longitudeOfFirstGridPointInDegre); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1634, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_v_lon1 = __pyx_t_5;
      __pyx_t_5 = 0;

      /* "pygrib.pyx":1635
 *                 lat2 = self['latitudeOfLastGridPointInDegrees']
 *                 lon1 = self['longitudeOfFirstGridPointInDegrees']
 *                 lon2 = self['longitudeOfLastGridPointInDegrees']             # <<<<<<<<<<<<<<
 *                 lons = np.linspace(lon1,lon2,nx)
 *                 lats = np.linspace(lat1,lat2,ny)
 */
      __pyx_t_5 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_longitudeOfLastGridPointInDegree); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1635, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_v_lon2 = __pyx_t_5;
      __pyx_t_5 = 0;

      /* "pygrib.pyx":1636
 *                 lon1 = self['longitudeOfFirstGridPointInDegrees']
 *                 lon2 = self['longitudeOfLastGridPointInDegrees']
 *                 lons = np.linspace(lon1,lon2,nx)             # <<<<<<<<<<<<<<
 *                 lats = np.linspace(lat1,lat2,ny)
 *                 lons,lats = np.meshgrid(lons,lats)
 */
      __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1636, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_linspace); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1636, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_7 = NULL;
      __pyx_t_6 = 0;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
        __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_3);
        if (likely(__pyx_t_7)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
          __Pyx_INCREF(__pyx_t_7);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_3, function);
          __pyx_t_6 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_3)) {
        PyObject *__pyx_temp[4] = {__pyx_t_7, __pyx_v_lon1, __pyx_v_lon2, __pyx_v_nx};
        __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1636, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_GOTREF(__pyx_t_5);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
        PyObject *__pyx_temp[4] = {__pyx_t_7, __pyx_v_lon1, __pyx_v_lon2, __pyx_v_nx};
        __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1636, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_GOTREF(__pyx_t_5);
      } else
      #endif
      {
        __pyx_t_4 = PyTuple_New(3+__pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1636, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        if (__pyx_t_7) {
          __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_7); __pyx_t_7 = NULL;
        }
        __Pyx_INCREF(__pyx_v_lon1);
        __Pyx_GIVEREF(__pyx_v_lon1);
        PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_6, __pyx_v_lon1);
        __Pyx_INCREF(__pyx_v_lon2);
        __Pyx_GIVEREF(__pyx_v_lon2);
        PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_6, __pyx_v_lon2);
        __Pyx_INCREF(__pyx_v_nx);
        __Pyx_GIVEREF(__pyx_v_nx);
        PyTuple_SET_ITEM(__pyx_t_4, 2+__pyx_t_6, __pyx_v_nx);
        __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1636, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      }
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_v_lons = __pyx_t_5;
      __pyx_t_5 = 0;

      /* "pygrib.pyx":1637
 *                 lon2 = self['longitudeOfLastGridPointInDegrees']
 *                 lons = np.linspace(lon1,lon2,nx)
 *                 lats = np.linspace(lat1,lat2,ny)             # <<<<<<<<<<<<<<
 *                 lons,lats = np.meshgrid(lons,lats)
 *             else:
 */
      __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1637, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_linspace); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1637, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = NULL;
      __pyx_t_6 = 0;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
        __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
        if (likely(__pyx_t_3)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_3);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_4, function);
          __pyx_t_6 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_4)) {
        PyObject *__pyx_temp[4] = {__pyx_t_3, __pyx_v_lat1, __pyx_v_lat2, __pyx_v_ny};
        __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1637, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_GOTREF(__pyx_t_5);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
        PyObject *__pyx_temp[4] = {__pyx_t_3, __pyx_v_lat1, __pyx_v_lat2, __pyx_v_ny};
        __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1637, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_GOTREF(__pyx_t_5);
      } else
      #endif
      {
        __pyx_t_7 = PyTuple_New(3+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1637, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        if (__pyx_t_3) {
          __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_3); __pyx_t_3 = NULL;
        }
        __Pyx_INCREF(__pyx_v_lat1);
        __Pyx_GIVEREF(__pyx_v_lat1);
        PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_v_lat1);
        __Pyx_INCREF(__pyx_v_lat2);
        __Pyx_GIVEREF(__pyx_v_lat2);
        PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_v_lat2);
        __Pyx_INCREF(__pyx_v_ny);
        __Pyx_GIVEREF(__pyx_v_ny);
        PyTuple_SET_ITEM(__pyx_t_7, 2+__pyx_t_6, __pyx_v_ny);
        __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_7, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1637, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      }
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_v_lats = __pyx_t_5;
      __pyx_t_5 = 0;

      /* "pygrib.pyx":1638
 *                 lons = np.linspace(lon1,lon2,nx)
 *                 lats = np.linspace(lat1,lat2,ny)
 *                 lons,lats = np.meshgrid(lons,lats)             # <<<<<<<<<<<<<<
 *             else:
 *                 lats = self['latitudes']
 */
      __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1638, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_meshgrid); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1638, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = NULL;
      __pyx_t_6 = 0;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
        __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_7);
        if (likely(__pyx_t_4)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
          __Pyx_INCREF(__pyx_t_4);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_7, function);
          __pyx_t_6 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_7)) {
        PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_lons, __pyx_v_lats};
        __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1638, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_GOTREF(__pyx_t_5);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) {
        PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_lons, __pyx_v_lats};
        __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1638, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_GOTREF(__pyx_t_5);
      } else
      #endif
      {
        __pyx_t_3 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1638, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        if (__pyx_t_4) {
          __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4); __pyx_t_4 = NULL;
        }
        __Pyx_INCREF(__pyx_v_lons);
        __Pyx_GIVEREF(__pyx_v_lons);
        PyTuple_SET_ITEM(__pyx_t_3, 0+__pyx_t_6, __pyx_v_lons);
        __Pyx_INCREF(__pyx_v_lats);
        __Pyx_GIVEREF(__pyx_v_lats);
        PyTuple_SET_ITEM(__pyx_t_3, 1+__pyx_t_6, __pyx_v_lats);
        __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1638, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      }
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      if ((likely(PyTuple_CheckExact(__pyx_t_5))) || (PyList_CheckExact(__pyx_t_5))) {
        PyObject* sequence = __pyx_t_5;
        Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
        if (unlikely(size != 2)) {
          if (size > 2) __Pyx_RaiseTooManyValuesError(2);
          else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
          __PYX_ERR(0, 1638, __pyx_L1_error)
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        if (likely(PyTuple_CheckExact(sequence))) {
          __pyx_t_7 = PyTuple_GET_ITEM(sequence, 0); 
          __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
        } else {
          __pyx_t_7 = PyList_GET_ITEM(sequence, 0); 
          __pyx_t_3 = PyList_GET_ITEM(sequence, 1); 
        }
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_3);
        #else
        __pyx_t_7 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1638, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1638, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        #endif
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      } else {
        Py_ssize_t index = -1;
        __pyx_t_4 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1638, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_t_8 = Py_TYPE(__pyx_t_4)->tp_iternext;
        index = 0; __pyx_t_7 = __pyx_t_8(__pyx_t_4); if (unlikely(!__pyx_t_7)) goto __pyx_L29_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_7);
        index = 1; __pyx_t_3 = __pyx_t_8(__pyx_t_4); if (unlikely(!__pyx_t_3)) goto __pyx_L29_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_3);
        if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_4), 2) < 0) __PYX_ERR(0, 1638, __pyx_L1_error)
        __pyx_t_8 = NULL;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        goto __pyx_L30_unpacking_done;
        __pyx_L29_unpacking_failed:;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __pyx_t_8 = NULL;
        if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
        __PYX_ERR(0, 1638, __pyx_L1_error)
        __pyx_L30_unpacking_done:;
      }
      __Pyx_DECREF_SET(__pyx_v_lons, __pyx_t_7);
      __pyx_t_7 = 0;
      __Pyx_DECREF_SET(__pyx_v_lats, __pyx_t_3);
      __pyx_t_3 = 0;

      /* "pygrib.pyx":1629
 *                 lons = self['longitudes']
 *         elif self['gridType'] == 'reduced_ll': # reduced lat/lon grid
 *             if self.expand_reduced:             # <<<<<<<<<<<<<<
 *                 ny = self['Nj']
 *                 nx = 2*ny
 */
      goto __pyx_L28;
    }

    /* "pygrib.pyx":1640
 *                 lons,lats = np.meshgrid(lons,lats)
 *             else:
 *                 lats = self['latitudes']             # <<<<<<<<<<<<<<
 *                 lons = self['longitudes']
 *         elif self['gridType'] == 'polar_stereographic':
 */
    /*else*/ {
      __pyx_t_5 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_latitudes); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1640, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_v_lats = __pyx_t_5;
      __pyx_t_5 = 0;

      /* "pygrib.pyx":1641
 *             else:
 *                 lats = self['latitudes']
 *                 lons = self['longitudes']             # <<<<<<<<<<<<<<
 *         elif self['gridType'] == 'polar_stereographic':
 *             lat1 = self['latitudeOfFirstGridPointInDegrees']
 */
      __pyx_t_5 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_longitudes); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1641, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_v_lons = __pyx_t_5;
      __pyx_t_5 = 0;
    }
    __pyx_L28:;

    /* "pygrib.pyx":1628
 *                 lats = self['latitudes']
 *                 lons = self['longitudes']
 *         elif self['gridType'] == 'reduced_ll': # reduced lat/lon grid             # <<<<<<<<<<<<<<
 *             if self.expand_reduced:
 *                 ny = self['Nj']
 */
    goto __pyx_L4;
  }

  /* "pygrib.pyx":1642
 *                 lats = self['latitudes']
 *                 lons = self['longitudes']
 *         elif self['gridType'] == 'polar_stereographic':             # <<<<<<<<<<<<<<
 *             lat1 = self['latitudeOfFirstGridPointInDegrees']
 *             lon1 = self['longitudeOfFirstGridPointInDegrees']
 */
  __pyx_t_5 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_gridType); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1642, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_t_5, __pyx_n_s_polar_stereographic, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1642, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (__pyx_t_1) {

    /* "pygrib.pyx":1643
 *                 lons = self['longitudes']
 *         elif self['gridType'] == 'polar_stereographic':
 *             lat1 = self['latitudeOfFirstGridPointInDegrees']             # <<<<<<<<<<<<<<
 *             lon1 = self['longitudeOfFirstGridPointInDegrees']
 *             try:
 */
    __pyx_t_5 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_latitudeOfFirstGridPointInDegree); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1643, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_v_lat1 = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "pygrib.pyx":1644
 *         elif self['gridType'] == 'polar_stereographic':
 *             lat1 = self['latitudeOfFirstGridPointInDegrees']
 *             lon1 = self['longitudeOfFirstGridPointInDegrees']             # <<<<<<<<<<<<<<
 *             try:
 *                 nx = self['Nx']
 */
    __pyx_t_5 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_longitudeOfFirstGridPointInDegre); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1644, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_v_lon1 = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "pygrib.pyx":1645
 *             lat1 = self['latitudeOfFirstGridPointInDegrees']
 *             lon1 = self['longitudeOfFirstGridPointInDegrees']
 *             try:             # <<<<<<<<<<<<<<
 *                 nx = self['Nx']
 *                 ny = self['Ny']
 */
    {
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __Pyx_ExceptionSave(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
      __Pyx_XGOTREF(__pyx_t_9);
      __Pyx_XGOTREF(__pyx_t_10);
      __Pyx_XGOTREF(__pyx_t_11);
      /*try:*/ {

        /* "pygrib.pyx":1646
 *             lon1 = self['longitudeOfFirstGridPointInDegrees']
 *             try:
 *                 nx = self['Nx']             # <<<<<<<<<<<<<<
 *                 ny = self['Ny']
 *             except:
 */
        __pyx_t_5 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_Nx); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1646, __pyx_L31_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_v_nx = __pyx_t_5;
        __pyx_t_5 = 0;

        /* "pygrib.pyx":1647
 *             try:
 *                 nx = self['Nx']
 *                 ny = self['Ny']             # <<<<<<<<<<<<<<
 *             except:
 *                 nx = self['Ni']
 */
        __pyx_t_5 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_Ny); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1647, __pyx_L31_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_v_ny = __pyx_t_5;
        __pyx_t_5 = 0;

        /* "pygrib.pyx":1645
 *             lat1 = self['latitudeOfFirstGridPointInDegrees']
 *             lon1 = self['longitudeOfFirstGridPointInDegrees']
 *             try:             # <<<<<<<<<<<<<<
 *                 nx = self['Nx']
 *                 ny = self['Ny']
 */
      }
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      goto __pyx_L36_try_end;
      __pyx_L31_error:;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;

      /* "pygrib.pyx":1648
 *                 nx = self['Nx']
 *                 ny = self['Ny']
 *             except:             # <<<<<<<<<<<<<<
 *                 nx = self['Ni']
 *                 ny = self['Nj']
 */
      /*except:*/ {
        __Pyx_AddTraceback("pygrib.gribmessage.latlons", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_3, &__pyx_t_7) < 0) __PYX_ERR(0, 1648, __pyx_L33_except_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_GOTREF(__pyx_t_7);

        /* "pygrib.pyx":1649
 *                 ny = self['Ny']
 *             except:
 *                 nx = self['Ni']             # <<<<<<<<<<<<<<
 *                 ny = self['Nj']
 *             # key renamed from xDirectionGridLengthInMetres to
 */
        __pyx_t_4 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_Ni); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1649, __pyx_L33_except_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_XDECREF_SET(__pyx_v_nx, __pyx_t_4);
        __pyx_t_4 = 0;

        /* "pygrib.pyx":1650
 *             except:
 *                 nx = self['Ni']
 *                 ny = self['Nj']             # <<<<<<<<<<<<<<
 *             # key renamed from xDirectionGridLengthInMetres to
 *             # DxInMetres grib_api 1.8.0.1.
 */
        __pyx_t_4 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_Nj); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1650, __pyx_L33_except_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_XDECREF_SET(__pyx_v_ny, __pyx_t_4);
        __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        goto __pyx_L32_exception_handled;
      }
      __pyx_L33_except_error:;

      /* "pygrib.pyx":1645
 *             lat1 = self['latitudeOfFirstGridPointInDegrees']
 *             lon1 = self['longitudeOfFirstGridPointInDegrees']
 *             try:             # <<<<<<<<<<<<<<
 *                 nx = self['Nx']
 *                 ny = self['Ny']
 */
      __Pyx_XGIVEREF(__pyx_t_9);
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11);
      goto __pyx_L1_error;
      __pyx_L32_exception_handled:;
      __Pyx_XGIVEREF(__pyx_t_9);
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11);
      __pyx_L36_try_end:;
    }

    /* "pygrib.pyx":1653
 *             # key renamed from xDirectionGridLengthInMetres to
 *             # DxInMetres grib_api 1.8.0.1.
 *             try:             # <<<<<<<<<<<<<<
 *                 dx = self['DxInMetres']
 *             except:
 */
    {
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __Pyx_ExceptionSave(&__pyx_t_11, &__pyx_t_10, &__pyx_t_9);
      __Pyx_XGOTREF(__pyx_t_11);
      __Pyx_XGOTREF(__pyx_t_10);
      __Pyx_XGOTREF(__pyx_t_9);
      /*try:*/ {

        /* "pygrib.pyx":1654
 *             # DxInMetres grib_api 1.8.0.1.
 *             try:
 *                 dx = self['DxInMetres']             # <<<<<<<<<<<<<<
 *             except:
 *                 dx = self['xDirectionGridLengthInMetres']
 */
        __pyx_t_7 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_DxInMetres); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1654, __pyx_L39_error)
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_v_dx = __pyx_t_7;
        __pyx_t_7 = 0;

        /* "pygrib.pyx":1653
 *             # key renamed from xDirectionGridLengthInMetres to
 *             # DxInMetres grib_api 1.8.0.1.
 *             try:             # <<<<<<<<<<<<<<
 *                 dx = self['DxInMetres']
 *             except:
 */
      }
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      goto __pyx_L44_try_end;
      __pyx_L39_error:;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;

      /* "pygrib.pyx":1655
 *             try:
 *                 dx = self['DxInMetres']
 *             except:             # <<<<<<<<<<<<<<
 *                 dx = self['xDirectionGridLengthInMetres']
 *             try:
 */
      /*except:*/ {
        __Pyx_AddTraceback("pygrib.gribmessage.latlons", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_3, &__pyx_t_5) < 0) __PYX_ERR(0, 1655, __pyx_L41_except_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_GOTREF(__pyx_t_5);

        /* "pygrib.pyx":1656
 *                 dx = self['DxInMetres']
 *             except:
 *                 dx = self['xDirectionGridLengthInMetres']             # <<<<<<<<<<<<<<
 *             try:
 *                 dy = self['DyInMetres']
 */
        __pyx_t_4 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_xDirectionGridLengthInMetres); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1656, __pyx_L41_except_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_XDECREF_SET(__pyx_v_dx, __pyx_t_4);
        __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        goto __pyx_L40_exception_handled;
      }
      __pyx_L41_except_error:;

      /* "pygrib.pyx":1653
 *             # key renamed from xDirectionGridLengthInMetres to
 *             # DxInMetres grib_api 1.8.0.1.
 *             try:             # <<<<<<<<<<<<<<
 *                 dx = self['DxInMetres']
 *             except:
 */
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_XGIVEREF(__pyx_t_9);
      __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_10, __pyx_t_9);
      goto __pyx_L1_error;
      __pyx_L40_exception_handled:;
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_XGIVEREF(__pyx_t_9);
      __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_10, __pyx_t_9);
      __pyx_L44_try_end:;
    }

    /* "pygrib.pyx":1657
 *             except:
 *                 dx = self['xDirectionGridLengthInMetres']
 *             try:             # <<<<<<<<<<<<<<
 *                 dy = self['DyInMetres']
 *             except:
 */
    {
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __Pyx_ExceptionSave(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
      __Pyx_XGOTREF(__pyx_t_9);
      __Pyx_XGOTREF(__pyx_t_10);
      __Pyx_XGOTREF(__pyx_t_11);
      /*try:*/ {

        /* "pygrib.pyx":1658
 *                 dx = self['xDirectionGridLengthInMetres']
 *             try:
 *                 dy = self['DyInMetres']             # <<<<<<<<<<<<<<
 *             except:
 *                 dy = self['yDirectionGridLengthInMetres']
 */
        __pyx_t_5 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_DyInMetres); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1658, __pyx_L47_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_v_dy = __pyx_t_5;
        __pyx_t_5 = 0;

        /* "pygrib.pyx":1657
 *             except:
 *                 dx = self['xDirectionGridLengthInMetres']
 *             try:             # <<<<<<<<<<<<<<
 *                 dy = self['DyInMetres']
 *             except:
 */
      }
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      goto __pyx_L52_try_end;
      __pyx_L47_error:;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;

      /* "pygrib.pyx":1659
 *             try:
 *                 dy = self['DyInMetres']
 *             except:             # <<<<<<<<<<<<<<
 *                 dy = self['yDirectionGridLengthInMetres']
 *             pj = pyproj.Proj(self.projparams)
 */
      /*except:*/ {
        __Pyx_AddTraceback("pygrib.gribmessage.latlons", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_3, &__pyx_t_7) < 0) __PYX_ERR(0, 1659, __pyx_L49_except_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_GOTREF(__pyx_t_7);

        /* "pygrib.pyx":1660
 *                 dy = self['DyInMetres']
 *             except:
 *                 dy = self['yDirectionGridLengthInMetres']             # <<<<<<<<<<<<<<
 *             pj = pyproj.Proj(self.projparams)
 *             llcrnrx, llcrnry = pj(lon1,lat1)
 */
        __pyx_t_4 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_yDirectionGridLengthInMetres); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1660, __pyx_L49_except_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_XDECREF_SET(__pyx_v_dy, __pyx_t_4);
        __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        goto __pyx_L48_exception_handled;
      }
      __pyx_L49_except_error:;

      /* "pygrib.pyx":1657
 *             except:
 *                 dx = self['xDirectionGridLengthInMetres']
 *             try:             # <<<<<<<<<<<<<<
 *                 dy = self['DyInMetres']
 *             except:
 */
      __Pyx_XGIVEREF(__pyx_t_9);
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11);
      goto __pyx_L1_error;
      __pyx_L48_exception_handled:;
      __Pyx_XGIVEREF(__pyx_t_9);
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11);
      __pyx_L52_try_end:;
    }

    /* "pygrib.pyx":1661
 *             except:
 *                 dy = self['yDirectionGridLengthInMetres']
 *             pj = pyproj.Proj(self.projparams)             # <<<<<<<<<<<<<<
 *             llcrnrx, llcrnry = pj(lon1,lat1)
 *             x = llcrnrx+dx*np.arange(nx)
 */
    __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_pyproj); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1661, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_Proj); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1661, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
      }
    }
    if (!__pyx_t_3) {
      __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_self->projparams); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1661, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_5)) {
        PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_self->projparams};
        __pyx_t_7 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1661, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_GOTREF(__pyx_t_7);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
        PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_self->projparams};
        __pyx_t_7 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1661, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_GOTREF(__pyx_t_7);
      } else
      #endif
      {
        __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1661, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __pyx_t_3 = NULL;
        __Pyx_INCREF(__pyx_v_self->projparams);
        __Pyx_GIVEREF(__pyx_v_self->projparams);
        PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_self->projparams);
        __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_4, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1661, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_v_pj = __pyx_t_7;
    __pyx_t_7 = 0;

    /* "pygrib.pyx":1662
 *                 dy = self['yDirectionGridLengthInMetres']
 *             pj = pyproj.Proj(self.projparams)
 *             llcrnrx, llcrnry = pj(lon1,lat1)             # <<<<<<<<<<<<<<
 *             x = llcrnrx+dx*np.arange(nx)
 *             y = llcrnry+dy*np.arange(ny)
 */
    __Pyx_INCREF(__pyx_v_pj);
    __pyx_t_5 = __pyx_v_pj; __pyx_t_4 = NULL;
    __pyx_t_6 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
        __pyx_t_6 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_lon1, __pyx_v_lat1};
      __pyx_t_7 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1662, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_7);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_lon1, __pyx_v_lat1};
      __pyx_t_7 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1662, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_7);
    } else
    #endif
    {
      __pyx_t_3 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1662, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (__pyx_t_4) {
        __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4); __pyx_t_4 = NULL;
      }
      __Pyx_INCREF(__pyx_v_lon1);
      __Pyx_GIVEREF(__pyx_v_lon1);
      PyTuple_SET_ITEM(__pyx_t_3, 0+__pyx_t_6, __pyx_v_lon1);
      __Pyx_INCREF(__pyx_v_lat1);
      __Pyx_GIVEREF(__pyx_v_lat1);
      PyTuple_SET_ITEM(__pyx_t_3, 1+__pyx_t_6, __pyx_v_lat1);
      __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_3, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1662, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if ((likely(PyTuple_CheckExact(__pyx_t_7))) || (PyList_CheckExact(__pyx_t_7))) {
      PyObject* sequence = __pyx_t_7;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 1662, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_5 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_3 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_3);
      #else
      __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1662, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1662, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      #endif
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_4 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1662, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_8 = Py_TYPE(__pyx_t_4)->tp_iternext;
      index = 0; __pyx_t_5 = __pyx_t_8(__pyx_t_4); if (unlikely(!__pyx_t_5)) goto __pyx_L55_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_5);
      index = 1; __pyx_t_3 = __pyx_t_8(__pyx_t_4); if (unlikely(!__pyx_t_3)) goto __pyx_L55_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_3);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_4), 2) < 0) __PYX_ERR(0, 1662, __pyx_L1_error)
      __pyx_t_8 = NULL;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      goto __pyx_L56_unpacking_done;
      __pyx_L55_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_8 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 1662, __pyx_L1_error)
      __pyx_L56_unpacking_done:;
    }
    __pyx_v_llcrnrx = __pyx_t_5;
    __pyx_t_5 = 0;
    __pyx_v_llcrnry = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "pygrib.pyx":1663
 *             pj = pyproj.Proj(self.projparams)
 *             llcrnrx, llcrnry = pj(lon1,lat1)
 *             x = llcrnrx+dx*np.arange(nx)             # <<<<<<<<<<<<<<
 *             y = llcrnry+dy*np.arange(ny)
 *             x, y = np.meshgrid(x, y)
 */
    __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1663, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_arange); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1663, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
      }
    }
    if (!__pyx_t_3) {
      __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_nx); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1663, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_5)) {
        PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_nx};
        __pyx_t_7 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1663, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_GOTREF(__pyx_t_7);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
        PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_nx};
        __pyx_t_7 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1663, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_GOTREF(__pyx_t_7);
      } else
      #endif
      {
        __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1663, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __pyx_t_3 = NULL;
        __Pyx_INCREF(__pyx_v_nx);
        __Pyx_GIVEREF(__pyx_v_nx);
        PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_nx);
        __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_4, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1663, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = PyNumber_Multiply(__pyx_v_dx, __pyx_t_7); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1663, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = PyNumber_Add(__pyx_v_llcrnrx, __pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1663, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_v_x = __pyx_t_7;
    __pyx_t_7 = 0;

    /* "pygrib.pyx":1664
 *             llcrnrx, llcrnry = pj(lon1,lat1)
 *             x = llcrnrx+dx*np.arange(nx)
 *             y = llcrnry+dy*np.arange(ny)             # <<<<<<<<<<<<<<
 *             x, y = np.meshgrid(x, y)
 *             lons, lats = pj(x, y, inverse=True)
 */
    __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1664, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_arange); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1664, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    if (!__pyx_t_5) {
      __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_ny); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1664, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_4)) {
        PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_v_ny};
        __pyx_t_7 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1664, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_GOTREF(__pyx_t_7);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
        PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_v_ny};
        __pyx_t_7 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1664, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_GOTREF(__pyx_t_7);
      } else
      #endif
      {
        __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1664, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5); __pyx_t_5 = NULL;
        __Pyx_INCREF(__pyx_v_ny);
        __Pyx_GIVEREF(__pyx_v_ny);
        PyTuple_SET_ITEM(__pyx_t_3, 0+1, __pyx_v_ny);
        __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_3, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1664, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyNumber_Multiply(__pyx_v_dy, __pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1664, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = PyNumber_Add(__pyx_v_llcrnry, __pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1664, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_v_y = __pyx_t_7;
    __pyx_t_7 = 0;

    /* "pygrib.pyx":1665
 *             x = llcrnrx+dx*np.arange(nx)
 *             y = llcrnry+dy*np.arange(ny)
 *             x, y = np.meshgrid(x, y)             # <<<<<<<<<<<<<<
 *             lons, lats = pj(x, y, inverse=True)
 *         elif self['gridType'] == 'lambert':
 */
    __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1665, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_meshgrid); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1665, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = NULL;
    __pyx_t_6 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
        __pyx_t_6 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_x, __pyx_v_y};
      __pyx_t_7 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1665, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_7);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_x, __pyx_v_y};
      __pyx_t_7 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1665, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_7);
    } else
    #endif
    {
      __pyx_t_5 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1665, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      if (__pyx_t_4) {
        __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __pyx_t_4 = NULL;
      }
      __Pyx_INCREF(__pyx_v_x);
      __Pyx_GIVEREF(__pyx_v_x);
      PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_6, __pyx_v_x);
      __Pyx_INCREF(__pyx_v_y);
      __Pyx_GIVEREF(__pyx_v_y);
      PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_6, __pyx_v_y);
      __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1665, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if ((likely(PyTuple_CheckExact(__pyx_t_7))) || (PyList_CheckExact(__pyx_t_7))) {
      PyObject* sequence = __pyx_t_7;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 1665, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_3 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_5 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_5);
      #else
      __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1665, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1665, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      #endif
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_4 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1665, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_8 = Py_TYPE(__pyx_t_4)->tp_iternext;
      index = 0; __pyx_t_3 = __pyx_t_8(__pyx_t_4); if (unlikely(!__pyx_t_3)) goto __pyx_L57_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_3);
      index = 1; __pyx_t_5 = __pyx_t_8(__pyx_t_4); if (unlikely(!__pyx_t_5)) goto __pyx_L57_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_5);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_4), 2) < 0) __PYX_ERR(0, 1665, __pyx_L1_error)
      __pyx_t_8 = NULL;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      goto __pyx_L58_unpacking_done;
      __pyx_L57_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_8 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 1665, __pyx_L1_error)
      __pyx_L58_unpacking_done:;
    }
    __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_3);
    __pyx_t_3 = 0;
    __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_5);
    __pyx_t_5 = 0;

    /* "pygrib.pyx":1666
 *             y = llcrnry+dy*np.arange(ny)
 *             x, y = np.meshgrid(x, y)
 *             lons, lats = pj(x, y, inverse=True)             # <<<<<<<<<<<<<<
 *         elif self['gridType'] == 'lambert':
 *             lat1 = self['latitudeOfFirstGridPointInDegrees']
 */
    __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1666, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_INCREF(__pyx_v_x);
    __Pyx_GIVEREF(__pyx_v_x);
    PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_x);
    __Pyx_INCREF(__pyx_v_y);
    __Pyx_GIVEREF(__pyx_v_y);
    PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_v_y);
    __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1666, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_inverse, Py_True) < 0) __PYX_ERR(0, 1666, __pyx_L1_error)
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_v_pj, __pyx_t_7, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1666, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) {
      PyObject* sequence = __pyx_t_3;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 1666, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_7 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_5 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_7 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_7);
      #else
      __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1666, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_7 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1666, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      #endif
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_4 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1666, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_8 = Py_TYPE(__pyx_t_4)->tp_iternext;
      index = 0; __pyx_t_5 = __pyx_t_8(__pyx_t_4); if (unlikely(!__pyx_t_5)) goto __pyx_L59_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_5);
      index = 1; __pyx_t_7 = __pyx_t_8(__pyx_t_4); if (unlikely(!__pyx_t_7)) goto __pyx_L59_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_7);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_4), 2) < 0) __PYX_ERR(0, 1666, __pyx_L1_error)
      __pyx_t_8 = NULL;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      goto __pyx_L60_unpacking_done;
      __pyx_L59_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_8 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 1666, __pyx_L1_error)
      __pyx_L60_unpacking_done:;
    }
    __pyx_v_lons = __pyx_t_5;
    __pyx_t_5 = 0;
    __pyx_v_lats = __pyx_t_7;
    __pyx_t_7 = 0;

    /* "pygrib.pyx":1642
 *                 lats = self['latitudes']
 *                 lons = self['longitudes']
 *         elif self['gridType'] == 'polar_stereographic':             # <<<<<<<<<<<<<<
 *             lat1 = self['latitudeOfFirstGridPointInDegrees']
 *             lon1 = self['longitudeOfFirstGridPointInDegrees']
 */
    goto __pyx_L4;
  }

  /* "pygrib.pyx":1667
 *             x, y = np.meshgrid(x, y)
 *             lons, lats = pj(x, y, inverse=True)
 *         elif self['gridType'] == 'lambert':             # <<<<<<<<<<<<<<
 *             lat1 = self['latitudeOfFirstGridPointInDegrees']
 *             lon1 = self['longitudeOfFirstGridPointInDegrees']
 */
  __pyx_t_3 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_gridType); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1667, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_t_3, __pyx_n_s_lambert, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1667, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__pyx_t_1) {

    /* "pygrib.pyx":1668
 *             lons, lats = pj(x, y, inverse=True)
 *         elif self['gridType'] == 'lambert':
 *             lat1 = self['latitudeOfFirstGridPointInDegrees']             # <<<<<<<<<<<<<<
 *             lon1 = self['longitudeOfFirstGridPointInDegrees']
 *             try:
 */
    __pyx_t_3 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_latitudeOfFirstGridPointInDegree); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1668, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_v_lat1 = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "pygrib.pyx":1669
 *         elif self['gridType'] == 'lambert':
 *             lat1 = self['latitudeOfFirstGridPointInDegrees']
 *             lon1 = self['longitudeOfFirstGridPointInDegrees']             # <<<<<<<<<<<<<<
 *             try:
 *                 nx = self['Nx']
 */
    __pyx_t_3 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_longitudeOfFirstGridPointInDegre); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1669, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_v_lon1 = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "pygrib.pyx":1670
 *             lat1 = self['latitudeOfFirstGridPointInDegrees']
 *             lon1 = self['longitudeOfFirstGridPointInDegrees']
 *             try:             # <<<<<<<<<<<<<<
 *                 nx = self['Nx']
 *                 ny = self['Ny']
 */
    {
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __Pyx_ExceptionSave(&__pyx_t_11, &__pyx_t_10, &__pyx_t_9);
      __Pyx_XGOTREF(__pyx_t_11);
      __Pyx_XGOTREF(__pyx_t_10);
      __Pyx_XGOTREF(__pyx_t_9);
      /*try:*/ {

        /* "pygrib.pyx":1671
 *             lon1 = self['longitudeOfFirstGridPointInDegrees']
 *             try:
 *                 nx = self['Nx']             # <<<<<<<<<<<<<<
 *                 ny = self['Ny']
 *             except:
 */
        __pyx_t_3 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_Nx); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1671, __pyx_L61_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_v_nx = __pyx_t_3;
        __pyx_t_3 = 0;

        /* "pygrib.pyx":1672
 *             try:
 *                 nx = self['Nx']
 *                 ny = self['Ny']             # <<<<<<<<<<<<<<
 *             except:
 *                 nx = self['Ni']
 */
        __pyx_t_3 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_Ny); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1672, __pyx_L61_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_v_ny = __pyx_t_3;
        __pyx_t_3 = 0;

        /* "pygrib.pyx":1670
 *             lat1 = self['latitudeOfFirstGridPointInDegrees']
 *             lon1 = self['longitudeOfFirstGridPointInDegrees']
 *             try:             # <<<<<<<<<<<<<<
 *                 nx = self['Nx']
 *                 ny = self['Ny']
 */
      }
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      goto __pyx_L66_try_end;
      __pyx_L61_error:;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "pygrib.pyx":1673
 *                 nx = self['Nx']
 *                 ny = self['Ny']
 *             except:             # <<<<<<<<<<<<<<
 *                 nx = self['Ni']
 *                 ny = self['Nj']
 */
      /*except:*/ {
        __Pyx_AddTraceback("pygrib.gribmessage.latlons", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_7, &__pyx_t_5) < 0) __PYX_ERR(0, 1673, __pyx_L63_except_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_GOTREF(__pyx_t_5);

        /* "pygrib.pyx":1674
 *                 ny = self['Ny']
 *             except:
 *                 nx = self['Ni']             # <<<<<<<<<<<<<<
 *                 ny = self['Nj']
 *             dx = self['DxInMetres']
 */
        __pyx_t_4 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_Ni); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1674, __pyx_L63_except_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_XDECREF_SET(__pyx_v_nx, __pyx_t_4);
        __pyx_t_4 = 0;

        /* "pygrib.pyx":1675
 *             except:
 *                 nx = self['Ni']
 *                 ny = self['Nj']             # <<<<<<<<<<<<<<
 *             dx = self['DxInMetres']
 *             dy = self['DyInMetres']
 */
        __pyx_t_4 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_Nj); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1675, __pyx_L63_except_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_XDECREF_SET(__pyx_v_ny, __pyx_t_4);
        __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        goto __pyx_L62_exception_handled;
      }
      __pyx_L63_except_error:;

      /* "pygrib.pyx":1670
 *             lat1 = self['latitudeOfFirstGridPointInDegrees']
 *             lon1 = self['longitudeOfFirstGridPointInDegrees']
 *             try:             # <<<<<<<<<<<<<<
 *                 nx = self['Nx']
 *                 ny = self['Ny']
 */
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_XGIVEREF(__pyx_t_9);
      __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_10, __pyx_t_9);
      goto __pyx_L1_error;
      __pyx_L62_exception_handled:;
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_XGIVEREF(__pyx_t_9);
      __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_10, __pyx_t_9);
      __pyx_L66_try_end:;
    }

    /* "pygrib.pyx":1676
 *                 nx = self['Ni']
 *                 ny = self['Nj']
 *             dx = self['DxInMetres']             # <<<<<<<<<<<<<<
 *             dy = self['DyInMetres']
 *             pj = pyproj.Proj(self.projparams)
 */
    __pyx_t_5 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_DxInMetres); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1676, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_v_dx = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "pygrib.pyx":1677
 *                 ny = self['Nj']
 *             dx = self['DxInMetres']
 *             dy = self['DyInMetres']             # <<<<<<<<<<<<<<
 *             pj = pyproj.Proj(self.projparams)
 *             llcrnrx, llcrnry = pj(lon1,lat1)
 */
    __pyx_t_5 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_DyInMetres); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1677, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_v_dy = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "pygrib.pyx":1678
 *             dx = self['DxInMetres']
 *             dy = self['DyInMetres']
 *             pj = pyproj.Proj(self.projparams)             # <<<<<<<<<<<<<<
 *             llcrnrx, llcrnry = pj(lon1,lat1)
 *             x = llcrnrx+dx*np.arange(nx)
 */
    __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_pyproj); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1678, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_Proj); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1678, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_7)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    if (!__pyx_t_7) {
      __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_self->projparams); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1678, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_3)) {
        PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_v_self->projparams};
        __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1678, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_GOTREF(__pyx_t_5);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
        PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_v_self->projparams};
        __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1678, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_GOTREF(__pyx_t_5);
      } else
      #endif
      {
        __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1678, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_7); __pyx_t_7 = NULL;
        __Pyx_INCREF(__pyx_v_self->projparams);
        __Pyx_GIVEREF(__pyx_v_self->projparams);
        PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_self->projparams);
        __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1678, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_pj = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "pygrib.pyx":1679
 *             dy = self['DyInMetres']
 *             pj = pyproj.Proj(self.projparams)
 *             llcrnrx, llcrnry = pj(lon1,lat1)             # <<<<<<<<<<<<<<
 *             x = llcrnrx+dx*np.arange(nx)
 *             y = llcrnry+dy*np.arange(ny)
 */
    __Pyx_INCREF(__pyx_v_pj);
    __pyx_t_3 = __pyx_v_pj; __pyx_t_4 = NULL;
    __pyx_t_6 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
        __pyx_t_6 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_lon1, __pyx_v_lat1};
      __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1679, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_5);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_lon1, __pyx_v_lat1};
      __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1679, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_5);
    } else
    #endif
    {
      __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1679, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      if (__pyx_t_4) {
        __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_4); __pyx_t_4 = NULL;
      }
      __Pyx_INCREF(__pyx_v_lon1);
      __Pyx_GIVEREF(__pyx_v_lon1);
      PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_v_lon1);
      __Pyx_INCREF(__pyx_v_lat1);
      __Pyx_GIVEREF(__pyx_v_lat1);
      PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_v_lat1);
      __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_7, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1679, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if ((likely(PyTuple_CheckExact(__pyx_t_5))) || (PyList_CheckExact(__pyx_t_5))) {
      PyObject* sequence = __pyx_t_5;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 1679, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_7 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_3 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_7 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_7);
      #else
      __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1679, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_7 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1679, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      #endif
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_4 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1679, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_8 = Py_TYPE(__pyx_t_4)->tp_iternext;
      index = 0; __pyx_t_3 = __pyx_t_8(__pyx_t_4); if (unlikely(!__pyx_t_3)) goto __pyx_L69_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_3);
      index = 1; __pyx_t_7 = __pyx_t_8(__pyx_t_4); if (unlikely(!__pyx_t_7)) goto __pyx_L69_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_7);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_4), 2) < 0) __PYX_ERR(0, 1679, __pyx_L1_error)
      __pyx_t_8 = NULL;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      goto __pyx_L70_unpacking_done;
      __pyx_L69_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_8 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 1679, __pyx_L1_error)
      __pyx_L70_unpacking_done:;
    }
    __pyx_v_llcrnrx = __pyx_t_3;
    __pyx_t_3 = 0;
    __pyx_v_llcrnry = __pyx_t_7;
    __pyx_t_7 = 0;

    /* "pygrib.pyx":1680
 *             pj = pyproj.Proj(self.projparams)
 *             llcrnrx, llcrnry = pj(lon1,lat1)
 *             x = llcrnrx+dx*np.arange(nx)             # <<<<<<<<<<<<<<
 *             y = llcrnry+dy*np.arange(ny)
 *             x, y = np.meshgrid(x, y)
 */
    __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1680, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_arange); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1680, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_7)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    if (!__pyx_t_7) {
      __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_nx); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1680, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_3)) {
        PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_v_nx};
        __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1680, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_GOTREF(__pyx_t_5);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
        PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_v_nx};
        __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1680, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_GOTREF(__pyx_t_5);
      } else
      #endif
      {
        __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1680, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_7); __pyx_t_7 = NULL;
        __Pyx_INCREF(__pyx_v_nx);
        __Pyx_GIVEREF(__pyx_v_nx);
        PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_nx);
        __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1680, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyNumber_Multiply(__pyx_v_dx, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1680, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = PyNumber_Add(__pyx_v_llcrnrx, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1680, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_x = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "pygrib.pyx":1681
 *             llcrnrx, llcrnry = pj(lon1,lat1)
 *             x = llcrnrx+dx*np.arange(nx)
 *             y = llcrnry+dy*np.arange(ny)             # <<<<<<<<<<<<<<
 *             x, y = np.meshgrid(x, y)
 *             lons, lats = pj(x, y, inverse=True)
 */
    __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1681, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_arange); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1681, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    if (!__pyx_t_3) {
      __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_ny); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1681, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_4)) {
        PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_ny};
        __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1681, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_GOTREF(__pyx_t_5);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
        PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_ny};
        __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1681, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_GOTREF(__pyx_t_5);
      } else
      #endif
      {
        __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1681, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_3); __pyx_t_3 = NULL;
        __Pyx_INCREF(__pyx_v_ny);
        __Pyx_GIVEREF(__pyx_v_ny);
        PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_v_ny);
        __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_7, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1681, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyNumber_Multiply(__pyx_v_dy, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1681, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = PyNumber_Add(__pyx_v_llcrnry, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1681, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_v_y = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "pygrib.pyx":1682
 *             x = llcrnrx+dx*np.arange(nx)
 *             y = llcrnry+dy*np.arange(ny)
 *             x, y = np.meshgrid(x, y)             # <<<<<<<<<<<<<<
 *             lons, lats = pj(x, y, inverse=True)
 *         elif self['gridType'] =='albers':
 */
    __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1682, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_meshgrid); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1682, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = NULL;
    __pyx_t_6 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_7);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_7, function);
        __pyx_t_6 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_7)) {
      PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_x, __pyx_v_y};
      __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1682, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_5);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) {
      PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_x, __pyx_v_y};
      __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1682, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_5);
    } else
    #endif
    {
      __pyx_t_3 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1682, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (__pyx_t_4) {
        __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4); __pyx_t_4 = NULL;
      }
      __Pyx_INCREF(__pyx_v_x);
      __Pyx_GIVEREF(__pyx_v_x);
      PyTuple_SET_ITEM(__pyx_t_3, 0+__pyx_t_6, __pyx_v_x);
      __Pyx_INCREF(__pyx_v_y);
      __Pyx_GIVEREF(__pyx_v_y);
      PyTuple_SET_ITEM(__pyx_t_3, 1+__pyx_t_6, __pyx_v_y);
      __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1682, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if ((likely(PyTuple_CheckExact(__pyx_t_5))) || (PyList_CheckExact(__pyx_t_5))) {
      PyObject* sequence = __pyx_t_5;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 1682, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_7 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_7 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_3 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_3);
      #else
      __pyx_t_7 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1682, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1682, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      #endif
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_4 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1682, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_8 = Py_TYPE(__pyx_t_4)->tp_iternext;
      index = 0; __pyx_t_7 = __pyx_t_8(__pyx_t_4); if (unlikely(!__pyx_t_7)) goto __pyx_L71_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_7);
      index = 1; __pyx_t_3 = __pyx_t_8(__pyx_t_4); if (unlikely(!__pyx_t_3)) goto __pyx_L71_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_3);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_4), 2) < 0) __PYX_ERR(0, 1682, __pyx_L1_error)
      __pyx_t_8 = NULL;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      goto __pyx_L72_unpacking_done;
      __pyx_L71_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_8 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 1682, __pyx_L1_error)
      __pyx_L72_unpacking_done:;
    }
    __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_7);
    __pyx_t_7 = 0;
    __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "pygrib.pyx":1683
 *             y = llcrnry+dy*np.arange(ny)
 *             x, y = np.meshgrid(x, y)
 *             lons, lats = pj(x, y, inverse=True)             # <<<<<<<<<<<<<<
 *         elif self['gridType'] =='albers':
 *             lat1 = self['latitudeOfFirstGridPointInDegrees']
 */
    __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1683, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_v_x);
    __Pyx_GIVEREF(__pyx_v_x);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_x);
    __Pyx_INCREF(__pyx_v_y);
    __Pyx_GIVEREF(__pyx_v_y);
    PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_y);
    __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1683, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_inverse, Py_True) < 0) __PYX_ERR(0, 1683, __pyx_L1_error)
    __pyx_t_7 = __Pyx_PyObject_Call(__pyx_v_pj, __pyx_t_5, __pyx_t_3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1683, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if ((likely(PyTuple_CheckExact(__pyx_t_7))) || (PyList_CheckExact(__pyx_t_7))) {
      PyObject* sequence = __pyx_t_7;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 1683, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_3 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_5 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_5);
      #else
      __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1683, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1683, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      #endif
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_4 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1683, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_8 = Py_TYPE(__pyx_t_4)->tp_iternext;
      index = 0; __pyx_t_3 = __pyx_t_8(__pyx_t_4); if (unlikely(!__pyx_t_3)) goto __pyx_L73_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_3);
      index = 1; __pyx_t_5 = __pyx_t_8(__pyx_t_4); if (unlikely(!__pyx_t_5)) goto __pyx_L73_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_5);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_4), 2) < 0) __PYX_ERR(0, 1683, __pyx_L1_error)
      __pyx_t_8 = NULL;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      goto __pyx_L74_unpacking_done;
      __pyx_L73_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_8 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 1683, __pyx_L1_error)
      __pyx_L74_unpacking_done:;
    }
    __pyx_v_lons = __pyx_t_3;
    __pyx_t_3 = 0;
    __pyx_v_lats = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "pygrib.pyx":1667
 *             x, y = np.meshgrid(x, y)
 *             lons, lats = pj(x, y, inverse=True)
 *         elif self['gridType'] == 'lambert':             # <<<<<<<<<<<<<<
 *             lat1 = self['latitudeOfFirstGridPointInDegrees']
 *             lon1 = self['longitudeOfFirstGridPointInDegrees']
 */
    goto __pyx_L4;
  }

  /* "pygrib.pyx":1684
 *             x, y = np.meshgrid(x, y)
 *             lons, lats = pj(x, y, inverse=True)
 *         elif self['gridType'] =='albers':             # <<<<<<<<<<<<<<
 *             lat1 = self['latitudeOfFirstGridPointInDegrees']
 *             lon1 = self['longitudeOfFirstGridPointInDegrees']
 */
  __pyx_t_7 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_gridType); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1684, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_t_7, __pyx_n_s_albers, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1684, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (__pyx_t_1) {

    /* "pygrib.pyx":1685
 *             lons, lats = pj(x, y, inverse=True)
 *         elif self['gridType'] =='albers':
 *             lat1 = self['latitudeOfFirstGridPointInDegrees']             # <<<<<<<<<<<<<<
 *             lon1 = self['longitudeOfFirstGridPointInDegrees']
 *             try:
 */
    __pyx_t_7 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_latitudeOfFirstGridPointInDegree); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1685, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_v_lat1 = __pyx_t_7;
    __pyx_t_7 = 0;

    /* "pygrib.pyx":1686
 *         elif self['gridType'] =='albers':
 *             lat1 = self['latitudeOfFirstGridPointInDegrees']
 *             lon1 = self['longitudeOfFirstGridPointInDegrees']             # <<<<<<<<<<<<<<
 *             try:
 *                 nx = self['Nx']
 */
    __pyx_t_7 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_longitudeOfFirstGridPointInDegre); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1686, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_v_lon1 = __pyx_t_7;
    __pyx_t_7 = 0;

    /* "pygrib.pyx":1687
 *             lat1 = self['latitudeOfFirstGridPointInDegrees']
 *             lon1 = self['longitudeOfFirstGridPointInDegrees']
 *             try:             # <<<<<<<<<<<<<<
 *                 nx = self['Nx']
 *                 ny = self['Ny']
 */
    {
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __Pyx_ExceptionSave(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
      __Pyx_XGOTREF(__pyx_t_9);
      __Pyx_XGOTREF(__pyx_t_10);
      __Pyx_XGOTREF(__pyx_t_11);
      /*try:*/ {

        /* "pygrib.pyx":1688
 *             lon1 = self['longitudeOfFirstGridPointInDegrees']
 *             try:
 *                 nx = self['Nx']             # <<<<<<<<<<<<<<
 *                 ny = self['Ny']
 *             except:
 */
        __pyx_t_7 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_Nx); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1688, __pyx_L75_error)
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_v_nx = __pyx_t_7;
        __pyx_t_7 = 0;

        /* "pygrib.pyx":1689
 *             try:
 *                 nx = self['Nx']
 *                 ny = self['Ny']             # <<<<<<<<<<<<<<
 *             except:
 *                 nx = self['Ni']
 */
        __pyx_t_7 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_Ny); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1689, __pyx_L75_error)
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_v_ny = __pyx_t_7;
        __pyx_t_7 = 0;

        /* "pygrib.pyx":1687
 *             lat1 = self['latitudeOfFirstGridPointInDegrees']
 *             lon1 = self['longitudeOfFirstGridPointInDegrees']
 *             try:             # <<<<<<<<<<<<<<
 *                 nx = self['Nx']
 *                 ny = self['Ny']
 */
      }
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      goto __pyx_L80_try_end;
      __pyx_L75_error:;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;

      /* "pygrib.pyx":1690
 *                 nx = self['Nx']
 *                 ny = self['Ny']
 *             except:             # <<<<<<<<<<<<<<
 *                 nx = self['Ni']
 *                 ny = self['Nj']
 */
      /*except:*/ {
        __Pyx_AddTraceback("pygrib.gribmessage.latlons", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_5, &__pyx_t_3) < 0) __PYX_ERR(0, 1690, __pyx_L77_except_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_GOTREF(__pyx_t_3);

        /* "pygrib.pyx":1691
 *                 ny = self['Ny']
 *             except:
 *                 nx = self['Ni']             # <<<<<<<<<<<<<<
 *                 ny = self['Nj']
 *             dx = self['Dx']/1000.
 */
        __pyx_t_4 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_Ni); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1691, __pyx_L77_except_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_XDECREF_SET(__pyx_v_nx, __pyx_t_4);
        __pyx_t_4 = 0;

        /* "pygrib.pyx":1692
 *             except:
 *                 nx = self['Ni']
 *                 ny = self['Nj']             # <<<<<<<<<<<<<<
 *             dx = self['Dx']/1000.
 *             dy = self['Dy']/1000.
 */
        __pyx_t_4 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_Nj); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1692, __pyx_L77_except_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_XDECREF_SET(__pyx_v_ny, __pyx_t_4);
        __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        goto __pyx_L76_exception_handled;
      }
      __pyx_L77_except_error:;

      /* "pygrib.pyx":1687
 *             lat1 = self['latitudeOfFirstGridPointInDegrees']
 *             lon1 = self['longitudeOfFirstGridPointInDegrees']
 *             try:             # <<<<<<<<<<<<<<
 *                 nx = self['Nx']
 *                 ny = self['Ny']
 */
      __Pyx_XGIVEREF(__pyx_t_9);
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11);
      goto __pyx_L1_error;
      __pyx_L76_exception_handled:;
      __Pyx_XGIVEREF(__pyx_t_9);
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11);
      __pyx_L80_try_end:;
    }

    /* "pygrib.pyx":1693
 *                 nx = self['Ni']
 *                 ny = self['Nj']
 *             dx = self['Dx']/1000.             # <<<<<<<<<<<<<<
 *             dy = self['Dy']/1000.
 *             scale = float(self['grib2divider'])
 */
    __pyx_t_3 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_Dx); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1693, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = __Pyx_PyFloat_DivideObjC(__pyx_t_3, __pyx_float_1000_, 1000., 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1693, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_dx = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "pygrib.pyx":1694
 *                 ny = self['Nj']
 *             dx = self['Dx']/1000.
 *             dy = self['Dy']/1000.             # <<<<<<<<<<<<<<
 *             scale = float(self['grib2divider'])
 *             pj = pyproj.Proj(self.projparams)
 */
    __pyx_t_5 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_Dy); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1694, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_3 = __Pyx_PyFloat_DivideObjC(__pyx_t_5, __pyx_float_1000_, 1000., 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1694, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_v_dy = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "pygrib.pyx":1695
 *             dx = self['Dx']/1000.
 *             dy = self['Dy']/1000.
 *             scale = float(self['grib2divider'])             # <<<<<<<<<<<<<<
 *             pj = pyproj.Proj(self.projparams)
 *             llcrnrx, llcrnry = pj(lon1,lat1)
 */
    __pyx_t_3 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_grib2divider); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1695, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = __Pyx_PyNumber_Float(__pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1695, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_scale = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "pygrib.pyx":1696
 *             dy = self['Dy']/1000.
 *             scale = float(self['grib2divider'])
 *             pj = pyproj.Proj(self.projparams)             # <<<<<<<<<<<<<<
 *             llcrnrx, llcrnry = pj(lon1,lat1)
 *             x = llcrnrx+dx*np.arange(nx)
 */
    __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_pyproj); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1696, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_Proj); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1696, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_7);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_7, function);
      }
    }
    if (!__pyx_t_3) {
      __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_v_self->projparams); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1696, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_7)) {
        PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_self->projparams};
        __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1696, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_GOTREF(__pyx_t_5);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) {
        PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_self->projparams};
        __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1696, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_GOTREF(__pyx_t_5);
      } else
      #endif
      {
        __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1696, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __pyx_t_3 = NULL;
        __Pyx_INCREF(__pyx_v_self->projparams);
        __Pyx_GIVEREF(__pyx_v_self->projparams);
        PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_self->projparams);
        __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1696, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_v_pj = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "pygrib.pyx":1697
 *             scale = float(self['grib2divider'])
 *             pj = pyproj.Proj(self.projparams)
 *             llcrnrx, llcrnry = pj(lon1,lat1)             # <<<<<<<<<<<<<<
 *             x = llcrnrx+dx*np.arange(nx)
 *             y = llcrnry+dy*np.arange(ny)
 */
    __Pyx_INCREF(__pyx_v_pj);
    __pyx_t_7 = __pyx_v_pj; __pyx_t_4 = NULL;
    __pyx_t_6 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_7);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_7, function);
        __pyx_t_6 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_7)) {
      PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_lon1, __pyx_v_lat1};
      __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1697, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_5);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) {
      PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_lon1, __pyx_v_lat1};
      __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1697, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_5);
    } else
    #endif
    {
      __pyx_t_3 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1697, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (__pyx_t_4) {
        __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4); __pyx_t_4 = NULL;
      }
      __Pyx_INCREF(__pyx_v_lon1);
      __Pyx_GIVEREF(__pyx_v_lon1);
      PyTuple_SET_ITEM(__pyx_t_3, 0+__pyx_t_6, __pyx_v_lon1);
      __Pyx_INCREF(__pyx_v_lat1);
      __Pyx_GIVEREF(__pyx_v_lat1);
      PyTuple_SET_ITEM(__pyx_t_3, 1+__pyx_t_6, __pyx_v_lat1);
      __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1697, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if ((likely(PyTuple_CheckExact(__pyx_t_5))) || (PyList_CheckExact(__pyx_t_5))) {
      PyObject* sequence = __pyx_t_5;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 1697, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_7 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_7 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_3 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_3);
      #else
      __pyx_t_7 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1697, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1697, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      #endif
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_4 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1697, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_8 = Py_TYPE(__pyx_t_4)->tp_iternext;
      index = 0; __pyx_t_7 = __pyx_t_8(__pyx_t_4); if (unlikely(!__pyx_t_7)) goto __pyx_L83_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_7);
      index = 1; __pyx_t_3 = __pyx_t_8(__pyx_t_4); if (unlikely(!__pyx_t_3)) goto __pyx_L83_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_3);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_4), 2) < 0) __PYX_ERR(0, 1697, __pyx_L1_error)
      __pyx_t_8 = NULL;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      goto __pyx_L84_unpacking_done;
      __pyx_L83_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_8 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 1697, __pyx_L1_error)
      __pyx_L84_unpacking_done:;
    }
    __pyx_v_llcrnrx = __pyx_t_7;
    __pyx_t_7 = 0;
    __pyx_v_llcrnry = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "pygrib.pyx":1698
 *             pj = pyproj.Proj(self.projparams)
 *             llcrnrx, llcrnry = pj(lon1,lat1)
 *             x = llcrnrx+dx*np.arange(nx)             # <<<<<<<<<<<<<<
 *             y = llcrnry+dy*np.arange(ny)
 *             x, y = np.meshgrid(x, y)
 */
    __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1698, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_arange); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1698, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_7);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_7, function);
      }
    }
    if (!__pyx_t_3) {
      __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_v_nx); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1698, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_7)) {
        PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_nx};
        __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1698, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_GOTREF(__pyx_t_5);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) {
        PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_nx};
        __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1698, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_GOTREF(__pyx_t_5);
      } else
      #endif
      {
        __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1698, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __pyx_t_3 = NULL;
        __Pyx_INCREF(__pyx_v_nx);
        __Pyx_GIVEREF(__pyx_v_nx);
        PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_nx);
        __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1698, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = PyNumber_Multiply(__pyx_v_dx, __pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1698, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = PyNumber_Add(__pyx_v_llcrnrx, __pyx_t_7); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1698, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_v_x = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "pygrib.pyx":1699
 *             llcrnrx, llcrnry = pj(lon1,lat1)
 *             x = llcrnrx+dx*np.arange(nx)
 *             y = llcrnry+dy*np.arange(ny)             # <<<<<<<<<<<<<<
 *             x, y = np.meshgrid(x, y)
 *             lons, lats = pj(x, y, inverse=True)
 */
    __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1699, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_arange); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1699, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_7)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    if (!__pyx_t_7) {
      __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_ny); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1699, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_4)) {
        PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_v_ny};
        __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1699, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_GOTREF(__pyx_t_5);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
        PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_v_ny};
        __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1699, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_GOTREF(__pyx_t_5);
      } else
      #endif
      {
        __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1699, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_7); __pyx_t_7 = NULL;
        __Pyx_INCREF(__pyx_v_ny);
        __Pyx_GIVEREF(__pyx_v_ny);
        PyTuple_SET_ITEM(__pyx_t_3, 0+1, __pyx_v_ny);
        __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1699, __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;
    __pyx_t_4 = PyNumber_Multiply(__pyx_v_dy, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1699, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = PyNumber_Add(__pyx_v_llcrnry, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1699, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_v_y = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "pygrib.pyx":1700
 *             x = llcrnrx+dx*np.arange(nx)
 *             y = llcrnry+dy*np.arange(ny)
 *             x, y = np.meshgrid(x, y)             # <<<<<<<<<<<<<<
 *             lons, lats = pj(x, y, inverse=True)
 *         elif self['gridType'] == 'space_view':
 */
    __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1700, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_meshgrid); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1700, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = NULL;
    __pyx_t_6 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
        __pyx_t_6 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_x, __pyx_v_y};
      __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1700, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_5);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_x, __pyx_v_y};
      __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1700, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_5);
    } else
    #endif
    {
      __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1700, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      if (__pyx_t_4) {
        __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_4); __pyx_t_4 = NULL;
      }
      __Pyx_INCREF(__pyx_v_x);
      __Pyx_GIVEREF(__pyx_v_x);
      PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_v_x);
      __Pyx_INCREF(__pyx_v_y);
      __Pyx_GIVEREF(__pyx_v_y);
      PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_v_y);
      __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_7, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1700, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if ((likely(PyTuple_CheckExact(__pyx_t_5))) || (PyList_CheckExact(__pyx_t_5))) {
      PyObject* sequence = __pyx_t_5;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 1700, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_7 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_3 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_7 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_7);
      #else
      __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1700, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_7 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1700, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      #endif
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_4 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1700, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_8 = Py_TYPE(__pyx_t_4)->tp_iternext;
      index = 0; __pyx_t_3 = __pyx_t_8(__pyx_t_4); if (unlikely(!__pyx_t_3)) goto __pyx_L85_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_3);
      index = 1; __pyx_t_7 = __pyx_t_8(__pyx_t_4); if (unlikely(!__pyx_t_7)) goto __pyx_L85_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_7);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_4), 2) < 0) __PYX_ERR(0, 1700, __pyx_L1_error)
      __pyx_t_8 = NULL;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      goto __pyx_L86_unpacking_done;
      __pyx_L85_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_8 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 1700, __pyx_L1_error)
      __pyx_L86_unpacking_done:;
    }
    __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_3);
    __pyx_t_3 = 0;
    __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_7);
    __pyx_t_7 = 0;

    /* "pygrib.pyx":1701
 *             y = llcrnry+dy*np.arange(ny)
 *             x, y = np.meshgrid(x, y)
 *             lons, lats = pj(x, y, inverse=True)             # <<<<<<<<<<<<<<
 *         elif self['gridType'] == 'space_view':
 *             try:
 */
    __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1701, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_v_x);
    __Pyx_GIVEREF(__pyx_v_x);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_x);
    __Pyx_INCREF(__pyx_v_y);
    __Pyx_GIVEREF(__pyx_v_y);
    PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_y);
    __pyx_t_7 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1701, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_inverse, Py_True) < 0) __PYX_ERR(0, 1701, __pyx_L1_error)
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_v_pj, __pyx_t_5, __pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1701, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) {
      PyObject* sequence = __pyx_t_3;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 1701, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_7 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_7 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_5 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_5);
      #else
      __pyx_t_7 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1701, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1701, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      #endif
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_4 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1701, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_8 = Py_TYPE(__pyx_t_4)->tp_iternext;
      index = 0; __pyx_t_7 = __pyx_t_8(__pyx_t_4); if (unlikely(!__pyx_t_7)) goto __pyx_L87_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_7);
      index = 1; __pyx_t_5 = __pyx_t_8(__pyx_t_4); if (unlikely(!__pyx_t_5)) goto __pyx_L87_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_5);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_4), 2) < 0) __PYX_ERR(0, 1701, __pyx_L1_error)
      __pyx_t_8 = NULL;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      goto __pyx_L88_unpacking_done;
      __pyx_L87_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_8 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 1701, __pyx_L1_error)
      __pyx_L88_unpacking_done:;
    }
    __pyx_v_lons = __pyx_t_7;
    __pyx_t_7 = 0;
    __pyx_v_lats = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "pygrib.pyx":1684
 *             x, y = np.meshgrid(x, y)
 *             lons, lats = pj(x, y, inverse=True)
 *         elif self['gridType'] =='albers':             # <<<<<<<<<<<<<<
 *             lat1 = self['latitudeOfFirstGridPointInDegrees']
 *             lon1 = self['longitudeOfFirstGridPointInDegrees']
 */
    goto __pyx_L4;
  }

  /* "pygrib.pyx":1702
 *             x, y = np.meshgrid(x, y)
 *             lons, lats = pj(x, y, inverse=True)
 *         elif self['gridType'] == 'space_view':             # <<<<<<<<<<<<<<
 *             try:
 *                 nx = self['Nx']
 */
  __pyx_t_3 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_gridType); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1702, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_t_3, __pyx_n_s_space_view, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1702, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__pyx_t_1) {

    /* "pygrib.pyx":1703
 *             lons, lats = pj(x, y, inverse=True)
 *         elif self['gridType'] == 'space_view':
 *             try:             # <<<<<<<<<<<<<<
 *                 nx = self['Nx']
 *                 ny = self['Ny']
 */
    {
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __Pyx_ExceptionSave(&__pyx_t_11, &__pyx_t_10, &__pyx_t_9);
      __Pyx_XGOTREF(__pyx_t_11);
      __Pyx_XGOTREF(__pyx_t_10);
      __Pyx_XGOTREF(__pyx_t_9);
      /*try:*/ {

        /* "pygrib.pyx":1704
 *         elif self['gridType'] == 'space_view':
 *             try:
 *                 nx = self['Nx']             # <<<<<<<<<<<<<<
 *                 ny = self['Ny']
 *             except:
 */
        __pyx_t_3 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_Nx); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1704, __pyx_L89_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_v_nx = __pyx_t_3;
        __pyx_t_3 = 0;

        /* "pygrib.pyx":1705
 *             try:
 *                 nx = self['Nx']
 *                 ny = self['Ny']             # <<<<<<<<<<<<<<
 *             except:
 *                 nx = self['Ni']
 */
        __pyx_t_3 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_Ny); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1705, __pyx_L89_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_v_ny = __pyx_t_3;
        __pyx_t_3 = 0;

        /* "pygrib.pyx":1703
 *             lons, lats = pj(x, y, inverse=True)
 *         elif self['gridType'] == 'space_view':
 *             try:             # <<<<<<<<<<<<<<
 *                 nx = self['Nx']
 *                 ny = self['Ny']
 */
      }
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      goto __pyx_L94_try_end;
      __pyx_L89_error:;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "pygrib.pyx":1706
 *                 nx = self['Nx']
 *                 ny = self['Ny']
 *             except:             # <<<<<<<<<<<<<<
 *                 nx = self['Ni']
 *                 ny = self['Nj']
 */
      /*except:*/ {
        __Pyx_AddTraceback("pygrib.gribmessage.latlons", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_5, &__pyx_t_7) < 0) __PYX_ERR(0, 1706, __pyx_L91_except_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_GOTREF(__pyx_t_7);

        /* "pygrib.pyx":1707
 *                 ny = self['Ny']
 *             except:
 *                 nx = self['Ni']             # <<<<<<<<<<<<<<
 *                 ny = self['Nj']
 *             # general case of 'near-side perspective projection' (untested)
 */
        __pyx_t_4 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_Ni); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1707, __pyx_L91_except_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_XDECREF_SET(__pyx_v_nx, __pyx_t_4);
        __pyx_t_4 = 0;

        /* "pygrib.pyx":1708
 *             except:
 *                 nx = self['Ni']
 *                 ny = self['Nj']             # <<<<<<<<<<<<<<
 *             # general case of 'near-side perspective projection' (untested)
 *             if self.projparams['proj'] == 'nsper' and \
 */
        __pyx_t_4 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_Nj); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1708, __pyx_L91_except_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_XDECREF_SET(__pyx_v_ny, __pyx_t_4);
        __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        goto __pyx_L90_exception_handled;
      }
      __pyx_L91_except_error:;

      /* "pygrib.pyx":1703
 *             lons, lats = pj(x, y, inverse=True)
 *         elif self['gridType'] == 'space_view':
 *             try:             # <<<<<<<<<<<<<<
 *                 nx = self['Nx']
 *                 ny = self['Ny']
 */
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_XGIVEREF(__pyx_t_9);
      __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_10, __pyx_t_9);
      goto __pyx_L1_error;
      __pyx_L90_exception_handled:;
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_XGIVEREF(__pyx_t_9);
      __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_10, __pyx_t_9);
      __pyx_L94_try_end:;
    }

    /* "pygrib.pyx":1710
 *                 ny = self['Nj']
 *             # general case of 'near-side perspective projection' (untested)
 *             if self.projparams['proj'] == 'nsper' and \             # <<<<<<<<<<<<<<
 *                self.projparams['a'] != self.projparams['b']:
 *                 raise ValueError('unsupported grid - earth not a perfect sphere')
 */
    __pyx_t_7 = __Pyx_PyObject_Dict_GetItem(__pyx_v_self->projparams, __pyx_n_s_proj); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1710, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_2 = (__Pyx_PyString_Equals(__pyx_t_7, __pyx_n_s_nsper, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 1710, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (__pyx_t_2) {
    } else {
      __pyx_t_1 = __pyx_t_2;
      goto __pyx_L98_bool_binop_done;
    }

    /* "pygrib.pyx":1711
 *             # general case of 'near-side perspective projection' (untested)
 *             if self.projparams['proj'] == 'nsper' and \
 *                self.projparams['a'] != self.projparams['b']:             # <<<<<<<<<<<<<<
 *                 raise ValueError('unsupported grid - earth not a perfect sphere')
 *             scale = float(self['grib2divider'])
 */
    __pyx_t_7 = __Pyx_PyObject_Dict_GetItem(__pyx_v_self->projparams, __pyx_n_s_a); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1711, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_5 = __Pyx_PyObject_Dict_GetItem(__pyx_v_self->projparams, __pyx_n_s_b); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1711, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_3 = PyObject_RichCompare(__pyx_t_7, __pyx_t_5, Py_NE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1711, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 1711, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_1 = __pyx_t_2;
    __pyx_L98_bool_binop_done:;

    /* "pygrib.pyx":1710
 *                 ny = self['Nj']
 *             # general case of 'near-side perspective projection' (untested)
 *             if self.projparams['proj'] == 'nsper' and \             # <<<<<<<<<<<<<<
 *                self.projparams['a'] != self.projparams['b']:
 *                 raise ValueError('unsupported grid - earth not a perfect sphere')
 */
    if (unlikely(__pyx_t_1)) {

      /* "pygrib.pyx":1712
 *             if self.projparams['proj'] == 'nsper' and \
 *                self.projparams['a'] != self.projparams['b']:
 *                 raise ValueError('unsupported grid - earth not a perfect sphere')             # <<<<<<<<<<<<<<
 *             scale = float(self['grib2divider'])
 *             # latitude of horizon on central meridian
 */
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__99, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1712, __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_ERR(0, 1712, __pyx_L1_error)

      /* "pygrib.pyx":1710
 *                 ny = self['Nj']
 *             # general case of 'near-side perspective projection' (untested)
 *             if self.projparams['proj'] == 'nsper' and \             # <<<<<<<<<<<<<<
 *                self.projparams['a'] != self.projparams['b']:
 *                 raise ValueError('unsupported grid - earth not a perfect sphere')
 */
    }

    /* "pygrib.pyx":1713
 *                self.projparams['a'] != self.projparams['b']:
 *                 raise ValueError('unsupported grid - earth not a perfect sphere')
 *             scale = float(self['grib2divider'])             # <<<<<<<<<<<<<<
 *             # latitude of horizon on central meridian
 *             lon_0=self.projparams['lon_0']; lat_0=self.projparams['lat_0']
 */
    __pyx_t_3 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_grib2divider); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1713, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = __Pyx_PyNumber_Float(__pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1713, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_scale = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "pygrib.pyx":1715
 *             scale = float(self['grib2divider'])
 *             # latitude of horizon on central meridian
 *             lon_0=self.projparams['lon_0']; lat_0=self.projparams['lat_0']             # <<<<<<<<<<<<<<
 *             lonmax =\
 *             lon_0+90.-(180./np.pi)*np.arcsin(scale/self['Nr'])
 */
    __pyx_t_5 = __Pyx_PyObject_Dict_GetItem(__pyx_v_self->projparams, __pyx_n_s_lon_0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1715, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_v_lon_0 = __pyx_t_5;
    __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_PyObject_Dict_GetItem(__pyx_v_self->projparams, __pyx_n_s_lat_0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1715, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_v_lat_0 = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "pygrib.pyx":1717
 *             lon_0=self.projparams['lon_0']; lat_0=self.projparams['lat_0']
 *             lonmax =\
 *             lon_0+90.-(180./np.pi)*np.arcsin(scale/self['Nr'])             # <<<<<<<<<<<<<<
 *             # longitude of horizon on equator
 *             latmax =\
 */
    __pyx_t_5 = __Pyx_PyFloat_AddObjC(__pyx_v_lon_0, __pyx_float_90_, 90., 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1717, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1717, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_pi); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1717, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyFloat_DivideCObj(__pyx_float_180_, __pyx_t_7, 180., 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1717, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1717, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_arcsin); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1717, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_Nr); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1717, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_13 = __Pyx_PyNumber_Divide(__pyx_v_scale, __pyx_t_4); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1717, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_13);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_12))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_12);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_12, function);
      }
    }
    if (!__pyx_t_4) {
      __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_t_12, __pyx_t_13); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1717, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      __Pyx_GOTREF(__pyx_t_7);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_12)) {
        PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_t_13};
        __pyx_t_7 = __Pyx_PyFunction_FastCall(__pyx_t_12, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1717, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_12)) {
        PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_t_13};
        __pyx_t_7 = __Pyx_PyCFunction_FastCall(__pyx_t_12, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1717, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      } else
      #endif
      {
        __pyx_t_14 = PyTuple_New(1+1); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1717, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_14);
        __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_4); __pyx_t_4 = NULL;
        __Pyx_GIVEREF(__pyx_t_13);
        PyTuple_SET_ITEM(__pyx_t_14, 0+1, __pyx_t_13);
        __pyx_t_13 = 0;
        __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_12, __pyx_t_14, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1717, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __pyx_t_12 = PyNumber_Multiply(__pyx_t_3, __pyx_t_7); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1717, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = PyNumber_Subtract(__pyx_t_5, __pyx_t_12); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1717, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __pyx_v_lonmax = __pyx_t_7;
    __pyx_t_7 = 0;

    /* "pygrib.pyx":1720
 *             # longitude of horizon on equator
 *             latmax =\
 *             lat_0+90.-(180./np.pi)*np.arcsin(scale/self['Nr'])             # <<<<<<<<<<<<<<
 *             # truncate to nearest thousandth of a degree (to make sure
 *             # they aren't slightly over the horizon)
 */
    __pyx_t_7 = __Pyx_PyFloat_AddObjC(__pyx_v_lat_0, __pyx_float_90_, 90., 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1720, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_12 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1720, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_pi); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1720, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __pyx_t_12 = __Pyx_PyFloat_DivideCObj(__pyx_float_180_, __pyx_t_5, 180., 0); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1720, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1720, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_arcsin); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1720, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_Nr); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1720, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_13 = __Pyx_PyNumber_Divide(__pyx_v_scale, __pyx_t_3); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1720, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_13);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_14))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_14);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_14);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_14, function);
      }
    }
    if (!__pyx_t_3) {
      __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_14, __pyx_t_13); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1720, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      __Pyx_GOTREF(__pyx_t_5);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_14)) {
        PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_13};
        __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_14, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1720, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_14)) {
        PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_13};
        __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_14, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1720, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      } else
      #endif
      {
        __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1720, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __pyx_t_3 = NULL;
        __Pyx_GIVEREF(__pyx_t_13);
        PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_t_13);
        __pyx_t_13 = 0;
        __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_14, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1720, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    __pyx_t_14 = PyNumber_Multiply(__pyx_t_12, __pyx_t_5); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1720, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = PyNumber_Subtract(__pyx_t_7, __pyx_t_14); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1720, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    __pyx_v_latmax = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "pygrib.pyx":1723
 *             # truncate to nearest thousandth of a degree (to make sure
 *             # they aren't slightly over the horizon)
 *             latmax = int(1000*latmax)/1000.             # <<<<<<<<<<<<<<
 *             lonmax = int(1000*lonmax)/1000.
 *             pj = pyproj.Proj(self.projparams)
 */
    __pyx_t_5 = PyNumber_Multiply(__pyx_int_1000, __pyx_v_latmax); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1723, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_14 = __Pyx_PyNumber_Int(__pyx_t_5); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1723, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_PyFloat_DivideObjC(__pyx_t_14, __pyx_float_1000_, 1000., 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1723, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    __Pyx_DECREF_SET(__pyx_v_latmax, __pyx_t_5);
    __pyx_t_5 = 0;

    /* "pygrib.pyx":1724
 *             # they aren't slightly over the horizon)
 *             latmax = int(1000*latmax)/1000.
 *             lonmax = int(1000*lonmax)/1000.             # <<<<<<<<<<<<<<
 *             pj = pyproj.Proj(self.projparams)
 *             x1,y1 = pj(lon_0,latmax); x2,y2 = pj(lonmax,lat_0)
 */
    __pyx_t_5 = PyNumber_Multiply(__pyx_int_1000, __pyx_v_lonmax); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1724, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_14 = __Pyx_PyNumber_Int(__pyx_t_5); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1724, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_PyFloat_DivideObjC(__pyx_t_14, __pyx_float_1000_, 1000., 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1724, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    __Pyx_DECREF_SET(__pyx_v_lonmax, __pyx_t_5);
    __pyx_t_5 = 0;

    /* "pygrib.pyx":1725
 *             latmax = int(1000*latmax)/1000.
 *             lonmax = int(1000*lonmax)/1000.
 *             pj = pyproj.Proj(self.projparams)             # <<<<<<<<<<<<<<
 *             x1,y1 = pj(lon_0,latmax); x2,y2 = pj(lonmax,lat_0)
 *             width = 2*x2; height = 2*y1
 */
    __pyx_t_14 = __Pyx_GetModuleGlobalName(__pyx_n_s_pyproj); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1725, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_14, __pyx_n_s_Proj); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1725, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    __pyx_t_14 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_7);
      if (likely(__pyx_t_14)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_14);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_7, function);
      }
    }
    if (!__pyx_t_14) {
      __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_v_self->projparams); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1725, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_7)) {
        PyObject *__pyx_temp[2] = {__pyx_t_14, __pyx_v_self->projparams};
        __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1725, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
        __Pyx_GOTREF(__pyx_t_5);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) {
        PyObject *__pyx_temp[2] = {__pyx_t_14, __pyx_v_self->projparams};
        __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1725, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
        __Pyx_GOTREF(__pyx_t_5);
      } else
      #endif
      {
        __pyx_t_12 = PyTuple_New(1+1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1725, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_12);
        __Pyx_GIVEREF(__pyx_t_14); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_14); __pyx_t_14 = NULL;
        __Pyx_INCREF(__pyx_v_self->projparams);
        __Pyx_GIVEREF(__pyx_v_self->projparams);
        PyTuple_SET_ITEM(__pyx_t_12, 0+1, __pyx_v_self->projparams);
        __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_12, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1725, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_v_pj = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "pygrib.pyx":1726
 *             lonmax = int(1000*lonmax)/1000.
 *             pj = pyproj.Proj(self.projparams)
 *             x1,y1 = pj(lon_0,latmax); x2,y2 = pj(lonmax,lat_0)             # <<<<<<<<<<<<<<
 *             width = 2*x2; height = 2*y1
 *             dx = width/self['dx']
 */
    __Pyx_INCREF(__pyx_v_pj);
    __pyx_t_7 = __pyx_v_pj; __pyx_t_12 = NULL;
    __pyx_t_6 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_7);
      if (likely(__pyx_t_12)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_12);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_7, function);
        __pyx_t_6 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_7)) {
      PyObject *__pyx_temp[3] = {__pyx_t_12, __pyx_v_lon_0, __pyx_v_latmax};
      __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1726, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_GOTREF(__pyx_t_5);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) {
      PyObject *__pyx_temp[3] = {__pyx_t_12, __pyx_v_lon_0, __pyx_v_latmax};
      __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1726, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_GOTREF(__pyx_t_5);
    } else
    #endif
    {
      __pyx_t_14 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1726, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_14);
      if (__pyx_t_12) {
        __Pyx_GIVEREF(__pyx_t_12); PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_12); __pyx_t_12 = NULL;
      }
      __Pyx_INCREF(__pyx_v_lon_0);
      __Pyx_GIVEREF(__pyx_v_lon_0);
      PyTuple_SET_ITEM(__pyx_t_14, 0+__pyx_t_6, __pyx_v_lon_0);
      __Pyx_INCREF(__pyx_v_latmax);
      __Pyx_GIVEREF(__pyx_v_latmax);
      PyTuple_SET_ITEM(__pyx_t_14, 1+__pyx_t_6, __pyx_v_latmax);
      __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_14, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1726, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    }
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if ((likely(PyTuple_CheckExact(__pyx_t_5))) || (PyList_CheckExact(__pyx_t_5))) {
      PyObject* sequence = __pyx_t_5;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 1726, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_7 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_14 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_7 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_14 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_14);
      #else
      __pyx_t_7 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1726, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_14 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1726, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_14);
      #endif
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_12 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1726, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_8 = Py_TYPE(__pyx_t_12)->tp_iternext;
      index = 0; __pyx_t_7 = __pyx_t_8(__pyx_t_12); if (unlikely(!__pyx_t_7)) goto __pyx_L100_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_7);
      index = 1; __pyx_t_14 = __pyx_t_8(__pyx_t_12); if (unlikely(!__pyx_t_14)) goto __pyx_L100_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_14);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_12), 2) < 0) __PYX_ERR(0, 1726, __pyx_L1_error)
      __pyx_t_8 = NULL;
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      goto __pyx_L101_unpacking_done;
      __pyx_L100_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __pyx_t_8 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 1726, __pyx_L1_error)
      __pyx_L101_unpacking_done:;
    }
    __pyx_v_x1 = __pyx_t_7;
    __pyx_t_7 = 0;
    __pyx_v_y1 = __pyx_t_14;
    __pyx_t_14 = 0;
    __Pyx_INCREF(__pyx_v_pj);
    __pyx_t_14 = __pyx_v_pj; __pyx_t_7 = NULL;
    __pyx_t_6 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_14))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_14);
      if (likely(__pyx_t_7)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_14);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_14, function);
        __pyx_t_6 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_14)) {
      PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_v_lonmax, __pyx_v_lat_0};
      __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_14, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1726, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_GOTREF(__pyx_t_5);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_14)) {
      PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_v_lonmax, __pyx_v_lat_0};
      __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_14, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1726, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_GOTREF(__pyx_t_5);
    } else
    #endif
    {
      __pyx_t_12 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1726, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      if (__pyx_t_7) {
        __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_7); __pyx_t_7 = NULL;
      }
      __Pyx_INCREF(__pyx_v_lonmax);
      __Pyx_GIVEREF(__pyx_v_lonmax);
      PyTuple_SET_ITEM(__pyx_t_12, 0+__pyx_t_6, __pyx_v_lonmax);
      __Pyx_INCREF(__pyx_v_lat_0);
      __Pyx_GIVEREF(__pyx_v_lat_0);
      PyTuple_SET_ITEM(__pyx_t_12, 1+__pyx_t_6, __pyx_v_lat_0);
      __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_14, __pyx_t_12, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1726, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    }
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    if ((likely(PyTuple_CheckExact(__pyx_t_5))) || (PyList_CheckExact(__pyx_t_5))) {
      PyObject* sequence = __pyx_t_5;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 1726, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_14 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_12 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_14 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_12 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_14);
      __Pyx_INCREF(__pyx_t_12);
      #else
      __pyx_t_14 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1726, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_14);
      __pyx_t_12 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1726, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      #endif
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_7 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1726, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext;
      index = 0; __pyx_t_14 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_14)) goto __pyx_L102_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_14);
      index = 1; __pyx_t_12 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_12)) goto __pyx_L102_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_12);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < 0) __PYX_ERR(0, 1726, __pyx_L1_error)
      __pyx_t_8 = NULL;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L103_unpacking_done;
      __pyx_L102_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_8 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 1726, __pyx_L1_error)
      __pyx_L103_unpacking_done:;
    }
    __pyx_v_x2 = __pyx_t_14;
    __pyx_t_14 = 0;
    __pyx_v_y2 = __pyx_t_12;
    __pyx_t_12 = 0;

    /* "pygrib.pyx":1727
 *             pj = pyproj.Proj(self.projparams)
 *             x1,y1 = pj(lon_0,latmax); x2,y2 = pj(lonmax,lat_0)
 *             width = 2*x2; height = 2*y1             # <<<<<<<<<<<<<<
 *             dx = width/self['dx']
 *             dy = height/self['dy']
 */
    __pyx_t_5 = PyNumber_Multiply(__pyx_int_2, __pyx_v_x2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1727, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_v_width = __pyx_t_5;
    __pyx_t_5 = 0;
    __pyx_t_5 = PyNumber_Multiply(__pyx_int_2, __pyx_v_y1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1727, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_v_height = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "pygrib.pyx":1728
 *             x1,y1 = pj(lon_0,latmax); x2,y2 = pj(lonmax,lat_0)
 *             width = 2*x2; height = 2*y1
 *             dx = width/self['dx']             # <<<<<<<<<<<<<<
 *             dy = height/self['dy']
 *             xmax = dx*(nx-1); ymax = dy*(ny-1)
 */
    __pyx_t_5 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_dx); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1728, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_12 = __Pyx_PyNumber_Divide(__pyx_v_width, __pyx_t_5); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1728, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_v_dx = __pyx_t_12;
    __pyx_t_12 = 0;

    /* "pygrib.pyx":1729
 *             width = 2*x2; height = 2*y1
 *             dx = width/self['dx']
 *             dy = height/self['dy']             # <<<<<<<<<<<<<<
 *             xmax = dx*(nx-1); ymax = dy*(ny-1)
 *             x = np.linspace(-0.5*xmax,0.5*xmax,nx)
 */
    __pyx_t_12 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_dy); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1729, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __pyx_t_5 = __Pyx_PyNumber_Divide(__pyx_v_height, __pyx_t_12); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1729, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __pyx_v_dy = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "pygrib.pyx":1730
 *             dx = width/self['dx']
 *             dy = height/self['dy']
 *             xmax = dx*(nx-1); ymax = dy*(ny-1)             # <<<<<<<<<<<<<<
 *             x = np.linspace(-0.5*xmax,0.5*xmax,nx)
 *             y = np.linspace(-0.5*ymax,0.5*ymax,ny)
 */
    __pyx_t_5 = __Pyx_PyInt_SubtractObjC(__pyx_v_nx, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1730, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_12 = PyNumber_Multiply(__pyx_v_dx, __pyx_t_5); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1730, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_v_xmax = __pyx_t_12;
    __pyx_t_12 = 0;
    __pyx_t_12 = __Pyx_PyInt_SubtractObjC(__pyx_v_ny, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1730, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __pyx_t_5 = PyNumber_Multiply(__pyx_v_dy, __pyx_t_12); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1730, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __pyx_v_ymax = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "pygrib.pyx":1731
 *             dy = height/self['dy']
 *             xmax = dx*(nx-1); ymax = dy*(ny-1)
 *             x = np.linspace(-0.5*xmax,0.5*xmax,nx)             # <<<<<<<<<<<<<<
 *             y = np.linspace(-0.5*ymax,0.5*ymax,ny)
 *             x, y = np.meshgrid(x, y)
 */
    __pyx_t_12 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1731, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_linspace); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1731, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __pyx_t_12 = PyNumber_Multiply(__pyx_float_neg_0_5, __pyx_v_xmax); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1731, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __pyx_t_7 = PyNumber_Multiply(__pyx_float_0_5, __pyx_v_xmax); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1731, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_4 = NULL;
    __pyx_t_6 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_14))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_14);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_14);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_14, function);
        __pyx_t_6 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_14)) {
      PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_t_12, __pyx_t_7, __pyx_v_nx};
      __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_14, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1731, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_14)) {
      PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_t_12, __pyx_t_7, __pyx_v_nx};
      __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_14, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1731, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    } else
    #endif
    {
      __pyx_t_13 = PyTuple_New(3+__pyx_t_6); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1731, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_13);
      if (__pyx_t_4) {
        __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_4); __pyx_t_4 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_12);
      PyTuple_SET_ITEM(__pyx_t_13, 0+__pyx_t_6, __pyx_t_12);
      __Pyx_GIVEREF(__pyx_t_7);
      PyTuple_SET_ITEM(__pyx_t_13, 1+__pyx_t_6, __pyx_t_7);
      __Pyx_INCREF(__pyx_v_nx);
      __Pyx_GIVEREF(__pyx_v_nx);
      PyTuple_SET_ITEM(__pyx_t_13, 2+__pyx_t_6, __pyx_v_nx);
      __pyx_t_12 = 0;
      __pyx_t_7 = 0;
      __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_14, __pyx_t_13, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1731, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    }
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    __pyx_v_x = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "pygrib.pyx":1732
 *             xmax = dx*(nx-1); ymax = dy*(ny-1)
 *             x = np.linspace(-0.5*xmax,0.5*xmax,nx)
 *             y = np.linspace(-0.5*ymax,0.5*ymax,ny)             # <<<<<<<<<<<<<<
 *             x, y = np.meshgrid(x, y)
 *             lons, lats = pj(x,y,inverse=True)
 */
    __pyx_t_14 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1732, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_14, __pyx_n_s_linspace); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1732, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_13);
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    __pyx_t_14 = PyNumber_Multiply(__pyx_float_neg_0_5, __pyx_v_ymax); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1732, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    __pyx_t_7 = PyNumber_Multiply(__pyx_float_0_5, __pyx_v_ymax); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1732, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_12 = NULL;
    __pyx_t_6 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_13))) {
      __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_13);
      if (likely(__pyx_t_12)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_13);
        __Pyx_INCREF(__pyx_t_12);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_13, function);
        __pyx_t_6 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_13)) {
      PyObject *__pyx_temp[4] = {__pyx_t_12, __pyx_t_14, __pyx_t_7, __pyx_v_ny};
      __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_13, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1732, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_13)) {
      PyObject *__pyx_temp[4] = {__pyx_t_12, __pyx_t_14, __pyx_t_7, __pyx_v_ny};
      __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_13, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1732, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    } else
    #endif
    {
      __pyx_t_4 = PyTuple_New(3+__pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1732, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (__pyx_t_12) {
        __Pyx_GIVEREF(__pyx_t_12); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_12); __pyx_t_12 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_14);
      PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_6, __pyx_t_14);
      __Pyx_GIVEREF(__pyx_t_7);
      PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_6, __pyx_t_7);
      __Pyx_INCREF(__pyx_v_ny);
      __Pyx_GIVEREF(__pyx_v_ny);
      PyTuple_SET_ITEM(__pyx_t_4, 2+__pyx_t_6, __pyx_v_ny);
      __pyx_t_14 = 0;
      __pyx_t_7 = 0;
      __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_13, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1732, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    __pyx_v_y = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "pygrib.pyx":1733
 *             x = np.linspace(-0.5*xmax,0.5*xmax,nx)
 *             y = np.linspace(-0.5*ymax,0.5*ymax,ny)
 *             x, y = np.meshgrid(x, y)             # <<<<<<<<<<<<<<
 *             lons, lats = pj(x,y,inverse=True)
 *             # set lons,lats to 1.e30 where undefined
 */
    __pyx_t_13 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1733, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_13);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s_meshgrid); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1733, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    __pyx_t_13 = NULL;
    __pyx_t_6 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_13)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_13);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
        __pyx_t_6 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[3] = {__pyx_t_13, __pyx_v_x, __pyx_v_y};
      __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1733, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
      __Pyx_GOTREF(__pyx_t_5);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[3] = {__pyx_t_13, __pyx_v_x, __pyx_v_y};
      __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1733, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
      __Pyx_GOTREF(__pyx_t_5);
    } else
    #endif
    {
      __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1733, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      if (__pyx_t_13) {
        __Pyx_GIVEREF(__pyx_t_13); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_13); __pyx_t_13 = NULL;
      }
      __Pyx_INCREF(__pyx_v_x);
      __Pyx_GIVEREF(__pyx_v_x);
      PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_v_x);
      __Pyx_INCREF(__pyx_v_y);
      __Pyx_GIVEREF(__pyx_v_y);
      PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_v_y);
      __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_7, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1733, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if ((likely(PyTuple_CheckExact(__pyx_t_5))) || (PyList_CheckExact(__pyx_t_5))) {
      PyObject* sequence = __pyx_t_5;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 1733, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_7 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_4 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_7 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_7);
      #else
      __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1733, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_7 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1733, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      #endif
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_13 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1733, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_13);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_8 = Py_TYPE(__pyx_t_13)->tp_iternext;
      index = 0; __pyx_t_4 = __pyx_t_8(__pyx_t_13); if (unlikely(!__pyx_t_4)) goto __pyx_L104_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_4);
      index = 1; __pyx_t_7 = __pyx_t_8(__pyx_t_13); if (unlikely(!__pyx_t_7)) goto __pyx_L104_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_7);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_13), 2) < 0) __PYX_ERR(0, 1733, __pyx_L1_error)
      __pyx_t_8 = NULL;
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      goto __pyx_L105_unpacking_done;
      __pyx_L104_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      __pyx_t_8 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 1733, __pyx_L1_error)
      __pyx_L105_unpacking_done:;
    }
    __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_4);
    __pyx_t_4 = 0;
    __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_7);
    __pyx_t_7 = 0;

    /* "pygrib.pyx":1734
 *             y = np.linspace(-0.5*ymax,0.5*ymax,ny)
 *             x, y = np.meshgrid(x, y)
 *             lons, lats = pj(x,y,inverse=True)             # <<<<<<<<<<<<<<
 *             # set lons,lats to 1.e30 where undefined
 *             abslons = np.fabs(lons); abslats = np.fabs(lats)
 */
    __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1734, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_v_x);
    __Pyx_GIVEREF(__pyx_v_x);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_x);
    __Pyx_INCREF(__pyx_v_y);
    __Pyx_GIVEREF(__pyx_v_y);
    PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_y);
    __pyx_t_7 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1734, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_inverse, Py_True) < 0) __PYX_ERR(0, 1734, __pyx_L1_error)
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_v_pj, __pyx_t_5, __pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1734, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) {
      PyObject* sequence = __pyx_t_4;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 1734, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_7 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_7 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_5 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_5);
      #else
      __pyx_t_7 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1734, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1734, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      #endif
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_13 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1734, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_13);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_8 = Py_TYPE(__pyx_t_13)->tp_iternext;
      index = 0; __pyx_t_7 = __pyx_t_8(__pyx_t_13); if (unlikely(!__pyx_t_7)) goto __pyx_L106_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_7);
      index = 1; __pyx_t_5 = __pyx_t_8(__pyx_t_13); if (unlikely(!__pyx_t_5)) goto __pyx_L106_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_5);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_13), 2) < 0) __PYX_ERR(0, 1734, __pyx_L1_error)
      __pyx_t_8 = NULL;
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      goto __pyx_L107_unpacking_done;
      __pyx_L106_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      __pyx_t_8 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 1734, __pyx_L1_error)
      __pyx_L107_unpacking_done:;
    }
    __pyx_v_lons = __pyx_t_7;
    __pyx_t_7 = 0;
    __pyx_v_lats = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "pygrib.pyx":1736
 *             lons, lats = pj(x,y,inverse=True)
 *             # set lons,lats to 1.e30 where undefined
 *             abslons = np.fabs(lons); abslats = np.fabs(lats)             # <<<<<<<<<<<<<<
 *             lons = np.where(abslons < 1.e20, lons, 1.e30)
 *             lats = np.where(abslats < 1.e20, lats, 1.e30)
 */
    __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1736, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_fabs); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1736, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_7);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_7, function);
      }
    }
    if (!__pyx_t_5) {
      __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_v_lons); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1736, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_7)) {
        PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_v_lons};
        __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1736, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_GOTREF(__pyx_t_4);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) {
        PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_v_lons};
        __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1736, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_GOTREF(__pyx_t_4);
      } else
      #endif
      {
        __pyx_t_13 = PyTuple_New(1+1); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1736, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_13);
        __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_5); __pyx_t_5 = NULL;
        __Pyx_INCREF(__pyx_v_lons);
        __Pyx_GIVEREF(__pyx_v_lons);
        PyTuple_SET_ITEM(__pyx_t_13, 0+1, __pyx_v_lons);
        __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_13, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1736, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_v_abslons = __pyx_t_4;
    __pyx_t_4 = 0;
    __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1736, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_fabs); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1736, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_13);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_13))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_13);
      if (likely(__pyx_t_7)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_13);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_13, function);
      }
    }
    if (!__pyx_t_7) {
      __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_13, __pyx_v_lats); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1736, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_13)) {
        PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_v_lats};
        __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_13, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1736, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_GOTREF(__pyx_t_4);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_13)) {
        PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_v_lats};
        __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_13, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1736, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_GOTREF(__pyx_t_4);
      } else
      #endif
      {
        __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1736, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_7); __pyx_t_7 = NULL;
        __Pyx_INCREF(__pyx_v_lats);
        __Pyx_GIVEREF(__pyx_v_lats);
        PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_v_lats);
        __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_13, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1736, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    __pyx_v_abslats = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "pygrib.pyx":1737
 *             # set lons,lats to 1.e30 where undefined
 *             abslons = np.fabs(lons); abslats = np.fabs(lats)
 *             lons = np.where(abslons < 1.e20, lons, 1.e30)             # <<<<<<<<<<<<<<
 *             lats = np.where(abslats < 1.e20, lats, 1.e30)
 *         elif self['gridType'] == "equatorial_azimuthal_equidistant":
 */
    __pyx_t_13 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1737, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_13);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s_where); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1737, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    __pyx_t_13 = PyObject_RichCompare(__pyx_v_abslons, __pyx_float_1_e20, Py_LT); __Pyx_XGOTREF(__pyx_t_13); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1737, __pyx_L1_error)
    __pyx_t_7 = NULL;
    __pyx_t_6 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_7)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
        __pyx_t_6 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[4] = {__pyx_t_7, __pyx_t_13, __pyx_v_lons, __pyx_float_1_e30};
      __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1737, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[4] = {__pyx_t_7, __pyx_t_13, __pyx_v_lons, __pyx_float_1_e30};
      __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1737, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    } else
    #endif
    {
      __pyx_t_14 = PyTuple_New(3+__pyx_t_6); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1737, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_14);
      if (__pyx_t_7) {
        __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_7); __pyx_t_7 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_13);
      PyTuple_SET_ITEM(__pyx_t_14, 0+__pyx_t_6, __pyx_t_13);
      __Pyx_INCREF(__pyx_v_lons);
      __Pyx_GIVEREF(__pyx_v_lons);
      PyTuple_SET_ITEM(__pyx_t_14, 1+__pyx_t_6, __pyx_v_lons);
      __Pyx_INCREF(__pyx_float_1_e30);
      __Pyx_GIVEREF(__pyx_float_1_e30);
      PyTuple_SET_ITEM(__pyx_t_14, 2+__pyx_t_6, __pyx_float_1_e30);
      __pyx_t_13 = 0;
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_14, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1737, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF_SET(__pyx_v_lons, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "pygrib.pyx":1738
 *             abslons = np.fabs(lons); abslats = np.fabs(lats)
 *             lons = np.where(abslons < 1.e20, lons, 1.e30)
 *             lats = np.where(abslats < 1.e20, lats, 1.e30)             # <<<<<<<<<<<<<<
 *         elif self['gridType'] == "equatorial_azimuthal_equidistant":
 *             dx = self['Dx']/1.e3
 */
    __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1738, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_where); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1738, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = PyObject_RichCompare(__pyx_v_abslats, __pyx_float_1_e20, Py_LT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1738, __pyx_L1_error)
    __pyx_t_13 = NULL;
    __pyx_t_6 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_14))) {
      __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_14);
      if (likely(__pyx_t_13)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_14);
        __Pyx_INCREF(__pyx_t_13);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_14, function);
        __pyx_t_6 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_14)) {
      PyObject *__pyx_temp[4] = {__pyx_t_13, __pyx_t_5, __pyx_v_lats, __pyx_float_1_e30};
      __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_14, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1738, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_14)) {
      PyObject *__pyx_temp[4] = {__pyx_t_13, __pyx_t_5, __pyx_v_lats, __pyx_float_1_e30};
      __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_14, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1738, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else
    #endif
    {
      __pyx_t_7 = PyTuple_New(3+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1738, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      if (__pyx_t_13) {
        __Pyx_GIVEREF(__pyx_t_13); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_13); __pyx_t_13 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_t_5);
      __Pyx_INCREF(__pyx_v_lats);
      __Pyx_GIVEREF(__pyx_v_lats);
      PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_v_lats);
      __Pyx_INCREF(__pyx_float_1_e30);
      __Pyx_GIVEREF(__pyx_float_1_e30);
      PyTuple_SET_ITEM(__pyx_t_7, 2+__pyx_t_6, __pyx_float_1_e30);
      __pyx_t_5 = 0;
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_14, __pyx_t_7, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1738, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    }
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    __Pyx_DECREF_SET(__pyx_v_lats, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "pygrib.pyx":1702
 *             x, y = np.meshgrid(x, y)
 *             lons, lats = pj(x, y, inverse=True)
 *         elif self['gridType'] == 'space_view':             # <<<<<<<<<<<<<<
 *             try:
 *                 nx = self['Nx']
 */
    goto __pyx_L4;
  }

  /* "pygrib.pyx":1739
 *             lons = np.where(abslons < 1.e20, lons, 1.e30)
 *             lats = np.where(abslats < 1.e20, lats, 1.e30)
 *         elif self['gridType'] == "equatorial_azimuthal_equidistant":             # <<<<<<<<<<<<<<
 *             dx = self['Dx']/1.e3
 *             dy = self['Dy']/1.e3
 */
  __pyx_t_4 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_gridType); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1739, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_t_4, __pyx_n_s_equatorial_azimuthal_equidistant, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1739, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__pyx_t_1) {

    /* "pygrib.pyx":1740
 *             lats = np.where(abslats < 1.e20, lats, 1.e30)
 *         elif self['gridType'] == "equatorial_azimuthal_equidistant":
 *             dx = self['Dx']/1.e3             # <<<<<<<<<<<<<<
 *             dy = self['Dy']/1.e3
 *             lat1 = self['latitudeOfFirstGridPointInDegrees']
 */
    __pyx_t_4 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_Dx); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1740, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_14 = __Pyx_PyFloat_DivideObjC(__pyx_t_4, __pyx_float_1_e3, 1.e3, 0); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1740, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_v_dx = __pyx_t_14;
    __pyx_t_14 = 0;

    /* "pygrib.pyx":1741
 *         elif self['gridType'] == "equatorial_azimuthal_equidistant":
 *             dx = self['Dx']/1.e3
 *             dy = self['Dy']/1.e3             # <<<<<<<<<<<<<<
 *             lat1 = self['latitudeOfFirstGridPointInDegrees']
 *             lon1 = self['longitudeOfFirstGridPointInDegrees']
 */
    __pyx_t_14 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_Dy); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1741, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    __pyx_t_4 = __Pyx_PyFloat_DivideObjC(__pyx_t_14, __pyx_float_1_e3, 1.e3, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1741, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    __pyx_v_dy = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "pygrib.pyx":1742
 *             dx = self['Dx']/1.e3
 *             dy = self['Dy']/1.e3
 *             lat1 = self['latitudeOfFirstGridPointInDegrees']             # <<<<<<<<<<<<<<
 *             lon1 = self['longitudeOfFirstGridPointInDegrees']
 *             pj = pyproj.Proj(self.projparams)
 */
    __pyx_t_4 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_latitudeOfFirstGridPointInDegree); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1742, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_v_lat1 = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "pygrib.pyx":1743
 *             dy = self['Dy']/1.e3
 *             lat1 = self['latitudeOfFirstGridPointInDegrees']
 *             lon1 = self['longitudeOfFirstGridPointInDegrees']             # <<<<<<<<<<<<<<
 *             pj = pyproj.Proj(self.projparams)
 *             llcrnrx, llcrnry = pj(lon1,lat1)
 */
    __pyx_t_4 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_longitudeOfFirstGridPointInDegre); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1743, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_v_lon1 = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "pygrib.pyx":1744
 *             lat1 = self['latitudeOfFirstGridPointInDegrees']
 *             lon1 = self['longitudeOfFirstGridPointInDegrees']
 *             pj = pyproj.Proj(self.projparams)             # <<<<<<<<<<<<<<
 *             llcrnrx, llcrnry = pj(lon1,lat1)
 *             try:
 */
    __pyx_t_14 = __Pyx_GetModuleGlobalName(__pyx_n_s_pyproj); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1744, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_14, __pyx_n_s_Proj); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1744, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    __pyx_t_14 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_7);
      if (likely(__pyx_t_14)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_14);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_7, function);
      }
    }
    if (!__pyx_t_14) {
      __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_v_self->projparams); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1744, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_7)) {
        PyObject *__pyx_temp[2] = {__pyx_t_14, __pyx_v_self->projparams};
        __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1744, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
        __Pyx_GOTREF(__pyx_t_4);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) {
        PyObject *__pyx_temp[2] = {__pyx_t_14, __pyx_v_self->projparams};
        __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1744, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
        __Pyx_GOTREF(__pyx_t_4);
      } else
      #endif
      {
        __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1744, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_GIVEREF(__pyx_t_14); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_14); __pyx_t_14 = NULL;
        __Pyx_INCREF(__pyx_v_self->projparams);
        __Pyx_GIVEREF(__pyx_v_self->projparams);
        PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_v_self->projparams);
        __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1744, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_v_pj = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "pygrib.pyx":1745
 *             lon1 = self['longitudeOfFirstGridPointInDegrees']
 *             pj = pyproj.Proj(self.projparams)
 *             llcrnrx, llcrnry = pj(lon1,lat1)             # <<<<<<<<<<<<<<
 *             try:
 *                 nx = self['Nx']
 */
    __Pyx_INCREF(__pyx_v_pj);
    __pyx_t_7 = __pyx_v_pj; __pyx_t_5 = NULL;
    __pyx_t_6 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_7);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_7, function);
        __pyx_t_6 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_7)) {
      PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_v_lon1, __pyx_v_lat1};
      __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1745, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_4);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) {
      PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_v_lon1, __pyx_v_lat1};
      __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1745, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_4);
    } else
    #endif
    {
      __pyx_t_14 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1745, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_14);
      if (__pyx_t_5) {
        __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_5); __pyx_t_5 = NULL;
      }
      __Pyx_INCREF(__pyx_v_lon1);
      __Pyx_GIVEREF(__pyx_v_lon1);
      PyTuple_SET_ITEM(__pyx_t_14, 0+__pyx_t_6, __pyx_v_lon1);
      __Pyx_INCREF(__pyx_v_lat1);
      __Pyx_GIVEREF(__pyx_v_lat1);
      PyTuple_SET_ITEM(__pyx_t_14, 1+__pyx_t_6, __pyx_v_lat1);
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_14, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1745, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    }
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) {
      PyObject* sequence = __pyx_t_4;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 1745, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_7 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_14 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_7 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_14 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_14);
      #else
      __pyx_t_7 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1745, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_14 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1745, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_14);
      #endif
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_5 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1745, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_8 = Py_TYPE(__pyx_t_5)->tp_iternext;
      index = 0; __pyx_t_7 = __pyx_t_8(__pyx_t_5); if (unlikely(!__pyx_t_7)) goto __pyx_L108_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_7);
      index = 1; __pyx_t_14 = __pyx_t_8(__pyx_t_5); if (unlikely(!__pyx_t_14)) goto __pyx_L108_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_14);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_5), 2) < 0) __PYX_ERR(0, 1745, __pyx_L1_error)
      __pyx_t_8 = NULL;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      goto __pyx_L109_unpacking_done;
      __pyx_L108_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_8 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 1745, __pyx_L1_error)
      __pyx_L109_unpacking_done:;
    }
    __pyx_v_llcrnrx = __pyx_t_7;
    __pyx_t_7 = 0;
    __pyx_v_llcrnry = __pyx_t_14;
    __pyx_t_14 = 0;

    /* "pygrib.pyx":1746
 *             pj = pyproj.Proj(self.projparams)
 *             llcrnrx, llcrnry = pj(lon1,lat1)
 *             try:             # <<<<<<<<<<<<<<
 *                 nx = self['Nx']
 *                 ny = self['Ny']
 */
    {
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __Pyx_ExceptionSave(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
      __Pyx_XGOTREF(__pyx_t_9);
      __Pyx_XGOTREF(__pyx_t_10);
      __Pyx_XGOTREF(__pyx_t_11);
      /*try:*/ {

        /* "pygrib.pyx":1747
 *             llcrnrx, llcrnry = pj(lon1,lat1)
 *             try:
 *                 nx = self['Nx']             # <<<<<<<<<<<<<<
 *                 ny = self['Ny']
 *             except:
 */
        __pyx_t_4 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_Nx); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1747, __pyx_L110_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_v_nx = __pyx_t_4;
        __pyx_t_4 = 0;

        /* "pygrib.pyx":1748
 *             try:
 *                 nx = self['Nx']
 *                 ny = self['Ny']             # <<<<<<<<<<<<<<
 *             except:
 *                 nx = self['Ni']
 */
        __pyx_t_4 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_Ny); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1748, __pyx_L110_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_v_ny = __pyx_t_4;
        __pyx_t_4 = 0;

        /* "pygrib.pyx":1746
 *             pj = pyproj.Proj(self.projparams)
 *             llcrnrx, llcrnry = pj(lon1,lat1)
 *             try:             # <<<<<<<<<<<<<<
 *                 nx = self['Nx']
 *                 ny = self['Ny']
 */
      }
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      goto __pyx_L115_try_end;
      __pyx_L110_error:;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "pygrib.pyx":1749
 *                 nx = self['Nx']
 *                 ny = self['Ny']
 *             except:             # <<<<<<<<<<<<<<
 *                 nx = self['Ni']
 *                 ny = self['Nj']
 */
      /*except:*/ {
        __Pyx_AddTraceback("pygrib.gribmessage.latlons", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_14, &__pyx_t_7) < 0) __PYX_ERR(0, 1749, __pyx_L112_except_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_GOTREF(__pyx_t_14);
        __Pyx_GOTREF(__pyx_t_7);

        /* "pygrib.pyx":1750
 *                 ny = self['Ny']
 *             except:
 *                 nx = self['Ni']             # <<<<<<<<<<<<<<
 *                 ny = self['Nj']
 *             x = llcrnrx+dx*np.arange(nx)
 */
        __pyx_t_5 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_Ni); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1750, __pyx_L112_except_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_XDECREF_SET(__pyx_v_nx, __pyx_t_5);
        __pyx_t_5 = 0;

        /* "pygrib.pyx":1751
 *             except:
 *                 nx = self['Ni']
 *                 ny = self['Nj']             # <<<<<<<<<<<<<<
 *             x = llcrnrx+dx*np.arange(nx)
 *             y = llcrnry+dy*np.arange(ny)
 */
        __pyx_t_5 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_Nj); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1751, __pyx_L112_except_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_XDECREF_SET(__pyx_v_ny, __pyx_t_5);
        __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        goto __pyx_L111_exception_handled;
      }
      __pyx_L112_except_error:;

      /* "pygrib.pyx":1746
 *             pj = pyproj.Proj(self.projparams)
 *             llcrnrx, llcrnry = pj(lon1,lat1)
 *             try:             # <<<<<<<<<<<<<<
 *                 nx = self['Nx']
 *                 ny = self['Ny']
 */
      __Pyx_XGIVEREF(__pyx_t_9);
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11);
      goto __pyx_L1_error;
      __pyx_L111_exception_handled:;
      __Pyx_XGIVEREF(__pyx_t_9);
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11);
      __pyx_L115_try_end:;
    }

    /* "pygrib.pyx":1752
 *                 nx = self['Ni']
 *                 ny = self['Nj']
 *             x = llcrnrx+dx*np.arange(nx)             # <<<<<<<<<<<<<<
 *             y = llcrnry+dy*np.arange(ny)
 *             x, y = np.meshgrid(x, y)
 */
    __pyx_t_14 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1752, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_14, __pyx_n_s_arange); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1752, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    __pyx_t_14 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_14)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_14);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    if (!__pyx_t_14) {
      __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_nx); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1752, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_4)) {
        PyObject *__pyx_temp[2] = {__pyx_t_14, __pyx_v_nx};
        __pyx_t_7 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1752, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
        __Pyx_GOTREF(__pyx_t_7);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
        PyObject *__pyx_temp[2] = {__pyx_t_14, __pyx_v_nx};
        __pyx_t_7 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1752, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
        __Pyx_GOTREF(__pyx_t_7);
      } else
      #endif
      {
        __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1752, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_GIVEREF(__pyx_t_14); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_14); __pyx_t_14 = NULL;
        __Pyx_INCREF(__pyx_v_nx);
        __Pyx_GIVEREF(__pyx_v_nx);
        PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_v_nx);
        __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_5, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1752, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyNumber_Multiply(__pyx_v_dx, __pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1752, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = PyNumber_Add(__pyx_v_llcrnrx, __pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1752, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_v_x = __pyx_t_7;
    __pyx_t_7 = 0;

    /* "pygrib.pyx":1753
 *                 ny = self['Nj']
 *             x = llcrnrx+dx*np.arange(nx)
 *             y = llcrnry+dy*np.arange(ny)             # <<<<<<<<<<<<<<
 *             x, y = np.meshgrid(x, y)
 *             lons, lats = pj(x, y, inverse=True)
 */
    __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1753, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_arange); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1753, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
      }
    }
    if (!__pyx_t_4) {
      __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_ny); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1753, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_5)) {
        PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_v_ny};
        __pyx_t_7 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1753, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_GOTREF(__pyx_t_7);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
        PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_v_ny};
        __pyx_t_7 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1753, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_GOTREF(__pyx_t_7);
      } else
      #endif
      {
        __pyx_t_14 = PyTuple_New(1+1); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1753, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_14);
        __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_4); __pyx_t_4 = NULL;
        __Pyx_INCREF(__pyx_v_ny);
        __Pyx_GIVEREF(__pyx_v_ny);
        PyTuple_SET_ITEM(__pyx_t_14, 0+1, __pyx_v_ny);
        __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_14, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1753, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = PyNumber_Multiply(__pyx_v_dy, __pyx_t_7); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1753, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = PyNumber_Add(__pyx_v_llcrnry, __pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1753, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_v_y = __pyx_t_7;
    __pyx_t_7 = 0;

    /* "pygrib.pyx":1754
 *             x = llcrnrx+dx*np.arange(nx)
 *             y = llcrnry+dy*np.arange(ny)
 *             x, y = np.meshgrid(x, y)             # <<<<<<<<<<<<<<
 *             lons, lats = pj(x, y, inverse=True)
 *         elif self['gridType'] == "lambert_azimuthal_equal_area":
 */
    __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1754, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_meshgrid); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1754, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = NULL;
    __pyx_t_6 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_14))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_14);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_14);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_14, function);
        __pyx_t_6 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_14)) {
      PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_v_x, __pyx_v_y};
      __pyx_t_7 = __Pyx_PyFunction_FastCall(__pyx_t_14, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1754, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_7);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_14)) {
      PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_v_x, __pyx_v_y};
      __pyx_t_7 = __Pyx_PyCFunction_FastCall(__pyx_t_14, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1754, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_7);
    } else
    #endif
    {
      __pyx_t_4 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1754, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (__pyx_t_5) {
        __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5); __pyx_t_5 = NULL;
      }
      __Pyx_INCREF(__pyx_v_x);
      __Pyx_GIVEREF(__pyx_v_x);
      PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_6, __pyx_v_x);
      __Pyx_INCREF(__pyx_v_y);
      __Pyx_GIVEREF(__pyx_v_y);
      PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_6, __pyx_v_y);
      __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_14, __pyx_t_4, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1754, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    if ((likely(PyTuple_CheckExact(__pyx_t_7))) || (PyList_CheckExact(__pyx_t_7))) {
      PyObject* sequence = __pyx_t_7;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 1754, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_14 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_14 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_4 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_14);
      __Pyx_INCREF(__pyx_t_4);
      #else
      __pyx_t_14 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1754, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_14);
      __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1754, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      #endif
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_5 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1754, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_8 = Py_TYPE(__pyx_t_5)->tp_iternext;
      index = 0; __pyx_t_14 = __pyx_t_8(__pyx_t_5); if (unlikely(!__pyx_t_14)) goto __pyx_L118_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_14);
      index = 1; __pyx_t_4 = __pyx_t_8(__pyx_t_5); if (unlikely(!__pyx_t_4)) goto __pyx_L118_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_4);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_5), 2) < 0) __PYX_ERR(0, 1754, __pyx_L1_error)
      __pyx_t_8 = NULL;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      goto __pyx_L119_unpacking_done;
      __pyx_L118_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_8 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 1754, __pyx_L1_error)
      __pyx_L119_unpacking_done:;
    }
    __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_14);
    __pyx_t_14 = 0;
    __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "pygrib.pyx":1755
 *             y = llcrnry+dy*np.arange(ny)
 *             x, y = np.meshgrid(x, y)
 *             lons, lats = pj(x, y, inverse=True)             # <<<<<<<<<<<<<<
 *         elif self['gridType'] == "lambert_azimuthal_equal_area":
 *             dx = self['Dx']/1.e3
 */
    __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1755, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_INCREF(__pyx_v_x);
    __Pyx_GIVEREF(__pyx_v_x);
    PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_x);
    __Pyx_INCREF(__pyx_v_y);
    __Pyx_GIVEREF(__pyx_v_y);
    PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_v_y);
    __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1755, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_inverse, Py_True) < 0) __PYX_ERR(0, 1755, __pyx_L1_error)
    __pyx_t_14 = __Pyx_PyObject_Call(__pyx_v_pj, __pyx_t_7, __pyx_t_4); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1755, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if ((likely(PyTuple_CheckExact(__pyx_t_14))) || (PyList_CheckExact(__pyx_t_14))) {
      PyObject* sequence = __pyx_t_14;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 1755, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_7 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_4 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_7 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_7);
      #else
      __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1755, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_7 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1755, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      #endif
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_5 = PyObject_GetIter(__pyx_t_14); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1755, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
      __pyx_t_8 = Py_TYPE(__pyx_t_5)->tp_iternext;
      index = 0; __pyx_t_4 = __pyx_t_8(__pyx_t_5); if (unlikely(!__pyx_t_4)) goto __pyx_L120_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_4);
      index = 1; __pyx_t_7 = __pyx_t_8(__pyx_t_5); if (unlikely(!__pyx_t_7)) goto __pyx_L120_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_7);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_5), 2) < 0) __PYX_ERR(0, 1755, __pyx_L1_error)
      __pyx_t_8 = NULL;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      goto __pyx_L121_unpacking_done;
      __pyx_L120_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_8 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 1755, __pyx_L1_error)
      __pyx_L121_unpacking_done:;
    }
    __pyx_v_lons = __pyx_t_4;
    __pyx_t_4 = 0;
    __pyx_v_lats = __pyx_t_7;
    __pyx_t_7 = 0;

    /* "pygrib.pyx":1739
 *             lons = np.where(abslons < 1.e20, lons, 1.e30)
 *             lats = np.where(abslats < 1.e20, lats, 1.e30)
 *         elif self['gridType'] == "equatorial_azimuthal_equidistant":             # <<<<<<<<<<<<<<
 *             dx = self['Dx']/1.e3
 *             dy = self['Dy']/1.e3
 */
    goto __pyx_L4;
  }

  /* "pygrib.pyx":1756
 *             x, y = np.meshgrid(x, y)
 *             lons, lats = pj(x, y, inverse=True)
 *         elif self['gridType'] == "lambert_azimuthal_equal_area":             # <<<<<<<<<<<<<<
 *             dx = self['Dx']/1.e3
 *             dy = self['Dy']/1.e3
 */
  __pyx_t_14 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_gridType); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1756, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_14);
  __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_t_14, __pyx_n_s_lambert_azimuthal_equal_area, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1756, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
  if (__pyx_t_1) {

    /* "pygrib.pyx":1757
 *             lons, lats = pj(x, y, inverse=True)
 *         elif self['gridType'] == "lambert_azimuthal_equal_area":
 *             dx = self['Dx']/1.e3             # <<<<<<<<<<<<<<
 *             dy = self['Dy']/1.e3
 *             lat1 = self['latitudeOfFirstGridPointInDegrees']
 */
    __pyx_t_14 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_Dx); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1757, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    __pyx_t_7 = __Pyx_PyFloat_DivideObjC(__pyx_t_14, __pyx_float_1_e3, 1.e3, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1757, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    __pyx_v_dx = __pyx_t_7;
    __pyx_t_7 = 0;

    /* "pygrib.pyx":1758
 *         elif self['gridType'] == "lambert_azimuthal_equal_area":
 *             dx = self['Dx']/1.e3
 *             dy = self['Dy']/1.e3             # <<<<<<<<<<<<<<
 *             lat1 = self['latitudeOfFirstGridPointInDegrees']
 *             lon1 = self['longitudeOfFirstGridPointInDegrees']
 */
    __pyx_t_7 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_Dy); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1758, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_14 = __Pyx_PyFloat_DivideObjC(__pyx_t_7, __pyx_float_1_e3, 1.e3, 0); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1758, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_v_dy = __pyx_t_14;
    __pyx_t_14 = 0;

    /* "pygrib.pyx":1759
 *             dx = self['Dx']/1.e3
 *             dy = self['Dy']/1.e3
 *             lat1 = self['latitudeOfFirstGridPointInDegrees']             # <<<<<<<<<<<<<<
 *             lon1 = self['longitudeOfFirstGridPointInDegrees']
 *             pj = pyproj.Proj(self.projparams)
 */
    __pyx_t_14 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_latitudeOfFirstGridPointInDegree); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1759, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    __pyx_v_lat1 = __pyx_t_14;
    __pyx_t_14 = 0;

    /* "pygrib.pyx":1760
 *             dy = self['Dy']/1.e3
 *             lat1 = self['latitudeOfFirstGridPointInDegrees']
 *             lon1 = self['longitudeOfFirstGridPointInDegrees']             # <<<<<<<<<<<<<<
 *             pj = pyproj.Proj(self.projparams)
 *             llcrnrx, llcrnry = pj(lon1,lat1)
 */
    __pyx_t_14 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_longitudeOfFirstGridPointInDegre); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1760, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    __pyx_v_lon1 = __pyx_t_14;
    __pyx_t_14 = 0;

    /* "pygrib.pyx":1761
 *             lat1 = self['latitudeOfFirstGridPointInDegrees']
 *             lon1 = self['longitudeOfFirstGridPointInDegrees']
 *             pj = pyproj.Proj(self.projparams)             # <<<<<<<<<<<<<<
 *             llcrnrx, llcrnry = pj(lon1,lat1)
 *             try:
 */
    __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_pyproj); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1761, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_Proj); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1761, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_7)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    if (!__pyx_t_7) {
      __pyx_t_14 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_self->projparams); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1761, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_14);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_4)) {
        PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_v_self->projparams};
        __pyx_t_14 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1761, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_GOTREF(__pyx_t_14);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
        PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_v_self->projparams};
        __pyx_t_14 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1761, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_GOTREF(__pyx_t_14);
      } else
      #endif
      {
        __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1761, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_7); __pyx_t_7 = NULL;
        __Pyx_INCREF(__pyx_v_self->projparams);
        __Pyx_GIVEREF(__pyx_v_self->projparams);
        PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_v_self->projparams);
        __pyx_t_14 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_5, NULL); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1761, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_14);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_v_pj = __pyx_t_14;
    __pyx_t_14 = 0;

    /* "pygrib.pyx":1762
 *             lon1 = self['longitudeOfFirstGridPointInDegrees']
 *             pj = pyproj.Proj(self.projparams)
 *             llcrnrx, llcrnry = pj(lon1,lat1)             # <<<<<<<<<<<<<<
 *             try:
 *                 nx = self['Nx']
 */
    __Pyx_INCREF(__pyx_v_pj);
    __pyx_t_4 = __pyx_v_pj; __pyx_t_5 = NULL;
    __pyx_t_6 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
        __pyx_t_6 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_v_lon1, __pyx_v_lat1};
      __pyx_t_14 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1762, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_14);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_v_lon1, __pyx_v_lat1};
      __pyx_t_14 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1762, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_14);
    } else
    #endif
    {
      __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1762, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      if (__pyx_t_5) {
        __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __pyx_t_5 = NULL;
      }
      __Pyx_INCREF(__pyx_v_lon1);
      __Pyx_GIVEREF(__pyx_v_lon1);
      PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_v_lon1);
      __Pyx_INCREF(__pyx_v_lat1);
      __Pyx_GIVEREF(__pyx_v_lat1);
      PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_v_lat1);
      __pyx_t_14 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_7, NULL); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1762, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_14);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if ((likely(PyTuple_CheckExact(__pyx_t_14))) || (PyList_CheckExact(__pyx_t_14))) {
      PyObject* sequence = __pyx_t_14;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 1762, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_7 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_4 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_7 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_7);
      #else
      __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1762, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_7 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1762, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      #endif
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_5 = PyObject_GetIter(__pyx_t_14); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1762, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
      __pyx_t_8 = Py_TYPE(__pyx_t_5)->tp_iternext;
      index = 0; __pyx_t_4 = __pyx_t_8(__pyx_t_5); if (unlikely(!__pyx_t_4)) goto __pyx_L122_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_4);
      index = 1; __pyx_t_7 = __pyx_t_8(__pyx_t_5); if (unlikely(!__pyx_t_7)) goto __pyx_L122_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_7);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_5), 2) < 0) __PYX_ERR(0, 1762, __pyx_L1_error)
      __pyx_t_8 = NULL;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      goto __pyx_L123_unpacking_done;
      __pyx_L122_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_8 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 1762, __pyx_L1_error)
      __pyx_L123_unpacking_done:;
    }
    __pyx_v_llcrnrx = __pyx_t_4;
    __pyx_t_4 = 0;
    __pyx_v_llcrnry = __pyx_t_7;
    __pyx_t_7 = 0;

    /* "pygrib.pyx":1763
 *             pj = pyproj.Proj(self.projparams)
 *             llcrnrx, llcrnry = pj(lon1,lat1)
 *             try:             # <<<<<<<<<<<<<<
 *                 nx = self['Nx']
 *                 ny = self['Ny']
 */
    {
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __Pyx_ExceptionSave(&__pyx_t_11, &__pyx_t_10, &__pyx_t_9);
      __Pyx_XGOTREF(__pyx_t_11);
      __Pyx_XGOTREF(__pyx_t_10);
      __Pyx_XGOTREF(__pyx_t_9);
      /*try:*/ {

        /* "pygrib.pyx":1764
 *             llcrnrx, llcrnry = pj(lon1,lat1)
 *             try:
 *                 nx = self['Nx']             # <<<<<<<<<<<<<<
 *                 ny = self['Ny']
 *             except:
 */
        __pyx_t_14 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_Nx); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1764, __pyx_L124_error)
        __Pyx_GOTREF(__pyx_t_14);
        __pyx_v_nx = __pyx_t_14;
        __pyx_t_14 = 0;

        /* "pygrib.pyx":1765
 *             try:
 *                 nx = self['Nx']
 *                 ny = self['Ny']             # <<<<<<<<<<<<<<
 *             except:
 *                 nx = self['Ni']
 */
        __pyx_t_14 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_Ny); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1765, __pyx_L124_error)
        __Pyx_GOTREF(__pyx_t_14);
        __pyx_v_ny = __pyx_t_14;
        __pyx_t_14 = 0;

        /* "pygrib.pyx":1763
 *             pj = pyproj.Proj(self.projparams)
 *             llcrnrx, llcrnry = pj(lon1,lat1)
 *             try:             # <<<<<<<<<<<<<<
 *                 nx = self['Nx']
 *                 ny = self['Ny']
 */
      }
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      goto __pyx_L129_try_end;
      __pyx_L124_error:;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;

      /* "pygrib.pyx":1766
 *                 nx = self['Nx']
 *                 ny = self['Ny']
 *             except:             # <<<<<<<<<<<<<<
 *                 nx = self['Ni']
 *                 ny = self['Nj']
 */
      /*except:*/ {
        __Pyx_AddTraceback("pygrib.gribmessage.latlons", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_14, &__pyx_t_7, &__pyx_t_4) < 0) __PYX_ERR(0, 1766, __pyx_L126_except_error)
        __Pyx_GOTREF(__pyx_t_14);
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_GOTREF(__pyx_t_4);

        /* "pygrib.pyx":1767
 *                 ny = self['Ny']
 *             except:
 *                 nx = self['Ni']             # <<<<<<<<<<<<<<
 *                 ny = self['Nj']
 *             x = llcrnrx+dx*np.arange(nx)
 */
        __pyx_t_5 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_Ni); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1767, __pyx_L126_except_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_XDECREF_SET(__pyx_v_nx, __pyx_t_5);
        __pyx_t_5 = 0;

        /* "pygrib.pyx":1768
 *             except:
 *                 nx = self['Ni']
 *                 ny = self['Nj']             # <<<<<<<<<<<<<<
 *             x = llcrnrx+dx*np.arange(nx)
 *             y = llcrnry+dy*np.arange(ny)
 */
        __pyx_t_5 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_Nj); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1768, __pyx_L126_except_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_XDECREF_SET(__pyx_v_ny, __pyx_t_5);
        __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        goto __pyx_L125_exception_handled;
      }
      __pyx_L126_except_error:;

      /* "pygrib.pyx":1763
 *             pj = pyproj.Proj(self.projparams)
 *             llcrnrx, llcrnry = pj(lon1,lat1)
 *             try:             # <<<<<<<<<<<<<<
 *                 nx = self['Nx']
 *                 ny = self['Ny']
 */
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_XGIVEREF(__pyx_t_9);
      __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_10, __pyx_t_9);
      goto __pyx_L1_error;
      __pyx_L125_exception_handled:;
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_XGIVEREF(__pyx_t_9);
      __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_10, __pyx_t_9);
      __pyx_L129_try_end:;
    }

    /* "pygrib.pyx":1769
 *                 nx = self['Ni']
 *                 ny = self['Nj']
 *             x = llcrnrx+dx*np.arange(nx)             # <<<<<<<<<<<<<<
 *             y = llcrnry+dy*np.arange(ny)
 *             x, y = np.meshgrid(x, y)
 */
    __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1769, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_arange); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1769, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_14))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_14);
      if (likely(__pyx_t_7)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_14);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_14, function);
      }
    }
    if (!__pyx_t_7) {
      __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_14, __pyx_v_nx); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1769, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_14)) {
        PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_v_nx};
        __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_14, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1769, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_GOTREF(__pyx_t_4);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_14)) {
        PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_v_nx};
        __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_14, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1769, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_GOTREF(__pyx_t_4);
      } else
      #endif
      {
        __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1769, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_7); __pyx_t_7 = NULL;
        __Pyx_INCREF(__pyx_v_nx);
        __Pyx_GIVEREF(__pyx_v_nx);
        PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_v_nx);
        __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_14, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1769, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    __pyx_t_14 = PyNumber_Multiply(__pyx_v_dx, __pyx_t_4); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1769, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyNumber_Add(__pyx_v_llcrnrx, __pyx_t_14); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1769, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    __pyx_v_x = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "pygrib.pyx":1770
 *                 ny = self['Nj']
 *             x = llcrnrx+dx*np.arange(nx)
 *             y = llcrnry+dy*np.arange(ny)             # <<<<<<<<<<<<<<
 *             x, y = np.meshgrid(x, y)
 *             lons, lats = pj(x, y, inverse=True)
 */
    __pyx_t_14 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1770, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_14, __pyx_n_s_arange); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1770, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    __pyx_t_14 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_14)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_14);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
      }
    }
    if (!__pyx_t_14) {
      __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_ny); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1770, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_5)) {
        PyObject *__pyx_temp[2] = {__pyx_t_14, __pyx_v_ny};
        __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1770, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
        __Pyx_GOTREF(__pyx_t_4);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
        PyObject *__pyx_temp[2] = {__pyx_t_14, __pyx_v_ny};
        __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1770, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
        __Pyx_GOTREF(__pyx_t_4);
      } else
      #endif
      {
        __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1770, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_GIVEREF(__pyx_t_14); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_14); __pyx_t_14 = NULL;
        __Pyx_INCREF(__pyx_v_ny);
        __Pyx_GIVEREF(__pyx_v_ny);
        PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_v_ny);
        __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_7, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1770, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = PyNumber_Multiply(__pyx_v_dy, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1770, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyNumber_Add(__pyx_v_llcrnry, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1770, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_v_y = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "pygrib.pyx":1771
 *             x = llcrnrx+dx*np.arange(nx)
 *             y = llcrnry+dy*np.arange(ny)
 *             x, y = np.meshgrid(x, y)             # <<<<<<<<<<<<<<
 *             lons, lats = pj(x, y, inverse=True)
 *         elif self['gridType'] == 'mercator':
 */
    __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1771, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_meshgrid); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1771, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = NULL;
    __pyx_t_6 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_7);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_7, function);
        __pyx_t_6 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_7)) {
      PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_v_x, __pyx_v_y};
      __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1771, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_4);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) {
      PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_v_x, __pyx_v_y};
      __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1771, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_4);
    } else
    #endif
    {
      __pyx_t_14 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1771, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_14);
      if (__pyx_t_5) {
        __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_5); __pyx_t_5 = NULL;
      }
      __Pyx_INCREF(__pyx_v_x);
      __Pyx_GIVEREF(__pyx_v_x);
      PyTuple_SET_ITEM(__pyx_t_14, 0+__pyx_t_6, __pyx_v_x);
      __Pyx_INCREF(__pyx_v_y);
      __Pyx_GIVEREF(__pyx_v_y);
      PyTuple_SET_ITEM(__pyx_t_14, 1+__pyx_t_6, __pyx_v_y);
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_14, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1771, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    }
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) {
      PyObject* sequence = __pyx_t_4;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 1771, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_7 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_14 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_7 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_14 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_14);
      #else
      __pyx_t_7 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1771, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_14 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1771, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_14);
      #endif
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_5 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1771, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_8 = Py_TYPE(__pyx_t_5)->tp_iternext;
      index = 0; __pyx_t_7 = __pyx_t_8(__pyx_t_5); if (unlikely(!__pyx_t_7)) goto __pyx_L132_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_7);
      index = 1; __pyx_t_14 = __pyx_t_8(__pyx_t_5); if (unlikely(!__pyx_t_14)) goto __pyx_L132_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_14);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_5), 2) < 0) __PYX_ERR(0, 1771, __pyx_L1_error)
      __pyx_t_8 = NULL;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      goto __pyx_L133_unpacking_done;
      __pyx_L132_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_8 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 1771, __pyx_L1_error)
      __pyx_L133_unpacking_done:;
    }
    __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_7);
    __pyx_t_7 = 0;
    __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_14);
    __pyx_t_14 = 0;

    /* "pygrib.pyx":1772
 *             y = llcrnry+dy*np.arange(ny)
 *             x, y = np.meshgrid(x, y)
 *             lons, lats = pj(x, y, inverse=True)             # <<<<<<<<<<<<<<
 *         elif self['gridType'] == 'mercator':
 *             scale = self._get_key('grib2divider',False)
 */
    __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1772, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_v_x);
    __Pyx_GIVEREF(__pyx_v_x);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_x);
    __Pyx_INCREF(__pyx_v_y);
    __Pyx_GIVEREF(__pyx_v_y);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_y);
    __pyx_t_14 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1772, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    if (PyDict_SetItem(__pyx_t_14, __pyx_n_s_inverse, Py_True) < 0) __PYX_ERR(0, 1772, __pyx_L1_error)
    __pyx_t_7 = __Pyx_PyObject_Call(__pyx_v_pj, __pyx_t_4, __pyx_t_14); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1772, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    if ((likely(PyTuple_CheckExact(__pyx_t_7))) || (PyList_CheckExact(__pyx_t_7))) {
      PyObject* sequence = __pyx_t_7;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 1772, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_14 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_14 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_4 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_14);
      __Pyx_INCREF(__pyx_t_4);
      #else
      __pyx_t_14 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1772, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_14);
      __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1772, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      #endif
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_5 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1772, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_8 = Py_TYPE(__pyx_t_5)->tp_iternext;
      index = 0; __pyx_t_14 = __pyx_t_8(__pyx_t_5); if (unlikely(!__pyx_t_14)) goto __pyx_L134_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_14);
      index = 1; __pyx_t_4 = __pyx_t_8(__pyx_t_5); if (unlikely(!__pyx_t_4)) goto __pyx_L134_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_4);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_5), 2) < 0) __PYX_ERR(0, 1772, __pyx_L1_error)
      __pyx_t_8 = NULL;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      goto __pyx_L135_unpacking_done;
      __pyx_L134_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_8 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 1772, __pyx_L1_error)
      __pyx_L135_unpacking_done:;
    }
    __pyx_v_lons = __pyx_t_14;
    __pyx_t_14 = 0;
    __pyx_v_lats = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "pygrib.pyx":1756
 *             x, y = np.meshgrid(x, y)
 *             lons, lats = pj(x, y, inverse=True)
 *         elif self['gridType'] == "lambert_azimuthal_equal_area":             # <<<<<<<<<<<<<<
 *             dx = self['Dx']/1.e3
 *             dy = self['Dy']/1.e3
 */
    goto __pyx_L4;
  }

  /* "pygrib.pyx":1773
 *             x, y = np.meshgrid(x, y)
 *             lons, lats = pj(x, y, inverse=True)
 *         elif self['gridType'] == 'mercator':             # <<<<<<<<<<<<<<
 *             scale = self._get_key('grib2divider',False)
 *             if scale:
 */
  __pyx_t_7 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_gridType); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1773, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_t_7, __pyx_n_s_mercator, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1773, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (__pyx_t_1) {

    /* "pygrib.pyx":1774
 *             lons, lats = pj(x, y, inverse=True)
 *         elif self['gridType'] == 'mercator':
 *             scale = self._get_key('grib2divider',False)             # <<<<<<<<<<<<<<
 *             if scale:
 *                 scale = float(scale)
 */
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_get_key); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1774, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_tuple__100, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1774, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_v_scale = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "pygrib.pyx":1775
 *         elif self['gridType'] == 'mercator':
 *             scale = self._get_key('grib2divider',False)
 *             if scale:             # <<<<<<<<<<<<<<
 *                 scale = float(scale)
 *             else:
 */
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_scale); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1775, __pyx_L1_error)
    if (__pyx_t_1) {

      /* "pygrib.pyx":1776
 *             scale = self._get_key('grib2divider',False)
 *             if scale:
 *                 scale = float(scale)             # <<<<<<<<<<<<<<
 *             else:
 *                 scale = 1000.
 */
      __pyx_t_4 = __Pyx_PyNumber_Float(__pyx_v_scale); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1776, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF_SET(__pyx_v_scale, __pyx_t_4);
      __pyx_t_4 = 0;

      /* "pygrib.pyx":1775
 *         elif self['gridType'] == 'mercator':
 *             scale = self._get_key('grib2divider',False)
 *             if scale:             # <<<<<<<<<<<<<<
 *                 scale = float(scale)
 *             else:
 */
      goto __pyx_L136;
    }

    /* "pygrib.pyx":1778
 *                 scale = float(scale)
 *             else:
 *                 scale = 1000.             # <<<<<<<<<<<<<<
 *             lon1 = self['longitudeOfFirstGridPoint']/scale
 *             lon2 = self['longitudeOfLastGridPoint']/scale
 */
    /*else*/ {
      __Pyx_INCREF(__pyx_float_1000_);
      __Pyx_DECREF_SET(__pyx_v_scale, __pyx_float_1000_);
    }
    __pyx_L136:;

    /* "pygrib.pyx":1779
 *             else:
 *                 scale = 1000.
 *             lon1 = self['longitudeOfFirstGridPoint']/scale             # <<<<<<<<<<<<<<
 *             lon2 = self['longitudeOfLastGridPoint']/scale
 *             if self._get_key('truncateDegrees',False):
 */
    __pyx_t_4 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_longitudeOfFirstGridPoint); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1779, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_7 = __Pyx_PyNumber_Divide(__pyx_t_4, __pyx_v_scale); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1779, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_v_lon1 = __pyx_t_7;
    __pyx_t_7 = 0;

    /* "pygrib.pyx":1780
 *                 scale = 1000.
 *             lon1 = self['longitudeOfFirstGridPoint']/scale
 *             lon2 = self['longitudeOfLastGridPoint']/scale             # <<<<<<<<<<<<<<
 *             if self._get_key('truncateDegrees',False):
 *                 lon1 = int(lon1)
 */
    __pyx_t_7 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_longitudeOfLastGridPoint); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1780, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_4 = __Pyx_PyNumber_Divide(__pyx_t_7, __pyx_v_scale); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1780, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_v_lon2 = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "pygrib.pyx":1781
 *             lon1 = self['longitudeOfFirstGridPoint']/scale
 *             lon2 = self['longitudeOfLastGridPoint']/scale
 *             if self._get_key('truncateDegrees',False):             # <<<<<<<<<<<<<<
 *                 lon1 = int(lon1)
 *                 lon2 = int(lon2)
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_get_key); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1781, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_tuple__101, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1781, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1781, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (__pyx_t_1) {

      /* "pygrib.pyx":1782
 *             lon2 = self['longitudeOfLastGridPoint']/scale
 *             if self._get_key('truncateDegrees',False):
 *                 lon1 = int(lon1)             # <<<<<<<<<<<<<<
 *                 lon2 = int(lon2)
 *             lat1 = self['latitudeOfFirstGridPoint']/scale
 */
      __pyx_t_7 = __Pyx_PyNumber_Int(__pyx_v_lon1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1782, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF_SET(__pyx_v_lon1, __pyx_t_7);
      __pyx_t_7 = 0;

      /* "pygrib.pyx":1783
 *             if self._get_key('truncateDegrees',False):
 *                 lon1 = int(lon1)
 *                 lon2 = int(lon2)             # <<<<<<<<<<<<<<
 *             lat1 = self['latitudeOfFirstGridPoint']/scale
 *             lat2 = self['latitudeOfLastGridPoint']/scale
 */
      __pyx_t_7 = __Pyx_PyNumber_Int(__pyx_v_lon2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1783, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF_SET(__pyx_v_lon2, __pyx_t_7);
      __pyx_t_7 = 0;

      /* "pygrib.pyx":1781
 *             lon1 = self['longitudeOfFirstGridPoint']/scale
 *             lon2 = self['longitudeOfLastGridPoint']/scale
 *             if self._get_key('truncateDegrees',False):             # <<<<<<<<<<<<<<
 *                 lon1 = int(lon1)
 *                 lon2 = int(lon2)
 */
    }

    /* "pygrib.pyx":1784
 *                 lon1 = int(lon1)
 *                 lon2 = int(lon2)
 *             lat1 = self['latitudeOfFirstGridPoint']/scale             # <<<<<<<<<<<<<<
 *             lat2 = self['latitudeOfLastGridPoint']/scale
 *             if self._get_key('truncateDegrees',False):
 */
    __pyx_t_7 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_latitudeOfFirstGridPoint); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1784, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_4 = __Pyx_PyNumber_Divide(__pyx_t_7, __pyx_v_scale); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1784, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_v_lat1 = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "pygrib.pyx":1785
 *                 lon2 = int(lon2)
 *             lat1 = self['latitudeOfFirstGridPoint']/scale
 *             lat2 = self['latitudeOfLastGridPoint']/scale             # <<<<<<<<<<<<<<
 *             if self._get_key('truncateDegrees',False):
 *                 lat1 = int(lat1)
 */
    __pyx_t_4 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_latitudeOfLastGridPoint); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1785, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_7 = __Pyx_PyNumber_Divide(__pyx_t_4, __pyx_v_scale); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1785, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_v_lat2 = __pyx_t_7;
    __pyx_t_7 = 0;

    /* "pygrib.pyx":1786
 *             lat1 = self['latitudeOfFirstGridPoint']/scale
 *             lat2 = self['latitudeOfLastGridPoint']/scale
 *             if self._get_key('truncateDegrees',False):             # <<<<<<<<<<<<<<
 *                 lat1 = int(lat1)
 *                 lat2 = int(lat2)
 */
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_get_key); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1786, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_tuple__102, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1786, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1786, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (__pyx_t_1) {

      /* "pygrib.pyx":1787
 *             lat2 = self['latitudeOfLastGridPoint']/scale
 *             if self._get_key('truncateDegrees',False):
 *                 lat1 = int(lat1)             # <<<<<<<<<<<<<<
 *                 lat2 = int(lat2)
 *             pj = pyproj.Proj(self.projparams)
 */
      __pyx_t_4 = __Pyx_PyNumber_Int(__pyx_v_lat1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1787, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF_SET(__pyx_v_lat1, __pyx_t_4);
      __pyx_t_4 = 0;

      /* "pygrib.pyx":1788
 *             if self._get_key('truncateDegrees',False):
 *                 lat1 = int(lat1)
 *                 lat2 = int(lat2)             # <<<<<<<<<<<<<<
 *             pj = pyproj.Proj(self.projparams)
 *             llcrnrx, llcrnry = pj(lon1,lat1)
 */
      __pyx_t_4 = __Pyx_PyNumber_Int(__pyx_v_lat2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1788, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF_SET(__pyx_v_lat2, __pyx_t_4);
      __pyx_t_4 = 0;

      /* "pygrib.pyx":1786
 *             lat1 = self['latitudeOfFirstGridPoint']/scale
 *             lat2 = self['latitudeOfLastGridPoint']/scale
 *             if self._get_key('truncateDegrees',False):             # <<<<<<<<<<<<<<
 *                 lat1 = int(lat1)
 *                 lat2 = int(lat2)
 */
    }

    /* "pygrib.pyx":1789
 *                 lat1 = int(lat1)
 *                 lat2 = int(lat2)
 *             pj = pyproj.Proj(self.projparams)             # <<<<<<<<<<<<<<
 *             llcrnrx, llcrnry = pj(lon1,lat1)
 *             urcrnrx, urcrnry = pj(lon2,lat2)
 */
    __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_pyproj); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1789, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_Proj); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1789, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_14))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_14);
      if (likely(__pyx_t_7)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_14);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_14, function);
      }
    }
    if (!__pyx_t_7) {
      __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_14, __pyx_v_self->projparams); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1789, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_14)) {
        PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_v_self->projparams};
        __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_14, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1789, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_GOTREF(__pyx_t_4);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_14)) {
        PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_v_self->projparams};
        __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_14, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1789, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_GOTREF(__pyx_t_4);
      } else
      #endif
      {
        __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1789, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_7); __pyx_t_7 = NULL;
        __Pyx_INCREF(__pyx_v_self->projparams);
        __Pyx_GIVEREF(__pyx_v_self->projparams);
        PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_v_self->projparams);
        __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_14, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1789, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    __pyx_v_pj = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "pygrib.pyx":1790
 *                 lat2 = int(lat2)
 *             pj = pyproj.Proj(self.projparams)
 *             llcrnrx, llcrnry = pj(lon1,lat1)             # <<<<<<<<<<<<<<
 *             urcrnrx, urcrnry = pj(lon2,lat2)
 *             try:
 */
    __Pyx_INCREF(__pyx_v_pj);
    __pyx_t_14 = __pyx_v_pj; __pyx_t_5 = NULL;
    __pyx_t_6 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_14))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_14);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_14);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_14, function);
        __pyx_t_6 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_14)) {
      PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_v_lon1, __pyx_v_lat1};
      __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_14, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1790, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_4);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_14)) {
      PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_v_lon1, __pyx_v_lat1};
      __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_14, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1790, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_4);
    } else
    #endif
    {
      __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1790, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      if (__pyx_t_5) {
        __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __pyx_t_5 = NULL;
      }
      __Pyx_INCREF(__pyx_v_lon1);
      __Pyx_GIVEREF(__pyx_v_lon1);
      PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_v_lon1);
      __Pyx_INCREF(__pyx_v_lat1);
      __Pyx_GIVEREF(__pyx_v_lat1);
      PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_v_lat1);
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_14, __pyx_t_7, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1790, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    }
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) {
      PyObject* sequence = __pyx_t_4;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 1790, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_14 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_7 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_14 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_7 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_14);
      __Pyx_INCREF(__pyx_t_7);
      #else
      __pyx_t_14 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1790, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_14);
      __pyx_t_7 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1790, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      #endif
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_5 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1790, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_8 = Py_TYPE(__pyx_t_5)->tp_iternext;
      index = 0; __pyx_t_14 = __pyx_t_8(__pyx_t_5); if (unlikely(!__pyx_t_14)) goto __pyx_L139_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_14);
      index = 1; __pyx_t_7 = __pyx_t_8(__pyx_t_5); if (unlikely(!__pyx_t_7)) goto __pyx_L139_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_7);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_5), 2) < 0) __PYX_ERR(0, 1790, __pyx_L1_error)
      __pyx_t_8 = NULL;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      goto __pyx_L140_unpacking_done;
      __pyx_L139_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_8 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 1790, __pyx_L1_error)
      __pyx_L140_unpacking_done:;
    }
    __pyx_v_llcrnrx = __pyx_t_14;
    __pyx_t_14 = 0;
    __pyx_v_llcrnry = __pyx_t_7;
    __pyx_t_7 = 0;

    /* "pygrib.pyx":1791
 *             pj = pyproj.Proj(self.projparams)
 *             llcrnrx, llcrnry = pj(lon1,lat1)
 *             urcrnrx, urcrnry = pj(lon2,lat2)             # <<<<<<<<<<<<<<
 *             try:
 *                 nx = self['Nx']
 */
    __Pyx_INCREF(__pyx_v_pj);
    __pyx_t_7 = __pyx_v_pj; __pyx_t_14 = NULL;
    __pyx_t_6 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_7);
      if (likely(__pyx_t_14)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_14);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_7, function);
        __pyx_t_6 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_7)) {
      PyObject *__pyx_temp[3] = {__pyx_t_14, __pyx_v_lon2, __pyx_v_lat2};
      __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1791, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
      __Pyx_GOTREF(__pyx_t_4);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) {
      PyObject *__pyx_temp[3] = {__pyx_t_14, __pyx_v_lon2, __pyx_v_lat2};
      __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1791, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
      __Pyx_GOTREF(__pyx_t_4);
    } else
    #endif
    {
      __pyx_t_5 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1791, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      if (__pyx_t_14) {
        __Pyx_GIVEREF(__pyx_t_14); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_14); __pyx_t_14 = NULL;
      }
      __Pyx_INCREF(__pyx_v_lon2);
      __Pyx_GIVEREF(__pyx_v_lon2);
      PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_6, __pyx_v_lon2);
      __Pyx_INCREF(__pyx_v_lat2);
      __Pyx_GIVEREF(__pyx_v_lat2);
      PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_6, __pyx_v_lat2);
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1791, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    }
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) {
      PyObject* sequence = __pyx_t_4;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 1791, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_7 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_7 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_5 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_5);
      #else
      __pyx_t_7 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1791, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1791, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      #endif
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_14 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1791, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_14);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_8 = Py_TYPE(__pyx_t_14)->tp_iternext;
      index = 0; __pyx_t_7 = __pyx_t_8(__pyx_t_14); if (unlikely(!__pyx_t_7)) goto __pyx_L141_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_7);
      index = 1; __pyx_t_5 = __pyx_t_8(__pyx_t_14); if (unlikely(!__pyx_t_5)) goto __pyx_L141_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_5);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_14), 2) < 0) __PYX_ERR(0, 1791, __pyx_L1_error)
      __pyx_t_8 = NULL;
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
      goto __pyx_L142_unpacking_done;
      __pyx_L141_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
      __pyx_t_8 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 1791, __pyx_L1_error)
      __pyx_L142_unpacking_done:;
    }
    __pyx_v_urcrnrx = __pyx_t_7;
    __pyx_t_7 = 0;
    __pyx_v_urcrnry = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "pygrib.pyx":1792
 *             llcrnrx, llcrnry = pj(lon1,lat1)
 *             urcrnrx, urcrnry = pj(lon2,lat2)
 *             try:             # <<<<<<<<<<<<<<
 *                 nx = self['Nx']
 *                 ny = self['Ny']
 */
    {
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __Pyx_ExceptionSave(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
      __Pyx_XGOTREF(__pyx_t_9);
      __Pyx_XGOTREF(__pyx_t_10);
      __Pyx_XGOTREF(__pyx_t_11);
      /*try:*/ {

        /* "pygrib.pyx":1793
 *             urcrnrx, urcrnry = pj(lon2,lat2)
 *             try:
 *                 nx = self['Nx']             # <<<<<<<<<<<<<<
 *                 ny = self['Ny']
 *             except:
 */
        __pyx_t_4 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_Nx); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1793, __pyx_L143_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_v_nx = __pyx_t_4;
        __pyx_t_4 = 0;

        /* "pygrib.pyx":1794
 *             try:
 *                 nx = self['Nx']
 *                 ny = self['Ny']             # <<<<<<<<<<<<<<
 *             except:
 *                 nx = self['Ni']
 */
        __pyx_t_4 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_Ny); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1794, __pyx_L143_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_v_ny = __pyx_t_4;
        __pyx_t_4 = 0;

        /* "pygrib.pyx":1792
 *             llcrnrx, llcrnry = pj(lon1,lat1)
 *             urcrnrx, urcrnry = pj(lon2,lat2)
 *             try:             # <<<<<<<<<<<<<<
 *                 nx = self['Nx']
 *                 ny = self['Ny']
 */
      }
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      goto __pyx_L148_try_end;
      __pyx_L143_error:;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
      __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "pygrib.pyx":1795
 *                 nx = self['Nx']
 *                 ny = self['Ny']
 *             except:             # <<<<<<<<<<<<<<
 *                 nx = self['Ni']
 *                 ny = self['Nj']
 */
      /*except:*/ {
        __Pyx_AddTraceback("pygrib.gribmessage.latlons", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_5, &__pyx_t_7) < 0) __PYX_ERR(0, 1795, __pyx_L145_except_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_GOTREF(__pyx_t_7);

        /* "pygrib.pyx":1796
 *                 ny = self['Ny']
 *             except:
 *                 nx = self['Ni']             # <<<<<<<<<<<<<<
 *                 ny = self['Nj']
 *             dx = (urcrnrx-llcrnrx)/(nx-1)
 */
        __pyx_t_14 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_Ni); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1796, __pyx_L145_except_error)
        __Pyx_GOTREF(__pyx_t_14);
        __Pyx_XDECREF_SET(__pyx_v_nx, __pyx_t_14);
        __pyx_t_14 = 0;

        /* "pygrib.pyx":1797
 *             except:
 *                 nx = self['Ni']
 *                 ny = self['Nj']             # <<<<<<<<<<<<<<
 *             dx = (urcrnrx-llcrnrx)/(nx-1)
 *             dy = (urcrnry-llcrnry)/(ny-1)
 */
        __pyx_t_14 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_Nj); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1797, __pyx_L145_except_error)
        __Pyx_GOTREF(__pyx_t_14);
        __Pyx_XDECREF_SET(__pyx_v_ny, __pyx_t_14);
        __pyx_t_14 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        goto __pyx_L144_exception_handled;
      }
      __pyx_L145_except_error:;

      /* "pygrib.pyx":1792
 *             llcrnrx, llcrnry = pj(lon1,lat1)
 *             urcrnrx, urcrnry = pj(lon2,lat2)
 *             try:             # <<<<<<<<<<<<<<
 *                 nx = self['Nx']
 *                 ny = self['Ny']
 */
      __Pyx_XGIVEREF(__pyx_t_9);
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11);
      goto __pyx_L1_error;
      __pyx_L144_exception_handled:;
      __Pyx_XGIVEREF(__pyx_t_9);
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11);
      __pyx_L148_try_end:;
    }

    /* "pygrib.pyx":1798
 *                 nx = self['Ni']
 *                 ny = self['Nj']
 *             dx = (urcrnrx-llcrnrx)/(nx-1)             # <<<<<<<<<<<<<<
 *             dy = (urcrnry-llcrnry)/(ny-1)
 *             x = llcrnrx+dx*np.arange(nx)
 */
    __pyx_t_7 = PyNumber_Subtract(__pyx_v_urcrnrx, __pyx_v_llcrnrx); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1798, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_5 = __Pyx_PyInt_SubtractObjC(__pyx_v_nx, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1798, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_4 = __Pyx_PyNumber_Divide(__pyx_t_7, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1798, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_v_dx = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "pygrib.pyx":1799
 *                 ny = self['Nj']
 *             dx = (urcrnrx-llcrnrx)/(nx-1)
 *             dy = (urcrnry-llcrnry)/(ny-1)             # <<<<<<<<<<<<<<
 *             x = llcrnrx+dx*np.arange(nx)
 *             y = llcrnry+dy*np.arange(ny)
 */
    __pyx_t_4 = PyNumber_Subtract(__pyx_v_urcrnry, __pyx_v_llcrnry); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1799, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = __Pyx_PyInt_SubtractObjC(__pyx_v_ny, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1799, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_7 = __Pyx_PyNumber_Divide(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1799, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_v_dy = __pyx_t_7;
    __pyx_t_7 = 0;

    /* "pygrib.pyx":1800
 *             dx = (urcrnrx-llcrnrx)/(nx-1)
 *             dy = (urcrnry-llcrnry)/(ny-1)
 *             x = llcrnrx+dx*np.arange(nx)             # <<<<<<<<<<<<<<
 *             y = llcrnry+dy*np.arange(ny)
 *             x, y = np.meshgrid(x, y)
 */
    __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1800, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_arange); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1800, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    if (!__pyx_t_5) {
      __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_nx); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1800, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_4)) {
        PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_v_nx};
        __pyx_t_7 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1800, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_GOTREF(__pyx_t_7);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
        PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_v_nx};
        __pyx_t_7 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1800, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_GOTREF(__pyx_t_7);
      } else
      #endif
      {
        __pyx_t_14 = PyTuple_New(1+1); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1800, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_14);
        __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_5); __pyx_t_5 = NULL;
        __Pyx_INCREF(__pyx_v_nx);
        __Pyx_GIVEREF(__pyx_v_nx);
        PyTuple_SET_ITEM(__pyx_t_14, 0+1, __pyx_v_nx);
        __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_14, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1800, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyNumber_Multiply(__pyx_v_dx, __pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1800, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = PyNumber_Add(__pyx_v_llcrnrx, __pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1800, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_v_x = __pyx_t_7;
    __pyx_t_7 = 0;

    /* "pygrib.pyx":1801
 *             dy = (urcrnry-llcrnry)/(ny-1)
 *             x = llcrnrx+dx*np.arange(nx)
 *             y = llcrnry+dy*np.arange(ny)             # <<<<<<<<<<<<<<
 *             x, y = np.meshgrid(x, y)
 *             lons, lats = pj(x, y, inverse=True)
 */
    __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1801, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_arange); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1801, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_14))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_14);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_14);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_14, function);
      }
    }
    if (!__pyx_t_4) {
      __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_t_14, __pyx_v_ny); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1801, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_14)) {
        PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_v_ny};
        __pyx_t_7 = __Pyx_PyFunction_FastCall(__pyx_t_14, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1801, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_GOTREF(__pyx_t_7);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_14)) {
        PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_v_ny};
        __pyx_t_7 = __Pyx_PyCFunction_FastCall(__pyx_t_14, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1801, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_GOTREF(__pyx_t_7);
      } else
      #endif
      {
        __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1801, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __pyx_t_4 = NULL;
        __Pyx_INCREF(__pyx_v_ny);
        __Pyx_GIVEREF(__pyx_v_ny);
        PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_v_ny);
        __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_14, __pyx_t_5, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1801, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    __pyx_t_14 = PyNumber_Multiply(__pyx_v_dy, __pyx_t_7); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1801, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = PyNumber_Add(__pyx_v_llcrnry, __pyx_t_14); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1801, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    __pyx_v_y = __pyx_t_7;
    __pyx_t_7 = 0;

    /* "pygrib.pyx":1802
 *             x = llcrnrx+dx*np.arange(nx)
 *             y = llcrnry+dy*np.arange(ny)
 *             x, y = np.meshgrid(x, y)             # <<<<<<<<<<<<<<
 *             lons, lats = pj(x, y, inverse=True)
 *         elif self['gridType'] in ['rotated_ll','rotated_gg']:
 */
    __pyx_t_14 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1802, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_14, __pyx_n_s_meshgrid); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1802, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    __pyx_t_14 = NULL;
    __pyx_t_6 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_14)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_14);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
        __pyx_t_6 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[3] = {__pyx_t_14, __pyx_v_x, __pyx_v_y};
      __pyx_t_7 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1802, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
      __Pyx_GOTREF(__pyx_t_7);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[3] = {__pyx_t_14, __pyx_v_x, __pyx_v_y};
      __pyx_t_7 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1802, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
      __Pyx_GOTREF(__pyx_t_7);
    } else
    #endif
    {
      __pyx_t_4 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1802, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (__pyx_t_14) {
        __Pyx_GIVEREF(__pyx_t_14); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_14); __pyx_t_14 = NULL;
      }
      __Pyx_INCREF(__pyx_v_x);
      __Pyx_GIVEREF(__pyx_v_x);
      PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_6, __pyx_v_x);
      __Pyx_INCREF(__pyx_v_y);
      __Pyx_GIVEREF(__pyx_v_y);
      PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_6, __pyx_v_y);
      __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_4, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1802, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if ((likely(PyTuple_CheckExact(__pyx_t_7))) || (PyList_CheckExact(__pyx_t_7))) {
      PyObject* sequence = __pyx_t_7;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 1802, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_5 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_4 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_4);
      #else
      __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1802, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1802, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      #endif
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_14 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1802, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_14);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_8 = Py_TYPE(__pyx_t_14)->tp_iternext;
      index = 0; __pyx_t_5 = __pyx_t_8(__pyx_t_14); if (unlikely(!__pyx_t_5)) goto __pyx_L151_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_5);
      index = 1; __pyx_t_4 = __pyx_t_8(__pyx_t_14); if (unlikely(!__pyx_t_4)) goto __pyx_L151_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_4);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_14), 2) < 0) __PYX_ERR(0, 1802, __pyx_L1_error)
      __pyx_t_8 = NULL;
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
      goto __pyx_L152_unpacking_done;
      __pyx_L151_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
      __pyx_t_8 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 1802, __pyx_L1_error)
      __pyx_L152_unpacking_done:;
    }
    __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_5);
    __pyx_t_5 = 0;
    __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "pygrib.pyx":1803
 *             y = llcrnry+dy*np.arange(ny)
 *             x, y = np.meshgrid(x, y)
 *             lons, lats = pj(x, y, inverse=True)             # <<<<<<<<<<<<<<
 *         elif self['gridType'] in ['rotated_ll','rotated_gg']:
 *             rotatedlats = self['distinctLatitudes']
 */
    __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1803, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_INCREF(__pyx_v_x);
    __Pyx_GIVEREF(__pyx_v_x);
    PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_x);
    __Pyx_INCREF(__pyx_v_y);
    __Pyx_GIVEREF(__pyx_v_y);
    PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_v_y);
    __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1803, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_inverse, Py_True) < 0) __PYX_ERR(0, 1803, __pyx_L1_error)
    __pyx_t_5 = __Pyx_PyObject_Call(__pyx_v_pj, __pyx_t_7, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1803, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if ((likely(PyTuple_CheckExact(__pyx_t_5))) || (PyList_CheckExact(__pyx_t_5))) {
      PyObject* sequence = __pyx_t_5;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 1803, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_7 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_4 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_7 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_7);
      #else
      __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1803, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_7 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1803, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      #endif
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_14 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1803, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_14);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_8 = Py_TYPE(__pyx_t_14)->tp_iternext;
      index = 0; __pyx_t_4 = __pyx_t_8(__pyx_t_14); if (unlikely(!__pyx_t_4)) goto __pyx_L153_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_4);
      index = 1; __pyx_t_7 = __pyx_t_8(__pyx_t_14); if (unlikely(!__pyx_t_7)) goto __pyx_L153_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_7);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_14), 2) < 0) __PYX_ERR(0, 1803, __pyx_L1_error)
      __pyx_t_8 = NULL;
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
      goto __pyx_L154_unpacking_done;
      __pyx_L153_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
      __pyx_t_8 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 1803, __pyx_L1_error)
      __pyx_L154_unpacking_done:;
    }
    __pyx_v_lons = __pyx_t_4;
    __pyx_t_4 = 0;
    __pyx_v_lats = __pyx_t_7;
    __pyx_t_7 = 0;

    /* "pygrib.pyx":1773
 *             x, y = np.meshgrid(x, y)
 *             lons, lats = pj(x, y, inverse=True)
 *         elif self['gridType'] == 'mercator':             # <<<<<<<<<<<<<<
 *             scale = self._get_key('grib2divider',False)
 *             if scale:
 */
    goto __pyx_L4;
  }

  /* "pygrib.pyx":1804
 *             x, y = np.meshgrid(x, y)
 *             lons, lats = pj(x, y, inverse=True)
 *         elif self['gridType'] in ['rotated_ll','rotated_gg']:             # <<<<<<<<<<<<<<
 *             rotatedlats = self['distinctLatitudes']
 *             rotatedlons = self['distinctLongitudes']
 */
  __pyx_t_5 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_gridType); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1804, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_2 = (__Pyx_PyString_Equals(__pyx_t_5, __pyx_n_s_rotated_ll, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 1804, __pyx_L1_error)
  if (!__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L155_bool_binop_done;
  }
  __pyx_t_2 = (__Pyx_PyString_Equals(__pyx_t_5, __pyx_n_s_rotated_gg, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 1804, __pyx_L1_error)
  __pyx_t_1 = __pyx_t_2;
  __pyx_L155_bool_binop_done:;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (likely(__pyx_t_2)) {

    /* "pygrib.pyx":1805
 *             lons, lats = pj(x, y, inverse=True)
 *         elif self['gridType'] in ['rotated_ll','rotated_gg']:
 *             rotatedlats = self['distinctLatitudes']             # <<<<<<<<<<<<<<
 *             rotatedlons = self['distinctLongitudes']
 *             d2r = np.pi/180.
 */
    __pyx_t_5 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_distinctLatitudes); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1805, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_v_rotatedlats = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "pygrib.pyx":1806
 *         elif self['gridType'] in ['rotated_ll','rotated_gg']:
 *             rotatedlats = self['distinctLatitudes']
 *             rotatedlons = self['distinctLongitudes']             # <<<<<<<<<<<<<<
 *             d2r = np.pi/180.
 *             lonsr, latsr = np.meshgrid(rotatedlons*d2r, rotatedlats*d2r)
 */
    __pyx_t_5 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_distinctLongitudes); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1806, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_v_rotatedlons = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "pygrib.pyx":1807
 *             rotatedlats = self['distinctLatitudes']
 *             rotatedlons = self['distinctLongitudes']
 *             d2r = np.pi/180.             # <<<<<<<<<<<<<<
 *             lonsr, latsr = np.meshgrid(rotatedlons*d2r, rotatedlats*d2r)
 *             pj = pyproj.Proj(self.projparams)
 */
    __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1807, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_pi); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1807, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_PyFloat_DivideObjC(__pyx_t_7, __pyx_float_180_, 180., 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1807, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_v_d2r = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "pygrib.pyx":1808
 *             rotatedlons = self['distinctLongitudes']
 *             d2r = np.pi/180.
 *             lonsr, latsr = np.meshgrid(rotatedlons*d2r, rotatedlats*d2r)             # <<<<<<<<<<<<<<
 *             pj = pyproj.Proj(self.projparams)
 *             lons,lats = pj(lonsr,latsr,inverse=True)
 */
    __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1808, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_meshgrid); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1808, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = PyNumber_Multiply(__pyx_v_rotatedlons, __pyx_v_d2r); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1808, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_14 = PyNumber_Multiply(__pyx_v_rotatedlats, __pyx_v_d2r); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1808, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    __pyx_t_13 = NULL;
    __pyx_t_6 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_13)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_13);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
        __pyx_t_6 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[3] = {__pyx_t_13, __pyx_t_7, __pyx_t_14};
      __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1808, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[3] = {__pyx_t_13, __pyx_t_7, __pyx_t_14};
      __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1808, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    } else
    #endif
    {
      __pyx_t_12 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1808, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      if (__pyx_t_13) {
        __Pyx_GIVEREF(__pyx_t_13); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_13); __pyx_t_13 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_7);
      PyTuple_SET_ITEM(__pyx_t_12, 0+__pyx_t_6, __pyx_t_7);
      __Pyx_GIVEREF(__pyx_t_14);
      PyTuple_SET_ITEM(__pyx_t_12, 1+__pyx_t_6, __pyx_t_14);
      __pyx_t_7 = 0;
      __pyx_t_14 = 0;
      __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_12, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1808, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if ((likely(PyTuple_CheckExact(__pyx_t_5))) || (PyList_CheckExact(__pyx_t_5))) {
      PyObject* sequence = __pyx_t_5;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 1808, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_12 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_4 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_12 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_12);
      #else
      __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1808, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_12 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1808, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      #endif
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_14 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1808, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_14);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_8 = Py_TYPE(__pyx_t_14)->tp_iternext;
      index = 0; __pyx_t_4 = __pyx_t_8(__pyx_t_14); if (unlikely(!__pyx_t_4)) goto __pyx_L157_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_4);
      index = 1; __pyx_t_12 = __pyx_t_8(__pyx_t_14); if (unlikely(!__pyx_t_12)) goto __pyx_L157_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_12);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_14), 2) < 0) __PYX_ERR(0, 1808, __pyx_L1_error)
      __pyx_t_8 = NULL;
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
      goto __pyx_L158_unpacking_done;
      __pyx_L157_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
      __pyx_t_8 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 1808, __pyx_L1_error)
      __pyx_L158_unpacking_done:;
    }
    __pyx_v_lonsr = __pyx_t_4;
    __pyx_t_4 = 0;
    __pyx_v_latsr = __pyx_t_12;
    __pyx_t_12 = 0;

    /* "pygrib.pyx":1809
 *             d2r = np.pi/180.
 *             lonsr, latsr = np.meshgrid(rotatedlons*d2r, rotatedlats*d2r)
 *             pj = pyproj.Proj(self.projparams)             # <<<<<<<<<<<<<<
 *             lons,lats = pj(lonsr,latsr,inverse=True)
 *         else:
 */
    __pyx_t_12 = __Pyx_GetModuleGlobalName(__pyx_n_s_pyproj); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1809, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_Proj); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1809, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __pyx_t_12 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_12)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_12);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    if (!__pyx_t_12) {
      __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_self->projparams); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1809, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_4)) {
        PyObject *__pyx_temp[2] = {__pyx_t_12, __pyx_v_self->projparams};
        __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1809, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
        __Pyx_GOTREF(__pyx_t_5);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
        PyObject *__pyx_temp[2] = {__pyx_t_12, __pyx_v_self->projparams};
        __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1809, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
        __Pyx_GOTREF(__pyx_t_5);
      } else
      #endif
      {
        __pyx_t_14 = PyTuple_New(1+1); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1809, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_14);
        __Pyx_GIVEREF(__pyx_t_12); PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_12); __pyx_t_12 = NULL;
        __Pyx_INCREF(__pyx_v_self->projparams);
        __Pyx_GIVEREF(__pyx_v_self->projparams);
        PyTuple_SET_ITEM(__pyx_t_14, 0+1, __pyx_v_self->projparams);
        __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_14, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1809, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_v_pj = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "pygrib.pyx":1810
 *             lonsr, latsr = np.meshgrid(rotatedlons*d2r, rotatedlats*d2r)
 *             pj = pyproj.Proj(self.projparams)
 *             lons,lats = pj(lonsr,latsr,inverse=True)             # <<<<<<<<<<<<<<
 *         else:
 *             raise ValueError('unsupported grid %s' % self['gridType'])
 */
    __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1810, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_v_lonsr);
    __Pyx_GIVEREF(__pyx_v_lonsr);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_lonsr);
    __Pyx_INCREF(__pyx_v_latsr);
    __Pyx_GIVEREF(__pyx_v_latsr);
    PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_latsr);
    __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1810, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_inverse, Py_True) < 0) __PYX_ERR(0, 1810, __pyx_L1_error)
    __pyx_t_14 = __Pyx_PyObject_Call(__pyx_v_pj, __pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1810, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if ((likely(PyTuple_CheckExact(__pyx_t_14))) || (PyList_CheckExact(__pyx_t_14))) {
      PyObject* sequence = __pyx_t_14;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 1810, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_4 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_5 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_5);
      #else
      __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1810, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1810, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      #endif
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_12 = PyObject_GetIter(__pyx_t_14); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1810, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
      __pyx_t_8 = Py_TYPE(__pyx_t_12)->tp_iternext;
      index = 0; __pyx_t_4 = __pyx_t_8(__pyx_t_12); if (unlikely(!__pyx_t_4)) goto __pyx_L159_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_4);
      index = 1; __pyx_t_5 = __pyx_t_8(__pyx_t_12); if (unlikely(!__pyx_t_5)) goto __pyx_L159_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_5);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_12), 2) < 0) __PYX_ERR(0, 1810, __pyx_L1_error)
      __pyx_t_8 = NULL;
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      goto __pyx_L160_unpacking_done;
      __pyx_L159_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __pyx_t_8 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 1810, __pyx_L1_error)
      __pyx_L160_unpacking_done:;
    }
    __pyx_v_lons = __pyx_t_4;
    __pyx_t_4 = 0;
    __pyx_v_lats = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "pygrib.pyx":1804
 *             x, y = np.meshgrid(x, y)
 *             lons, lats = pj(x, y, inverse=True)
 *         elif self['gridType'] in ['rotated_ll','rotated_gg']:             # <<<<<<<<<<<<<<
 *             rotatedlats = self['distinctLatitudes']
 *             rotatedlons = self['distinctLongitudes']
 */
    goto __pyx_L4;
  }

  /* "pygrib.pyx":1812
 *             lons,lats = pj(lonsr,latsr,inverse=True)
 *         else:
 *             raise ValueError('unsupported grid %s' % self['gridType'])             # <<<<<<<<<<<<<<
 *         return lats, lons
 * 
 */
  /*else*/ {
    __pyx_t_14 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_gridType); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1812, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    __pyx_t_5 = __Pyx_PyString_Format(__pyx_kp_s_unsupported_grid_s, __pyx_t_14); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1812, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    __pyx_t_14 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_5); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1812, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_Raise(__pyx_t_14, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    __PYX_ERR(0, 1812, __pyx_L1_error)
  }
  __pyx_L4:;

  /* "pygrib.pyx":1813
 *         else:
 *             raise ValueError('unsupported grid %s' % self['gridType'])
 *         return lats, lons             # <<<<<<<<<<<<<<
 * 
 * cdef class index(object):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_14 = PyTuple_New(2); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1813, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_14);
  __Pyx_INCREF(__pyx_v_lats);
  __Pyx_GIVEREF(__pyx_v_lats);
  PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_v_lats);
  __Pyx_INCREF(__pyx_v_lons);
  __Pyx_GIVEREF(__pyx_v_lons);
  PyTuple_SET_ITEM(__pyx_t_14, 1, __pyx_v_lons);
  __pyx_r = __pyx_t_14;
  __pyx_t_14 = 0;
  goto __pyx_L0;

  /* "pygrib.pyx":1567
 *         self.projparams = projparams
 * 
 *     def latlons(self):             # <<<<<<<<<<<<<<
 *         """
 *         latlons()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_XDECREF(__pyx_t_14);
  __Pyx_AddTraceback("pygrib.gribmessage.latlons", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_nx);
  __Pyx_XDECREF(__pyx_v_ny);
  __Pyx_XDECREF(__pyx_v_lon1);
  __Pyx_XDECREF(__pyx_v_lon2);
  __Pyx_XDECREF(__pyx_v_lat1);
  __Pyx_XDECREF(__pyx_v_lat2);
  __Pyx_XDECREF(__pyx_v_lats);
  __Pyx_XDECREF(__pyx_v_lons);
  __Pyx_XDECREF(__pyx_v_dx);
  __Pyx_XDECREF(__pyx_v_dy);
  __Pyx_XDECREF(__pyx_v_pj);
  __Pyx_XDECREF(__pyx_v_llcrnrx);
  __Pyx_XDECREF(__pyx_v_llcrnry);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_y);
  __Pyx_XDECREF(__pyx_v_scale);
  __Pyx_XDECREF(__pyx_v_lon_0);
  __Pyx_XDECREF(__pyx_v_lat_0);
  __Pyx_XDECREF(__pyx_v_lonmax);
  __Pyx_XDECREF(__pyx_v_latmax);
  __Pyx_XDECREF(__pyx_v_x1);
  __Pyx_XDECREF(__pyx_v_y1);
  __Pyx_XDECREF(__pyx_v_x2);
  __Pyx_XDECREF(__pyx_v_y2);
  __Pyx_XDECREF(__pyx_v_width);
  __Pyx_XDECREF(__pyx_v_height);
  __Pyx_XDECREF(__pyx_v_xmax);
  __Pyx_XDECREF(__pyx_v_ymax);
  __Pyx_XDECREF(__pyx_v_abslons);
  __Pyx_XDECREF(__pyx_v_abslats);
  __Pyx_XDECREF(__pyx_v_urcrnrx);
  __Pyx_XDECREF(__pyx_v_urcrnry);
  __Pyx_XDECREF(__pyx_v_rotatedlats);
  __Pyx_XDECREF(__pyx_v_rotatedlons);
  __Pyx_XDECREF(__pyx_v_d2r);
  __Pyx_XDECREF(__pyx_v_lonsr);
  __Pyx_XDECREF(__pyx_v_latsr);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pygrib.pyx":830
 *     is a range, then C{validDate} corresponds to the end of the range."""
 *     cdef grib_handle *_gh
 *     cdef public messagenumber, projparams, validDate, analDate,\             # <<<<<<<<<<<<<<
 *     expand_reduced, _ro_keys, _all_keys, fcstimeunits
 *     def __init__(self):
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pygrib_11gribmessage_13messagenumber_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6pygrib_11gribmessage_13messagenumber_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pygrib_11gribmessage_13messagenumber___get__(((struct __pyx_obj_6pygrib_gribmessage *)__pyx_v_self));

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

static PyObject *__pyx_pf_6pygrib_11gribmessage_13messagenumber___get__(struct __pyx_obj_6pygrib_gribmessage *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->messagenumber);
  __pyx_r = __pyx_v_self->messagenumber;
  goto __pyx_L0;

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

/* Python wrapper */
static int __pyx_pw_6pygrib_11gribmessage_13messagenumber_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_6pygrib_11gribmessage_13messagenumber_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pygrib_11gribmessage_13messagenumber_2__set__(((struct __pyx_obj_6pygrib_gribmessage *)__pyx_v_self), ((PyObject *)__pyx_v_value));

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

static int __pyx_pf_6pygrib_11gribmessage_13messagenumber_2__set__(struct __pyx_obj_6pygrib_gribmessage *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__", 0);
  __Pyx_INCREF(__pyx_v_value);
  __Pyx_GIVEREF(__pyx_v_value);
  __Pyx_GOTREF(__pyx_v_self->messagenumber);
  __Pyx_DECREF(__pyx_v_self->messagenumber);
  __pyx_v_self->messagenumber = __pyx_v_value;

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

/* Python wrapper */
static int __pyx_pw_6pygrib_11gribmessage_13messagenumber_5__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_6pygrib_11gribmessage_13messagenumber_5__del__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pygrib_11gribmessage_13messagenumber_4__del__(((struct __pyx_obj_6pygrib_gribmessage *)__pyx_v_self));

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

static int __pyx_pf_6pygrib_11gribmessage_13messagenumber_4__del__(struct __pyx_obj_6pygrib_gribmessage *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__", 0);
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->messagenumber);
  __Pyx_DECREF(__pyx_v_self->messagenumber);
  __pyx_v_self->messagenumber = Py_None;

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

/* Python wrapper */
static PyObject *__pyx_pw_6pygrib_11gribmessage_10projparams_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6pygrib_11gribmessage_10projparams_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pygrib_11gribmessage_10projparams___get__(((struct __pyx_obj_6pygrib_gribmessage *)__pyx_v_self));

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

static PyObject *__pyx_pf_6pygrib_11gribmessage_10projparams___get__(struct __pyx_obj_6pygrib_gribmessage *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->projparams);
  __pyx_r = __pyx_v_self->projparams;
  goto __pyx_L0;

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

/* Python wrapper */
static int __pyx_pw_6pygrib_11gribmessage_10projparams_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_6pygrib_11gribmessage_10projparams_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pygrib_11gribmessage_10projparams_2__set__(((struct __pyx_obj_6pygrib_gribmessage *)__pyx_v_self), ((PyObject *)__pyx_v_value));

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

static int __pyx_pf_6pygrib_11gribmessage_10projparams_2__set__(struct __pyx_obj_6pygrib_gribmessage *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__", 0);
  __Pyx_INCREF(__pyx_v_value);
  __Pyx_GIVEREF(__pyx_v_value);
  __Pyx_GOTREF(__pyx_v_self->projparams);
  __Pyx_DECREF(__pyx_v_self->projparams);
  __pyx_v_self->projparams = __pyx_v_value;

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

/* Python wrapper */
static int __pyx_pw_6pygrib_11gribmessage_10projparams_5__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_6pygrib_11gribmessage_10projparams_5__del__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pygrib_11gribmessage_10projparams_4__del__(((struct __pyx_obj_6pygrib_gribmessage *)__pyx_v_self));

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

static int __pyx_pf_6pygrib_11gribmessage_10projparams_4__del__(struct __pyx_obj_6pygrib_gribmessage *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__", 0);
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->projparams);
  __Pyx_DECREF(__pyx_v_self->projparams);
  __pyx_v_self->projparams = Py_None;

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

/* Python wrapper */
static PyObject *__pyx_pw_6pygrib_11gribmessage_9validDate_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6pygrib_11gribmessage_9validDate_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pygrib_11gribmessage_9validDate___get__(((struct __pyx_obj_6pygrib_gribmessage *)__pyx_v_self));

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

static PyObject *__pyx_pf_6pygrib_11gribmessage_9validDate___get__(struct __pyx_obj_6pygrib_gribmessage *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->validDate);
  __pyx_r = __pyx_v_self->validDate;
  goto __pyx_L0;

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

/* Python wrapper */
static int __pyx_pw_6pygrib_11gribmessage_9validDate_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_6pygrib_11gribmessage_9validDate_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pygrib_11gribmessage_9validDate_2__set__(((struct __pyx_obj_6pygrib_gribmessage *)__pyx_v_self), ((PyObject *)__pyx_v_value));

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

static int __pyx_pf_6pygrib_11gribmessage_9validDate_2__set__(struct __pyx_obj_6pygrib_gribmessage *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__", 0);
  __Pyx_INCREF(__pyx_v_value);
  __Pyx_GIVEREF(__pyx_v_value);
  __Pyx_GOTREF(__pyx_v_self->validDate);
  __Pyx_DECREF(__pyx_v_self->validDate);
  __pyx_v_self->validDate = __pyx_v_value;

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

/* Python wrapper */
static int __pyx_pw_6pygrib_11gribmessage_9validDate_5__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_6pygrib_11gribmessage_9validDate_5__del__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pygrib_11gribmessage_9validDate_4__del__(((struct __pyx_obj_6pygrib_gribmessage *)__pyx_v_self));

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

static int __pyx_pf_6pygrib_11gribmessage_9validDate_4__del__(struct __pyx_obj_6pygrib_gribmessage *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__", 0);
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->validDate);
  __Pyx_DECREF(__pyx_v_self->validDate);
  __pyx_v_self->validDate = Py_None;

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

/* Python wrapper */
static PyObject *__pyx_pw_6pygrib_11gribmessage_8analDate_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6pygrib_11gribmessage_8analDate_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pygrib_11gribmessage_8analDate___get__(((struct __pyx_obj_6pygrib_gribmessage *)__pyx_v_self));

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

static PyObject *__pyx_pf_6pygrib_11gribmessage_8analDate___get__(struct __pyx_obj_6pygrib_gribmessage *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->analDate);
  __pyx_r = __pyx_v_self->analDate;
  goto __pyx_L0;

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

/* Python wrapper */
static int __pyx_pw_6pygrib_11gribmessage_8analDate_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_6pygrib_11gribmessage_8analDate_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pygrib_11gribmessage_8analDate_2__set__(((struct __pyx_obj_6pygrib_gribmessage *)__pyx_v_self), ((PyObject *)__pyx_v_value));

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

static int __pyx_pf_6pygrib_11gribmessage_8analDate_2__set__(struct __pyx_obj_6pygrib_gribmessage *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__", 0);
  __Pyx_INCREF(__pyx_v_value);
  __Pyx_GIVEREF(__pyx_v_value);
  __Pyx_GOTREF(__pyx_v_self->analDate);
  __Pyx_DECREF(__pyx_v_self->analDate);
  __pyx_v_self->analDate = __pyx_v_value;

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

/* Python wrapper */
static int __pyx_pw_6pygrib_11gribmessage_8analDate_5__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_6pygrib_11gribmessage_8analDate_5__del__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pygrib_11gribmessage_8analDate_4__del__(((struct __pyx_obj_6pygrib_gribmessage *)__pyx_v_self));

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

static int __pyx_pf_6pygrib_11gribmessage_8analDate_4__del__(struct __pyx_obj_6pygrib_gribmessage *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__", 0);
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->analDate);
  __Pyx_DECREF(__pyx_v_self->analDate);
  __pyx_v_self->analDate = Py_None;

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

/* "pygrib.pyx":831
 *     cdef grib_handle *_gh
 *     cdef public messagenumber, projparams, validDate, analDate,\
 *     expand_reduced, _ro_keys, _all_keys, fcstimeunits             # <<<<<<<<<<<<<<
 *     def __init__(self):
 *         # calling "__new__()" will not call "__init__()" !
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pygrib_11gribmessage_14expand_reduced_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6pygrib_11gribmessage_14expand_reduced_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pygrib_11gribmessage_14expand_reduced___get__(((struct __pyx_obj_6pygrib_gribmessage *)__pyx_v_self));

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

static PyObject *__pyx_pf_6pygrib_11gribmessage_14expand_reduced___get__(struct __pyx_obj_6pygrib_gribmessage *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->expand_reduced);
  __pyx_r = __pyx_v_self->expand_reduced;
  goto __pyx_L0;

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

/* Python wrapper */
static int __pyx_pw_6pygrib_11gribmessage_14expand_reduced_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_6pygrib_11gribmessage_14expand_reduced_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pygrib_11gribmessage_14expand_reduced_2__set__(((struct __pyx_obj_6pygrib_gribmessage *)__pyx_v_self), ((PyObject *)__pyx_v_value));

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

static int __pyx_pf_6pygrib_11gribmessage_14expand_reduced_2__set__(struct __pyx_obj_6pygrib_gribmessage *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__", 0);
  __Pyx_INCREF(__pyx_v_value);
  __Pyx_GIVEREF(__pyx_v_value);
  __Pyx_GOTREF(__pyx_v_self->expand_reduced);
  __Pyx_DECREF(__pyx_v_self->expand_reduced);
  __pyx_v_self->expand_reduced = __pyx_v_value;

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

/* Python wrapper */
static int __pyx_pw_6pygrib_11gribmessage_14expand_reduced_5__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_6pygrib_11gribmessage_14expand_reduced_5__del__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pygrib_11gribmessage_14expand_reduced_4__del__(((struct __pyx_obj_6pygrib_gribmessage *)__pyx_v_self));

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

static int __pyx_pf_6pygrib_11gribmessage_14expand_reduced_4__del__(struct __pyx_obj_6pygrib_gribmessage *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__", 0);
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->expand_reduced);
  __Pyx_DECREF(__pyx_v_self->expand_reduced);
  __pyx_v_self->expand_reduced = Py_None;

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

/* Python wrapper */
static PyObject *__pyx_pw_6pygrib_11gribmessage_8_ro_keys_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6pygrib_11gribmessage_8_ro_keys_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pygrib_11gribmessage_8_ro_keys___get__(((struct __pyx_obj_6pygrib_gribmessage *)__pyx_v_self));

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

static PyObject *__pyx_pf_6pygrib_11gribmessage_8_ro_keys___get__(struct __pyx_obj_6pygrib_gribmessage *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->_ro_keys);
  __pyx_r = __pyx_v_self->_ro_keys;
  goto __pyx_L0;

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

/* Python wrapper */
static int __pyx_pw_6pygrib_11gribmessage_8_ro_keys_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_6pygrib_11gribmessage_8_ro_keys_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pygrib_11gribmessage_8_ro_keys_2__set__(((struct __pyx_obj_6pygrib_gribmessage *)__pyx_v_self), ((PyObject *)__pyx_v_value));

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

static int __pyx_pf_6pygrib_11gribmessage_8_ro_keys_2__set__(struct __pyx_obj_6pygrib_gribmessage *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__", 0);
  __Pyx_INCREF(__pyx_v_value);
  __Pyx_GIVEREF(__pyx_v_value);
  __Pyx_GOTREF(__pyx_v_self->_ro_keys);
  __Pyx_DECREF(__pyx_v_self->_ro_keys);
  __pyx_v_self->_ro_keys = __pyx_v_value;

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

/* Python wrapper */
static int __pyx_pw_6pygrib_11gribmessage_8_ro_keys_5__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_6pygrib_11gribmessage_8_ro_keys_5__del__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pygrib_11gribmessage_8_ro_keys_4__del__(((struct __pyx_obj_6pygrib_gribmessage *)__pyx_v_self));

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

static int __pyx_pf_6pygrib_11gribmessage_8_ro_keys_4__del__(struct __pyx_obj_6pygrib_gribmessage *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__", 0);
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->_ro_keys);
  __Pyx_DECREF(__pyx_v_self->_ro_keys);
  __pyx_v_self->_ro_keys = Py_None;

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

/* Python wrapper */
static PyObject *__pyx_pw_6pygrib_11gribmessage_9_all_keys_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6pygrib_11gribmessage_9_all_keys_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pygrib_11gribmessage_9_all_keys___get__(((struct __pyx_obj_6pygrib_gribmessage *)__pyx_v_self));

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

static PyObject *__pyx_pf_6pygrib_11gribmessage_9_all_keys___get__(struct __pyx_obj_6pygrib_gribmessage *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->_all_keys);
  __pyx_r = __pyx_v_self->_all_keys;
  goto __pyx_L0;

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

/* Python wrapper */
static int __pyx_pw_6pygrib_11gribmessage_9_all_keys_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_6pygrib_11gribmessage_9_all_keys_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pygrib_11gribmessage_9_all_keys_2__set__(((struct __pyx_obj_6pygrib_gribmessage *)__pyx_v_self), ((PyObject *)__pyx_v_value));

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

static int __pyx_pf_6pygrib_11gribmessage_9_all_keys_2__set__(struct __pyx_obj_6pygrib_gribmessage *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__", 0);
  __Pyx_INCREF(__pyx_v_value);
  __Pyx_GIVEREF(__pyx_v_value);
  __Pyx_GOTREF(__pyx_v_self->_all_keys);
  __Pyx_DECREF(__pyx_v_self->_all_keys);
  __pyx_v_self->_all_keys = __pyx_v_value;

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

/* Python wrapper */
static int __pyx_pw_6pygrib_11gribmessage_9_all_keys_5__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_6pygrib_11gribmessage_9_all_keys_5__del__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pygrib_11gribmessage_9_all_keys_4__del__(((struct __pyx_obj_6pygrib_gribmessage *)__pyx_v_self));

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

static int __pyx_pf_6pygrib_11gribmessage_9_all_keys_4__del__(struct __pyx_obj_6pygrib_gribmessage *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__", 0);
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->_all_keys);
  __Pyx_DECREF(__pyx_v_self->_all_keys);
  __pyx_v_self->_all_keys = Py_None;

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

/* Python wrapper */
static PyObject *__pyx_pw_6pygrib_11gribmessage_12fcstimeunits_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6pygrib_11gribmessage_12fcstimeunits_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pygrib_11gribmessage_12fcstimeunits___get__(((struct __pyx_obj_6pygrib_gribmessage *)__pyx_v_self));

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

static PyObject *__pyx_pf_6pygrib_11gribmessage_12fcstimeunits___get__(struct __pyx_obj_6pygrib_gribmessage *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->fcstimeunits);
  __pyx_r = __pyx_v_self->fcstimeunits;
  goto __pyx_L0;

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

/* Python wrapper */
static int __pyx_pw_6pygrib_11gribmessage_12fcstimeunits_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_6pygrib_11gribmessage_12fcstimeunits_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pygrib_11gribmessage_12fcstimeunits_2__set__(((struct __pyx_obj_6pygrib_gribmessage *)__pyx_v_self), ((PyObject *)__pyx_v_value));

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

static int __pyx_pf_6pygrib_11gribmessage_12fcstimeunits_2__set__(struct __pyx_obj_6pygrib_gribmessage *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__", 0);
  __Pyx_INCREF(__pyx_v_value);
  __Pyx_GIVEREF(__pyx_v_value);
  __Pyx_GOTREF(__pyx_v_self->fcstimeunits);
  __Pyx_DECREF(__pyx_v_self->fcstimeunits);
  __pyx_v_self->fcstimeunits = __pyx_v_value;

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

/* Python wrapper */
static int __pyx_pw_6pygrib_11gribmessage_12fcstimeunits_5__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_6pygrib_11gribmessage_12fcstimeunits_5__del__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pygrib_11gribmessage_12fcstimeunits_4__del__(((struct __pyx_obj_6pygrib_gribmessage *)__pyx_v_self));

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

static int __pyx_pf_6pygrib_11gribmessage_12fcstimeunits_4__del__(struct __pyx_obj_6pygrib_gribmessage *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__", 0);
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->fcstimeunits);
  __Pyx_DECREF(__pyx_v_self->fcstimeunits);
  __pyx_v_self->fcstimeunits = Py_None;

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

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("self._gh cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pygrib_11gribmessage_41__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_6pygrib_11gribmessage_41__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pygrib_11gribmessage_40__reduce_cython__(((struct __pyx_obj_6pygrib_gribmessage *)__pyx_v_self));

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

static PyObject *__pyx_pf_6pygrib_11gribmessage_40__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6pygrib_gribmessage *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("self._gh cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self._gh cannot be converted to a Python object for pickling")
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__103, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __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_ERR(1, 2, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("self._gh cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 */

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

/* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError("self._gh cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("self._gh cannot be converted to a Python object for pickling")
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pygrib_11gribmessage_43__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static PyObject *__pyx_pw_6pygrib_11gribmessage_43__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pygrib_11gribmessage_42__setstate_cython__(((struct __pyx_obj_6pygrib_gribmessage *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

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

static PyObject *__pyx_pf_6pygrib_11gribmessage_42__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6pygrib_gribmessage *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":4
 *     raise TypeError("self._gh cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self._gh cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__104, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __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_ERR(1, 4, __pyx_L1_error)

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError("self._gh cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("self._gh cannot be converted to a Python object for pickling")
 */

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

/* "pygrib.pyx":1870
 *     cdef grib_index *_gi
 *     cdef public object keys, types, name
 *     def __cinit__(self, filename, *args):             # <<<<<<<<<<<<<<
 *         # initialize C level objects.
 *         cdef grib_index *gi
 */

/* Python wrapper */
static int __pyx_pw_6pygrib_5index_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_6pygrib_5index_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_filename = 0;
  PyObject *__pyx_v_args = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  if (PyTuple_GET_SIZE(__pyx_args) > 1) {
    __pyx_v_args = PyTuple_GetSlice(__pyx_args, 1, PyTuple_GET_SIZE(__pyx_args));
    if (unlikely(!__pyx_v_args)) {
      __Pyx_RefNannyFinishContext();
      return -1;
    }
    __Pyx_GOTREF(__pyx_v_args);
  } else {
    __pyx_v_args = __pyx_empty_tuple; __Pyx_INCREF(__pyx_empty_tuple);
  }
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_filename,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) {
        default:
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_filename)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t used_pos_args = (pos_args < 1) ? pos_args : 1;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, used_pos_args, "__cinit__") < 0)) __PYX_ERR(0, 1870, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) < 1) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
    }
    __pyx_v_filename = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1870, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v_args); __pyx_v_args = 0;
  __Pyx_AddTraceback("pygrib.index.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pygrib_5index___cinit__(((struct __pyx_obj_6pygrib_index *)__pyx_v_self), __pyx_v_filename, __pyx_v_args);

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

static int __pyx_pf_6pygrib_5index___cinit__(struct __pyx_obj_6pygrib_index *__pyx_v_self, PyObject *__pyx_v_filename, PyObject *__pyx_v_args) {
  int __pyx_v_err;
  char *__pyx_v_filenamec;
  char *__pyx_v_keys;
  PyObject *__pyx_v_bytestr = NULL;
  struct __pyx_obj_6pygrib_open *__pyx_v_grbs = NULL;
  PyObject *__pyx_v_msg = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  char *__pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "pygrib.pyx":1876
 *         cdef char *filenamec
 *         cdef char *keys
 *         bytestr = _strencode(filename)             # <<<<<<<<<<<<<<
 *         filenamec = bytestr
 *         if args == ():
 */
  __pyx_t_1 = __pyx_f_6pygrib__strencode(__pyx_v_filename, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1876, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_bytestr = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pygrib.pyx":1877
 *         cdef char *keys
 *         bytestr = _strencode(filename)
 *         filenamec = bytestr             # <<<<<<<<<<<<<<
 *         if args == ():
 *             #raise ValueError('no keys specified for index')
 */
  __pyx_t_2 = __Pyx_PyObject_AsWritableString(__pyx_v_bytestr); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 1877, __pyx_L1_error)
  __pyx_v_filenamec = __pyx_t_2;

  /* "pygrib.pyx":1878
 *         bytestr = _strencode(filename)
 *         filenamec = bytestr
 *         if args == ():             # <<<<<<<<<<<<<<
 *             #raise ValueError('no keys specified for index')
 *             # assume filename is a saved index.
 */
  __pyx_t_1 = PyObject_RichCompare(__pyx_v_args, __pyx_empty_tuple, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1878, __pyx_L1_error)
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 1878, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_3) {

    /* "pygrib.pyx":1881
 *             #raise ValueError('no keys specified for index')
 *             # assume filename is a saved index.
 *             self._gi = grib_index_read(NULL, filenamec, &err)             # <<<<<<<<<<<<<<
 *             if err:
 *                 raise RuntimeError(grib_get_error_message(err))
 */
    __pyx_v_self->_gi = grib_index_read(NULL, __pyx_v_filenamec, (&__pyx_v_err));

    /* "pygrib.pyx":1882
 *             # assume filename is a saved index.
 *             self._gi = grib_index_read(NULL, filenamec, &err)
 *             if err:             # <<<<<<<<<<<<<<
 *                 raise RuntimeError(grib_get_error_message(err))
 *         else:
 */
    __pyx_t_3 = (__pyx_v_err != 0);
    if (unlikely(__pyx_t_3)) {

      /* "pygrib.pyx":1883
 *             self._gi = grib_index_read(NULL, filenamec, &err)
 *             if err:
 *                 raise RuntimeError(grib_get_error_message(err))             # <<<<<<<<<<<<<<
 *         else:
 *             bytestr = _strencode(','.join(args))
 */
      __pyx_t_1 = __Pyx_PyBytes_FromString(grib_get_error_message(__pyx_v_err)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1883, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_RuntimeError, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1883, __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_ERR(0, 1883, __pyx_L1_error)

      /* "pygrib.pyx":1882
 *             # assume filename is a saved index.
 *             self._gi = grib_index_read(NULL, filenamec, &err)
 *             if err:             # <<<<<<<<<<<<<<
 *                 raise RuntimeError(grib_get_error_message(err))
 *         else:
 */
    }

    /* "pygrib.pyx":1878
 *         bytestr = _strencode(filename)
 *         filenamec = bytestr
 *         if args == ():             # <<<<<<<<<<<<<<
 *             #raise ValueError('no keys specified for index')
 *             # assume filename is a saved index.
 */
    goto __pyx_L3;
  }

  /* "pygrib.pyx":1885
 *                 raise RuntimeError(grib_get_error_message(err))
 *         else:
 *             bytestr = _strencode(','.join(args))             # <<<<<<<<<<<<<<
 *             keys = bytestr
 *             self._gi = grib_index_new_from_file (NULL, filenamec, keys, &err)
 */
  /*else*/ {
    __pyx_t_4 = __Pyx_PyString_Join(__pyx_kp_s__105, __pyx_v_args); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1885, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = __pyx_f_6pygrib__strencode(__pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1885, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF_SET(__pyx_v_bytestr, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "pygrib.pyx":1886
 *         else:
 *             bytestr = _strencode(','.join(args))
 *             keys = bytestr             # <<<<<<<<<<<<<<
 *             self._gi = grib_index_new_from_file (NULL, filenamec, keys, &err)
 *             if err:
 */
    __pyx_t_2 = __Pyx_PyObject_AsWritableString(__pyx_v_bytestr); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 1886, __pyx_L1_error)
    __pyx_v_keys = __pyx_t_2;

    /* "pygrib.pyx":1887
 *             bytestr = _strencode(','.join(args))
 *             keys = bytestr
 *             self._gi = grib_index_new_from_file (NULL, filenamec, keys, &err)             # <<<<<<<<<<<<<<
 *             if err:
 *                 raise RuntimeError(grib_get_error_message(err))
 */
    __pyx_v_self->_gi = grib_index_new_from_file(NULL, __pyx_v_filenamec, __pyx_v_keys, (&__pyx_v_err));

    /* "pygrib.pyx":1888
 *             keys = bytestr
 *             self._gi = grib_index_new_from_file (NULL, filenamec, keys, &err)
 *             if err:             # <<<<<<<<<<<<<<
 *                 raise RuntimeError(grib_get_error_message(err))
 *             grbs = open(filename)
 */
    __pyx_t_3 = (__pyx_v_err != 0);
    if (unlikely(__pyx_t_3)) {

      /* "pygrib.pyx":1889
 *             self._gi = grib_index_new_from_file (NULL, filenamec, keys, &err)
 *             if err:
 *                 raise RuntimeError(grib_get_error_message(err))             # <<<<<<<<<<<<<<
 *             grbs = open(filename)
 *             if grbs.has_multi_field_msgs:
 */
      __pyx_t_1 = __Pyx_PyBytes_FromString(grib_get_error_message(__pyx_v_err)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1889, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_RuntimeError, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1889, __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_ERR(0, 1889, __pyx_L1_error)

      /* "pygrib.pyx":1888
 *             keys = bytestr
 *             self._gi = grib_index_new_from_file (NULL, filenamec, keys, &err)
 *             if err:             # <<<<<<<<<<<<<<
 *                 raise RuntimeError(grib_get_error_message(err))
 *             grbs = open(filename)
 */
    }

    /* "pygrib.pyx":1890
 *             if err:
 *                 raise RuntimeError(grib_get_error_message(err))
 *             grbs = open(filename)             # <<<<<<<<<<<<<<
 *             if grbs.has_multi_field_msgs:
 *                 msg="""
 */
    __pyx_t_4 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_6pygrib_open), __pyx_v_filename); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1890, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_v_grbs = ((struct __pyx_obj_6pygrib_open *)__pyx_t_4);
    __pyx_t_4 = 0;

    /* "pygrib.pyx":1891
 *                 raise RuntimeError(grib_get_error_message(err))
 *             grbs = open(filename)
 *             if grbs.has_multi_field_msgs:             # <<<<<<<<<<<<<<
 *                 msg="""
 * file %s has multi-field messages, keys inside multi-field
 */
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_grbs->has_multi_field_msgs); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 1891, __pyx_L1_error)
    if (__pyx_t_3) {

      /* "pygrib.pyx":1894
 *                 msg="""
 * file %s has multi-field messages, keys inside multi-field
 * messages will not be indexed correctly""" % filename             # <<<<<<<<<<<<<<
 *                 warnings.warn(msg)
 *             grbs.close()
 */
      __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_file_s_has_multi_field_messages, __pyx_v_filename); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1894, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_v_msg = ((PyObject*)__pyx_t_4);
      __pyx_t_4 = 0;

      /* "pygrib.pyx":1895
 * file %s has multi-field messages, keys inside multi-field
 * messages will not be indexed correctly""" % filename
 *                 warnings.warn(msg)             # <<<<<<<<<<<<<<
 *             grbs.close()
 *     def __init__(self, filename, *args):
 */
      __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_warnings); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1895, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_warn); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1895, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
        __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_5);
        if (likely(__pyx_t_1)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
          __Pyx_INCREF(__pyx_t_1);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_5, function);
        }
      }
      if (!__pyx_t_1) {
        __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_msg); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1895, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
      } else {
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_5)) {
          PyObject *__pyx_temp[2] = {__pyx_t_1, __pyx_v_msg};
          __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1895, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_GOTREF(__pyx_t_4);
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
          PyObject *__pyx_temp[2] = {__pyx_t_1, __pyx_v_msg};
          __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1895, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_GOTREF(__pyx_t_4);
        } else
        #endif
        {
          __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1895, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_1); __pyx_t_1 = NULL;
          __Pyx_INCREF(__pyx_v_msg);
          __Pyx_GIVEREF(__pyx_v_msg);
          PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_v_msg);
          __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_6, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1895, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __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;

      /* "pygrib.pyx":1891
 *                 raise RuntimeError(grib_get_error_message(err))
 *             grbs = open(filename)
 *             if grbs.has_multi_field_msgs:             # <<<<<<<<<<<<<<
 *                 msg="""
 * file %s has multi-field messages, keys inside multi-field
 */
    }

    /* "pygrib.pyx":1896
 * messages will not be indexed correctly""" % filename
 *                 warnings.warn(msg)
 *             grbs.close()             # <<<<<<<<<<<<<<
 *     def __init__(self, filename, *args):
 *         # initalize Python level objects
 */
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_grbs), __pyx_n_s_close); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1896, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_6)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
      }
    }
    if (__pyx_t_6) {
      __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1896, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    } else {
      __pyx_t_4 = __Pyx_PyObject_CallNoArg(__pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1896, __pyx_L1_error)
    }
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __pyx_L3:;

  /* "pygrib.pyx":1870
 *     cdef grib_index *_gi
 *     cdef public object keys, types, name
 *     def __cinit__(self, filename, *args):             # <<<<<<<<<<<<<<
 *         # initialize C level objects.
 *         cdef grib_index *gi
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __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("pygrib.index.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_bytestr);
  __Pyx_XDECREF((PyObject *)__pyx_v_grbs);
  __Pyx_XDECREF(__pyx_v_msg);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pygrib.pyx":1897
 *                 warnings.warn(msg)
 *             grbs.close()
 *     def __init__(self, filename, *args):             # <<<<<<<<<<<<<<
 *         # initalize Python level objects
 *         self.name = filename
 */

/* Python wrapper */
static int __pyx_pw_6pygrib_5index_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_6pygrib_5index_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_filename = 0;
  PyObject *__pyx_v_args = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  if (PyTuple_GET_SIZE(__pyx_args) > 1) {
    __pyx_v_args = PyTuple_GetSlice(__pyx_args, 1, PyTuple_GET_SIZE(__pyx_args));
    if (unlikely(!__pyx_v_args)) {
      __Pyx_RefNannyFinishContext();
      return -1;
    }
    __Pyx_GOTREF(__pyx_v_args);
  } else {
    __pyx_v_args = __pyx_empty_tuple; __Pyx_INCREF(__pyx_empty_tuple);
  }
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_filename,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) {
        default:
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_filename)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t used_pos_args = (pos_args < 1) ? pos_args : 1;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, used_pos_args, "__init__") < 0)) __PYX_ERR(0, 1897, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) < 1) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
    }
    __pyx_v_filename = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1897, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v_args); __pyx_v_args = 0;
  __Pyx_AddTraceback("pygrib.index.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pygrib_5index_2__init__(((struct __pyx_obj_6pygrib_index *)__pyx_v_self), __pyx_v_filename, __pyx_v_args);

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

static int __pyx_pf_6pygrib_5index_2__init__(struct __pyx_obj_6pygrib_index *__pyx_v_self, PyObject *__pyx_v_filename, PyObject *__pyx_v_args) {
  PyObject *__pyx_v_keys = NULL;
  PyObject *__pyx_v_types = NULL;
  PyObject *__pyx_v_arg = NULL;
  PyObject *__pyx_v_type = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  int __pyx_t_11;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "pygrib.pyx":1899
 *     def __init__(self, filename, *args):
 *         # initalize Python level objects
 *         self.name = filename             # <<<<<<<<<<<<<<
 *         self.keys = None
 *         self.types = None
 */
  __Pyx_INCREF(__pyx_v_filename);
  __Pyx_GIVEREF(__pyx_v_filename);
  __Pyx_GOTREF(__pyx_v_self->name);
  __Pyx_DECREF(__pyx_v_self->name);
  __pyx_v_self->name = __pyx_v_filename;

  /* "pygrib.pyx":1900
 *         # initalize Python level objects
 *         self.name = filename
 *         self.keys = None             # <<<<<<<<<<<<<<
 *         self.types = None
 *         if args != ():
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->keys);
  __Pyx_DECREF(__pyx_v_self->keys);
  __pyx_v_self->keys = Py_None;

  /* "pygrib.pyx":1901
 *         self.name = filename
 *         self.keys = None
 *         self.types = None             # <<<<<<<<<<<<<<
 *         if args != ():
 *             # is type is specified, strip it off.
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->types);
  __Pyx_DECREF(__pyx_v_self->types);
  __pyx_v_self->types = Py_None;

  /* "pygrib.pyx":1902
 *         self.keys = None
 *         self.types = None
 *         if args != ():             # <<<<<<<<<<<<<<
 *             # is type is specified, strip it off.
 *             keys = [arg.split(':')[0] for arg in args]
 */
  __pyx_t_1 = PyObject_RichCompare(__pyx_v_args, __pyx_empty_tuple, Py_NE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1902, __pyx_L1_error)
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 1902, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "pygrib.pyx":1904
 *         if args != ():
 *             # is type is specified, strip it off.
 *             keys = [arg.split(':')[0] for arg in args]             # <<<<<<<<<<<<<<
 *             # if type is declared, save it (None if not declared)
 *             types = []
 */
    __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1904, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = __pyx_v_args; __Pyx_INCREF(__pyx_t_3); __pyx_t_4 = 0;
    for (;;) {
      if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_5); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 1904, __pyx_L1_error)
      #else
      __pyx_t_5 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1904, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      #endif
      __Pyx_XDECREF_SET(__pyx_v_arg, __pyx_t_5);
      __pyx_t_5 = 0;
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_arg, __pyx_n_s_split); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1904, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_tuple__106, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1904, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_6, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1904, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) __PYX_ERR(0, 1904, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_keys = ((PyObject*)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "pygrib.pyx":1906
 *             keys = [arg.split(':')[0] for arg in args]
 *             # if type is declared, save it (None if not declared)
 *             types = []             # <<<<<<<<<<<<<<
 *             for arg in args:
 *                 try:
 */
    __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1906, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_types = ((PyObject*)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "pygrib.pyx":1907
 *             # if type is declared, save it (None if not declared)
 *             types = []
 *             for arg in args:             # <<<<<<<<<<<<<<
 *                 try:
 *                     type = arg.split(':')[1]
 */
    __pyx_t_1 = __pyx_v_args; __Pyx_INCREF(__pyx_t_1); __pyx_t_4 = 0;
    for (;;) {
      if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_3); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 1907, __pyx_L1_error)
      #else
      __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1907, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      #endif
      __Pyx_XDECREF_SET(__pyx_v_arg, __pyx_t_3);
      __pyx_t_3 = 0;

      /* "pygrib.pyx":1908
 *             types = []
 *             for arg in args:
 *                 try:             # <<<<<<<<<<<<<<
 *                     type = arg.split(':')[1]
 *                 except IndexError:
 */
      {
        __Pyx_PyThreadState_declare
        __Pyx_PyThreadState_assign
        __Pyx_ExceptionSave(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9);
        __Pyx_XGOTREF(__pyx_t_7);
        __Pyx_XGOTREF(__pyx_t_8);
        __Pyx_XGOTREF(__pyx_t_9);
        /*try:*/ {

          /* "pygrib.pyx":1909
 *             for arg in args:
 *                 try:
 *                     type = arg.split(':')[1]             # <<<<<<<<<<<<<<
 *                 except IndexError:
 *                     type = None
 */
          __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_arg, __pyx_n_s_split); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1909, __pyx_L8_error)
          __Pyx_GOTREF(__pyx_t_3);
          __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__107, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1909, __pyx_L8_error)
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_5, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1909, __pyx_L8_error)
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_XDECREF_SET(__pyx_v_type, __pyx_t_3);
          __pyx_t_3 = 0;

          /* "pygrib.pyx":1908
 *             types = []
 *             for arg in args:
 *                 try:             # <<<<<<<<<<<<<<
 *                     type = arg.split(':')[1]
 *                 except IndexError:
 */
        }
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        goto __pyx_L15_try_end;
        __pyx_L8_error:;
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;

        /* "pygrib.pyx":1910
 *                 try:
 *                     type = arg.split(':')[1]
 *                 except IndexError:             # <<<<<<<<<<<<<<
 *                     type = None
 *                 types.append(type)
 */
        __pyx_t_10 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_IndexError);
        if (__pyx_t_10) {
          __Pyx_AddTraceback("pygrib.index.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
          if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_5, &__pyx_t_6) < 0) __PYX_ERR(0, 1910, __pyx_L10_except_error)
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_GOTREF(__pyx_t_6);

          /* "pygrib.pyx":1911
 *                     type = arg.split(':')[1]
 *                 except IndexError:
 *                     type = None             # <<<<<<<<<<<<<<
 *                 types.append(type)
 *             self.keys = keys
 */
          __Pyx_INCREF(Py_None);
          __Pyx_XDECREF_SET(__pyx_v_type, Py_None);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          goto __pyx_L9_exception_handled;
        }
        goto __pyx_L10_except_error;
        __pyx_L10_except_error:;

        /* "pygrib.pyx":1908
 *             types = []
 *             for arg in args:
 *                 try:             # <<<<<<<<<<<<<<
 *                     type = arg.split(':')[1]
 *                 except IndexError:
 */
        __Pyx_XGIVEREF(__pyx_t_7);
        __Pyx_XGIVEREF(__pyx_t_8);
        __Pyx_XGIVEREF(__pyx_t_9);
        __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9);
        goto __pyx_L1_error;
        __pyx_L9_exception_handled:;
        __Pyx_XGIVEREF(__pyx_t_7);
        __Pyx_XGIVEREF(__pyx_t_8);
        __Pyx_XGIVEREF(__pyx_t_9);
        __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9);
        __pyx_L15_try_end:;
      }

      /* "pygrib.pyx":1912
 *                 except IndexError:
 *                     type = None
 *                 types.append(type)             # <<<<<<<<<<<<<<
 *             self.keys = keys
 *             self.types = types
 */
      __pyx_t_11 = __Pyx_PyList_Append(__pyx_v_types, __pyx_v_type); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(0, 1912, __pyx_L1_error)

      /* "pygrib.pyx":1907
 *             # if type is declared, save it (None if not declared)
 *             types = []
 *             for arg in args:             # <<<<<<<<<<<<<<
 *                 try:
 *                     type = arg.split(':')[1]
 */
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "pygrib.pyx":1913
 *                     type = None
 *                 types.append(type)
 *             self.keys = keys             # <<<<<<<<<<<<<<
 *             self.types = types
 *     def __call__(self, **kwargs):
 */
    __Pyx_INCREF(__pyx_v_keys);
    __Pyx_GIVEREF(__pyx_v_keys);
    __Pyx_GOTREF(__pyx_v_self->keys);
    __Pyx_DECREF(__pyx_v_self->keys);
    __pyx_v_self->keys = __pyx_v_keys;

    /* "pygrib.pyx":1914
 *                 types.append(type)
 *             self.keys = keys
 *             self.types = types             # <<<<<<<<<<<<<<
 *     def __call__(self, **kwargs):
 *         """same as L{select}"""
 */
    __Pyx_INCREF(__pyx_v_types);
    __Pyx_GIVEREF(__pyx_v_types);
    __Pyx_GOTREF(__pyx_v_self->types);
    __Pyx_DECREF(__pyx_v_self->types);
    __pyx_v_self->types = __pyx_v_types;

    /* "pygrib.pyx":1902
 *         self.keys = None
 *         self.types = None
 *         if args != ():             # <<<<<<<<<<<<<<
 *             # is type is specified, strip it off.
 *             keys = [arg.split(':')[0] for arg in args]
 */
  }

  /* "pygrib.pyx":1897
 *                 warnings.warn(msg)
 *             grbs.close()
 *     def __init__(self, filename, *args):             # <<<<<<<<<<<<<<
 *         # initalize Python level objects
 *         self.name = filename
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("pygrib.index.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_keys);
  __Pyx_XDECREF(__pyx_v_types);
  __Pyx_XDECREF(__pyx_v_arg);
  __Pyx_XDECREF(__pyx_v_type);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pygrib.pyx":1915
 *             self.keys = keys
 *             self.types = types
 *     def __call__(self, **kwargs):             # <<<<<<<<<<<<<<
 *         """same as L{select}"""
 *         return self.select(**kwargs)
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pygrib_5index_5__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6pygrib_5index_4__call__[] = "same as L{select}";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_6pygrib_5index_4__call__;
#endif
static PyObject *__pyx_pw_6pygrib_5index_5__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_kwargs = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__call__ (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("__call__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (__pyx_kwds && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__call__", 1))) return NULL;
  if (__pyx_kwds) {
    __pyx_v_kwargs = PyDict_Copy(__pyx_kwds); if (unlikely(!__pyx_v_kwargs)) return NULL;
    __Pyx_GOTREF(__pyx_v_kwargs);
  } else {
    __pyx_v_kwargs = NULL;
  }
  __pyx_r = __pyx_pf_6pygrib_5index_4__call__(((struct __pyx_obj_6pygrib_index *)__pyx_v_self), __pyx_v_kwargs);

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

static PyObject *__pyx_pf_6pygrib_5index_4__call__(struct __pyx_obj_6pygrib_index *__pyx_v_self, PyObject *__pyx_v_kwargs) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("__call__", 0);

  /* "pygrib.pyx":1917
 *     def __call__(self, **kwargs):
 *         """same as L{select}"""
 *         return self.select(**kwargs)             # <<<<<<<<<<<<<<
 *     def select(self, **kwargs):
 *         """
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_select); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1917, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, __pyx_v_kwargs); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1917, __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;

  /* "pygrib.pyx":1915
 *             self.keys = keys
 *             self.types = types
 *     def __call__(self, **kwargs):             # <<<<<<<<<<<<<<
 *         """same as L{select}"""
 *         return self.select(**kwargs)
 */

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

/* "pygrib.pyx":1918
 *         """same as L{select}"""
 *         return self.select(**kwargs)
 *     def select(self, **kwargs):             # <<<<<<<<<<<<<<
 *         """
 * select(**kwargs)
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pygrib_5index_7select(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6pygrib_5index_6select[] = "\nselect(**kwargs)\n\nreturn a list of L{gribmessage} instances from grib index object \ncorresponding to specific values of indexed keys (given by kwargs).\nUnlike L{open.select}, containers or callables cannot be used to \nselect multiple key values.\nHowever, using L{index.select} is much faster than L{open.select}.\n\nExample usage:\n\n>>> import pygrib\n>>> grbindx=pygrib.index('sampledata/gfs.grb','shortName','typeOfLevel','level')\n>>> selected_grbs=grbindx.select(shortName='gh',typeOfLevel='isobaricInhPa',level=500)\n>>> for grb in selected_grbs:\n>>>     grb\n1:Geopotential height:gpm (instant):regular_ll:isobaricInhPa:level 500 Pa:fcst time 72 hrs:from 200412091200:lo res cntl fcst\n>>> # __call__ method does same thing as select\n>>> selected_grbs=grbindx(shortName='u',typeOfLevel='isobaricInhPa',level=250)\n>>> for grb in selected_grbs:\n>>>     grb\n1:u-component of wind:m s**-1 (instant):regular_ll:isobaricInhPa:level 250 Pa:fcst time 72 hrs:from 200412091200:lo res cntl fcst\n>>> grbindx.close()\n";
static PyObject *__pyx_pw_6pygrib_5index_7select(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_kwargs = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("select (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("select", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
  if (__pyx_kwds && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "select", 1))) return NULL;
  __pyx_v_kwargs = (__pyx_kwds) ? PyDict_Copy(__pyx_kwds) : PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return NULL;
  __Pyx_GOTREF(__pyx_v_kwargs);
  __pyx_r = __pyx_pf_6pygrib_5index_6select(((struct __pyx_obj_6pygrib_index *)__pyx_v_self), __pyx_v_kwargs);

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

static PyObject *__pyx_pf_6pygrib_5index_6select(struct __pyx_obj_6pygrib_index *__pyx_v_self, PyObject *__pyx_v_kwargs) {
  grib_handle *__pyx_v_gh;
  int __pyx_v_err;
  size_t __pyx_v_size;
  long __pyx_v_longval;
  double __pyx_v_doubval;
  char *__pyx_v_strval;
  char *__pyx_v_key;
  PyObject *__pyx_v_sizetot = NULL;
  PyObject *__pyx_v_k = NULL;
  PyObject *__pyx_v_v = NULL;
  PyObject *__pyx_v_typ = NULL;
  PyObject *__pyx_v_bytestr = NULL;
  PyObject *__pyx_v_messagenumber = NULL;
  PyObject *__pyx_v_grbs = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  PyObject *(*__pyx_t_4)(PyObject *);
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *(*__pyx_t_8)(PyObject *);
  int __pyx_t_9;
  int __pyx_t_10;
  int __pyx_t_11;
  char *__pyx_t_12;
  long __pyx_t_13;
  double __pyx_t_14;
  int __pyx_t_15;
  __Pyx_RefNannySetupContext("select", 0);

  /* "pygrib.pyx":1952
 *         # set index selection.
 *         # used declared type if available, other infer from type of value.
 *         sizetot = 0             # <<<<<<<<<<<<<<
 *         for k,v in kwargs.items():
 *             if self.keys is not None and k not in self.keys:
 */
  __Pyx_INCREF(__pyx_int_0);
  __pyx_v_sizetot = __pyx_int_0;

  /* "pygrib.pyx":1953
 *         # used declared type if available, other infer from type of value.
 *         sizetot = 0
 *         for k,v in kwargs.items():             # <<<<<<<<<<<<<<
 *             if self.keys is not None and k not in self.keys:
 *                 raise KeyError('key not part of grib index')
 */
  __pyx_t_1 = __Pyx_PyDict_Items(__pyx_v_kwargs); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1953, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {
    __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
    __pyx_t_4 = NULL;
  } else {
    __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1953, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1953, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  for (;;) {
    if (likely(!__pyx_t_4)) {
      if (likely(PyList_CheckExact(__pyx_t_2))) {
        if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 1953, __pyx_L1_error)
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1953, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      } else {
        if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 1953, __pyx_L1_error)
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1953, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      }
    } else {
      __pyx_t_1 = __pyx_t_4(__pyx_t_2);
      if (unlikely(!__pyx_t_1)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 1953, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_1);
    }
    if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
      PyObject* sequence = __pyx_t_1;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 1953, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_5 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_6 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_6);
      #else
      __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1953, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1953, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_7 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1953, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext;
      index = 0; __pyx_t_5 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_5)) goto __pyx_L5_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_5);
      index = 1; __pyx_t_6 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L5_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_6);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < 0) __PYX_ERR(0, 1953, __pyx_L1_error)
      __pyx_t_8 = NULL;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L6_unpacking_done;
      __pyx_L5_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_8 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 1953, __pyx_L1_error)
      __pyx_L6_unpacking_done:;
    }
    __Pyx_XDECREF_SET(__pyx_v_k, __pyx_t_5);
    __pyx_t_5 = 0;
    __Pyx_XDECREF_SET(__pyx_v_v, __pyx_t_6);
    __pyx_t_6 = 0;

    /* "pygrib.pyx":1954
 *         sizetot = 0
 *         for k,v in kwargs.items():
 *             if self.keys is not None and k not in self.keys:             # <<<<<<<<<<<<<<
 *                 raise KeyError('key not part of grib index')
 *             if self.types is not None:
 */
    __pyx_t_10 = (__pyx_v_self->keys != Py_None);
    __pyx_t_11 = (__pyx_t_10 != 0);
    if (__pyx_t_11) {
    } else {
      __pyx_t_9 = __pyx_t_11;
      goto __pyx_L8_bool_binop_done;
    }
    __pyx_t_11 = (__Pyx_PySequence_ContainsTF(__pyx_v_k, __pyx_v_self->keys, Py_NE)); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 1954, __pyx_L1_error)
    __pyx_t_10 = (__pyx_t_11 != 0);
    __pyx_t_9 = __pyx_t_10;
    __pyx_L8_bool_binop_done:;
    if (unlikely(__pyx_t_9)) {

      /* "pygrib.pyx":1955
 *         for k,v in kwargs.items():
 *             if self.keys is not None and k not in self.keys:
 *                 raise KeyError('key not part of grib index')             # <<<<<<<<<<<<<<
 *             if self.types is not None:
 *                 typ = self.types[self.keys.index(k)]
 */
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_KeyError, __pyx_tuple__108, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1955, __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_ERR(0, 1955, __pyx_L1_error)

      /* "pygrib.pyx":1954
 *         sizetot = 0
 *         for k,v in kwargs.items():
 *             if self.keys is not None and k not in self.keys:             # <<<<<<<<<<<<<<
 *                 raise KeyError('key not part of grib index')
 *             if self.types is not None:
 */
    }

    /* "pygrib.pyx":1956
 *             if self.keys is not None and k not in self.keys:
 *                 raise KeyError('key not part of grib index')
 *             if self.types is not None:             # <<<<<<<<<<<<<<
 *                 typ = self.types[self.keys.index(k)]
 *             else:
 */
    __pyx_t_9 = (__pyx_v_self->types != Py_None);
    __pyx_t_10 = (__pyx_t_9 != 0);
    if (__pyx_t_10) {

      /* "pygrib.pyx":1957
 *                 raise KeyError('key not part of grib index')
 *             if self.types is not None:
 *                 typ = self.types[self.keys.index(k)]             # <<<<<<<<<<<<<<
 *             else:
 *                 typ = None
 */
      __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->keys, __pyx_n_s_index); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1957, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_5 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
        __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6);
        if (likely(__pyx_t_5)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
          __Pyx_INCREF(__pyx_t_5);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_6, function);
        }
      }
      if (!__pyx_t_5) {
        __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_k); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1957, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
      } else {
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_6)) {
          PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_v_k};
          __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1957, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_GOTREF(__pyx_t_1);
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
          PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_v_k};
          __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1957, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_GOTREF(__pyx_t_1);
        } else
        #endif
        {
          __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1957, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __pyx_t_5 = NULL;
          __Pyx_INCREF(__pyx_v_k);
          __Pyx_GIVEREF(__pyx_v_k);
          PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_v_k);
          __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1957, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        }
      }
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = __Pyx_PyObject_GetItem(__pyx_v_self->types, __pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1957, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF_SET(__pyx_v_typ, __pyx_t_6);
      __pyx_t_6 = 0;

      /* "pygrib.pyx":1956
 *             if self.keys is not None and k not in self.keys:
 *                 raise KeyError('key not part of grib index')
 *             if self.types is not None:             # <<<<<<<<<<<<<<
 *                 typ = self.types[self.keys.index(k)]
 *             else:
 */
      goto __pyx_L10;
    }

    /* "pygrib.pyx":1959
 *                 typ = self.types[self.keys.index(k)]
 *             else:
 *                 typ = None             # <<<<<<<<<<<<<<
 *             bytestr = _strencode(k)
 *             key = bytestr
 */
    /*else*/ {
      __Pyx_INCREF(Py_None);
      __Pyx_XDECREF_SET(__pyx_v_typ, Py_None);
    }
    __pyx_L10:;

    /* "pygrib.pyx":1960
 *             else:
 *                 typ = None
 *             bytestr = _strencode(k)             # <<<<<<<<<<<<<<
 *             key = bytestr
 *             err = grib_index_get_size(self._gi, key, &size)
 */
    __pyx_t_6 = __pyx_f_6pygrib__strencode(__pyx_v_k, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1960, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_XDECREF_SET(__pyx_v_bytestr, __pyx_t_6);
    __pyx_t_6 = 0;

    /* "pygrib.pyx":1961
 *                 typ = None
 *             bytestr = _strencode(k)
 *             key = bytestr             # <<<<<<<<<<<<<<
 *             err = grib_index_get_size(self._gi, key, &size)
 *             if err:
 */
    __pyx_t_12 = __Pyx_PyObject_AsWritableString(__pyx_v_bytestr); if (unlikely((!__pyx_t_12) && PyErr_Occurred())) __PYX_ERR(0, 1961, __pyx_L1_error)
    __pyx_v_key = __pyx_t_12;

    /* "pygrib.pyx":1962
 *             bytestr = _strencode(k)
 *             key = bytestr
 *             err = grib_index_get_size(self._gi, key, &size)             # <<<<<<<<<<<<<<
 *             if err:
 *                 raise RuntimeError(grib_get_error_message(err))
 */
    __pyx_v_err = grib_index_get_size(__pyx_v_self->_gi, __pyx_v_key, (&__pyx_v_size));

    /* "pygrib.pyx":1963
 *             key = bytestr
 *             err = grib_index_get_size(self._gi, key, &size)
 *             if err:             # <<<<<<<<<<<<<<
 *                 raise RuntimeError(grib_get_error_message(err))
 *             sizetot = sizetot + size
 */
    __pyx_t_10 = (__pyx_v_err != 0);
    if (unlikely(__pyx_t_10)) {

      /* "pygrib.pyx":1964
 *             err = grib_index_get_size(self._gi, key, &size)
 *             if err:
 *                 raise RuntimeError(grib_get_error_message(err))             # <<<<<<<<<<<<<<
 *             sizetot = sizetot + size
 *             # if there are no matches for this key, just skip it
 */
      __pyx_t_6 = __Pyx_PyBytes_FromString(grib_get_error_message(__pyx_v_err)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1964, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_RuntimeError, __pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1964, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_Raise(__pyx_t_1, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __PYX_ERR(0, 1964, __pyx_L1_error)

      /* "pygrib.pyx":1963
 *             key = bytestr
 *             err = grib_index_get_size(self._gi, key, &size)
 *             if err:             # <<<<<<<<<<<<<<
 *                 raise RuntimeError(grib_get_error_message(err))
 *             sizetot = sizetot + size
 */
    }

    /* "pygrib.pyx":1965
 *             if err:
 *                 raise RuntimeError(grib_get_error_message(err))
 *             sizetot = sizetot + size             # <<<<<<<<<<<<<<
 *             # if there are no matches for this key, just skip it
 *             if not size:
 */
    __pyx_t_1 = __Pyx_PyInt_FromSize_t(__pyx_v_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1965, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_6 = PyNumber_Add(__pyx_v_sizetot, __pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1965, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF_SET(__pyx_v_sizetot, __pyx_t_6);
    __pyx_t_6 = 0;

    /* "pygrib.pyx":1967
 *             sizetot = sizetot + size
 *             # if there are no matches for this key, just skip it
 *             if not size:             # <<<<<<<<<<<<<<
 *                 continue
 *             if typ == 'l' or (type(v) == int or type(v) == long):
 */
    __pyx_t_10 = ((!(__pyx_v_size != 0)) != 0);
    if (__pyx_t_10) {

      /* "pygrib.pyx":1968
 *             # if there are no matches for this key, just skip it
 *             if not size:
 *                 continue             # <<<<<<<<<<<<<<
 *             if typ == 'l' or (type(v) == int or type(v) == long):
 *                 longval = long(v)
 */
      goto __pyx_L3_continue;

      /* "pygrib.pyx":1967
 *             sizetot = sizetot + size
 *             # if there are no matches for this key, just skip it
 *             if not size:             # <<<<<<<<<<<<<<
 *                 continue
 *             if typ == 'l' or (type(v) == int or type(v) == long):
 */
    }

    /* "pygrib.pyx":1969
 *             if not size:
 *                 continue
 *             if typ == 'l' or (type(v) == int or type(v) == long):             # <<<<<<<<<<<<<<
 *                 longval = long(v)
 *                 err = grib_index_select_long(self._gi, key, longval)
 */
    __pyx_t_9 = (__Pyx_PyString_Equals(__pyx_v_typ, __pyx_n_s_l, Py_EQ)); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 1969, __pyx_L1_error)
    if (!__pyx_t_9) {
    } else {
      __pyx_t_10 = __pyx_t_9;
      goto __pyx_L14_bool_binop_done;
    }
    __pyx_t_6 = PyObject_RichCompare(((PyObject *)Py_TYPE(__pyx_v_v)), ((PyObject *)(&PyInt_Type)), Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1969, __pyx_L1_error)
    __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 1969, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (!__pyx_t_9) {
    } else {
      __pyx_t_10 = __pyx_t_9;
      goto __pyx_L14_bool_binop_done;
    }
    __pyx_t_6 = PyObject_RichCompare(((PyObject *)Py_TYPE(__pyx_v_v)), ((PyObject *)(&PyLong_Type)), Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1969, __pyx_L1_error)
    __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 1969, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_10 = __pyx_t_9;
    __pyx_L14_bool_binop_done:;
    if (__pyx_t_10) {

      /* "pygrib.pyx":1970
 *                 continue
 *             if typ == 'l' or (type(v) == int or type(v) == long):
 *                 longval = long(v)             # <<<<<<<<<<<<<<
 *                 err = grib_index_select_long(self._gi, key, longval)
 *                 if err:
 */
      __pyx_t_6 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyLong_Type)), __pyx_v_v); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1970, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_13 = __Pyx_PyInt_As_long(__pyx_t_6); if (unlikely((__pyx_t_13 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 1970, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_v_longval = __pyx_t_13;

      /* "pygrib.pyx":1971
 *             if typ == 'l' or (type(v) == int or type(v) == long):
 *                 longval = long(v)
 *                 err = grib_index_select_long(self._gi, key, longval)             # <<<<<<<<<<<<<<
 *                 if err:
 *                     raise RuntimeError(grib_get_error_message(err))
 */
      __pyx_v_err = grib_index_select_long(__pyx_v_self->_gi, __pyx_v_key, __pyx_v_longval);

      /* "pygrib.pyx":1972
 *                 longval = long(v)
 *                 err = grib_index_select_long(self._gi, key, longval)
 *                 if err:             # <<<<<<<<<<<<<<
 *                     raise RuntimeError(grib_get_error_message(err))
 *             elif typ == 'd' or type(v) == float:
 */
      __pyx_t_10 = (__pyx_v_err != 0);
      if (unlikely(__pyx_t_10)) {

        /* "pygrib.pyx":1973
 *                 err = grib_index_select_long(self._gi, key, longval)
 *                 if err:
 *                     raise RuntimeError(grib_get_error_message(err))             # <<<<<<<<<<<<<<
 *             elif typ == 'd' or type(v) == float:
 *                 doubval = float(v)
 */
        __pyx_t_6 = __Pyx_PyBytes_FromString(grib_get_error_message(__pyx_v_err)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1973, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_RuntimeError, __pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1973, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_Raise(__pyx_t_1, 0, 0, 0);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __PYX_ERR(0, 1973, __pyx_L1_error)

        /* "pygrib.pyx":1972
 *                 longval = long(v)
 *                 err = grib_index_select_long(self._gi, key, longval)
 *                 if err:             # <<<<<<<<<<<<<<
 *                     raise RuntimeError(grib_get_error_message(err))
 *             elif typ == 'd' or type(v) == float:
 */
      }

      /* "pygrib.pyx":1969
 *             if not size:
 *                 continue
 *             if typ == 'l' or (type(v) == int or type(v) == long):             # <<<<<<<<<<<<<<
 *                 longval = long(v)
 *                 err = grib_index_select_long(self._gi, key, longval)
 */
      goto __pyx_L13;
    }

    /* "pygrib.pyx":1974
 *                 if err:
 *                     raise RuntimeError(grib_get_error_message(err))
 *             elif typ == 'd' or type(v) == float:             # <<<<<<<<<<<<<<
 *                 doubval = float(v)
 *                 err = grib_index_select_double(self._gi, key, doubval)
 */
    __pyx_t_9 = (__Pyx_PyString_Equals(__pyx_v_typ, __pyx_n_s_d, Py_EQ)); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 1974, __pyx_L1_error)
    if (!__pyx_t_9) {
    } else {
      __pyx_t_10 = __pyx_t_9;
      goto __pyx_L18_bool_binop_done;
    }
    __pyx_t_1 = PyObject_RichCompare(((PyObject *)Py_TYPE(__pyx_v_v)), ((PyObject *)(&PyFloat_Type)), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1974, __pyx_L1_error)
    __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 1974, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_10 = __pyx_t_9;
    __pyx_L18_bool_binop_done:;
    if (__pyx_t_10) {

      /* "pygrib.pyx":1975
 *                     raise RuntimeError(grib_get_error_message(err))
 *             elif typ == 'd' or type(v) == float:
 *                 doubval = float(v)             # <<<<<<<<<<<<<<
 *                 err = grib_index_select_double(self._gi, key, doubval)
 *                 if err:
 */
      __pyx_t_14 = __Pyx_PyObject_AsDouble(__pyx_v_v); if (unlikely(__pyx_t_14 == ((double)((double)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1975, __pyx_L1_error)
      __pyx_v_doubval = __pyx_t_14;

      /* "pygrib.pyx":1976
 *             elif typ == 'd' or type(v) == float:
 *                 doubval = float(v)
 *                 err = grib_index_select_double(self._gi, key, doubval)             # <<<<<<<<<<<<<<
 *                 if err:
 *                     raise RuntimeError(grib_get_error_message(err))
 */
      __pyx_v_err = grib_index_select_double(__pyx_v_self->_gi, __pyx_v_key, __pyx_v_doubval);

      /* "pygrib.pyx":1977
 *                 doubval = float(v)
 *                 err = grib_index_select_double(self._gi, key, doubval)
 *                 if err:             # <<<<<<<<<<<<<<
 *                     raise RuntimeError(grib_get_error_message(err))
 *             elif typ == 's' or _is_stringlike(v):
 */
      __pyx_t_10 = (__pyx_v_err != 0);
      if (unlikely(__pyx_t_10)) {

        /* "pygrib.pyx":1978
 *                 err = grib_index_select_double(self._gi, key, doubval)
 *                 if err:
 *                     raise RuntimeError(grib_get_error_message(err))             # <<<<<<<<<<<<<<
 *             elif typ == 's' or _is_stringlike(v):
 *                 bytestr = _strencode(v)
 */
        __pyx_t_1 = __Pyx_PyBytes_FromString(grib_get_error_message(__pyx_v_err)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1978, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_builtin_RuntimeError, __pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1978, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_Raise(__pyx_t_6, 0, 0, 0);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __PYX_ERR(0, 1978, __pyx_L1_error)

        /* "pygrib.pyx":1977
 *                 doubval = float(v)
 *                 err = grib_index_select_double(self._gi, key, doubval)
 *                 if err:             # <<<<<<<<<<<<<<
 *                     raise RuntimeError(grib_get_error_message(err))
 *             elif typ == 's' or _is_stringlike(v):
 */
      }

      /* "pygrib.pyx":1974
 *                 if err:
 *                     raise RuntimeError(grib_get_error_message(err))
 *             elif typ == 'd' or type(v) == float:             # <<<<<<<<<<<<<<
 *                 doubval = float(v)
 *                 err = grib_index_select_double(self._gi, key, doubval)
 */
      goto __pyx_L13;
    }

    /* "pygrib.pyx":1979
 *                 if err:
 *                     raise RuntimeError(grib_get_error_message(err))
 *             elif typ == 's' or _is_stringlike(v):             # <<<<<<<<<<<<<<
 *                 bytestr = _strencode(v)
 *                 strval = bytestr
 */
    __pyx_t_9 = (__Pyx_PyString_Equals(__pyx_v_typ, __pyx_n_s_s_4, Py_EQ)); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 1979, __pyx_L1_error)
    if (!__pyx_t_9) {
    } else {
      __pyx_t_10 = __pyx_t_9;
      goto __pyx_L21_bool_binop_done;
    }
    __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_is_stringlike); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1979, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_7 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_1);
      if (likely(__pyx_t_7)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_1, function);
      }
    }
    if (!__pyx_t_7) {
      __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_v); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1979, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_1)) {
        PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_v_v};
        __pyx_t_6 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1979, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_GOTREF(__pyx_t_6);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
        PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_v_v};
        __pyx_t_6 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1979, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_GOTREF(__pyx_t_6);
      } else
      #endif
      {
        __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1979, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_7); __pyx_t_7 = NULL;
        __Pyx_INCREF(__pyx_v_v);
        __Pyx_GIVEREF(__pyx_v_v);
        PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_v_v);
        __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_5, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1979, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 1979, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_10 = __pyx_t_9;
    __pyx_L21_bool_binop_done:;
    if (likely(__pyx_t_10)) {

      /* "pygrib.pyx":1980
 *                     raise RuntimeError(grib_get_error_message(err))
 *             elif typ == 's' or _is_stringlike(v):
 *                 bytestr = _strencode(v)             # <<<<<<<<<<<<<<
 *                 strval = bytestr
 *                 err = grib_index_select_string(self._gi, key, strval)
 */
      __pyx_t_6 = __pyx_f_6pygrib__strencode(__pyx_v_v, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1980, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF_SET(__pyx_v_bytestr, __pyx_t_6);
      __pyx_t_6 = 0;

      /* "pygrib.pyx":1981
 *             elif typ == 's' or _is_stringlike(v):
 *                 bytestr = _strencode(v)
 *                 strval = bytestr             # <<<<<<<<<<<<<<
 *                 err = grib_index_select_string(self._gi, key, strval)
 *                 if err:
 */
      __pyx_t_12 = __Pyx_PyObject_AsWritableString(__pyx_v_bytestr); if (unlikely((!__pyx_t_12) && PyErr_Occurred())) __PYX_ERR(0, 1981, __pyx_L1_error)
      __pyx_v_strval = __pyx_t_12;

      /* "pygrib.pyx":1982
 *                 bytestr = _strencode(v)
 *                 strval = bytestr
 *                 err = grib_index_select_string(self._gi, key, strval)             # <<<<<<<<<<<<<<
 *                 if err:
 *                     raise RuntimeError(grib_get_error_message(err))
 */
      __pyx_v_err = grib_index_select_string(__pyx_v_self->_gi, __pyx_v_key, __pyx_v_strval);

      /* "pygrib.pyx":1983
 *                 strval = bytestr
 *                 err = grib_index_select_string(self._gi, key, strval)
 *                 if err:             # <<<<<<<<<<<<<<
 *                     raise RuntimeError(grib_get_error_message(err))
 *             else:
 */
      __pyx_t_10 = (__pyx_v_err != 0);
      if (unlikely(__pyx_t_10)) {

        /* "pygrib.pyx":1984
 *                 err = grib_index_select_string(self._gi, key, strval)
 *                 if err:
 *                     raise RuntimeError(grib_get_error_message(err))             # <<<<<<<<<<<<<<
 *             else:
 *                 raise TypeError('value must be float, int or string')
 */
        __pyx_t_6 = __Pyx_PyBytes_FromString(grib_get_error_message(__pyx_v_err)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1984, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_RuntimeError, __pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1984, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_Raise(__pyx_t_1, 0, 0, 0);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __PYX_ERR(0, 1984, __pyx_L1_error)

        /* "pygrib.pyx":1983
 *                 strval = bytestr
 *                 err = grib_index_select_string(self._gi, key, strval)
 *                 if err:             # <<<<<<<<<<<<<<
 *                     raise RuntimeError(grib_get_error_message(err))
 *             else:
 */
      }

      /* "pygrib.pyx":1979
 *                 if err:
 *                     raise RuntimeError(grib_get_error_message(err))
 *             elif typ == 's' or _is_stringlike(v):             # <<<<<<<<<<<<<<
 *                 bytestr = _strencode(v)
 *                 strval = bytestr
 */
      goto __pyx_L13;
    }

    /* "pygrib.pyx":1986
 *                     raise RuntimeError(grib_get_error_message(err))
 *             else:
 *                 raise TypeError('value must be float, int or string')             # <<<<<<<<<<<<<<
 *         # if no matches found, raise an error.
 *         if sizetot == 0:
 */
    /*else*/ {
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__109, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1986, __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_ERR(0, 1986, __pyx_L1_error)
    }
    __pyx_L13:;

    /* "pygrib.pyx":1953
 *         # used declared type if available, other infer from type of value.
 *         sizetot = 0
 *         for k,v in kwargs.items():             # <<<<<<<<<<<<<<
 *             if self.keys is not None and k not in self.keys:
 *                 raise KeyError('key not part of grib index')
 */
    __pyx_L3_continue:;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pygrib.pyx":1988
 *                 raise TypeError('value must be float, int or string')
 *         # if no matches found, raise an error.
 *         if sizetot == 0:             # <<<<<<<<<<<<<<
 *             raise ValueError('no matches found')
 *         # create a list of grib messages corresponding to selection.
 */
  __pyx_t_2 = __Pyx_PyInt_EqObjC(__pyx_v_sizetot, __pyx_int_0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1988, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 1988, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(__pyx_t_10)) {

    /* "pygrib.pyx":1989
 *         # if no matches found, raise an error.
 *         if sizetot == 0:
 *             raise ValueError('no matches found')             # <<<<<<<<<<<<<<
 *         # create a list of grib messages corresponding to selection.
 *         messagenumber = 0; grbs = []
 */
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__110, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1989, __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_ERR(0, 1989, __pyx_L1_error)

    /* "pygrib.pyx":1988
 *                 raise TypeError('value must be float, int or string')
 *         # if no matches found, raise an error.
 *         if sizetot == 0:             # <<<<<<<<<<<<<<
 *             raise ValueError('no matches found')
 *         # create a list of grib messages corresponding to selection.
 */
  }

  /* "pygrib.pyx":1991
 *             raise ValueError('no matches found')
 *         # create a list of grib messages corresponding to selection.
 *         messagenumber = 0; grbs = []             # <<<<<<<<<<<<<<
 *         while 1:
 *             gh = grib_handle_new_from_index(self._gi, &err)
 */
  __Pyx_INCREF(__pyx_int_0);
  __pyx_v_messagenumber = __pyx_int_0;
  __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1991, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_grbs = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "pygrib.pyx":1992
 *         # create a list of grib messages corresponding to selection.
 *         messagenumber = 0; grbs = []
 *         while 1:             # <<<<<<<<<<<<<<
 *             gh = grib_handle_new_from_index(self._gi, &err)
 *             if err or gh == NULL:
 */
  while (1) {

    /* "pygrib.pyx":1993
 *         messagenumber = 0; grbs = []
 *         while 1:
 *             gh = grib_handle_new_from_index(self._gi, &err)             # <<<<<<<<<<<<<<
 *             if err or gh == NULL:
 *                 break
 */
    __pyx_v_gh = grib_handle_new_from_index(__pyx_v_self->_gi, (&__pyx_v_err));

    /* "pygrib.pyx":1994
 *         while 1:
 *             gh = grib_handle_new_from_index(self._gi, &err)
 *             if err or gh == NULL:             # <<<<<<<<<<<<<<
 *                 break
 *             else:
 */
    __pyx_t_9 = (__pyx_v_err != 0);
    if (!__pyx_t_9) {
    } else {
      __pyx_t_10 = __pyx_t_9;
      goto __pyx_L28_bool_binop_done;
    }
    __pyx_t_9 = ((__pyx_v_gh == NULL) != 0);
    __pyx_t_10 = __pyx_t_9;
    __pyx_L28_bool_binop_done:;
    if (__pyx_t_10) {

      /* "pygrib.pyx":1995
 *             gh = grib_handle_new_from_index(self._gi, &err)
 *             if err or gh == NULL:
 *                 break             # <<<<<<<<<<<<<<
 *             else:
 *                 messagenumber = messagenumber + 1
 */
      goto __pyx_L26_break;

      /* "pygrib.pyx":1994
 *         while 1:
 *             gh = grib_handle_new_from_index(self._gi, &err)
 *             if err or gh == NULL:             # <<<<<<<<<<<<<<
 *                 break
 *             else:
 */
    }

    /* "pygrib.pyx":1997
 *                 break
 *             else:
 *                 messagenumber = messagenumber + 1             # <<<<<<<<<<<<<<
 *             grbs.append(_create_gribmessage(gh, messagenumber))
 *             err = grib_handle_delete(gh)
 */
    /*else*/ {
      __pyx_t_2 = __Pyx_PyInt_AddObjC(__pyx_v_messagenumber, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1997, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF_SET(__pyx_v_messagenumber, __pyx_t_2);
      __pyx_t_2 = 0;
    }

    /* "pygrib.pyx":1998
 *             else:
 *                 messagenumber = messagenumber + 1
 *             grbs.append(_create_gribmessage(gh, messagenumber))             # <<<<<<<<<<<<<<
 *             err = grib_handle_delete(gh)
 *             if err:
 */
    __pyx_t_2 = __pyx_f_6pygrib__create_gribmessage(__pyx_v_gh, __pyx_v_messagenumber); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1998, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_15 = __Pyx_PyList_Append(__pyx_v_grbs, __pyx_t_2); if (unlikely(__pyx_t_15 == ((int)-1))) __PYX_ERR(0, 1998, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "pygrib.pyx":1999
 *                 messagenumber = messagenumber + 1
 *             grbs.append(_create_gribmessage(gh, messagenumber))
 *             err = grib_handle_delete(gh)             # <<<<<<<<<<<<<<
 *             if err:
 *                 raise RuntimeError(grib_get_error_message(err))
 */
    __pyx_v_err = grib_handle_delete(__pyx_v_gh);

    /* "pygrib.pyx":2000
 *             grbs.append(_create_gribmessage(gh, messagenumber))
 *             err = grib_handle_delete(gh)
 *             if err:             # <<<<<<<<<<<<<<
 *                 raise RuntimeError(grib_get_error_message(err))
 *         if not grbs:
 */
    __pyx_t_10 = (__pyx_v_err != 0);
    if (unlikely(__pyx_t_10)) {

      /* "pygrib.pyx":2001
 *             err = grib_handle_delete(gh)
 *             if err:
 *                 raise RuntimeError(grib_get_error_message(err))             # <<<<<<<<<<<<<<
 *         if not grbs:
 *             raise ValueError('no matches found')
 */
      __pyx_t_2 = __Pyx_PyBytes_FromString(grib_get_error_message(__pyx_v_err)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2001, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_RuntimeError, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2001, __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_ERR(0, 2001, __pyx_L1_error)

      /* "pygrib.pyx":2000
 *             grbs.append(_create_gribmessage(gh, messagenumber))
 *             err = grib_handle_delete(gh)
 *             if err:             # <<<<<<<<<<<<<<
 *                 raise RuntimeError(grib_get_error_message(err))
 *         if not grbs:
 */
    }
  }
  __pyx_L26_break:;

  /* "pygrib.pyx":2002
 *             if err:
 *                 raise RuntimeError(grib_get_error_message(err))
 *         if not grbs:             # <<<<<<<<<<<<<<
 *             raise ValueError('no matches found')
 *         # return the list of grib messages.
 */
  __pyx_t_10 = (PyList_GET_SIZE(__pyx_v_grbs) != 0);
  __pyx_t_9 = ((!__pyx_t_10) != 0);
  if (unlikely(__pyx_t_9)) {

    /* "pygrib.pyx":2003
 *                 raise RuntimeError(grib_get_error_message(err))
 *         if not grbs:
 *             raise ValueError('no matches found')             # <<<<<<<<<<<<<<
 *         # return the list of grib messages.
 *         return grbs
 */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__111, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2003, __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_ERR(0, 2003, __pyx_L1_error)

    /* "pygrib.pyx":2002
 *             if err:
 *                 raise RuntimeError(grib_get_error_message(err))
 *         if not grbs:             # <<<<<<<<<<<<<<
 *             raise ValueError('no matches found')
 *         # return the list of grib messages.
 */
  }

  /* "pygrib.pyx":2005
 *             raise ValueError('no matches found')
 *         # return the list of grib messages.
 *         return grbs             # <<<<<<<<<<<<<<
 *     def write(self,filename):
 *         """
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_grbs);
  __pyx_r = __pyx_v_grbs;
  goto __pyx_L0;

  /* "pygrib.pyx":1918
 *         """same as L{select}"""
 *         return self.select(**kwargs)
 *     def select(self, **kwargs):             # <<<<<<<<<<<<<<
 *         """
 * select(**kwargs)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("pygrib.index.select", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_sizetot);
  __Pyx_XDECREF(__pyx_v_k);
  __Pyx_XDECREF(__pyx_v_v);
  __Pyx_XDECREF(__pyx_v_typ);
  __Pyx_XDECREF(__pyx_v_bytestr);
  __Pyx_XDECREF(__pyx_v_messagenumber);
  __Pyx_XDECREF(__pyx_v_grbs);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pygrib.pyx":2006
 *         # return the list of grib messages.
 *         return grbs
 *     def write(self,filename):             # <<<<<<<<<<<<<<
 *         """
 *         write(filename)
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pygrib_5index_9write(PyObject *__pyx_v_self, PyObject *__pyx_v_filename); /*proto*/
static char __pyx_doc_6pygrib_5index_8write[] = "\n        write(filename)\n\n        save grib index to file";
static PyObject *__pyx_pw_6pygrib_5index_9write(PyObject *__pyx_v_self, PyObject *__pyx_v_filename) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("write (wrapper)", 0);
  __pyx_r = __pyx_pf_6pygrib_5index_8write(((struct __pyx_obj_6pygrib_index *)__pyx_v_self), ((PyObject *)__pyx_v_filename));

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

static PyObject *__pyx_pf_6pygrib_5index_8write(struct __pyx_obj_6pygrib_index *__pyx_v_self, PyObject *__pyx_v_filename) {
  char *__pyx_v_filenamec;
  PyObject *__pyx_v_bytestr = NULL;
  int __pyx_v_err;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  char *__pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("write", 0);

  /* "pygrib.pyx":2012
 *         save grib index to file"""
 *         cdef char * filenamec
 *         bytestr = _strencode(filename)             # <<<<<<<<<<<<<<
 *         filenamec = bytestr
 *         err = grib_index_write(self._gi, filenamec);
 */
  __pyx_t_1 = __pyx_f_6pygrib__strencode(__pyx_v_filename, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2012, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_bytestr = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pygrib.pyx":2013
 *         cdef char * filenamec
 *         bytestr = _strencode(filename)
 *         filenamec = bytestr             # <<<<<<<<<<<<<<
 *         err = grib_index_write(self._gi, filenamec);
 *         if err:
 */
  __pyx_t_2 = __Pyx_PyObject_AsWritableString(__pyx_v_bytestr); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 2013, __pyx_L1_error)
  __pyx_v_filenamec = __pyx_t_2;

  /* "pygrib.pyx":2014
 *         bytestr = _strencode(filename)
 *         filenamec = bytestr
 *         err = grib_index_write(self._gi, filenamec);             # <<<<<<<<<<<<<<
 *         if err:
 *             raise RuntimeError(grib_get_error_message(err))
 */
  __pyx_v_err = grib_index_write(__pyx_v_self->_gi, __pyx_v_filenamec);

  /* "pygrib.pyx":2015
 *         filenamec = bytestr
 *         err = grib_index_write(self._gi, filenamec);
 *         if err:             # <<<<<<<<<<<<<<
 *             raise RuntimeError(grib_get_error_message(err))
 *     def close(self):
 */
  __pyx_t_3 = (__pyx_v_err != 0);
  if (unlikely(__pyx_t_3)) {

    /* "pygrib.pyx":2016
 *         err = grib_index_write(self._gi, filenamec);
 *         if err:
 *             raise RuntimeError(grib_get_error_message(err))             # <<<<<<<<<<<<<<
 *     def close(self):
 *         """
 */
    __pyx_t_1 = __Pyx_PyBytes_FromString(grib_get_error_message(__pyx_v_err)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2016, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_RuntimeError, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2016, __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_ERR(0, 2016, __pyx_L1_error)

    /* "pygrib.pyx":2015
 *         filenamec = bytestr
 *         err = grib_index_write(self._gi, filenamec);
 *         if err:             # <<<<<<<<<<<<<<
 *             raise RuntimeError(grib_get_error_message(err))
 *     def close(self):
 */
  }

  /* "pygrib.pyx":2006
 *         # return the list of grib messages.
 *         return grbs
 *     def write(self,filename):             # <<<<<<<<<<<<<<
 *         """
 *         write(filename)
 */

  /* 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_AddTraceback("pygrib.index.write", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_bytestr);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pygrib.pyx":2017
 *         if err:
 *             raise RuntimeError(grib_get_error_message(err))
 *     def close(self):             # <<<<<<<<<<<<<<
 *         """
 *         close()
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pygrib_5index_11close(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6pygrib_5index_10close[] = "\n        close()\n\n        deallocate C structures associated with class instance";
static PyObject *__pyx_pw_6pygrib_5index_11close(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("close (wrapper)", 0);
  __pyx_r = __pyx_pf_6pygrib_5index_10close(((struct __pyx_obj_6pygrib_index *)__pyx_v_self));

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

static PyObject *__pyx_pf_6pygrib_5index_10close(struct __pyx_obj_6pygrib_index *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("close", 0);

  /* "pygrib.pyx":2022
 * 
 *         deallocate C structures associated with class instance"""
 *         grib_index_delete(self._gi)             # <<<<<<<<<<<<<<
 *         self._gi = NULL
 * 
 */
  grib_index_delete(__pyx_v_self->_gi);

  /* "pygrib.pyx":2023
 *         deallocate C structures associated with class instance"""
 *         grib_index_delete(self._gi)
 *         self._gi = NULL             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(self):
 */
  __pyx_v_self->_gi = NULL;

  /* "pygrib.pyx":2017
 *         if err:
 *             raise RuntimeError(grib_get_error_message(err))
 *     def close(self):             # <<<<<<<<<<<<<<
 *         """
 *         close()
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pygrib.pyx":2025
 *         self._gi = NULL
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         # deallocate storage when there are no more references
 *         # to the object.
 */

/* Python wrapper */
static void __pyx_pw_6pygrib_5index_13__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_6pygrib_5index_13__dealloc__(PyObject *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_pf_6pygrib_5index_12__dealloc__(((struct __pyx_obj_6pygrib_index *)__pyx_v_self));

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

static void __pyx_pf_6pygrib_5index_12__dealloc__(struct __pyx_obj_6pygrib_index *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("__dealloc__", 0);

  /* "pygrib.pyx":2028
 *         # deallocate storage when there are no more references
 *         # to the object.
 *         if self._gi != NULL:             # <<<<<<<<<<<<<<
 *             grib_index_delete(self._gi)
 * 
 */
  __pyx_t_1 = ((__pyx_v_self->_gi != NULL) != 0);
  if (__pyx_t_1) {

    /* "pygrib.pyx":2029
 *         # to the object.
 *         if self._gi != NULL:
 *             grib_index_delete(self._gi)             # <<<<<<<<<<<<<<
 * 
 * def _is_stringlike(a):
 */
    grib_index_delete(__pyx_v_self->_gi);

    /* "pygrib.pyx":2028
 *         # deallocate storage when there are no more references
 *         # to the object.
 *         if self._gi != NULL:             # <<<<<<<<<<<<<<
 *             grib_index_delete(self._gi)
 * 
 */
  }

  /* "pygrib.pyx":2025
 *         self._gi = NULL
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         # deallocate storage when there are no more references
 *         # to the object.
 */

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

/* "pygrib.pyx":1869
 * """
 *     cdef grib_index *_gi
 *     cdef public object keys, types, name             # <<<<<<<<<<<<<<
 *     def __cinit__(self, filename, *args):
 *         # initialize C level objects.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pygrib_5index_4keys_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6pygrib_5index_4keys_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pygrib_5index_4keys___get__(((struct __pyx_obj_6pygrib_index *)__pyx_v_self));

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

static PyObject *__pyx_pf_6pygrib_5index_4keys___get__(struct __pyx_obj_6pygrib_index *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->keys);
  __pyx_r = __pyx_v_self->keys;
  goto __pyx_L0;

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

/* Python wrapper */
static int __pyx_pw_6pygrib_5index_4keys_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_6pygrib_5index_4keys_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pygrib_5index_4keys_2__set__(((struct __pyx_obj_6pygrib_index *)__pyx_v_self), ((PyObject *)__pyx_v_value));

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

static int __pyx_pf_6pygrib_5index_4keys_2__set__(struct __pyx_obj_6pygrib_index *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__", 0);
  __Pyx_INCREF(__pyx_v_value);
  __Pyx_GIVEREF(__pyx_v_value);
  __Pyx_GOTREF(__pyx_v_self->keys);
  __Pyx_DECREF(__pyx_v_self->keys);
  __pyx_v_self->keys = __pyx_v_value;

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

/* Python wrapper */
static int __pyx_pw_6pygrib_5index_4keys_5__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_6pygrib_5index_4keys_5__del__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pygrib_5index_4keys_4__del__(((struct __pyx_obj_6pygrib_index *)__pyx_v_self));

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

static int __pyx_pf_6pygrib_5index_4keys_4__del__(struct __pyx_obj_6pygrib_index *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__", 0);
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->keys);
  __Pyx_DECREF(__pyx_v_self->keys);
  __pyx_v_self->keys = Py_None;

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

/* Python wrapper */
static PyObject *__pyx_pw_6pygrib_5index_5types_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6pygrib_5index_5types_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pygrib_5index_5types___get__(((struct __pyx_obj_6pygrib_index *)__pyx_v_self));

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

static PyObject *__pyx_pf_6pygrib_5index_5types___get__(struct __pyx_obj_6pygrib_index *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->types);
  __pyx_r = __pyx_v_self->types;
  goto __pyx_L0;

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

/* Python wrapper */
static int __pyx_pw_6pygrib_5index_5types_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_6pygrib_5index_5types_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pygrib_5index_5types_2__set__(((struct __pyx_obj_6pygrib_index *)__pyx_v_self), ((PyObject *)__pyx_v_value));

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

static int __pyx_pf_6pygrib_5index_5types_2__set__(struct __pyx_obj_6pygrib_index *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__", 0);
  __Pyx_INCREF(__pyx_v_value);
  __Pyx_GIVEREF(__pyx_v_value);
  __Pyx_GOTREF(__pyx_v_self->types);
  __Pyx_DECREF(__pyx_v_self->types);
  __pyx_v_self->types = __pyx_v_value;

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

/* Python wrapper */
static int __pyx_pw_6pygrib_5index_5types_5__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_6pygrib_5index_5types_5__del__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pygrib_5index_5types_4__del__(((struct __pyx_obj_6pygrib_index *)__pyx_v_self));

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

static int __pyx_pf_6pygrib_5index_5types_4__del__(struct __pyx_obj_6pygrib_index *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__", 0);
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->types);
  __Pyx_DECREF(__pyx_v_self->types);
  __pyx_v_self->types = Py_None;

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

/* Python wrapper */
static PyObject *__pyx_pw_6pygrib_5index_4name_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6pygrib_5index_4name_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pygrib_5index_4name___get__(((struct __pyx_obj_6pygrib_index *)__pyx_v_self));

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

static PyObject *__pyx_pf_6pygrib_5index_4name___get__(struct __pyx_obj_6pygrib_index *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->name);
  __pyx_r = __pyx_v_self->name;
  goto __pyx_L0;

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

/* Python wrapper */
static int __pyx_pw_6pygrib_5index_4name_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_6pygrib_5index_4name_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pygrib_5index_4name_2__set__(((struct __pyx_obj_6pygrib_index *)__pyx_v_self), ((PyObject *)__pyx_v_value));

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

static int __pyx_pf_6pygrib_5index_4name_2__set__(struct __pyx_obj_6pygrib_index *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__", 0);
  __Pyx_INCREF(__pyx_v_value);
  __Pyx_GIVEREF(__pyx_v_value);
  __Pyx_GOTREF(__pyx_v_self->name);
  __Pyx_DECREF(__pyx_v_self->name);
  __pyx_v_self->name = __pyx_v_value;

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

/* Python wrapper */
static int __pyx_pw_6pygrib_5index_4name_5__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_6pygrib_5index_4name_5__del__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pygrib_5index_4name_4__del__(((struct __pyx_obj_6pygrib_index *)__pyx_v_self));

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

static int __pyx_pf_6pygrib_5index_4name_4__del__(struct __pyx_obj_6pygrib_index *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__", 0);
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->name);
  __Pyx_DECREF(__pyx_v_self->name);
  __pyx_v_self->name = Py_None;

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

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pygrib_5index_15__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_6pygrib_5index_15__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pygrib_5index_14__reduce_cython__(((struct __pyx_obj_6pygrib_index *)__pyx_v_self));

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

static PyObject *__pyx_pf_6pygrib_5index_14__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6pygrib_index *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__112, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __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_ERR(1, 2, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):
 */

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

/* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pygrib_5index_17__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static PyObject *__pyx_pw_6pygrib_5index_17__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pygrib_5index_16__setstate_cython__(((struct __pyx_obj_6pygrib_index *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

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

static PyObject *__pyx_pf_6pygrib_5index_16__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6pygrib_index *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":4
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__113, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __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_ERR(1, 4, __pyx_L1_error)

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 */

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

/* "pygrib.pyx":2031
 *             grib_index_delete(self._gi)
 * 
 * def _is_stringlike(a):             # <<<<<<<<<<<<<<
 *     if type(a) == str or type(a) == bytes or type(a) == unicode:
 *         return True
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pygrib_23_is_stringlike(PyObject *__pyx_self, PyObject *__pyx_v_a); /*proto*/
static PyMethodDef __pyx_mdef_6pygrib_23_is_stringlike = {"_is_stringlike", (PyCFunction)__pyx_pw_6pygrib_23_is_stringlike, METH_O, 0};
static PyObject *__pyx_pw_6pygrib_23_is_stringlike(PyObject *__pyx_self, PyObject *__pyx_v_a) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_is_stringlike (wrapper)", 0);
  __pyx_r = __pyx_pf_6pygrib_22_is_stringlike(__pyx_self, ((PyObject *)__pyx_v_a));

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

static PyObject *__pyx_pf_6pygrib_22_is_stringlike(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_a) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("_is_stringlike", 0);

  /* "pygrib.pyx":2032
 * 
 * def _is_stringlike(a):
 *     if type(a) == str or type(a) == bytes or type(a) == unicode:             # <<<<<<<<<<<<<<
 *         return True
 *     else:
 */
  __pyx_t_2 = PyObject_RichCompare(((PyObject *)Py_TYPE(__pyx_v_a)), ((PyObject *)(&PyString_Type)), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2032, __pyx_L1_error)
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 2032, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = PyObject_RichCompare(((PyObject *)Py_TYPE(__pyx_v_a)), ((PyObject *)(&PyBytes_Type)), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2032, __pyx_L1_error)
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 2032, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = PyObject_RichCompare(((PyObject *)Py_TYPE(__pyx_v_a)), ((PyObject *)(&PyUnicode_Type)), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2032, __pyx_L1_error)
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 2032, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_1 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "pygrib.pyx":2033
 * def _is_stringlike(a):
 *     if type(a) == str or type(a) == bytes or type(a) == unicode:
 *         return True             # <<<<<<<<<<<<<<
 *     else:
 *         return False
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_True);
    __pyx_r = Py_True;
    goto __pyx_L0;

    /* "pygrib.pyx":2032
 * 
 * def _is_stringlike(a):
 *     if type(a) == str or type(a) == bytes or type(a) == unicode:             # <<<<<<<<<<<<<<
 *         return True
 *     else:
 */
  }

  /* "pygrib.pyx":2035
 *         return True
 *     else:
 *         return False             # <<<<<<<<<<<<<<
 * 
 * def _is_container(a):
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_False);
    __pyx_r = Py_False;
    goto __pyx_L0;
  }

  /* "pygrib.pyx":2031
 *             grib_index_delete(self._gi)
 * 
 * def _is_stringlike(a):             # <<<<<<<<<<<<<<
 *     if type(a) == str or type(a) == bytes or type(a) == unicode:
 *         return True
 */

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

/* "pygrib.pyx":2037
 *         return False
 * 
 * def _is_container(a):             # <<<<<<<<<<<<<<
 *     # is object container-like?  (can test for
 *     # membership with "is in", but not a string)
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pygrib_25_is_container(PyObject *__pyx_self, PyObject *__pyx_v_a); /*proto*/
static PyMethodDef __pyx_mdef_6pygrib_25_is_container = {"_is_container", (PyCFunction)__pyx_pw_6pygrib_25_is_container, METH_O, 0};
static PyObject *__pyx_pw_6pygrib_25_is_container(PyObject *__pyx_self, PyObject *__pyx_v_a) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_is_container (wrapper)", 0);
  __pyx_r = __pyx_pf_6pygrib_24_is_container(__pyx_self, ((PyObject *)__pyx_v_a));

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

static PyObject *__pyx_pf_6pygrib_24_is_container(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_a) {
  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;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  __Pyx_RefNannySetupContext("_is_container", 0);

  /* "pygrib.pyx":2040
 *     # is object container-like?  (can test for
 *     # membership with "is in", but not a string)
 *     try: 1 in a             # <<<<<<<<<<<<<<
 *     except: return False
 *     if _is_stringlike(a): return False
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __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:*/ {
      __pyx_t_4 = (__Pyx_PySequence_ContainsTF(__pyx_int_1, __pyx_v_a, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 2040, __pyx_L3_error)
    }
    __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_L8_try_end;
    __pyx_L3_error:;

    /* "pygrib.pyx":2041
 *     # membership with "is in", but not a string)
 *     try: 1 in a
 *     except: return False             # <<<<<<<<<<<<<<
 *     if _is_stringlike(a): return False
 *     return True
 */
    /*except:*/ {
      __Pyx_AddTraceback("pygrib._is_container", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(0, 2041, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(Py_False);
      __pyx_r = Py_False;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L6_except_return;
    }
    __pyx_L5_except_error:;

    /* "pygrib.pyx":2040
 *     # is object container-like?  (can test for
 *     # membership with "is in", but not a string)
 *     try: 1 in a             # <<<<<<<<<<<<<<
 *     except: return False
 *     if _is_stringlike(a): return False
 */
    __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_L6_except_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_L8_try_end:;
  }

  /* "pygrib.pyx":2042
 *     try: 1 in a
 *     except: return False
 *     if _is_stringlike(a): return False             # <<<<<<<<<<<<<<
 *     return True
 * 
 */
  __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_is_stringlike); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2042, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_5 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_6, function);
    }
  }
  if (!__pyx_t_5) {
    __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_a); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2042, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_6)) {
      PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_v_a};
      __pyx_t_7 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2042, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_7);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
      PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_v_a};
      __pyx_t_7 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2042, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_7);
    } else
    #endif
    {
      __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2042, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_5); __pyx_t_5 = NULL;
      __Pyx_INCREF(__pyx_v_a);
      __Pyx_GIVEREF(__pyx_v_a);
      PyTuple_SET_ITEM(__pyx_t_8, 0+1, __pyx_v_a);
      __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_8, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2042, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 2042, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (__pyx_t_4) {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_False);
    __pyx_r = Py_False;
    goto __pyx_L0;
  }

  /* "pygrib.pyx":2043
 *     except: return False
 *     if _is_stringlike(a): return False
 *     return True             # <<<<<<<<<<<<<<
 * 
 * def _find(grb, **kwargs):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(Py_True);
  __pyx_r = Py_True;
  goto __pyx_L0;

  /* "pygrib.pyx":2037
 *         return False
 * 
 * def _is_container(a):             # <<<<<<<<<<<<<<
 *     # is object container-like?  (can test for
 *     # membership with "is in", but not a string)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("pygrib._is_container", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pygrib.pyx":2045
 *     return True
 * 
 * def _find(grb, **kwargs):             # <<<<<<<<<<<<<<
 *     # search for key/value matches in grib message.
 *     # If value is a container-like object, search for matches to any element.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6pygrib_27_find(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_6pygrib_27_find = {"_find", (PyCFunction)__pyx_pw_6pygrib_27_find, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6pygrib_27_find(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_grb = 0;
  PyObject *__pyx_v_kwargs = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_find (wrapper)", 0);
  __pyx_v_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return NULL;
  __Pyx_GOTREF(__pyx_v_kwargs);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_grb,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);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_grb)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kwargs, values, pos_args, "_find") < 0)) __PYX_ERR(0, 2045, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
    }
    __pyx_v_grb = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_find", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2045, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0;
  __Pyx_AddTraceback("pygrib._find", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pygrib_26_find(__pyx_self, __pyx_v_grb, __pyx_v_kwargs);

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

static PyObject *__pyx_pf_6pygrib_26_find(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_grb, PyObject *__pyx_v_kwargs) {
  PyObject *__pyx_v_k = NULL;
  PyObject *__pyx_v_v = NULL;
  PyObject *__pyx_v_iscontainer = NULL;
  int __pyx_v_iscallable;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  PyObject *(*__pyx_t_4)(PyObject *);
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *(*__pyx_t_8)(PyObject *);
  int __pyx_t_9;
  int __pyx_t_10;
  int __pyx_t_11;
  PyObject *__pyx_t_12 = NULL;
  __Pyx_RefNannySetupContext("_find", 0);

  /* "pygrib.pyx":2050
 *     # If value is a function, call that function with key value to determine
 *     # whether it is a match.
 *     for k,v in kwargs.items():             # <<<<<<<<<<<<<<
 *         if not grb.has_key(k): return False
 *         # is v a "container-like" non-string object?
 */
  __pyx_t_1 = __Pyx_PyDict_Items(__pyx_v_kwargs); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2050, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {
    __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
    __pyx_t_4 = NULL;
  } else {
    __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2050, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2050, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  for (;;) {
    if (likely(!__pyx_t_4)) {
      if (likely(PyList_CheckExact(__pyx_t_2))) {
        if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 2050, __pyx_L1_error)
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2050, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      } else {
        if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 2050, __pyx_L1_error)
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2050, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      }
    } else {
      __pyx_t_1 = __pyx_t_4(__pyx_t_2);
      if (unlikely(!__pyx_t_1)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 2050, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_1);
    }
    if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
      PyObject* sequence = __pyx_t_1;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 2050, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_5 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_6 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_6);
      #else
      __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2050, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2050, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_7 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2050, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext;
      index = 0; __pyx_t_5 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_5)) goto __pyx_L5_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_5);
      index = 1; __pyx_t_6 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L5_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_6);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < 0) __PYX_ERR(0, 2050, __pyx_L1_error)
      __pyx_t_8 = NULL;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L6_unpacking_done;
      __pyx_L5_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_8 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 2050, __pyx_L1_error)
      __pyx_L6_unpacking_done:;
    }
    __Pyx_XDECREF_SET(__pyx_v_k, __pyx_t_5);
    __pyx_t_5 = 0;
    __Pyx_XDECREF_SET(__pyx_v_v, __pyx_t_6);
    __pyx_t_6 = 0;

    /* "pygrib.pyx":2051
 *     # whether it is a match.
 *     for k,v in kwargs.items():
 *         if not grb.has_key(k): return False             # <<<<<<<<<<<<<<
 *         # is v a "container-like" non-string object?
 *         iscontainer = _is_container(v)
 */
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_grb, __pyx_n_s_has_key); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2051, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_6, function);
      }
    }
    if (!__pyx_t_5) {
      __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_k); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2051, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_6)) {
        PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_v_k};
        __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2051, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_GOTREF(__pyx_t_1);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
        PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_v_k};
        __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2051, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_GOTREF(__pyx_t_1);
      } else
      #endif
      {
        __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2051, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __pyx_t_5 = NULL;
        __Pyx_INCREF(__pyx_v_k);
        __Pyx_GIVEREF(__pyx_v_k);
        PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_v_k);
        __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2051, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 2051, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_10 = ((!__pyx_t_9) != 0);
    if (__pyx_t_10) {
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(Py_False);
      __pyx_r = Py_False;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      goto __pyx_L0;
    }

    /* "pygrib.pyx":2053
 *         if not grb.has_key(k): return False
 *         # is v a "container-like" non-string object?
 *         iscontainer = _is_container(v)             # <<<<<<<<<<<<<<
 *         # is v callable?
 *         iscallable = hasattr(v, '__call__')
 */
    __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_is_container); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2053, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6);
      if (likely(__pyx_t_7)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_6, function);
      }
    }
    if (!__pyx_t_7) {
      __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_v); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2053, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_6)) {
        PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_v_v};
        __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2053, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_GOTREF(__pyx_t_1);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
        PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_v_v};
        __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2053, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_GOTREF(__pyx_t_1);
      } else
      #endif
      {
        __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2053, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_7); __pyx_t_7 = NULL;
        __Pyx_INCREF(__pyx_v_v);
        __Pyx_GIVEREF(__pyx_v_v);
        PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_v_v);
        __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2053, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_XDECREF_SET(__pyx_v_iscontainer, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "pygrib.pyx":2055
 *         iscontainer = _is_container(v)
 *         # is v callable?
 *         iscallable = hasattr(v, '__call__')             # <<<<<<<<<<<<<<
 *         # if v is callable and container-like, treat it as a container.
 *         # v not a container or a function.
 */
    __pyx_t_10 = __Pyx_HasAttr(__pyx_v_v, __pyx_n_s_call); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(0, 2055, __pyx_L1_error)
    __pyx_v_iscallable = __pyx_t_10;

    /* "pygrib.pyx":2058
 *         # if v is callable and container-like, treat it as a container.
 *         # v not a container or a function.
 *         if not iscontainer and not iscallable and getattr(grb,k)==v:             # <<<<<<<<<<<<<<
 *             continue
 *         elif iscontainer and getattr(grb,k) in v: # v a container.
 */
    __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_v_iscontainer); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 2058, __pyx_L1_error)
    __pyx_t_11 = ((!__pyx_t_9) != 0);
    if (__pyx_t_11) {
    } else {
      __pyx_t_10 = __pyx_t_11;
      goto __pyx_L9_bool_binop_done;
    }
    __pyx_t_11 = ((!(__pyx_v_iscallable != 0)) != 0);
    if (__pyx_t_11) {
    } else {
      __pyx_t_10 = __pyx_t_11;
      goto __pyx_L9_bool_binop_done;
    }
    __pyx_t_1 = __Pyx_GetAttr(__pyx_v_grb, __pyx_v_k); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2058, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_6 = PyObject_RichCompare(__pyx_t_1, __pyx_v_v, Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2058, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 2058, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_10 = __pyx_t_11;
    __pyx_L9_bool_binop_done:;
    if (__pyx_t_10) {

      /* "pygrib.pyx":2059
 *         # v not a container or a function.
 *         if not iscontainer and not iscallable and getattr(grb,k)==v:
 *             continue             # <<<<<<<<<<<<<<
 *         elif iscontainer and getattr(grb,k) in v: # v a container.
 *             continue
 */
      goto __pyx_L3_continue;

      /* "pygrib.pyx":2058
 *         # if v is callable and container-like, treat it as a container.
 *         # v not a container or a function.
 *         if not iscontainer and not iscallable and getattr(grb,k)==v:             # <<<<<<<<<<<<<<
 *             continue
 *         elif iscontainer and getattr(grb,k) in v: # v a container.
 */
    }

    /* "pygrib.pyx":2060
 *         if not iscontainer and not iscallable and getattr(grb,k)==v:
 *             continue
 *         elif iscontainer and getattr(grb,k) in v: # v a container.             # <<<<<<<<<<<<<<
 *             continue
 *         elif iscallable and v(getattr(grb,k)): # v a function
 */
    __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_v_iscontainer); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 2060, __pyx_L1_error)
    if (__pyx_t_11) {
    } else {
      __pyx_t_10 = __pyx_t_11;
      goto __pyx_L12_bool_binop_done;
    }
    __pyx_t_6 = __Pyx_GetAttr(__pyx_v_grb, __pyx_v_k); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2060, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_11 = (__Pyx_PySequence_ContainsTF(__pyx_t_6, __pyx_v_v, Py_EQ)); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 2060, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_9 = (__pyx_t_11 != 0);
    __pyx_t_10 = __pyx_t_9;
    __pyx_L12_bool_binop_done:;
    if (__pyx_t_10) {

      /* "pygrib.pyx":2061
 *             continue
 *         elif iscontainer and getattr(grb,k) in v: # v a container.
 *             continue             # <<<<<<<<<<<<<<
 *         elif iscallable and v(getattr(grb,k)): # v a function
 *             continue
 */
      goto __pyx_L3_continue;

      /* "pygrib.pyx":2060
 *         if not iscontainer and not iscallable and getattr(grb,k)==v:
 *             continue
 *         elif iscontainer and getattr(grb,k) in v: # v a container.             # <<<<<<<<<<<<<<
 *             continue
 *         elif iscallable and v(getattr(grb,k)): # v a function
 */
    }

    /* "pygrib.pyx":2062
 *         elif iscontainer and getattr(grb,k) in v: # v a container.
 *             continue
 *         elif iscallable and v(getattr(grb,k)): # v a function             # <<<<<<<<<<<<<<
 *             continue
 *         else:
 */
    __pyx_t_9 = (__pyx_v_iscallable != 0);
    if (__pyx_t_9) {
    } else {
      __pyx_t_10 = __pyx_t_9;
      goto __pyx_L14_bool_binop_done;
    }
    __pyx_t_1 = __Pyx_GetAttr(__pyx_v_grb, __pyx_v_k); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2062, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_v_v);
    __pyx_t_5 = __pyx_v_v; __pyx_t_7 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_7)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
      }
    }
    if (!__pyx_t_7) {
      __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2062, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_GOTREF(__pyx_t_6);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_5)) {
        PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_t_1};
        __pyx_t_6 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2062, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
        PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_t_1};
        __pyx_t_6 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2062, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      } else
      #endif
      {
        __pyx_t_12 = PyTuple_New(1+1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 2062, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_12);
        __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_7); __pyx_t_7 = NULL;
        __Pyx_GIVEREF(__pyx_t_1);
        PyTuple_SET_ITEM(__pyx_t_12, 0+1, __pyx_t_1);
        __pyx_t_1 = 0;
        __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_12, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2062, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 2062, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_10 = __pyx_t_9;
    __pyx_L14_bool_binop_done:;
    if (__pyx_t_10) {

      /* "pygrib.pyx":2063
 *             continue
 *         elif iscallable and v(getattr(grb,k)): # v a function
 *             continue             # <<<<<<<<<<<<<<
 *         else:
 *             return False
 */
      goto __pyx_L3_continue;

      /* "pygrib.pyx":2062
 *         elif iscontainer and getattr(grb,k) in v: # v a container.
 *             continue
 *         elif iscallable and v(getattr(grb,k)): # v a function             # <<<<<<<<<<<<<<
 *             continue
 *         else:
 */
    }

    /* "pygrib.pyx":2065
 *             continue
 *         else:
 *             return False             # <<<<<<<<<<<<<<
 *     return True
 * 
 */
    /*else*/ {
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(Py_False);
      __pyx_r = Py_False;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      goto __pyx_L0;
    }

    /* "pygrib.pyx":2050
 *     # If value is a function, call that function with key value to determine
 *     # whether it is a match.
 *     for k,v in kwargs.items():             # <<<<<<<<<<<<<<
 *         if not grb.has_key(k): return False
 *         # is v a "container-like" non-string object?
 */
    __pyx_L3_continue:;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pygrib.pyx":2066
 *         else:
 *             return False
 *     return True             # <<<<<<<<<<<<<<
 * 
 * cdef _strencode(pystr,encoding=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(Py_True);
  __pyx_r = Py_True;
  goto __pyx_L0;

  /* "pygrib.pyx":2045
 *     return True
 * 
 * def _find(grb, **kwargs):             # <<<<<<<<<<<<<<
 *     # search for key/value matches in grib message.
 *     # If value is a container-like object, search for matches to any element.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_AddTraceback("pygrib._find", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_k);
  __Pyx_XDECREF(__pyx_v_v);
  __Pyx_XDECREF(__pyx_v_iscontainer);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pygrib.pyx":2068
 *     return True
 * 
 * cdef _strencode(pystr,encoding=None):             # <<<<<<<<<<<<<<
 *     # encode a string into bytes.  If already bytes, do nothing.
 *     # uses default_encoding module variable for default encoding.
 */

static PyObject *__pyx_f_6pygrib__strencode(PyObject *__pyx_v_pystr, struct __pyx_opt_args_6pygrib__strencode *__pyx_optional_args) {
  PyObject *__pyx_v_encoding = ((PyObject *)Py_None);
  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;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  __Pyx_RefNannySetupContext("_strencode", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_encoding = __pyx_optional_args->encoding;
    }
  }
  __Pyx_INCREF(__pyx_v_encoding);

  /* "pygrib.pyx":2071
 *     # encode a string into bytes.  If already bytes, do nothing.
 *     # uses default_encoding module variable for default encoding.
 *     if encoding is None:             # <<<<<<<<<<<<<<
 *         encoding = default_encoding
 *     try:
 */
  __pyx_t_1 = (__pyx_v_encoding == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "pygrib.pyx":2072
 *     # uses default_encoding module variable for default encoding.
 *     if encoding is None:
 *         encoding = default_encoding             # <<<<<<<<<<<<<<
 *     try:
 *         return pystr.encode(encoding)
 */
    __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_default_encoding); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2072, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF_SET(__pyx_v_encoding, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "pygrib.pyx":2071
 *     # encode a string into bytes.  If already bytes, do nothing.
 *     # uses default_encoding module variable for default encoding.
 *     if encoding is None:             # <<<<<<<<<<<<<<
 *         encoding = default_encoding
 *     try:
 */
  }

  /* "pygrib.pyx":2073
 *     if encoding is None:
 *         encoding = default_encoding
 *     try:             # <<<<<<<<<<<<<<
 *         return pystr.encode(encoding)
 *     except AttributeError:
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_4, &__pyx_t_5, &__pyx_t_6);
    __Pyx_XGOTREF(__pyx_t_4);
    __Pyx_XGOTREF(__pyx_t_5);
    __Pyx_XGOTREF(__pyx_t_6);
    /*try:*/ {

      /* "pygrib.pyx":2074
 *         encoding = default_encoding
 *     try:
 *         return pystr.encode(encoding)             # <<<<<<<<<<<<<<
 *     except AttributeError:
 *         return pystr # already bytes?
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_pystr, __pyx_n_s_encode); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2074, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_8 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
        __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
        if (likely(__pyx_t_8)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
          __Pyx_INCREF(__pyx_t_8);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_7, function);
        }
      }
      if (!__pyx_t_8) {
        __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_v_encoding); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2074, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_3);
      } else {
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_7)) {
          PyObject *__pyx_temp[2] = {__pyx_t_8, __pyx_v_encoding};
          __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2074, __pyx_L4_error)
          __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
          __Pyx_GOTREF(__pyx_t_3);
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) {
          PyObject *__pyx_temp[2] = {__pyx_t_8, __pyx_v_encoding};
          __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2074, __pyx_L4_error)
          __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
          __Pyx_GOTREF(__pyx_t_3);
        } else
        #endif
        {
          __pyx_t_9 = PyTuple_New(1+1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2074, __pyx_L4_error)
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_8); __pyx_t_8 = NULL;
          __Pyx_INCREF(__pyx_v_encoding);
          __Pyx_GIVEREF(__pyx_v_encoding);
          PyTuple_SET_ITEM(__pyx_t_9, 0+1, __pyx_v_encoding);
          __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_9, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2074, __pyx_L4_error)
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        }
      }
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_r = __pyx_t_3;
      __pyx_t_3 = 0;
      goto __pyx_L8_try_return;

      /* "pygrib.pyx":2073
 *     if encoding is None:
 *         encoding = default_encoding
 *     try:             # <<<<<<<<<<<<<<
 *         return pystr.encode(encoding)
 *     except AttributeError:
 */
    }
    __pyx_L4_error:;
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "pygrib.pyx":2075
 *     try:
 *         return pystr.encode(encoding)
 *     except AttributeError:             # <<<<<<<<<<<<<<
 *         return pystr # already bytes?
 */
    __pyx_t_10 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_AttributeError);
    if (__pyx_t_10) {
      __Pyx_AddTraceback("pygrib._strencode", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_7, &__pyx_t_9) < 0) __PYX_ERR(0, 2075, __pyx_L6_except_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_GOTREF(__pyx_t_9);

      /* "pygrib.pyx":2076
 *         return pystr.encode(encoding)
 *     except AttributeError:
 *         return pystr # already bytes?             # <<<<<<<<<<<<<<
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_v_pystr);
      __pyx_r = __pyx_v_pystr;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      goto __pyx_L7_except_return;
    }
    goto __pyx_L6_except_error;
    __pyx_L6_except_error:;

    /* "pygrib.pyx":2073
 *     if encoding is None:
 *         encoding = default_encoding
 *     try:             # <<<<<<<<<<<<<<
 *         return pystr.encode(encoding)
 *     except AttributeError:
 */
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_XGIVEREF(__pyx_t_6);
    __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
    goto __pyx_L1_error;
    __pyx_L8_try_return:;
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_XGIVEREF(__pyx_t_6);
    __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
    goto __pyx_L0;
    __pyx_L7_except_return:;
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_XGIVEREF(__pyx_t_6);
    __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
    goto __pyx_L0;
  }

  /* "pygrib.pyx":2068
 *     return True
 * 
 * cdef _strencode(pystr,encoding=None):             # <<<<<<<<<<<<<<
 *     # encode a string into bytes.  If already bytes, do nothing.
 *     # uses default_encoding module variable for default encoding.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("pygrib._strencode", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_encoding);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_tp_new_6pygrib_open(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_6pygrib_open *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_6pygrib_open *)o);
  p->name = Py_None; Py_INCREF(Py_None);
  p->messagenumber = Py_None; Py_INCREF(Py_None);
  p->messages = Py_None; Py_INCREF(Py_None);
  p->closed = Py_None; Py_INCREF(Py_None);
  p->has_multi_field_msgs = Py_None; Py_INCREF(Py_None);
  if (unlikely(__pyx_pw_6pygrib_4open_1__cinit__(o, a, k) < 0)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

static void __pyx_tp_dealloc_6pygrib_open(PyObject *o) {
  struct __pyx_obj_6pygrib_open *p = (struct __pyx_obj_6pygrib_open *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && 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_6pygrib_4open_27__dealloc__(o);
    --Py_REFCNT(o);
    PyErr_Restore(etype, eval, etb);
  }
  Py_CLEAR(p->name);
  Py_CLEAR(p->messagenumber);
  Py_CLEAR(p->messages);
  Py_CLEAR(p->closed);
  Py_CLEAR(p->has_multi_field_msgs);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_6pygrib_open(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_6pygrib_open *p = (struct __pyx_obj_6pygrib_open *)o;
  if (p->name) {
    e = (*v)(p->name, a); if (e) return e;
  }
  if (p->messagenumber) {
    e = (*v)(p->messagenumber, a); if (e) return e;
  }
  if (p->messages) {
    e = (*v)(p->messages, a); if (e) return e;
  }
  if (p->closed) {
    e = (*v)(p->closed, a); if (e) return e;
  }
  if (p->has_multi_field_msgs) {
    e = (*v)(p->has_multi_field_msgs, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_6pygrib_open(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_6pygrib_open *p = (struct __pyx_obj_6pygrib_open *)o;
  tmp = ((PyObject*)p->name);
  p->name = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->messagenumber);
  p->messagenumber = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->messages);
  p->messages = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->closed);
  p->closed = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->has_multi_field_msgs);
  p->has_multi_field_msgs = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}
static PyObject *__pyx_sq_item_6pygrib_open(PyObject *o, Py_ssize_t i) {
  PyObject *r;
  PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;
  r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
  Py_DECREF(x);
  return r;
}

static PyObject *__pyx_getprop_6pygrib_4open_name(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6pygrib_4open_4name_1__get__(o);
}

static int __pyx_setprop_6pygrib_4open_name(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_6pygrib_4open_4name_3__set__(o, v);
  }
  else {
    return __pyx_pw_6pygrib_4open_4name_5__del__(o);
  }
}

static PyObject *__pyx_getprop_6pygrib_4open_messagenumber(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6pygrib_4open_13messagenumber_1__get__(o);
}

static int __pyx_setprop_6pygrib_4open_messagenumber(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_6pygrib_4open_13messagenumber_3__set__(o, v);
  }
  else {
    return __pyx_pw_6pygrib_4open_13messagenumber_5__del__(o);
  }
}

static PyObject *__pyx_getprop_6pygrib_4open_messages(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6pygrib_4open_8messages_1__get__(o);
}

static int __pyx_setprop_6pygrib_4open_messages(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_6pygrib_4open_8messages_3__set__(o, v);
  }
  else {
    return __pyx_pw_6pygrib_4open_8messages_5__del__(o);
  }
}

static PyObject *__pyx_getprop_6pygrib_4open_closed(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6pygrib_4open_6closed_1__get__(o);
}

static int __pyx_setprop_6pygrib_4open_closed(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_6pygrib_4open_6closed_3__set__(o, v);
  }
  else {
    return __pyx_pw_6pygrib_4open_6closed_5__del__(o);
  }
}

static PyObject *__pyx_getprop_6pygrib_4open_has_multi_field_msgs(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6pygrib_4open_20has_multi_field_msgs_1__get__(o);
}

static int __pyx_setprop_6pygrib_4open_has_multi_field_msgs(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_6pygrib_4open_20has_multi_field_msgs_3__set__(o, v);
  }
  else {
    return __pyx_pw_6pygrib_4open_20has_multi_field_msgs_5__del__(o);
  }
}

static PyMethodDef __pyx_methods_6pygrib_open[] = {
  {"__next__", (PyCFunction)__pyx_pw_6pygrib_4open_7__next__, METH_NOARGS|METH_COEXIST, 0},
  {"__enter__", (PyCFunction)__pyx_pw_6pygrib_4open_13__enter__, METH_NOARGS, 0},
  {"__exit__", (PyCFunction)__pyx_pw_6pygrib_4open_15__exit__, METH_VARARGS|METH_KEYWORDS, 0},
  {"tell", (PyCFunction)__pyx_pw_6pygrib_4open_17tell, METH_NOARGS, __pyx_doc_6pygrib_4open_16tell},
  {"seek", (PyCFunction)__pyx_pw_6pygrib_4open_19seek, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6pygrib_4open_18seek},
  {"readline", (PyCFunction)__pyx_pw_6pygrib_4open_21readline, METH_NOARGS, __pyx_doc_6pygrib_4open_20readline},
  {"read", (PyCFunction)__pyx_pw_6pygrib_4open_23read, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6pygrib_4open_22read},
  {"close", (PyCFunction)__pyx_pw_6pygrib_4open_25close, METH_NOARGS, __pyx_doc_6pygrib_4open_24close},
  {"rewind", (PyCFunction)__pyx_pw_6pygrib_4open_29rewind, METH_NOARGS, __pyx_doc_6pygrib_4open_28rewind},
  {"message", (PyCFunction)__pyx_pw_6pygrib_4open_31message, METH_O, __pyx_doc_6pygrib_4open_30message},
  {"select", (PyCFunction)__pyx_pw_6pygrib_4open_33select, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6pygrib_4open_32select},
  {"_advance", (PyCFunction)__pyx_pw_6pygrib_4open_35_advance, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6pygrib_4open_34_advance},
  {"__reduce_cython__", (PyCFunction)__pyx_pw_6pygrib_4open_37__reduce_cython__, METH_NOARGS, 0},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_6pygrib_4open_39__setstate_cython__, METH_O, 0},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_6pygrib_open[] = {
  {(char *)"name", __pyx_getprop_6pygrib_4open_name, __pyx_setprop_6pygrib_4open_name, (char *)0, 0},
  {(char *)"messagenumber", __pyx_getprop_6pygrib_4open_messagenumber, __pyx_setprop_6pygrib_4open_messagenumber, (char *)0, 0},
  {(char *)"messages", __pyx_getprop_6pygrib_4open_messages, __pyx_setprop_6pygrib_4open_messages, (char *)0, 0},
  {(char *)"closed", __pyx_getprop_6pygrib_4open_closed, __pyx_setprop_6pygrib_4open_closed, (char *)0, 0},
  {(char *)"has_multi_field_msgs", __pyx_getprop_6pygrib_4open_has_multi_field_msgs, __pyx_setprop_6pygrib_4open_has_multi_field_msgs, (char *)0, 0},
  {0, 0, 0, 0, 0}
};

static PySequenceMethods __pyx_tp_as_sequence_open = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  __pyx_sq_item_6pygrib_open, /*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_open = {
  0, /*mp_length*/
  __pyx_pw_6pygrib_4open_9__getitem__, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyTypeObject __pyx_type_6pygrib_open = {
  PyVarObject_HEAD_INIT(0, 0)
  "pygrib.open", /*tp_name*/
  sizeof(struct __pyx_obj_6pygrib_open), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6pygrib_open, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  &__pyx_tp_as_sequence_open, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_open, /*tp_as_mapping*/
  0, /*tp_hash*/
  __pyx_pw_6pygrib_4open_11__call__, /*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*/
  " \n    open(filename)\n    \n    returns GRIB file iterator object given GRIB filename. When iterated, returns\n    instances of the L{gribmessage} class. Behaves much like a python file\n    object, with L{seek}, L{tell}, L{read} and L{close} methods, \n    except that offsets are measured in grib messages instead of bytes.\n    Additional methods include L{rewind} (like C{seek(0)}), L{message}\n    (like C{seek(N-1)}; followed by C{readline()}), and L{select} (filters\n    messages based on specified conditions).  The C{__call__} method forwards\n    to L{select}, and instances can be sliced with C{__getitem__} (returning\n    lists of L{gribmessage} instances).  The position of the iterator is not\n    altered by slicing with C{__getitem__}.\n     \n    @ivar messages: The total number of grib messages in the file.\n\n    @ivar messagenumber: The grib message number that the iterator currently\n    points to (the value returned by L{tell}).\n\n    @ivar name: The GRIB file which the instance represents.", /*tp_doc*/
  __pyx_tp_traverse_6pygrib_open, /*tp_traverse*/
  __pyx_tp_clear_6pygrib_open, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  __pyx_pw_6pygrib_4open_5__iter__, /*tp_iter*/
  __pyx_pw_6pygrib_4open_7__next__, /*tp_iternext*/
  __pyx_methods_6pygrib_open, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_6pygrib_open, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pw_6pygrib_4open_3__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6pygrib_open, /*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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};

static PyObject *__pyx_tp_new_6pygrib_gribmessage(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_6pygrib_gribmessage *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_6pygrib_gribmessage *)o);
  p->messagenumber = Py_None; Py_INCREF(Py_None);
  p->projparams = Py_None; Py_INCREF(Py_None);
  p->validDate = Py_None; Py_INCREF(Py_None);
  p->analDate = Py_None; Py_INCREF(Py_None);
  p->expand_reduced = Py_None; Py_INCREF(Py_None);
  p->_ro_keys = Py_None; Py_INCREF(Py_None);
  p->_all_keys = Py_None; Py_INCREF(Py_None);
  p->fcstimeunits = Py_None; Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_6pygrib_gribmessage(PyObject *o) {
  struct __pyx_obj_6pygrib_gribmessage *p = (struct __pyx_obj_6pygrib_gribmessage *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && 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_6pygrib_11gribmessage_3__dealloc__(o);
    --Py_REFCNT(o);
    PyErr_Restore(etype, eval, etb);
  }
  Py_CLEAR(p->messagenumber);
  Py_CLEAR(p->projparams);
  Py_CLEAR(p->validDate);
  Py_CLEAR(p->analDate);
  Py_CLEAR(p->expand_reduced);
  Py_CLEAR(p->_ro_keys);
  Py_CLEAR(p->_all_keys);
  Py_CLEAR(p->fcstimeunits);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_6pygrib_gribmessage(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_6pygrib_gribmessage *p = (struct __pyx_obj_6pygrib_gribmessage *)o;
  if (p->messagenumber) {
    e = (*v)(p->messagenumber, a); if (e) return e;
  }
  if (p->projparams) {
    e = (*v)(p->projparams, a); if (e) return e;
  }
  if (p->validDate) {
    e = (*v)(p->validDate, a); if (e) return e;
  }
  if (p->analDate) {
    e = (*v)(p->analDate, a); if (e) return e;
  }
  if (p->expand_reduced) {
    e = (*v)(p->expand_reduced, a); if (e) return e;
  }
  if (p->_ro_keys) {
    e = (*v)(p->_ro_keys, a); if (e) return e;
  }
  if (p->_all_keys) {
    e = (*v)(p->_all_keys, a); if (e) return e;
  }
  if (p->fcstimeunits) {
    e = (*v)(p->fcstimeunits, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_6pygrib_gribmessage(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_6pygrib_gribmessage *p = (struct __pyx_obj_6pygrib_gribmessage *)o;
  tmp = ((PyObject*)p->messagenumber);
  p->messagenumber = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->projparams);
  p->projparams = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->validDate);
  p->validDate = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->analDate);
  p->analDate = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->expand_reduced);
  p->expand_reduced = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_ro_keys);
  p->_ro_keys = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_all_keys);
  p->_all_keys = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->fcstimeunits);
  p->fcstimeunits = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}
static PyObject *__pyx_sq_item_6pygrib_gribmessage(PyObject *o, Py_ssize_t i) {
  PyObject *r;
  PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;
  r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
  Py_DECREF(x);
  return r;
}

static int __pyx_mp_ass_subscript_6pygrib_gribmessage(PyObject *o, PyObject *i, PyObject *v) {
  if (v) {
    return __pyx_pw_6pygrib_11gribmessage_23__setitem__(o, i, v);
  }
  else {
    PyErr_Format(PyExc_NotImplementedError,
      "Subscript deletion not supported by %.200s", Py_TYPE(o)->tp_name);
    return -1;
  }
}

static PyObject *__pyx_tp_getattro_6pygrib_gribmessage(PyObject *o, PyObject *n) {
  PyObject *v = __Pyx_PyObject_GenericGetAttr(o, n);
  if (!v && PyErr_ExceptionMatches(PyExc_AttributeError)) {
    PyErr_Clear();
    v = __pyx_pw_6pygrib_11gribmessage_5__getattr__(o, n);
  }
  return v;
}

static int __pyx_tp_setattro_6pygrib_gribmessage(PyObject *o, PyObject *n, PyObject *v) {
  if (v) {
    return __pyx_pw_6pygrib_11gribmessage_7__setattr__(o, n, v);
  }
  else {
    return PyObject_GenericSetAttr(o, n, 0);
  }
}

static PyObject *__pyx_getprop_6pygrib_11gribmessage_messagenumber(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6pygrib_11gribmessage_13messagenumber_1__get__(o);
}

static int __pyx_setprop_6pygrib_11gribmessage_messagenumber(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_6pygrib_11gribmessage_13messagenumber_3__set__(o, v);
  }
  else {
    return __pyx_pw_6pygrib_11gribmessage_13messagenumber_5__del__(o);
  }
}

static PyObject *__pyx_getprop_6pygrib_11gribmessage_projparams(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6pygrib_11gribmessage_10projparams_1__get__(o);
}

static int __pyx_setprop_6pygrib_11gribmessage_projparams(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_6pygrib_11gribmessage_10projparams_3__set__(o, v);
  }
  else {
    return __pyx_pw_6pygrib_11gribmessage_10projparams_5__del__(o);
  }
}

static PyObject *__pyx_getprop_6pygrib_11gribmessage_validDate(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6pygrib_11gribmessage_9validDate_1__get__(o);
}

static int __pyx_setprop_6pygrib_11gribmessage_validDate(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_6pygrib_11gribmessage_9validDate_3__set__(o, v);
  }
  else {
    return __pyx_pw_6pygrib_11gribmessage_9validDate_5__del__(o);
  }
}

static PyObject *__pyx_getprop_6pygrib_11gribmessage_analDate(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6pygrib_11gribmessage_8analDate_1__get__(o);
}

static int __pyx_setprop_6pygrib_11gribmessage_analDate(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_6pygrib_11gribmessage_8analDate_3__set__(o, v);
  }
  else {
    return __pyx_pw_6pygrib_11gribmessage_8analDate_5__del__(o);
  }
}

static PyObject *__pyx_getprop_6pygrib_11gribmessage_expand_reduced(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6pygrib_11gribmessage_14expand_reduced_1__get__(o);
}

static int __pyx_setprop_6pygrib_11gribmessage_expand_reduced(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_6pygrib_11gribmessage_14expand_reduced_3__set__(o, v);
  }
  else {
    return __pyx_pw_6pygrib_11gribmessage_14expand_reduced_5__del__(o);
  }
}

static PyObject *__pyx_getprop_6pygrib_11gribmessage__ro_keys(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6pygrib_11gribmessage_8_ro_keys_1__get__(o);
}

static int __pyx_setprop_6pygrib_11gribmessage__ro_keys(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_6pygrib_11gribmessage_8_ro_keys_3__set__(o, v);
  }
  else {
    return __pyx_pw_6pygrib_11gribmessage_8_ro_keys_5__del__(o);
  }
}

static PyObject *__pyx_getprop_6pygrib_11gribmessage__all_keys(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6pygrib_11gribmessage_9_all_keys_1__get__(o);
}

static int __pyx_setprop_6pygrib_11gribmessage__all_keys(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_6pygrib_11gribmessage_9_all_keys_3__set__(o, v);
  }
  else {
    return __pyx_pw_6pygrib_11gribmessage_9_all_keys_5__del__(o);
  }
}

static PyObject *__pyx_getprop_6pygrib_11gribmessage_fcstimeunits(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6pygrib_11gribmessage_12fcstimeunits_1__get__(o);
}

static int __pyx_setprop_6pygrib_11gribmessage_fcstimeunits(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_6pygrib_11gribmessage_12fcstimeunits_3__set__(o, v);
  }
  else {
    return __pyx_pw_6pygrib_11gribmessage_12fcstimeunits_5__del__(o);
  }
}

static PyMethodDef __pyx_methods_6pygrib_gribmessage[] = {
  {"__getattr__", (PyCFunction)__pyx_pw_6pygrib_11gribmessage_5__getattr__, METH_O|METH_COEXIST, 0},
  {"_get_key", (PyCFunction)__pyx_pw_6pygrib_11gribmessage_11_get_key, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6pygrib_11gribmessage_10_get_key},
  {"expand_grid", (PyCFunction)__pyx_pw_6pygrib_11gribmessage_13expand_grid, METH_O, __pyx_doc_6pygrib_11gribmessage_12expand_grid},
  {"is_missing", (PyCFunction)__pyx_pw_6pygrib_11gribmessage_15is_missing, METH_O, __pyx_doc_6pygrib_11gribmessage_14is_missing},
  {"keys", (PyCFunction)__pyx_pw_6pygrib_11gribmessage_17keys, METH_NOARGS, __pyx_doc_6pygrib_11gribmessage_16keys},
  {"_read_only_keys", (PyCFunction)__pyx_pw_6pygrib_11gribmessage_19_read_only_keys, METH_NOARGS, __pyx_doc_6pygrib_11gribmessage_18_read_only_keys},
  {"data", (PyCFunction)__pyx_pw_6pygrib_11gribmessage_21data, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6pygrib_11gribmessage_20data},
  {"has_key", (PyCFunction)__pyx_pw_6pygrib_11gribmessage_27has_key, METH_O, __pyx_doc_6pygrib_11gribmessage_26has_key},
  {"valid_key", (PyCFunction)__pyx_pw_6pygrib_11gribmessage_29valid_key, METH_O, __pyx_doc_6pygrib_11gribmessage_28valid_key},
  {"tostring", (PyCFunction)__pyx_pw_6pygrib_11gribmessage_31tostring, METH_NOARGS, __pyx_doc_6pygrib_11gribmessage_30tostring},
  {"_unshape_mask", (PyCFunction)__pyx_pw_6pygrib_11gribmessage_33_unshape_mask, METH_O, __pyx_doc_6pygrib_11gribmessage_32_unshape_mask},
  {"_reshape_mask", (PyCFunction)__pyx_pw_6pygrib_11gribmessage_35_reshape_mask, METH_O, __pyx_doc_6pygrib_11gribmessage_34_reshape_mask},
  {"_set_projparams", (PyCFunction)__pyx_pw_6pygrib_11gribmessage_37_set_projparams, METH_NOARGS, __pyx_doc_6pygrib_11gribmessage_36_set_projparams},
  {"latlons", (PyCFunction)__pyx_pw_6pygrib_11gribmessage_39latlons, METH_NOARGS, __pyx_doc_6pygrib_11gribmessage_38latlons},
  {"__reduce_cython__", (PyCFunction)__pyx_pw_6pygrib_11gribmessage_41__reduce_cython__, METH_NOARGS, 0},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_6pygrib_11gribmessage_43__setstate_cython__, METH_O, 0},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_6pygrib_gribmessage[] = {
  {(char *)"messagenumber", __pyx_getprop_6pygrib_11gribmessage_messagenumber, __pyx_setprop_6pygrib_11gribmessage_messagenumber, (char *)0, 0},
  {(char *)"projparams", __pyx_getprop_6pygrib_11gribmessage_projparams, __pyx_setprop_6pygrib_11gribmessage_projparams, (char *)0, 0},
  {(char *)"validDate", __pyx_getprop_6pygrib_11gribmessage_validDate, __pyx_setprop_6pygrib_11gribmessage_validDate, (char *)0, 0},
  {(char *)"analDate", __pyx_getprop_6pygrib_11gribmessage_analDate, __pyx_setprop_6pygrib_11gribmessage_analDate, (char *)0, 0},
  {(char *)"expand_reduced", __pyx_getprop_6pygrib_11gribmessage_expand_reduced, __pyx_setprop_6pygrib_11gribmessage_expand_reduced, (char *)0, 0},
  {(char *)"_ro_keys", __pyx_getprop_6pygrib_11gribmessage__ro_keys, __pyx_setprop_6pygrib_11gribmessage__ro_keys, (char *)0, 0},
  {(char *)"_all_keys", __pyx_getprop_6pygrib_11gribmessage__all_keys, __pyx_setprop_6pygrib_11gribmessage__all_keys, (char *)0, 0},
  {(char *)"fcstimeunits", __pyx_getprop_6pygrib_11gribmessage_fcstimeunits, __pyx_setprop_6pygrib_11gribmessage_fcstimeunits, (char *)0, 0},
  {0, 0, 0, 0, 0}
};

static PySequenceMethods __pyx_tp_as_sequence_gribmessage = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  __pyx_sq_item_6pygrib_gribmessage, /*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_gribmessage = {
  0, /*mp_length*/
  __pyx_pw_6pygrib_11gribmessage_25__getitem__, /*mp_subscript*/
  __pyx_mp_ass_subscript_6pygrib_gribmessage, /*mp_ass_subscript*/
};

static PyTypeObject __pyx_type_6pygrib_gribmessage = {
  PyVarObject_HEAD_INIT(0, 0)
  "pygrib.gribmessage", /*tp_name*/
  sizeof(struct __pyx_obj_6pygrib_gribmessage), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6pygrib_gribmessage, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  __pyx_pw_6pygrib_11gribmessage_9__repr__, /*tp_repr*/
  0, /*tp_as_number*/
  &__pyx_tp_as_sequence_gribmessage, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_gribmessage, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  __pyx_tp_getattro_6pygrib_gribmessage, /*tp_getattro*/
  __pyx_tp_setattro_6pygrib_gribmessage, /*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*/
  "\n    Grib message object.\n\n    Each grib message has attributes corresponding to grib message\n    keys for \n    U{GRIB1 <http://www.ecmwf.int/publications/manuals/d/gribapi/fm92/grib1>}\n    and\n    U{GRIB2 <http://www.ecmwf.int/publications/manuals/d/gribapi/fm92/grib2/>}.\n    Parameter names are\n    are given by the C{name}, C{shortName} and C{paramID}\n    U{keys <http://www.ecmwf.int/publications/manuals/d/gribapi/param/>}.\n    pygrib also defines some special attributes which are defined below\n    under the heading B{Instance Variables}.\n\n    @ivar messagenumber: The grib message number in the file.\n\n    @ivar projparams: A dictionary containing proj4 key/value pairs describing \n    the grid.  Set to C{None} for unsupported grid types.\n\n    @ivar expand_reduced:  If True (default), reduced lat/lon and gaussian grids\n    will be expanded to regular grids when data is accessed via \"values\" key. If\n    False, data is kept on unstructured reduced grid, and is returned in a 1-d\n    array.\n\n    @ivar fcstimeunits:  A string representing the forecast time units\n    (an empty string if not defined).\n\n    @ivar analDate:  A python datetime instance describing the analysis date\n    and time for the forecast. Only set if forecastTime and julianDay keys\n    exist.\n\n    @ivar validDate:  A python datetime instance describing the valid date\n    and time for the forecast. Only set if forecastTime and julianDay keys\n    exist, and fcstimeunits is defined. If forecast time\n    is a range, then C{validDate} corresponds to the end of the range.", /*tp_doc*/
  __pyx_tp_traverse_6pygrib_gribmessage, /*tp_traverse*/
  __pyx_tp_clear_6pygrib_gribmessage, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_6pygrib_gribmessage, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_6pygrib_gribmessage, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pw_6pygrib_11gribmessage_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6pygrib_gribmessage, /*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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};

static PyObject *__pyx_tp_new_6pygrib_index(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_6pygrib_index *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_6pygrib_index *)o);
  p->keys = Py_None; Py_INCREF(Py_None);
  p->types = Py_None; Py_INCREF(Py_None);
  p->name = Py_None; Py_INCREF(Py_None);
  if (unlikely(__pyx_pw_6pygrib_5index_1__cinit__(o, a, k) < 0)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

static void __pyx_tp_dealloc_6pygrib_index(PyObject *o) {
  struct __pyx_obj_6pygrib_index *p = (struct __pyx_obj_6pygrib_index *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && 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_6pygrib_5index_13__dealloc__(o);
    --Py_REFCNT(o);
    PyErr_Restore(etype, eval, etb);
  }
  Py_CLEAR(p->keys);
  Py_CLEAR(p->types);
  Py_CLEAR(p->name);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_6pygrib_index(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_6pygrib_index *p = (struct __pyx_obj_6pygrib_index *)o;
  if (p->keys) {
    e = (*v)(p->keys, a); if (e) return e;
  }
  if (p->types) {
    e = (*v)(p->types, a); if (e) return e;
  }
  if (p->name) {
    e = (*v)(p->name, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_6pygrib_index(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_6pygrib_index *p = (struct __pyx_obj_6pygrib_index *)o;
  tmp = ((PyObject*)p->keys);
  p->keys = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->types);
  p->types = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->name);
  p->name = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_getprop_6pygrib_5index_keys(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6pygrib_5index_4keys_1__get__(o);
}

static int __pyx_setprop_6pygrib_5index_keys(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_6pygrib_5index_4keys_3__set__(o, v);
  }
  else {
    return __pyx_pw_6pygrib_5index_4keys_5__del__(o);
  }
}

static PyObject *__pyx_getprop_6pygrib_5index_types(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6pygrib_5index_5types_1__get__(o);
}

static int __pyx_setprop_6pygrib_5index_types(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_6pygrib_5index_5types_3__set__(o, v);
  }
  else {
    return __pyx_pw_6pygrib_5index_5types_5__del__(o);
  }
}

static PyObject *__pyx_getprop_6pygrib_5index_name(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6pygrib_5index_4name_1__get__(o);
}

static int __pyx_setprop_6pygrib_5index_name(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_6pygrib_5index_4name_3__set__(o, v);
  }
  else {
    return __pyx_pw_6pygrib_5index_4name_5__del__(o);
  }
}

static PyMethodDef __pyx_methods_6pygrib_index[] = {
  {"select", (PyCFunction)__pyx_pw_6pygrib_5index_7select, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6pygrib_5index_6select},
  {"write", (PyCFunction)__pyx_pw_6pygrib_5index_9write, METH_O, __pyx_doc_6pygrib_5index_8write},
  {"close", (PyCFunction)__pyx_pw_6pygrib_5index_11close, METH_NOARGS, __pyx_doc_6pygrib_5index_10close},
  {"__reduce_cython__", (PyCFunction)__pyx_pw_6pygrib_5index_15__reduce_cython__, METH_NOARGS, 0},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_6pygrib_5index_17__setstate_cython__, METH_O, 0},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_6pygrib_index[] = {
  {(char *)"keys", __pyx_getprop_6pygrib_5index_keys, __pyx_setprop_6pygrib_5index_keys, (char *)0, 0},
  {(char *)"types", __pyx_getprop_6pygrib_5index_types, __pyx_setprop_6pygrib_5index_types, (char *)0, 0},
  {(char *)"name", __pyx_getprop_6pygrib_5index_name, __pyx_setprop_6pygrib_5index_name, (char *)0, 0},
  {0, 0, 0, 0, 0}
};

static PyTypeObject __pyx_type_6pygrib_index = {
  PyVarObject_HEAD_INIT(0, 0)
  "pygrib.index", /*tp_name*/
  sizeof(struct __pyx_obj_6pygrib_index), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6pygrib_index, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  __pyx_pw_6pygrib_5index_5__call__, /*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*/
  " \nindex(filename, *args)\n    \nreturns grib index object given GRIB filename indexed by keys given in\n*args.  The L{select} or L{__call__} method can then be used to selected grib messages\nbased on specified values of indexed keys.\nUnlike L{open.select}, containers or callables cannot be used to \nselect multiple key values.\nHowever, using L{index.select} is much faster than L{open.select}.\n\nB{Warning}:  Searching for data within multi-field grib messages does not\nwork using an index (and is not supported by the \nU{GRIB API<https://software.ecmwf.int/wiki/display/GRIB/Home>} library).  NCEP\noften puts u and v winds together in a single multi-field grib message.  You\nwill get incorrect results if you try to use an index to find data in these\nmessages.  Use the slower, but more robust L{open.select} in this case.\n\nIf no key are given (i.e. *args is empty), it is assumed the filename represents a previously\nsaved index (created using the C{grib_index_build} tool or L{index.write}) instead of a GRIB file.\n\nExample usage:\n\n>>> import pygrib\n>>> grbindx=pygrib.index('sampledata/gfs.grb','shortName','typeOfLevel','level')\n>>> grbindx.keys\n['shortName', 'level']\n>>> selected_grbs=grbindx.select(shortName='gh',typeOfLevel='isobaricInhPa',level=500)\n>>> for grb in selected_grbs:\n>>>     grb\n1:Geopotential height:gpm (instant):regular_ll:isobaricInhPa:level 500 Pa:fcst time 72 hrs:from 200412091200:lo res cntl fcst\n>>> # __call__ method does same thing as select\n>>> selected_grbs=grbindx(shortName='u',typeOfLevel='isobaricInhPa',level=250)\n>>> for grb in selected_grbs:\n>>>     grb\n1:u-component of wind:m s**-1 (instant):regular_ll:isobaricInhPa:level 250 Pa:fcst time 72 hrs:from 200412091200:lo res cntl fcst\n>>> grbindx.write('gfs.grb.idx') # save index to a file\n>>> grbindx.close()\n>>> grbindx = pygrib.index('gfs.grb.idx') # re-open index (no keys specified)\n>>> grbindx.keys # not set when opening a saved index file.\nNone\n>>> for grb in s""elected_grbs:\n>>>     grb\n1:u-component of wind:m s**-1 (instant):regular_ll:isobaricInhPa:level 250 Pa:fcst time 72 hrs:from 200412091200:lo res cntl fcst\n\n@ivar keys: list of strings containing keys used in the index.  Set to C{None}\nwhen opening a previously saved grib index file.\n\n@ivar types: if keys are typed, this list contains the type declarations\n(C{l}, C{s} or C{d}). Type declarations are specified by appending to the key\nname (i.e. C{level:l} will search for values of C{level} that are longs). Set\nto C{None} when opening a previously saved grib index file.\n", /*tp_doc*/
  __pyx_tp_traverse_6pygrib_index, /*tp_traverse*/
  __pyx_tp_clear_6pygrib_index, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_6pygrib_index, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_6pygrib_index, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pw_6pygrib_5index_3__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6pygrib_index, /*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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};

static PyMethodDef __pyx_methods[] = {
  {0, 0, 0, 0}
};

#if PY_MAJOR_VERSION >= 3
#if CYTHON_PEP489_MULTI_PHASE_INIT
static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/
static int __pyx_pymod_exec_pygrib(PyObject* module); /*proto*/
static PyModuleDef_Slot __pyx_moduledef_slots[] = {
  {Py_mod_create, (void*)__pyx_pymod_create},
  {Py_mod_exec, (void*)__pyx_pymod_exec_pygrib},
  {0, NULL}
};
#endif

static struct PyModuleDef __pyx_moduledef = {
    PyModuleDef_HEAD_INIT,
    "pygrib",
    __pyx_k_Introduction_Python_module_for, /* m_doc */
  #if CYTHON_PEP489_MULTI_PHASE_INIT
    0, /* m_size */
  #else
    -1, /* m_size */
  #endif
    __pyx_methods /* m_methods */,
  #if CYTHON_PEP489_MULTI_PHASE_INIT
    __pyx_moduledef_slots, /* m_slots */
  #else
    NULL, /* m_reload */
  #endif
    NULL, /* m_traverse */
    NULL, /* m_clear */
    NULL /* m_free */
};
#endif

static __Pyx_StringTabEntry __pyx_string_tab[] = {
  {&__pyx_kp_s_04i, __pyx_k_04i, sizeof(__pyx_k_04i), 0, 0, 1, 0},
  {&__pyx_kp_s_12_hr_periods, __pyx_k_12_hr_periods, sizeof(__pyx_k_12_hr_periods), 0, 0, 1, 0},
  {&__pyx_kp_s_1_9_0, __pyx_k_1_9_0, sizeof(__pyx_k_1_9_0), 0, 0, 1, 0},
  {&__pyx_kp_s_2_0_3, __pyx_k_2_0_3, sizeof(__pyx_k_2_0_3), 0, 0, 1, 0},
  {&__pyx_kp_s_30_yr_periods, __pyx_k_30_yr_periods, sizeof(__pyx_k_30_yr_periods), 0, 0, 1, 0},
  {&__pyx_kp_s_3_hr_periods, __pyx_k_3_hr_periods, sizeof(__pyx_k_3_hr_periods), 0, 0, 1, 0},
  {&__pyx_kp_s_6_hr_periods, __pyx_k_6_hr_periods, sizeof(__pyx_k_6_hr_periods), 0, 0, 1, 0},
  {&__pyx_kp_s_7777, __pyx_k_7777, sizeof(__pyx_k_7777), 0, 0, 1, 0},
  {&__pyx_n_s_AttributeError, __pyx_k_AttributeError, sizeof(__pyx_k_AttributeError), 0, 0, 1, 1},
  {&__pyx_n_s_C, __pyx_k_C, sizeof(__pyx_k_C), 0, 0, 1, 1},
  {&__pyx_n_s_Dx, __pyx_k_Dx, sizeof(__pyx_k_Dx), 0, 0, 1, 1},
  {&__pyx_n_s_DxInMetres, __pyx_k_DxInMetres, sizeof(__pyx_k_DxInMetres), 0, 0, 1, 1},
  {&__pyx_n_s_Dy, __pyx_k_Dy, sizeof(__pyx_k_Dy), 0, 0, 1, 1},
  {&__pyx_n_s_DyInMetres, __pyx_k_DyInMetres, sizeof(__pyx_k_DyInMetres), 0, 0, 1, 1},
  {&__pyx_n_s_F, __pyx_k_F, sizeof(__pyx_k_F), 0, 0, 1, 1},
  {&__pyx_n_s_Grib2Decode, __pyx_k_Grib2Decode, sizeof(__pyx_k_Grib2Decode), 0, 0, 1, 1},
  {&__pyx_n_s_IOError, __pyx_k_IOError, sizeof(__pyx_k_IOError), 0, 0, 1, 1},
  {&__pyx_n_s_ImportError, __pyx_k_ImportError, sizeof(__pyx_k_ImportError), 0, 0, 1, 1},
  {&__pyx_n_s_IndexError, __pyx_k_IndexError, sizeof(__pyx_k_IndexError), 0, 0, 1, 1},
  {&__pyx_n_s_KeyError, __pyx_k_KeyError, sizeof(__pyx_k_KeyError), 0, 0, 1, 1},
  {&__pyx_n_s_LaD, __pyx_k_LaD, sizeof(__pyx_k_LaD), 0, 0, 1, 1},
  {&__pyx_n_s_LaDInDegrees, __pyx_k_LaDInDegrees, sizeof(__pyx_k_LaDInDegrees), 0, 0, 1, 1},
  {&__pyx_n_s_Latin, __pyx_k_Latin, sizeof(__pyx_k_Latin), 0, 0, 1, 1},
  {&__pyx_n_s_Latin1, __pyx_k_Latin1, sizeof(__pyx_k_Latin1), 0, 0, 1, 1},
  {&__pyx_n_s_Latin1InDegrees, __pyx_k_Latin1InDegrees, sizeof(__pyx_k_Latin1InDegrees), 0, 0, 1, 1},
  {&__pyx_n_s_Latin2, __pyx_k_Latin2, sizeof(__pyx_k_Latin2), 0, 0, 1, 1},
  {&__pyx_n_s_Latin2InDegrees, __pyx_k_Latin2InDegrees, sizeof(__pyx_k_Latin2InDegrees), 0, 0, 1, 1},
  {&__pyx_n_s_LoV, __pyx_k_LoV, sizeof(__pyx_k_LoV), 0, 0, 1, 1},
  {&__pyx_n_s_LoVInDegrees, __pyx_k_LoVInDegrees, sizeof(__pyx_k_LoVInDegrees), 0, 0, 1, 1},
  {&__pyx_n_s_Ni, __pyx_k_Ni, sizeof(__pyx_k_Ni), 0, 0, 1, 1},
  {&__pyx_n_s_Nj, __pyx_k_Nj, sizeof(__pyx_k_Nj), 0, 0, 1, 1},
  {&__pyx_n_s_Nr, __pyx_k_Nr, sizeof(__pyx_k_Nr), 0, 0, 1, 1},
  {&__pyx_n_s_Nx, __pyx_k_Nx, sizeof(__pyx_k_Nx), 0, 0, 1, 1},
  {&__pyx_n_s_Ny, __pyx_k_Ny, sizeof(__pyx_k_Ny), 0, 0, 1, 1},
  {&__pyx_n_s_Proj, __pyx_k_Proj, sizeof(__pyx_k_Proj), 0, 0, 1, 1},
  {&__pyx_n_s_RuntimeError, __pyx_k_RuntimeError, sizeof(__pyx_k_RuntimeError), 0, 0, 1, 1},
  {&__pyx_n_s_StopIteration, __pyx_k_StopIteration, sizeof(__pyx_k_StopIteration), 0, 0, 1, 1},
  {&__pyx_kp_s_This_class_cannot_be_instantiate, __pyx_k_This_class_cannot_be_instantiate, sizeof(__pyx_k_This_class_cannot_be_instantiate), 0, 0, 1, 0},
  {&__pyx_n_s_TypeError, __pyx_k_TypeError, sizeof(__pyx_k_TypeError), 0, 0, 1, 1},
  {&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1},
  {&__pyx_kp_s__10, __pyx_k__10, sizeof(__pyx_k__10), 0, 0, 1, 0},
  {&__pyx_kp_s__105, __pyx_k__105, sizeof(__pyx_k__105), 0, 0, 1, 0},
  {&__pyx_kp_s__15, __pyx_k__15, sizeof(__pyx_k__15), 0, 0, 1, 0},
  {&__pyx_kp_s__20, __pyx_k__20, sizeof(__pyx_k__20), 0, 0, 1, 0},
  {&__pyx_kp_s__25, __pyx_k__25, sizeof(__pyx_k__25), 0, 0, 1, 0},
  {&__pyx_kp_s__26, __pyx_k__26, sizeof(__pyx_k__26), 0, 0, 1, 0},
  {&__pyx_n_s_a, __pyx_k_a, sizeof(__pyx_k_a), 0, 0, 1, 1},
  {&__pyx_n_s_advance, __pyx_k_advance, sizeof(__pyx_k_advance), 0, 0, 1, 1},
  {&__pyx_n_s_aea, __pyx_k_aea, sizeof(__pyx_k_aea), 0, 0, 1, 1},
  {&__pyx_n_s_aeqd, __pyx_k_aeqd, sizeof(__pyx_k_aeqd), 0, 0, 1, 1},
  {&__pyx_n_s_albers, __pyx_k_albers, sizeof(__pyx_k_albers), 0, 0, 1, 1},
  {&__pyx_n_s_all_keys, __pyx_k_all_keys, sizeof(__pyx_k_all_keys), 0, 0, 1, 1},
  {&__pyx_n_s_alternativeRowScanning, __pyx_k_alternativeRowScanning, sizeof(__pyx_k_alternativeRowScanning), 0, 0, 1, 1},
  {&__pyx_n_s_analDate, __pyx_k_analDate, sizeof(__pyx_k_analDate), 0, 0, 1, 1},
  {&__pyx_n_s_angleOfRotationInDegrees, __pyx_k_angleOfRotationInDegrees, sizeof(__pyx_k_angleOfRotationInDegrees), 0, 0, 1, 1},
  {&__pyx_n_s_arange, __pyx_k_arange, sizeof(__pyx_k_arange), 0, 0, 1, 1},
  {&__pyx_n_s_arcsin, __pyx_k_arcsin, sizeof(__pyx_k_arcsin), 0, 0, 1, 1},
  {&__pyx_kp_s_array_must_be_1d_or_2d, __pyx_k_array_must_be_1d_or_2d, sizeof(__pyx_k_array_must_be_1d_or_2d), 0, 0, 1, 0},
  {&__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_atype, __pyx_k_atype, sizeof(__pyx_k_atype), 0, 0, 1, 1},
  {&__pyx_n_s_b, __pyx_k_b, sizeof(__pyx_k_b), 0, 0, 1, 1},
  {&__pyx_n_s_bottomLevel, __pyx_k_bottomLevel, sizeof(__pyx_k_bottomLevel), 0, 0, 1, 1},
  {&__pyx_n_s_call, __pyx_k_call, sizeof(__pyx_k_call), 0, 0, 1, 1},
  {&__pyx_kp_s_can_only_modify_existing_grib_ke, __pyx_k_can_only_modify_existing_grib_ke, sizeof(__pyx_k_can_only_modify_existing_grib_ke), 0, 0, 1, 0},
  {&__pyx_kp_s_cannot_find_projection_center_fl, __pyx_k_cannot_find_projection_center_fl, sizeof(__pyx_k_cannot_find_projection_center_fl), 0, 0, 1, 0},
  {&__pyx_n_s_centralLongitude, __pyx_k_centralLongitude, sizeof(__pyx_k_centralLongitude), 0, 0, 1, 1},
  {&__pyx_n_s_centuries, __pyx_k_centuries, sizeof(__pyx_k_centuries), 0, 0, 1, 1},
  {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1},
  {&__pyx_n_s_close, __pyx_k_close, sizeof(__pyx_k_close), 0, 0, 1, 1},
  {&__pyx_n_s_copy, __pyx_k_copy, sizeof(__pyx_k_copy), 0, 0, 1, 1},
  {&__pyx_kp_s_could_not_open_s, __pyx_k_could_not_open_s, sizeof(__pyx_k_could_not_open_s), 0, 0, 1, 0},
  {&__pyx_n_s_cyl, __pyx_k_cyl, sizeof(__pyx_k_cyl), 0, 0, 1, 1},
  {&__pyx_n_s_d, __pyx_k_d, sizeof(__pyx_k_d), 0, 0, 1, 1},
  {&__pyx_kp_s_d_d_d, __pyx_k_d_d_d, sizeof(__pyx_k_d_d_d), 0, 0, 1, 0},
  {&__pyx_n_s_data, __pyx_k_data, sizeof(__pyx_k_data), 0, 0, 1, 1},
  {&__pyx_n_s_dataDate, __pyx_k_dataDate, sizeof(__pyx_k_dataDate), 0, 0, 1, 1},
  {&__pyx_n_s_dataTime, __pyx_k_dataTime, sizeof(__pyx_k_dataTime), 0, 0, 1, 1},
  {&__pyx_n_s_datetime, __pyx_k_datetime, sizeof(__pyx_k_datetime), 0, 0, 1, 1},
  {&__pyx_n_s_datetime_to_julian, __pyx_k_datetime_to_julian, sizeof(__pyx_k_datetime_to_julian), 0, 0, 1, 1},
  {&__pyx_n_s_day, __pyx_k_day, sizeof(__pyx_k_day), 0, 0, 1, 1},
  {&__pyx_n_s_days, __pyx_k_days, sizeof(__pyx_k_days), 0, 0, 1, 1},
  {&__pyx_n_s_decades, __pyx_k_decades, sizeof(__pyx_k_decades), 0, 0, 1, 1},
  {&__pyx_n_s_decode, __pyx_k_decode, sizeof(__pyx_k_decode), 0, 0, 1, 1},
  {&__pyx_n_s_default, __pyx_k_default, sizeof(__pyx_k_default), 0, 0, 1, 1},
  {&__pyx_n_s_default_encoding, __pyx_k_default_encoding, sizeof(__pyx_k_default_encoding), 0, 0, 1, 1},
  {&__pyx_n_s_derivedForecast, __pyx_k_derivedForecast, sizeof(__pyx_k_derivedForecast), 0, 0, 1, 1},
  {&__pyx_n_s_dict, __pyx_k_dict, sizeof(__pyx_k_dict), 0, 0, 1, 1},
  {&__pyx_n_s_distinctLatitudes, __pyx_k_distinctLatitudes, sizeof(__pyx_k_distinctLatitudes), 0, 0, 1, 1},
  {&__pyx_n_s_distinctLongitudes, __pyx_k_distinctLongitudes, sizeof(__pyx_k_distinctLongitudes), 0, 0, 1, 1},
  {&__pyx_n_s_div, __pyx_k_div, sizeof(__pyx_k_div), 0, 0, 1, 1},
  {&__pyx_n_s_double, __pyx_k_double, sizeof(__pyx_k_double), 0, 0, 1, 1},
  {&__pyx_n_s_dx, __pyx_k_dx, sizeof(__pyx_k_dx), 0, 0, 1, 1},
  {&__pyx_n_s_dy, __pyx_k_dy, sizeof(__pyx_k_dy), 0, 0, 1, 1},
  {&__pyx_n_s_eight, __pyx_k_eight, sizeof(__pyx_k_eight), 0, 0, 1, 1},
  {&__pyx_kp_s_either_pyproj_or_basemap_require, __pyx_k_either_pyproj_or_basemap_require, sizeof(__pyx_k_either_pyproj_or_basemap_require), 0, 0, 1, 0},
  {&__pyx_n_s_eleven, __pyx_k_eleven, sizeof(__pyx_k_eleven), 0, 0, 1, 1},
  {&__pyx_n_s_empty, __pyx_k_empty, sizeof(__pyx_k_empty), 0, 0, 1, 1},
  {&__pyx_n_s_encode, __pyx_k_encode, sizeof(__pyx_k_encode), 0, 0, 1, 1},
  {&__pyx_kp_s_ens_large_anomaly_index, __pyx_k_ens_large_anomaly_index, sizeof(__pyx_k_ens_large_anomaly_index), 0, 0, 1, 0},
  {&__pyx_kp_s_ens_mean, __pyx_k_ens_mean, sizeof(__pyx_k_ens_mean), 0, 0, 1, 0},
  {&__pyx_kp_s_ens_mean_of_cluster, __pyx_k_ens_mean_of_cluster, sizeof(__pyx_k_ens_mean_of_cluster), 0, 0, 1, 0},
  {&__pyx_kp_s_ens_spread, __pyx_k_ens_spread, sizeof(__pyx_k_ens_spread), 0, 0, 1, 0},
  {&__pyx_kp_s_ens_std_dev, __pyx_k_ens_std_dev, sizeof(__pyx_k_ens_std_dev), 0, 0, 1, 0},
  {&__pyx_n_s_equatorial_azimuthal_equidistant, __pyx_k_equatorial_azimuthal_equidistant, sizeof(__pyx_k_equatorial_azimuthal_equidistant), 0, 0, 1, 1},
  {&__pyx_n_s_err, __pyx_k_err, sizeof(__pyx_k_err), 0, 0, 1, 1},
  {&__pyx_n_s_expand_reduced, __pyx_k_expand_reduced, sizeof(__pyx_k_expand_reduced), 0, 0, 1, 1},
  {&__pyx_n_s_fabs, __pyx_k_fabs, sizeof(__pyx_k_fabs), 0, 0, 1, 1},
  {&__pyx_n_s_false, __pyx_k_false, sizeof(__pyx_k_false), 0, 0, 1, 1},
  {&__pyx_kp_s_fcst_time_s_s, __pyx_k_fcst_time_s_s, sizeof(__pyx_k_fcst_time_s_s), 0, 0, 1, 0},
  {&__pyx_kp_s_fcst_time_s_s_s, __pyx_k_fcst_time_s_s_s, sizeof(__pyx_k_fcst_time_s_s_s), 0, 0, 1, 0},
  {&__pyx_n_s_fcstimeunits, __pyx_k_fcstimeunits, sizeof(__pyx_k_fcstimeunits), 0, 0, 1, 1},
  {&__pyx_n_s_file, __pyx_k_file, sizeof(__pyx_k_file), 0, 0, 1, 1},
  {&__pyx_kp_s_file_s_has_multi_field_messages, __pyx_k_file_s_has_multi_field_messages, sizeof(__pyx_k_file_s_has_multi_field_messages), 0, 0, 1, 0},
  {&__pyx_n_s_filename, __pyx_k_filename, sizeof(__pyx_k_filename), 0, 0, 1, 1},
  {&__pyx_n_s_filled, __pyx_k_filled, sizeof(__pyx_k_filled), 0, 0, 1, 1},
  {&__pyx_n_s_find, __pyx_k_find, sizeof(__pyx_k_find), 0, 0, 1, 1},
  {&__pyx_n_s_float, __pyx_k_float, sizeof(__pyx_k_float), 0, 0, 1, 1},
  {&__pyx_n_s_float64, __pyx_k_float64, sizeof(__pyx_k_float64), 0, 0, 1, 1},
  {&__pyx_n_s_forecastTime, __pyx_k_forecastTime, sizeof(__pyx_k_forecastTime), 0, 0, 1, 1},
  {&__pyx_kp_s_from, __pyx_k_from, sizeof(__pyx_k_from), 0, 0, 1, 0},
  {&__pyx_n_s_from_what, __pyx_k_from_what, sizeof(__pyx_k_from_what), 0, 0, 1, 1},
  {&__pyx_kp_s_from_what_keyword_arg_to_seek_mu, __pyx_k_from_what_keyword_arg_to_seek_mu, sizeof(__pyx_k_from_what_keyword_arg_to_seek_mu), 0, 0, 1, 0},
  {&__pyx_n_s_fromstring, __pyx_k_fromstring, sizeof(__pyx_k_fromstring), 0, 0, 1, 1},
  {&__pyx_n_s_ftime, __pyx_k_ftime, sizeof(__pyx_k_ftime), 0, 0, 1, 1},
  {&__pyx_n_s_ftimedict, __pyx_k_ftimedict, sizeof(__pyx_k_ftimedict), 0, 0, 1, 1},
  {&__pyx_n_s_gaulats, __pyx_k_gaulats, sizeof(__pyx_k_gaulats), 0, 0, 1, 1},
  {&__pyx_n_s_geos, __pyx_k_geos, sizeof(__pyx_k_geos), 0, 0, 1, 1},
  {&__pyx_n_s_get_grib_api_version, __pyx_k_get_grib_api_version, sizeof(__pyx_k_get_grib_api_version), 0, 0, 1, 1},
  {&__pyx_n_s_get_grib_api_version_locals_lam, __pyx_k_get_grib_api_version_locals_lam, sizeof(__pyx_k_get_grib_api_version_locals_lam), 0, 0, 1, 1},
  {&__pyx_n_s_get_key, __pyx_k_get_key, sizeof(__pyx_k_get_key), 0, 0, 1, 1},
  {&__pyx_n_s_getitem, __pyx_k_getitem, sizeof(__pyx_k_getitem), 0, 0, 1, 1},
  {&__pyx_n_s_getstate, __pyx_k_getstate, sizeof(__pyx_k_getstate), 0, 0, 1, 1},
  {&__pyx_n_s_gh, __pyx_k_gh, sizeof(__pyx_k_gh), 0, 0, 1, 1},
  {&__pyx_n_s_gh_2, __pyx_k_gh_2, sizeof(__pyx_k_gh_2), 0, 0, 1, 1},
  {&__pyx_n_s_grb, __pyx_k_grb, sizeof(__pyx_k_grb), 0, 0, 1, 1},
  {&__pyx_kp_s_grb_message_numbers_start_at_1, __pyx_k_grb_message_numbers_start_at_1, sizeof(__pyx_k_grb_message_numbers_start_at_1), 0, 0, 1, 0},
  {&__pyx_n_s_grib2divider, __pyx_k_grib2divider, sizeof(__pyx_k_grib2divider), 0, 0, 1, 1},
  {&__pyx_n_s_grib_api_version, __pyx_k_grib_api_version, sizeof(__pyx_k_grib_api_version), 0, 0, 1, 1},
  {&__pyx_n_s_gribmsg, __pyx_k_gribmsg, sizeof(__pyx_k_gribmsg), 0, 0, 1, 1},
  {&__pyx_n_s_gribstr, __pyx_k_gribstr, sizeof(__pyx_k_gribstr), 0, 0, 1, 1},
  {&__pyx_n_s_gribstring, __pyx_k_gribstring, sizeof(__pyx_k_gribstring), 0, 0, 1, 1},
  {&__pyx_n_s_gridType, __pyx_k_gridType, sizeof(__pyx_k_gridType), 0, 0, 1, 1},
  {&__pyx_n_s_grid_complex, __pyx_k_grid_complex, sizeof(__pyx_k_grid_complex), 0, 0, 1, 1},
  {&__pyx_n_s_h, __pyx_k_h, sizeof(__pyx_k_h), 0, 0, 1, 1},
  {&__pyx_n_s_has_key, __pyx_k_has_key, sizeof(__pyx_k_has_key), 0, 0, 1, 1},
  {&__pyx_kp_s_hi_res_cntl_fcst, __pyx_k_hi_res_cntl_fcst, sizeof(__pyx_k_hi_res_cntl_fcst), 0, 0, 1, 0},
  {&__pyx_n_s_hour, __pyx_k_hour, sizeof(__pyx_k_hour), 0, 0, 1, 1},
  {&__pyx_n_s_hrs, __pyx_k_hrs, sizeof(__pyx_k_hrs), 0, 0, 1, 1},
  {&__pyx_n_s_iDirectionIncrement, __pyx_k_iDirectionIncrement, sizeof(__pyx_k_iDirectionIncrement), 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_n_s_indicatorOfUnitOfTimeRange, __pyx_k_indicatorOfUnitOfTimeRange, sizeof(__pyx_k_indicatorOfUnitOfTimeRange), 0, 0, 1, 1},
  {&__pyx_n_s_indices, __pyx_k_indices, sizeof(__pyx_k_indices), 0, 0, 1, 1},
  {&__pyx_n_s_instant, __pyx_k_instant, sizeof(__pyx_k_instant), 0, 0, 1, 1},
  {&__pyx_n_s_int, __pyx_k_int, sizeof(__pyx_k_int), 0, 0, 1, 1},
  {&__pyx_n_s_inverse, __pyx_k_inverse, sizeof(__pyx_k_inverse), 0, 0, 1, 1},
  {&__pyx_n_s_isMA, __pyx_k_isMA, sizeof(__pyx_k_isMA), 0, 0, 1, 1},
  {&__pyx_n_s_is_container, __pyx_k_is_container, sizeof(__pyx_k_is_container), 0, 0, 1, 1},
  {&__pyx_n_s_is_missing, __pyx_k_is_missing, sizeof(__pyx_k_is_missing), 0, 0, 1, 1},
  {&__pyx_n_s_is_stringlike, __pyx_k_is_stringlike, sizeof(__pyx_k_is_stringlike), 0, 0, 1, 1},
  {&__pyx_n_s_iscallable, __pyx_k_iscallable, sizeof(__pyx_k_iscallable), 0, 0, 1, 1},
  {&__pyx_n_s_iscontainer, __pyx_k_iscontainer, sizeof(__pyx_k_iscontainer), 0, 0, 1, 1},
  {&__pyx_n_s_items, __pyx_k_items, sizeof(__pyx_k_items), 0, 0, 1, 1},
  {&__pyx_n_s_jPointsAreConsecutive, __pyx_k_jPointsAreConsecutive, sizeof(__pyx_k_jPointsAreConsecutive), 0, 0, 1, 1},
  {&__pyx_n_s_jd, __pyx_k_jd, sizeof(__pyx_k_jd), 0, 0, 1, 1},
  {&__pyx_n_s_join, __pyx_k_join, sizeof(__pyx_k_join), 0, 0, 1, 1},
  {&__pyx_n_s_julday, __pyx_k_julday, sizeof(__pyx_k_julday), 0, 0, 1, 1},
  {&__pyx_n_s_julianDay, __pyx_k_julianDay, sizeof(__pyx_k_julianDay), 0, 0, 1, 1},
  {&__pyx_n_s_julian_to_datetime, __pyx_k_julian_to_datetime, sizeof(__pyx_k_julian_to_datetime), 0, 0, 1, 1},
  {&__pyx_n_s_k, __pyx_k_k, sizeof(__pyx_k_k), 0, 0, 1, 1},
  {&__pyx_n_s_key, __pyx_k_key, sizeof(__pyx_k_key), 0, 0, 1, 1},
  {&__pyx_kp_s_key_must_be_an_integer_message_n, __pyx_k_key_must_be_an_integer_message_n, sizeof(__pyx_k_key_must_be_an_integer_message_n), 0, 0, 1, 0},
  {&__pyx_kp_s_key_not_part_of_grib_index, __pyx_k_key_not_part_of_grib_index, sizeof(__pyx_k_key_not_part_of_grib_index), 0, 0, 1, 0},
  {&__pyx_kp_s_key_s_is_read_only, __pyx_k_key_s_is_read_only, sizeof(__pyx_k_key_s_is_read_only), 0, 0, 1, 0},
  {&__pyx_n_s_keys, __pyx_k_keys, sizeof(__pyx_k_keys), 0, 0, 1, 1},
  {&__pyx_n_s_kwargs, __pyx_k_kwargs, sizeof(__pyx_k_kwargs), 0, 0, 1, 1},
  {&__pyx_n_s_l, __pyx_k_l, sizeof(__pyx_k_l), 0, 0, 1, 1},
  {&__pyx_n_s_laea, __pyx_k_laea, sizeof(__pyx_k_laea), 0, 0, 1, 1},
  {&__pyx_n_s_lambert, __pyx_k_lambert, sizeof(__pyx_k_lambert), 0, 0, 1, 1},
  {&__pyx_n_s_lambert_azimuthal_equal_area, __pyx_k_lambert_azimuthal_equal_area, sizeof(__pyx_k_lambert_azimuthal_equal_area), 0, 0, 1, 1},
  {&__pyx_n_s_lat1, __pyx_k_lat1, sizeof(__pyx_k_lat1), 0, 0, 1, 1},
  {&__pyx_n_s_lat2, __pyx_k_lat2, sizeof(__pyx_k_lat2), 0, 0, 1, 1},
  {&__pyx_n_s_lat_0, __pyx_k_lat_0, sizeof(__pyx_k_lat_0), 0, 0, 1, 1},
  {&__pyx_n_s_lat_1, __pyx_k_lat_1, sizeof(__pyx_k_lat_1), 0, 0, 1, 1},
  {&__pyx_n_s_lat_2, __pyx_k_lat_2, sizeof(__pyx_k_lat_2), 0, 0, 1, 1},
  {&__pyx_n_s_lat_ts, __pyx_k_lat_ts, sizeof(__pyx_k_lat_ts), 0, 0, 1, 1},
  {&__pyx_n_s_latitudeOfFirstGridPoint, __pyx_k_latitudeOfFirstGridPoint, sizeof(__pyx_k_latitudeOfFirstGridPoint), 0, 0, 1, 1},
  {&__pyx_n_s_latitudeOfFirstGridPointInDegree, __pyx_k_latitudeOfFirstGridPointInDegree, sizeof(__pyx_k_latitudeOfFirstGridPointInDegree), 0, 0, 1, 1},
  {&__pyx_n_s_latitudeOfLastGridPoint, __pyx_k_latitudeOfLastGridPoint, sizeof(__pyx_k_latitudeOfLastGridPoint), 0, 0, 1, 1},
  {&__pyx_n_s_latitudeOfLastGridPointInDegrees, __pyx_k_latitudeOfLastGridPointInDegrees, sizeof(__pyx_k_latitudeOfLastGridPointInDegrees), 0, 0, 1, 1},
  {&__pyx_n_s_latitudeOfSouthernPoleInDegrees, __pyx_k_latitudeOfSouthernPoleInDegrees, sizeof(__pyx_k_latitudeOfSouthernPoleInDegrees), 0, 0, 1, 1},
  {&__pyx_n_s_latitudeOfSubSatellitePointInDeg, __pyx_k_latitudeOfSubSatellitePointInDeg, sizeof(__pyx_k_latitudeOfSubSatellitePointInDeg), 0, 0, 1, 1},
  {&__pyx_n_s_latitudeWhereDxAndDyAreSpecified, __pyx_k_latitudeWhereDxAndDyAreSpecified, sizeof(__pyx_k_latitudeWhereDxAndDyAreSpecified), 0, 0, 1, 1},
  {&__pyx_n_s_latitudes, __pyx_k_latitudes, sizeof(__pyx_k_latitudes), 0, 0, 1, 1},
  {&__pyx_n_s_latlons, __pyx_k_latlons, sizeof(__pyx_k_latlons), 0, 0, 1, 1},
  {&__pyx_n_s_lats, __pyx_k_lats, sizeof(__pyx_k_lats), 0, 0, 1, 1},
  {&__pyx_n_s_lcc, __pyx_k_lcc, sizeof(__pyx_k_lcc), 0, 0, 1, 1},
  {&__pyx_n_s_level, __pyx_k_level, sizeof(__pyx_k_level), 0, 0, 1, 1},
  {&__pyx_kp_s_level_s, __pyx_k_level_s, sizeof(__pyx_k_level_s), 0, 0, 1, 0},
  {&__pyx_kp_s_levels_s_s, __pyx_k_levels_s_s, sizeof(__pyx_k_levels_s_s), 0, 0, 1, 0},
  {&__pyx_n_s_linspace, __pyx_k_linspace, sizeof(__pyx_k_linspace), 0, 0, 1, 1},
  {&__pyx_kp_s_lo_res_cntl_fcst, __pyx_k_lo_res_cntl_fcst, sizeof(__pyx_k_lo_res_cntl_fcst), 0, 0, 1, 0},
  {&__pyx_n_s_localDir, __pyx_k_localDir, sizeof(__pyx_k_localDir), 0, 0, 1, 1},
  {&__pyx_n_s_lon1, __pyx_k_lon1, sizeof(__pyx_k_lon1), 0, 0, 1, 1},
  {&__pyx_n_s_lon2, __pyx_k_lon2, sizeof(__pyx_k_lon2), 0, 0, 1, 1},
  {&__pyx_n_s_lon_0, __pyx_k_lon_0, sizeof(__pyx_k_lon_0), 0, 0, 1, 1},
  {&__pyx_n_s_longitudeOfFirstGridPoint, __pyx_k_longitudeOfFirstGridPoint, sizeof(__pyx_k_longitudeOfFirstGridPoint), 0, 0, 1, 1},
  {&__pyx_n_s_longitudeOfFirstGridPointInDegre, __pyx_k_longitudeOfFirstGridPointInDegre, sizeof(__pyx_k_longitudeOfFirstGridPointInDegre), 0, 0, 1, 1},
  {&__pyx_n_s_longitudeOfLastGridPoint, __pyx_k_longitudeOfLastGridPoint, sizeof(__pyx_k_longitudeOfLastGridPoint), 0, 0, 1, 1},
  {&__pyx_n_s_longitudeOfLastGridPointInDegree, __pyx_k_longitudeOfLastGridPointInDegree, sizeof(__pyx_k_longitudeOfLastGridPointInDegree), 0, 0, 1, 1},
  {&__pyx_n_s_longitudeOfSouthernPoleInDegrees, __pyx_k_longitudeOfSouthernPoleInDegrees, sizeof(__pyx_k_longitudeOfSouthernPoleInDegrees), 0, 0, 1, 1},
  {&__pyx_n_s_longitudeOfSubSatellitePointInDe, __pyx_k_longitudeOfSubSatellitePointInDe, sizeof(__pyx_k_longitudeOfSubSatellitePointInDe), 0, 0, 1, 1},
  {&__pyx_n_s_longitudes, __pyx_k_longitudes, sizeof(__pyx_k_longitudes), 0, 0, 1, 1},
  {&__pyx_n_s_longlat, __pyx_k_longlat, sizeof(__pyx_k_longlat), 0, 0, 1, 1},
  {&__pyx_n_s_ma, __pyx_k_ma, sizeof(__pyx_k_ma), 0, 0, 1, 1},
  {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
  {&__pyx_n_s_major, __pyx_k_major, sizeof(__pyx_k_major), 0, 0, 1, 1},
  {&__pyx_n_s_masked_values, __pyx_k_masked_values, sizeof(__pyx_k_masked_values), 0, 0, 1, 1},
  {&__pyx_n_s_max, __pyx_k_max, sizeof(__pyx_k_max), 0, 0, 1, 1},
  {&__pyx_n_s_merc, __pyx_k_merc, sizeof(__pyx_k_merc), 0, 0, 1, 1},
  {&__pyx_n_s_mercator, __pyx_k_mercator, sizeof(__pyx_k_mercator), 0, 0, 1, 1},
  {&__pyx_n_s_meshgrid, __pyx_k_meshgrid, sizeof(__pyx_k_meshgrid), 0, 0, 1, 1},
  {&__pyx_n_s_message, __pyx_k_message, sizeof(__pyx_k_message), 0, 0, 1, 1},
  {&__pyx_n_s_messagenumber, __pyx_k_messagenumber, sizeof(__pyx_k_messagenumber), 0, 0, 1, 1},
  {&__pyx_n_s_min, __pyx_k_min, sizeof(__pyx_k_min), 0, 0, 1, 1},
  {&__pyx_n_s_minor, __pyx_k_minor, sizeof(__pyx_k_minor), 0, 0, 1, 1},
  {&__pyx_n_s_mins, __pyx_k_mins, sizeof(__pyx_k_mins), 0, 0, 1, 1},
  {&__pyx_n_s_minute, __pyx_k_minute, sizeof(__pyx_k_minute), 0, 0, 1, 1},
  {&__pyx_n_s_missingValue, __pyx_k_missingValue, sizeof(__pyx_k_missingValue), 0, 0, 1, 1},
  {&__pyx_n_s_missingvalue_float, __pyx_k_missingvalue_float, sizeof(__pyx_k_missingvalue_float), 0, 0, 1, 1},
  {&__pyx_n_s_missingvalue_int, __pyx_k_missingvalue_int, sizeof(__pyx_k_missingvalue_int), 0, 0, 1, 1},
  {&__pyx_n_s_month, __pyx_k_month, sizeof(__pyx_k_month), 0, 0, 1, 1},
  {&__pyx_n_s_months, __pyx_k_months, sizeof(__pyx_k_months), 0, 0, 1, 1},
  {&__pyx_n_s_mpl_toolkits_basemap, __pyx_k_mpl_toolkits_basemap, sizeof(__pyx_k_mpl_toolkits_basemap), 0, 0, 1, 1},
  {&__pyx_n_s_msg, __pyx_k_msg, sizeof(__pyx_k_msg), 0, 0, 1, 1},
  {&__pyx_n_s_msgs, __pyx_k_msgs, sizeof(__pyx_k_msgs), 0, 0, 1, 1},
  {&__pyx_n_s_multi_support_off, __pyx_k_multi_support_off, sizeof(__pyx_k_multi_support_off), 0, 0, 1, 1},
  {&__pyx_n_s_multi_support_on, __pyx_k_multi_support_on, sizeof(__pyx_k_multi_support_on), 0, 0, 1, 1},
  {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1},
  {&__pyx_n_s_name_2, __pyx_k_name_2, sizeof(__pyx_k_name_2), 0, 0, 1, 1},
  {&__pyx_n_s_ncepgrib2, __pyx_k_ncepgrib2, sizeof(__pyx_k_ncepgrib2), 0, 0, 1, 1},
  {&__pyx_n_s_ndim, __pyx_k_ndim, sizeof(__pyx_k_ndim), 0, 0, 1, 1},
  {&__pyx_kp_s_neg_ens_pert_d, __pyx_k_neg_ens_pert_d, sizeof(__pyx_k_neg_ens_pert_d), 0, 0, 1, 0},
  {&__pyx_n_s_next, __pyx_k_next, sizeof(__pyx_k_next), 0, 0, 1, 1},
  {&__pyx_n_s_nlats, __pyx_k_nlats, sizeof(__pyx_k_nlats), 0, 0, 1, 1},
  {&__pyx_kp_s_nlats_must_be_even, __pyx_k_nlats_must_be_even, sizeof(__pyx_k_nlats_must_be_even), 0, 0, 1, 0},
  {&__pyx_n_s_nmsgs, __pyx_k_nmsgs, sizeof(__pyx_k_nmsgs), 0, 0, 1, 1},
  {&__pyx_kp_s_nmsgs_must_be_0_in__advance, __pyx_k_nmsgs_must_be_0_in__advance, sizeof(__pyx_k_nmsgs_must_be_0_in__advance), 0, 0, 1, 0},
  {&__pyx_kp_s_no_default___reduce___due_to_non, __pyx_k_no_default___reduce___due_to_non, sizeof(__pyx_k_no_default___reduce___due_to_non), 0, 0, 1, 0},
  {&__pyx_kp_s_no_matches_found, __pyx_k_no_matches_found, sizeof(__pyx_k_no_matches_found), 0, 0, 1, 0},
  {&__pyx_kp_s_normalized_ens_std_dev, __pyx_k_normalized_ens_std_dev, sizeof(__pyx_k_normalized_ens_std_dev), 0, 0, 1, 0},
  {&__pyx_kp_s_not_that_many_messages_in_file, __pyx_k_not_that_many_messages_in_file, sizeof(__pyx_k_not_that_many_messages_in_file), 0, 0, 1, 0},
  {&__pyx_n_s_np, __pyx_k_np, sizeof(__pyx_k_np), 0, 0, 1, 1},
  {&__pyx_n_s_nsper, __pyx_k_nsper, sizeof(__pyx_k_nsper), 0, 0, 1, 1},
  {&__pyx_n_s_numberOfMissing, __pyx_k_numberOfMissing, sizeof(__pyx_k_numberOfMissing), 0, 0, 1, 1},
  {&__pyx_n_s_numberOfValues, __pyx_k_numberOfValues, sizeof(__pyx_k_numberOfValues), 0, 0, 1, 1},
  {&__pyx_n_s_numpy, __pyx_k_numpy, sizeof(__pyx_k_numpy), 0, 0, 1, 1},
  {&__pyx_n_s_o_lat_p, __pyx_k_o_lat_p, sizeof(__pyx_k_o_lat_p), 0, 0, 1, 1},
  {&__pyx_n_s_o_lon_p, __pyx_k_o_lon_p, sizeof(__pyx_k_o_lon_p), 0, 0, 1, 1},
  {&__pyx_n_s_o_proj, __pyx_k_o_proj, sizeof(__pyx_k_o_proj), 0, 0, 1, 1},
  {&__pyx_n_s_ob_tran, __pyx_k_ob_tran, sizeof(__pyx_k_ob_tran), 0, 0, 1, 1},
  {&__pyx_n_s_one, __pyx_k_one, sizeof(__pyx_k_one), 0, 0, 1, 1},
  {&__pyx_n_s_oneThousand, __pyx_k_oneThousand, sizeof(__pyx_k_oneThousand), 0, 0, 1, 1},
  {&__pyx_n_s_order, __pyx_k_order, sizeof(__pyx_k_order), 0, 0, 1, 1},
  {&__pyx_n_s_orientationOfTheGridInDegrees, __pyx_k_orientationOfTheGridInDegrees, sizeof(__pyx_k_orientationOfTheGridInDegrees), 0, 0, 1, 1},
  {&__pyx_n_s_packingType, __pyx_k_packingType, sizeof(__pyx_k_packingType), 0, 0, 1, 1},
  {&__pyx_n_s_paramId, __pyx_k_paramId, sizeof(__pyx_k_paramId), 0, 0, 1, 1},
  {&__pyx_n_s_parameterName, __pyx_k_parameterName, sizeof(__pyx_k_parameterName), 0, 0, 1, 1},
  {&__pyx_n_s_parameterUnits, __pyx_k_parameterUnits, sizeof(__pyx_k_parameterUnits), 0, 0, 1, 1},
  {&__pyx_n_s_parse_version, __pyx_k_parse_version, sizeof(__pyx_k_parse_version), 0, 0, 1, 1},
  {&__pyx_n_s_perturbationNumber, __pyx_k_perturbationNumber, sizeof(__pyx_k_perturbationNumber), 0, 0, 1, 1},
  {&__pyx_n_s_pi, __pyx_k_pi, sizeof(__pyx_k_pi), 0, 0, 1, 1},
  {&__pyx_n_s_pkg_resources, __pyx_k_pkg_resources, sizeof(__pyx_k_pkg_resources), 0, 0, 1, 1},
  {&__pyx_n_s_pl, __pyx_k_pl, sizeof(__pyx_k_pl), 0, 0, 1, 1},
  {&__pyx_n_s_polar_stereographic, __pyx_k_polar_stereographic, sizeof(__pyx_k_polar_stereographic), 0, 0, 1, 1},
  {&__pyx_kp_s_pos_ens_pert_d, __pyx_k_pos_ens_pert_d, sizeof(__pyx_k_pos_ens_pert_d), 0, 0, 1, 0},
  {&__pyx_n_s_power, __pyx_k_power, sizeof(__pyx_k_power), 0, 0, 1, 1},
  {&__pyx_n_s_private_atts, __pyx_k_private_atts, sizeof(__pyx_k_private_atts), 0, 0, 1, 1},
  {&__pyx_n_s_probabilityTypeName, __pyx_k_probabilityTypeName, sizeof(__pyx_k_probabilityTypeName), 0, 0, 1, 1},
  {&__pyx_n_s_proj, __pyx_k_proj, sizeof(__pyx_k_proj), 0, 0, 1, 1},
  {&__pyx_n_s_projectionCenterFlag, __pyx_k_projectionCenterFlag, sizeof(__pyx_k_projectionCenterFlag), 0, 0, 1, 1},
  {&__pyx_n_s_projectionCentreFlag, __pyx_k_projectionCentreFlag, sizeof(__pyx_k_projectionCentreFlag), 0, 0, 1, 1},
  {&__pyx_n_s_projparams, __pyx_k_projparams, sizeof(__pyx_k_projparams), 0, 0, 1, 1},
  {&__pyx_n_s_pygrib, __pyx_k_pygrib, sizeof(__pyx_k_pygrib), 0, 0, 1, 1},
  {&__pyx_kp_s_pygrib_pyx, __pyx_k_pygrib_pyx, sizeof(__pyx_k_pygrib_pyx), 0, 0, 1, 0},
  {&__pyx_n_s_pyproj, __pyx_k_pyproj, sizeof(__pyx_k_pyproj), 0, 0, 1, 1},
  {&__pyx_n_s_radius, __pyx_k_radius, sizeof(__pyx_k_radius), 0, 0, 1, 1},
  {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1},
  {&__pyx_n_s_read_only_keys, __pyx_k_read_only_keys, sizeof(__pyx_k_read_only_keys), 0, 0, 1, 1},
  {&__pyx_n_s_redtoreg, __pyx_k_redtoreg, sizeof(__pyx_k_redtoreg), 0, 0, 1, 1},
  {&__pyx_n_s_redtoreg_2, __pyx_k_redtoreg_2, sizeof(__pyx_k_redtoreg_2), 0, 0, 1, 1},
  {&__pyx_n_s_reduce, __pyx_k_reduce, sizeof(__pyx_k_reduce), 0, 0, 1, 1},
  {&__pyx_n_s_reduce_cython, __pyx_k_reduce_cython, sizeof(__pyx_k_reduce_cython), 0, 0, 1, 1},
  {&__pyx_n_s_reduce_ex, __pyx_k_reduce_ex, sizeof(__pyx_k_reduce_ex), 0, 0, 1, 1},
  {&__pyx_n_s_reduced, __pyx_k_reduced, sizeof(__pyx_k_reduced), 0, 0, 1, 1},
  {&__pyx_n_s_reduced_gg, __pyx_k_reduced_gg, sizeof(__pyx_k_reduced_gg), 0, 0, 1, 1},
  {&__pyx_kp_s_reduced_grid_data_array_must_be, __pyx_k_reduced_grid_data_array_must_be, sizeof(__pyx_k_reduced_grid_data_array_must_be), 0, 0, 1, 0},
  {&__pyx_n_s_reduced_ll, __pyx_k_reduced_ll, sizeof(__pyx_k_reduced_ll), 0, 0, 1, 1},
  {&__pyx_n_s_regular_gg, __pyx_k_regular_gg, sizeof(__pyx_k_regular_gg), 0, 0, 1, 1},
  {&__pyx_n_s_regular_ll, __pyx_k_regular_ll, sizeof(__pyx_k_regular_ll), 0, 0, 1, 1},
  {&__pyx_n_s_reload, __pyx_k_reload, sizeof(__pyx_k_reload), 0, 0, 1, 1},
  {&__pyx_n_s_reshape, __pyx_k_reshape, sizeof(__pyx_k_reshape), 0, 0, 1, 1},
  {&__pyx_n_s_reshape_mask, __pyx_k_reshape_mask, sizeof(__pyx_k_reshape_mask), 0, 0, 1, 1},
  {&__pyx_n_s_return_msgs, __pyx_k_return_msgs, sizeof(__pyx_k_return_msgs), 0, 0, 1, 1},
  {&__pyx_n_s_revision, __pyx_k_revision, sizeof(__pyx_k_revision), 0, 0, 1, 1},
  {&__pyx_n_s_rewind, __pyx_k_rewind, sizeof(__pyx_k_rewind), 0, 0, 1, 1},
  {&__pyx_n_s_ro_keys, __pyx_k_ro_keys, sizeof(__pyx_k_ro_keys), 0, 0, 1, 1},
  {&__pyx_n_s_rotated_gg, __pyx_k_rotated_gg, sizeof(__pyx_k_rotated_gg), 0, 0, 1, 1},
  {&__pyx_n_s_rotated_ll, __pyx_k_rotated_ll, sizeof(__pyx_k_rotated_ll), 0, 0, 1, 1},
  {&__pyx_n_s_rstrip, __pyx_k_rstrip, sizeof(__pyx_k_rstrip), 0, 0, 1, 1},
  {&__pyx_kp_s_s, __pyx_k_s, sizeof(__pyx_k_s), 0, 0, 1, 0},
  {&__pyx_kp_s_s_2, __pyx_k_s_2, sizeof(__pyx_k_s_2), 0, 0, 1, 0},
  {&__pyx_kp_s_s_3, __pyx_k_s_3, sizeof(__pyx_k_s_3), 0, 0, 1, 0},
  {&__pyx_n_s_s_4, __pyx_k_s_4, sizeof(__pyx_k_s_4), 0, 0, 1, 1},
  {&__pyx_kp_s_s_s, __pyx_k_s_s, sizeof(__pyx_k_s_s), 0, 0, 1, 0},
  {&__pyx_n_s_scaleFactorOfFirstFixedSurface, __pyx_k_scaleFactorOfFirstFixedSurface, sizeof(__pyx_k_scaleFactorOfFirstFixedSurface), 0, 0, 1, 1},
  {&__pyx_n_s_scaleFactorOfLowerLimit, __pyx_k_scaleFactorOfLowerLimit, sizeof(__pyx_k_scaleFactorOfLowerLimit), 0, 0, 1, 1},
  {&__pyx_n_s_scaleFactorOfMajorAxisOfOblateSp, __pyx_k_scaleFactorOfMajorAxisOfOblateSp, sizeof(__pyx_k_scaleFactorOfMajorAxisOfOblateSp), 0, 0, 1, 1},
  {&__pyx_n_s_scaleFactorOfMinorAxisOfOblateSp, __pyx_k_scaleFactorOfMinorAxisOfOblateSp, sizeof(__pyx_k_scaleFactorOfMinorAxisOfOblateSp), 0, 0, 1, 1},
  {&__pyx_n_s_scaleFactorOfRadiusOfSphericalEa, __pyx_k_scaleFactorOfRadiusOfSphericalEa, sizeof(__pyx_k_scaleFactorOfRadiusOfSphericalEa), 0, 0, 1, 1},
  {&__pyx_n_s_scaleFactorOfSecondFixedSurface, __pyx_k_scaleFactorOfSecondFixedSurface, sizeof(__pyx_k_scaleFactorOfSecondFixedSurface), 0, 0, 1, 1},
  {&__pyx_n_s_scaleFactorOfUpperLimit, __pyx_k_scaleFactorOfUpperLimit, sizeof(__pyx_k_scaleFactorOfUpperLimit), 0, 0, 1, 1},
  {&__pyx_n_s_scaledValueOfEarthMajorAxis, __pyx_k_scaledValueOfEarthMajorAxis, sizeof(__pyx_k_scaledValueOfEarthMajorAxis), 0, 0, 1, 1},
  {&__pyx_n_s_scaledValueOfEarthMinorAxis, __pyx_k_scaledValueOfEarthMinorAxis, sizeof(__pyx_k_scaledValueOfEarthMinorAxis), 0, 0, 1, 1},
  {&__pyx_n_s_scaledValueOfFirstFixedSurface, __pyx_k_scaledValueOfFirstFixedSurface, sizeof(__pyx_k_scaledValueOfFirstFixedSurface), 0, 0, 1, 1},
  {&__pyx_n_s_scaledValueOfLowerLimit, __pyx_k_scaledValueOfLowerLimit, sizeof(__pyx_k_scaledValueOfLowerLimit), 0, 0, 1, 1},
  {&__pyx_n_s_scaledValueOfMajorAxisOfOblateSp, __pyx_k_scaledValueOfMajorAxisOfOblateSp, sizeof(__pyx_k_scaledValueOfMajorAxisOfOblateSp), 0, 0, 1, 1},
  {&__pyx_n_s_scaledValueOfMinorAxisOfOblateSp, __pyx_k_scaledValueOfMinorAxisOfOblateSp, sizeof(__pyx_k_scaledValueOfMinorAxisOfOblateSp), 0, 0, 1, 1},
  {&__pyx_n_s_scaledValueOfRadiusOfSphericalEa, __pyx_k_scaledValueOfRadiusOfSphericalEa, sizeof(__pyx_k_scaledValueOfRadiusOfSphericalEa), 0, 0, 1, 1},
  {&__pyx_n_s_scaledValueOfSecondFixedSurface, __pyx_k_scaledValueOfSecondFixedSurface, sizeof(__pyx_k_scaledValueOfSecondFixedSurface), 0, 0, 1, 1},
  {&__pyx_n_s_scaledValueOfUpperLimit, __pyx_k_scaledValueOfUpperLimit, sizeof(__pyx_k_scaledValueOfUpperLimit), 0, 0, 1, 1},
  {&__pyx_n_s_second, __pyx_k_second, sizeof(__pyx_k_second), 0, 0, 1, 1},
  {&__pyx_n_s_secs, __pyx_k_secs, sizeof(__pyx_k_secs), 0, 0, 1, 1},
  {&__pyx_n_s_seek, __pyx_k_seek, sizeof(__pyx_k_seek), 0, 0, 1, 1},
  {&__pyx_n_s_select, __pyx_k_select, sizeof(__pyx_k_select), 0, 0, 1, 1},
  {&__pyx_kp_s_self__gh_cannot_be_converted_to, __pyx_k_self__gh_cannot_be_converted_to, sizeof(__pyx_k_self__gh_cannot_be_converted_to), 0, 0, 1, 0},
  {&__pyx_n_s_set_projparams, __pyx_k_set_projparams, sizeof(__pyx_k_set_projparams), 0, 0, 1, 1},
  {&__pyx_n_s_setdates, __pyx_k_setdates, sizeof(__pyx_k_setdates), 0, 0, 1, 1},
  {&__pyx_n_s_setstate, __pyx_k_setstate, sizeof(__pyx_k_setstate), 0, 0, 1, 1},
  {&__pyx_n_s_setstate_cython, __pyx_k_setstate_cython, sizeof(__pyx_k_setstate_cython), 0, 0, 1, 1},
  {&__pyx_n_s_shape, __pyx_k_shape, sizeof(__pyx_k_shape), 0, 0, 1, 1},
  {&__pyx_n_s_shapeOfTheEarth, __pyx_k_shapeOfTheEarth, sizeof(__pyx_k_shapeOfTheEarth), 0, 0, 1, 1},
  {&__pyx_n_s_size, __pyx_k_size, sizeof(__pyx_k_size), 0, 0, 1, 1},
  {&__pyx_n_s_space_view, __pyx_k_space_view, sizeof(__pyx_k_space_view), 0, 0, 1, 1},
  {&__pyx_n_s_split, __pyx_k_split, sizeof(__pyx_k_split), 0, 0, 1, 1},
  {&__pyx_n_s_standardParallel, __pyx_k_standardParallel, sizeof(__pyx_k_standardParallel), 0, 0, 1, 1},
  {&__pyx_n_s_startswith, __pyx_k_startswith, sizeof(__pyx_k_startswith), 0, 0, 1, 1},
  {&__pyx_n_s_stepRange, __pyx_k_stepRange, sizeof(__pyx_k_stepRange), 0, 0, 1, 1},
  {&__pyx_n_s_stepType, __pyx_k_stepType, sizeof(__pyx_k_stepType), 0, 0, 1, 1},
  {&__pyx_n_s_stere, __pyx_k_stere, sizeof(__pyx_k_stere), 0, 0, 1, 1},
  {&__pyx_n_s_sum, __pyx_k_sum, sizeof(__pyx_k_sum), 0, 0, 1, 1},
  {&__pyx_n_s_tell, __pyx_k_tell, sizeof(__pyx_k_tell), 0, 0, 1, 1},
  {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
  {&__pyx_n_s_thousand, __pyx_k_thousand, sizeof(__pyx_k_thousand), 0, 0, 1, 1},
  {&__pyx_n_s_tolerate_badgrib, __pyx_k_tolerate_badgrib, sizeof(__pyx_k_tolerate_badgrib), 0, 0, 1, 1},
  {&__pyx_n_s_tolerate_badgrib_off, __pyx_k_tolerate_badgrib_off, sizeof(__pyx_k_tolerate_badgrib_off), 0, 0, 1, 1},
  {&__pyx_n_s_tolerate_badgrib_on, __pyx_k_tolerate_badgrib_on, sizeof(__pyx_k_tolerate_badgrib_on), 0, 0, 1, 1},
  {&__pyx_n_s_topLevel, __pyx_k_topLevel, sizeof(__pyx_k_topLevel), 0, 0, 1, 1},
  {&__pyx_n_s_tostring, __pyx_k_tostring, sizeof(__pyx_k_tostring), 0, 0, 1, 1},
  {&__pyx_n_s_traceback, __pyx_k_traceback, sizeof(__pyx_k_traceback), 0, 0, 1, 1},
  {&__pyx_n_s_truncateDegrees, __pyx_k_truncateDegrees, sizeof(__pyx_k_truncateDegrees), 0, 0, 1, 1},
  {&__pyx_n_s_typeOfEnsembleForecast, __pyx_k_typeOfEnsembleForecast, sizeof(__pyx_k_typeOfEnsembleForecast), 0, 0, 1, 1},
  {&__pyx_n_s_typeOfFirstFixedSurface, __pyx_k_typeOfFirstFixedSurface, sizeof(__pyx_k_typeOfFirstFixedSurface), 0, 0, 1, 1},
  {&__pyx_n_s_typeOfGrid, __pyx_k_typeOfGrid, sizeof(__pyx_k_typeOfGrid), 0, 0, 1, 1},
  {&__pyx_n_s_typeOfLevel, __pyx_k_typeOfLevel, sizeof(__pyx_k_typeOfLevel), 0, 0, 1, 1},
  {&__pyx_n_s_typeOfSecondFixedSurface, __pyx_k_typeOfSecondFixedSurface, sizeof(__pyx_k_typeOfSecondFixedSurface), 0, 0, 1, 1},
  {&__pyx_n_s_units, __pyx_k_units, sizeof(__pyx_k_units), 0, 0, 1, 1},
  {&__pyx_n_s_unitsOfFirstFixedSurface, __pyx_k_unitsOfFirstFixedSurface, sizeof(__pyx_k_unitsOfFirstFixedSurface), 0, 0, 1, 1},
  {&__pyx_n_s_unknown, __pyx_k_unknown, sizeof(__pyx_k_unknown), 0, 0, 1, 1},
  {&__pyx_kp_s_unknown_shape_of_the_earth_flag, __pyx_k_unknown_shape_of_the_earth_flag, sizeof(__pyx_k_unknown_shape_of_the_earth_flag), 0, 0, 1, 0},
  {&__pyx_kp_s_unrecognized_grib_type_d, __pyx_k_unrecognized_grib_type_d, sizeof(__pyx_k_unrecognized_grib_type_d), 0, 0, 1, 0},
  {&__pyx_n_s_unshape_mask, __pyx_k_unshape_mask, sizeof(__pyx_k_unshape_mask), 0, 0, 1, 1},
  {&__pyx_kp_s_unsupported_grid_earth_not_a_per, __pyx_k_unsupported_grid_earth_not_a_per, sizeof(__pyx_k_unsupported_grid_earth_not_a_per), 0, 0, 1, 0},
  {&__pyx_kp_s_unsupported_grid_s, __pyx_k_unsupported_grid_s, sizeof(__pyx_k_unsupported_grid_s), 0, 0, 1, 0},
  {&__pyx_n_s_v, __pyx_k_v, sizeof(__pyx_k_v), 0, 0, 1, 1},
  {&__pyx_n_s_validDate, __pyx_k_validDate, sizeof(__pyx_k_validDate), 0, 0, 1, 1},
  {&__pyx_n_s_valid_key, __pyx_k_valid_key, sizeof(__pyx_k_valid_key), 0, 0, 1, 1},
  {&__pyx_n_s_value, __pyx_k_value, sizeof(__pyx_k_value), 0, 0, 1, 1},
  {&__pyx_kp_s_value_must_be_float_int_or_strin, __pyx_k_value_must_be_float_int_or_strin, sizeof(__pyx_k_value_must_be_float_int_or_strin), 0, 0, 1, 0},
  {&__pyx_n_b_values, __pyx_k_values, sizeof(__pyx_k_values), 0, 0, 0, 1},
  {&__pyx_n_s_values, __pyx_k_values, sizeof(__pyx_k_values), 0, 0, 1, 1},
  {&__pyx_n_s_version, __pyx_k_version, sizeof(__pyx_k_version), 0, 0, 1, 1},
  {&__pyx_n_s_warn, __pyx_k_warn, sizeof(__pyx_k_warn), 0, 0, 1, 1},
  {&__pyx_n_s_warnings, __pyx_k_warnings, sizeof(__pyx_k_warnings), 0, 0, 1, 1},
  {&__pyx_kp_s_weighted_ens_mean, __pyx_k_weighted_ens_mean, sizeof(__pyx_k_weighted_ens_mean), 0, 0, 1, 0},
  {&__pyx_n_s_where, __pyx_k_where, sizeof(__pyx_k_where), 0, 0, 1, 1},
  {&__pyx_n_s_xDirectionGridLengthInMetres, __pyx_k_xDirectionGridLengthInMetres, sizeof(__pyx_k_xDirectionGridLengthInMetres), 0, 0, 1, 1},
  {&__pyx_n_s_xrange, __pyx_k_xrange, sizeof(__pyx_k_xrange), 0, 0, 1, 1},
  {&__pyx_n_s_yDirectionGridLengthInMetres, __pyx_k_yDirectionGridLengthInMetres, sizeof(__pyx_k_yDirectionGridLengthInMetres), 0, 0, 1, 1},
  {&__pyx_n_s_year, __pyx_k_year, sizeof(__pyx_k_year), 0, 0, 1, 1},
  {&__pyx_n_s_yrs, __pyx_k_yrs, sizeof(__pyx_k_yrs), 0, 0, 1, 1},
  {&__pyx_n_s_zero, __pyx_k_zero, sizeof(__pyx_k_zero), 0, 0, 1, 1},
  {&__pyx_n_s_zeros, __pyx_k_zeros, sizeof(__pyx_k_zeros), 0, 0, 1, 1},
  {0, 0, 0, 0, 0, 0, 0}
};
static int __Pyx_InitCachedBuiltins(void) {
  __pyx_builtin_ImportError = __Pyx_GetBuiltinName(__pyx_n_s_ImportError); if (!__pyx_builtin_ImportError) __PYX_ERR(0, 181, __pyx_L1_error)
  __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(0, 332, __pyx_L1_error)
  __pyx_builtin_IOError = __Pyx_GetBuiltinName(__pyx_n_s_IOError); if (!__pyx_builtin_IOError) __PYX_ERR(0, 395, __pyx_L1_error)
  __pyx_builtin_StopIteration = __Pyx_GetBuiltinName(__pyx_n_s_StopIteration); if (!__pyx_builtin_StopIteration) __PYX_ERR(0, 427, __pyx_L1_error)
  __pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_n_s_RuntimeError); if (!__pyx_builtin_RuntimeError) __PYX_ERR(0, 431, __pyx_L1_error)
  #if PY_MAJOR_VERSION >= 3
  __pyx_builtin_xrange = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_xrange) __PYX_ERR(0, 446, __pyx_L1_error)
  #else
  __pyx_builtin_xrange = __Pyx_GetBuiltinName(__pyx_n_s_xrange); if (!__pyx_builtin_xrange) __PYX_ERR(0, 446, __pyx_L1_error)
  #endif
  __pyx_builtin_KeyError = __Pyx_GetBuiltinName(__pyx_n_s_KeyError); if (!__pyx_builtin_KeyError) __PYX_ERR(0, 456, __pyx_L1_error)
  __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 620, __pyx_L1_error)
  __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(1, 2, __pyx_L1_error)
  __pyx_builtin_AttributeError = __Pyx_GetBuiltinName(__pyx_n_s_AttributeError); if (!__pyx_builtin_AttributeError) __PYX_ERR(0, 845, __pyx_L1_error)
  __pyx_builtin_IndexError = __Pyx_GetBuiltinName(__pyx_n_s_IndexError); if (!__pyx_builtin_IndexError) __PYX_ERR(0, 1910, __pyx_L1_error)
  return 0;
  __pyx_L1_error:;
  return -1;
}

static int __Pyx_InitCachedConstants(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);

  /* "pygrib.pyx":332
 *     cdef ndarray lats
 *     if nlats%2:
 *         raise ValueError('nlats must be even')             # <<<<<<<<<<<<<<
 *     lats = np.empty(nlats, np.float64)
 *     grib_get_gaussian_latitudes(<long>nlats//2, <double *>lats.data)
 */
  __pyx_tuple_ = PyTuple_Pack(1, __pyx_kp_s_nlats_must_be_even); if (unlikely(!__pyx_tuple_)) __PYX_ERR(0, 332, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple_);
  __Pyx_GIVEREF(__pyx_tuple_);

  /* "pygrib.pyx":456
 *             return grb
 *         else:
 *             raise KeyError('key must be an integer message number or a slice')             # <<<<<<<<<<<<<<
 *     def __call__(self, **kwargs):
 *         """same as L{select}"""
 */
  __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_s_key_must_be_an_integer_message_n); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(0, 456, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__2);
  __Pyx_GIVEREF(__pyx_tuple__2);

  /* "pygrib.pyx":476
 *         or from the end of file (if C{from_what=2})."""
 *         if from_what not in [0,1,2]:
 *             raise ValueError('from_what keyword arg to seek must be 0,1 or 2')             # <<<<<<<<<<<<<<
 *         if msg == 0:
 *             if from_what == 0:
 */
  __pyx_tuple__3 = PyTuple_Pack(1, __pyx_kp_s_from_what_keyword_arg_to_seek_mu); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(0, 476, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__3);
  __Pyx_GIVEREF(__pyx_tuple__3);

  /* "pygrib.pyx":559
 *         same as seek(N-1) followed by readline()."""
 *         if N < 1:
 *             raise IOError('grb message numbers start at 1')             # <<<<<<<<<<<<<<
 *         # if iterator positioned past message N, reposition at beginning.
 *         if self.messagenumber >= N:
 */
  __pyx_tuple__4 = PyTuple_Pack(1, __pyx_kp_s_grb_message_numbers_start_at_1); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(0, 559, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__4);
  __Pyx_GIVEREF(__pyx_tuple__4);

  /* "pygrib.pyx":610
 *         self.seek(msgnum) # leave iterator in original position.
 *         if not grbs:
 *             raise ValueError('no matches found')             # <<<<<<<<<<<<<<
 *         return grbs
 *     def _advance(self,nmsgs,return_msgs=False):
 */
  __pyx_tuple__5 = PyTuple_Pack(1, __pyx_kp_s_no_matches_found); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(0, 610, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__5);
  __Pyx_GIVEREF(__pyx_tuple__5);

  /* "pygrib.pyx":618
 *         cdef int err
 *         if nmsgs < 0:
 *             raise ValueError('nmsgs must be >= 0 in _advance')             # <<<<<<<<<<<<<<
 *         if return_msgs: grbs=[]
 *         for n in range(self.messagenumber,self.messagenumber+nmsgs):
 */
  __pyx_tuple__6 = PyTuple_Pack(1, __pyx_kp_s_nmsgs_must_be_0_in__advance); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(0, 618, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__6);
  __Pyx_GIVEREF(__pyx_tuple__6);

  /* "pygrib.pyx":628
 *                 raise RuntimeError(grib_get_error_message(err))
 *             if self._gh == NULL:
 *                 raise IOError('not that many messages in file')             # <<<<<<<<<<<<<<
 *             self.messagenumber = self.messagenumber + 1
 *             if return_msgs: grbs.append(_create_gribmessage(self._gh, self.messagenumber))
 */
  __pyx_tuple__7 = PyTuple_Pack(1, __pyx_kp_s_not_that_many_messages_in_file); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(0, 628, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__7);
  __Pyx_GIVEREF(__pyx_tuple__7);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 */
  __pyx_tuple__8 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(1, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__8);
  __Pyx_GIVEREF(__pyx_tuple__8);

  /* "(tree fragment)":4
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
 */
  __pyx_tuple__9 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(1, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__9);
  __Pyx_GIVEREF(__pyx_tuple__9);

  /* "pygrib.pyx":713
 *     """
 *     grb.fcstimeunits = ""
 *     if grb.has_key('indicatorOfUnitOfTimeRange') and\             # <<<<<<<<<<<<<<
 *        grb.indicatorOfUnitOfTimeRange in _ftimedict:
 *         grb.fcstimeunits = _ftimedict[grb.indicatorOfUnitOfTimeRange]
 */
  __pyx_tuple__11 = PyTuple_Pack(1, __pyx_n_s_indicatorOfUnitOfTimeRange); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(0, 713, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__11);
  __Pyx_GIVEREF(__pyx_tuple__11);

  /* "pygrib.pyx":716
 *        grb.indicatorOfUnitOfTimeRange in _ftimedict:
 *         grb.fcstimeunits = _ftimedict[grb.indicatorOfUnitOfTimeRange]
 *     if grb.has_key('forecastTime'):             # <<<<<<<<<<<<<<
 *         if grb.has_key('forecastTime'):
 *             ftime = grb.forecastTime
 */
  __pyx_tuple__12 = PyTuple_Pack(1, __pyx_n_s_forecastTime); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(0, 716, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__12);
  __Pyx_GIVEREF(__pyx_tuple__12);

  /* "pygrib.pyx":717
 *         grb.fcstimeunits = _ftimedict[grb.indicatorOfUnitOfTimeRange]
 *     if grb.has_key('forecastTime'):
 *         if grb.has_key('forecastTime'):             # <<<<<<<<<<<<<<
 *             ftime = grb.forecastTime
 *         elif grb.has_key('stepRange'):
 */
  __pyx_tuple__13 = PyTuple_Pack(1, __pyx_n_s_forecastTime); if (unlikely(!__pyx_tuple__13)) __PYX_ERR(0, 717, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__13);
  __Pyx_GIVEREF(__pyx_tuple__13);

  /* "pygrib.pyx":719
 *         if grb.has_key('forecastTime'):
 *             ftime = grb.forecastTime
 *         elif grb.has_key('stepRange'):             # <<<<<<<<<<<<<<
 *             # if forecastTime doesn't exist, use end of stepRange.
 *             ftime = grb['stepRange'] # computed key, uses stepUnits
 */
  __pyx_tuple__14 = PyTuple_Pack(1, __pyx_n_s_stepRange); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(0, 719, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__14);
  __Pyx_GIVEREF(__pyx_tuple__14);

  /* "pygrib.pyx":724
 *             # if it's a range, use the end of the range to define validDate
 *             try:
 *                 ftime = float(ftime.split('-')[1])             # <<<<<<<<<<<<<<
 *             except:
 *                 ftime = None
 */
  __pyx_tuple__16 = PyTuple_Pack(1, __pyx_kp_s__15); if (unlikely(!__pyx_tuple__16)) __PYX_ERR(0, 724, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__16);
  __Pyx_GIVEREF(__pyx_tuple__16);

  /* "pygrib.pyx":730
 *         ftime = 0
 *     if ftime is None: ftime = 0. # make sure ftime is not None
 *     if grb.has_key('julianDay'):             # <<<<<<<<<<<<<<
 *         # don't do anything if datetime fails (because of a miscoded julianDay)
 *         try:
 */
  __pyx_tuple__17 = PyTuple_Pack(1, __pyx_n_s_julianDay); if (unlikely(!__pyx_tuple__17)) __PYX_ERR(0, 730, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__17);
  __Pyx_GIVEREF(__pyx_tuple__17);

  /* "pygrib.pyx":834
 *     def __init__(self):
 *         # calling "__new__()" will not call "__init__()" !
 *         raise TypeError("This class cannot be instantiated from Python")             # <<<<<<<<<<<<<<
 *     def __dealloc__(self):
 *         # finalization (inverse of __cinit__): needed to allow garbage collector to free memory.
 */
  __pyx_tuple__18 = PyTuple_Pack(1, __pyx_kp_s_This_class_cannot_be_instantiate); if (unlikely(!__pyx_tuple__18)) __PYX_ERR(0, 834, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__18);
  __Pyx_GIVEREF(__pyx_tuple__18);

  /* "pygrib.pyx":857
 *         """prints a short inventory of the grib message"""
 *         inventory = []
 *         if self.valid_key('name'):             # <<<<<<<<<<<<<<
 *             if self['name'] != 'unknown':
 *                 inventory.append(repr(self.messagenumber)+':'+self['name'])
 */
  __pyx_tuple__19 = PyTuple_Pack(1, __pyx_n_s_name); if (unlikely(!__pyx_tuple__19)) __PYX_ERR(0, 857, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__19);
  __Pyx_GIVEREF(__pyx_tuple__19);

  /* "pygrib.pyx":860
 *             if self['name'] != 'unknown':
 *                 inventory.append(repr(self.messagenumber)+':'+self['name'])
 *             elif self.valid_key('parameterName'):             # <<<<<<<<<<<<<<
 *                 inventory.append(repr(self.messagenumber)+':'+self['parameterName'])
 *         if self.valid_key('units'):
 */
  __pyx_tuple__21 = PyTuple_Pack(1, __pyx_n_s_parameterName); if (unlikely(!__pyx_tuple__21)) __PYX_ERR(0, 860, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__21);
  __Pyx_GIVEREF(__pyx_tuple__21);

  /* "pygrib.pyx":862
 *             elif self.valid_key('parameterName'):
 *                 inventory.append(repr(self.messagenumber)+':'+self['parameterName'])
 *         if self.valid_key('units'):             # <<<<<<<<<<<<<<
 *             if self['units'] != 'unknown':
 *                 inventory.append(':'+self['units'])
 */
  __pyx_tuple__22 = PyTuple_Pack(1, __pyx_n_s_units); if (unlikely(!__pyx_tuple__22)) __PYX_ERR(0, 862, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__22);
  __Pyx_GIVEREF(__pyx_tuple__22);

  /* "pygrib.pyx":865
 *             if self['units'] != 'unknown':
 *                 inventory.append(':'+self['units'])
 *             elif self.valid_key('parameterUnits'):             # <<<<<<<<<<<<<<
 *                 inventory.append(':'+self['parameterUnits'])
 *         if self.valid_key('stepType'):
 */
  __pyx_tuple__23 = PyTuple_Pack(1, __pyx_n_s_parameterUnits); if (unlikely(!__pyx_tuple__23)) __PYX_ERR(0, 865, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__23);
  __Pyx_GIVEREF(__pyx_tuple__23);

  /* "pygrib.pyx":867
 *             elif self.valid_key('parameterUnits'):
 *                 inventory.append(':'+self['parameterUnits'])
 *         if self.valid_key('stepType'):             # <<<<<<<<<<<<<<
 *             inventory.append(' ('+self['stepType']+')')
 *         if self.valid_key('typeOfGrid') or self.valid_key('gridType'):
 */
  __pyx_tuple__24 = PyTuple_Pack(1, __pyx_n_s_stepType); if (unlikely(!__pyx_tuple__24)) __PYX_ERR(0, 867, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__24);
  __Pyx_GIVEREF(__pyx_tuple__24);

  /* "pygrib.pyx":869
 *         if self.valid_key('stepType'):
 *             inventory.append(' ('+self['stepType']+')')
 *         if self.valid_key('typeOfGrid') or self.valid_key('gridType'):             # <<<<<<<<<<<<<<
 *             if self.valid_key('typeOfGrid'):
 *                inventory.append(':'+self['typeOfGrid'])
 */
  __pyx_tuple__27 = PyTuple_Pack(1, __pyx_n_s_typeOfGrid); if (unlikely(!__pyx_tuple__27)) __PYX_ERR(0, 869, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__27);
  __Pyx_GIVEREF(__pyx_tuple__27);
  __pyx_tuple__28 = PyTuple_Pack(1, __pyx_n_s_gridType); if (unlikely(!__pyx_tuple__28)) __PYX_ERR(0, 869, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__28);
  __Pyx_GIVEREF(__pyx_tuple__28);

  /* "pygrib.pyx":870
 *             inventory.append(' ('+self['stepType']+')')
 *         if self.valid_key('typeOfGrid') or self.valid_key('gridType'):
 *             if self.valid_key('typeOfGrid'):             # <<<<<<<<<<<<<<
 *                inventory.append(':'+self['typeOfGrid'])
 *             else:
 */
  __pyx_tuple__29 = PyTuple_Pack(1, __pyx_n_s_typeOfGrid); if (unlikely(!__pyx_tuple__29)) __PYX_ERR(0, 870, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__29);
  __Pyx_GIVEREF(__pyx_tuple__29);

  /* "pygrib.pyx":874
 *             else:
 *                inventory.append(':'+self['gridType'])
 *         if self.valid_key('typeOfLevel'):             # <<<<<<<<<<<<<<
 *             inventory.append(':'+self['typeOfLevel'])
 *         if self.valid_key('topLevel') and self.valid_key('bottomLevel'):
 */
  __pyx_tuple__30 = PyTuple_Pack(1, __pyx_n_s_typeOfLevel); if (unlikely(!__pyx_tuple__30)) __PYX_ERR(0, 874, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__30);
  __Pyx_GIVEREF(__pyx_tuple__30);

  /* "pygrib.pyx":876
 *         if self.valid_key('typeOfLevel'):
 *             inventory.append(':'+self['typeOfLevel'])
 *         if self.valid_key('topLevel') and self.valid_key('bottomLevel'):             # <<<<<<<<<<<<<<
 *             toplev = None; botlev = None
 *             levunits = 'unknown'
 */
  __pyx_tuple__31 = PyTuple_Pack(1, __pyx_n_s_topLevel); if (unlikely(!__pyx_tuple__31)) __PYX_ERR(0, 876, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__31);
  __Pyx_GIVEREF(__pyx_tuple__31);
  __pyx_tuple__32 = PyTuple_Pack(1, __pyx_n_s_bottomLevel); if (unlikely(!__pyx_tuple__32)) __PYX_ERR(0, 876, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__32);
  __Pyx_GIVEREF(__pyx_tuple__32);

  /* "pygrib.pyx":879
 *             toplev = None; botlev = None
 *             levunits = 'unknown'
 *             if self.valid_key('unitsOfFirstFixedSurface'):             # <<<<<<<<<<<<<<
 *                 levunits = self['unitsOfFirstFixedSurface']
 *             if self.valid_key('typeOfFirstFixedSurface') and self['typeOfFirstFixedSurface'] != 255:
 */
  __pyx_tuple__33 = PyTuple_Pack(1, __pyx_n_s_unitsOfFirstFixedSurface); if (unlikely(!__pyx_tuple__33)) __PYX_ERR(0, 879, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__33);
  __Pyx_GIVEREF(__pyx_tuple__33);

  /* "pygrib.pyx":881
 *             if self.valid_key('unitsOfFirstFixedSurface'):
 *                 levunits = self['unitsOfFirstFixedSurface']
 *             if self.valid_key('typeOfFirstFixedSurface') and self['typeOfFirstFixedSurface'] != 255:             # <<<<<<<<<<<<<<
 *                 toplev = self['topLevel']
 *                 if self.valid_key('scaledValueOfFirstFixedSurface') and\
 */
  __pyx_tuple__34 = PyTuple_Pack(1, __pyx_n_s_typeOfFirstFixedSurface); if (unlikely(!__pyx_tuple__34)) __PYX_ERR(0, 881, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__34);
  __Pyx_GIVEREF(__pyx_tuple__34);

  /* "pygrib.pyx":883
 *             if self.valid_key('typeOfFirstFixedSurface') and self['typeOfFirstFixedSurface'] != 255:
 *                 toplev = self['topLevel']
 *                 if self.valid_key('scaledValueOfFirstFixedSurface') and\             # <<<<<<<<<<<<<<
 *                    self.valid_key('scaleFactorOfFirstFixedSurface'):
 *                    if self['scaleFactorOfFirstFixedSurface']:
 */
  __pyx_tuple__35 = PyTuple_Pack(1, __pyx_n_s_scaledValueOfFirstFixedSurface); if (unlikely(!__pyx_tuple__35)) __PYX_ERR(0, 883, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__35);
  __Pyx_GIVEREF(__pyx_tuple__35);

  /* "pygrib.pyx":884
 *                 toplev = self['topLevel']
 *                 if self.valid_key('scaledValueOfFirstFixedSurface') and\
 *                    self.valid_key('scaleFactorOfFirstFixedSurface'):             # <<<<<<<<<<<<<<
 *                    if self['scaleFactorOfFirstFixedSurface']:
 *                        toplev = self['scaledValueOfFirstFixedSurface']/\
 */
  __pyx_tuple__36 = PyTuple_Pack(1, __pyx_n_s_scaleFactorOfFirstFixedSurface); if (unlikely(!__pyx_tuple__36)) __PYX_ERR(0, 884, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__36);
  __Pyx_GIVEREF(__pyx_tuple__36);

  /* "pygrib.pyx":890
 *                    else:
 *                        toplev = self['scaledValueOfFirstFixedSurface']
 *             if self.valid_key('typeOfSecondFixedSurface') and self['typeOfSecondFixedSurface'] != 255:             # <<<<<<<<<<<<<<
 *                 botlev = self['bottomLevel']
 *                 if self.valid_key('scaledValueOfSecondFixedSurface') and\
 */
  __pyx_tuple__37 = PyTuple_Pack(1, __pyx_n_s_typeOfSecondFixedSurface); if (unlikely(!__pyx_tuple__37)) __PYX_ERR(0, 890, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__37);
  __Pyx_GIVEREF(__pyx_tuple__37);

  /* "pygrib.pyx":892
 *             if self.valid_key('typeOfSecondFixedSurface') and self['typeOfSecondFixedSurface'] != 255:
 *                 botlev = self['bottomLevel']
 *                 if self.valid_key('scaledValueOfSecondFixedSurface') and\             # <<<<<<<<<<<<<<
 *                    self.valid_key('scaleFactorOfSecondFixedSurface'):
 *                    if self['scaleFactorOfSecondFixedSurface']:
 */
  __pyx_tuple__38 = PyTuple_Pack(1, __pyx_n_s_scaledValueOfSecondFixedSurface); if (unlikely(!__pyx_tuple__38)) __PYX_ERR(0, 892, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__38);
  __Pyx_GIVEREF(__pyx_tuple__38);

  /* "pygrib.pyx":893
 *                 botlev = self['bottomLevel']
 *                 if self.valid_key('scaledValueOfSecondFixedSurface') and\
 *                    self.valid_key('scaleFactorOfSecondFixedSurface'):             # <<<<<<<<<<<<<<
 *                    if self['scaleFactorOfSecondFixedSurface']:
 *                        botlev = self['scaledValueOfSecondFixedSurface']/\
 */
  __pyx_tuple__39 = PyTuple_Pack(1, __pyx_n_s_scaleFactorOfSecondFixedSurface); if (unlikely(!__pyx_tuple__39)) __PYX_ERR(0, 893, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__39);
  __Pyx_GIVEREF(__pyx_tuple__39);

  /* "pygrib.pyx":908
 *             if levstring is not None:
 *                 inventory.append(levstring)
 *         elif self.valid_key('level'):             # <<<<<<<<<<<<<<
 *             inventory.append(':level %s' % self['level'])
 *         if self.has_key('stepRange'):
 */
  __pyx_tuple__40 = PyTuple_Pack(1, __pyx_n_s_level); if (unlikely(!__pyx_tuple__40)) __PYX_ERR(0, 908, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__40);
  __Pyx_GIVEREF(__pyx_tuple__40);

  /* "pygrib.pyx":910
 *         elif self.valid_key('level'):
 *             inventory.append(':level %s' % self['level'])
 *         if self.has_key('stepRange'):             # <<<<<<<<<<<<<<
 *             ftime = self['stepRange'] # computed key, uses stepUnits
 *             if self.valid_key('stepType') and self['stepType'] != 'instant':
 */
  __pyx_tuple__41 = PyTuple_Pack(1, __pyx_n_s_stepRange); if (unlikely(!__pyx_tuple__41)) __PYX_ERR(0, 910, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__41);
  __Pyx_GIVEREF(__pyx_tuple__41);

  /* "pygrib.pyx":912
 *         if self.has_key('stepRange'):
 *             ftime = self['stepRange'] # computed key, uses stepUnits
 *             if self.valid_key('stepType') and self['stepType'] != 'instant':             # <<<<<<<<<<<<<<
 *                 inventory.append(':fcst time %s %s (%s)'%\
 *                     (ftime,self.fcstimeunits,self.stepType))
 */
  __pyx_tuple__42 = PyTuple_Pack(1, __pyx_n_s_stepType); if (unlikely(!__pyx_tuple__42)) __PYX_ERR(0, 912, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__42);
  __Pyx_GIVEREF(__pyx_tuple__42);

  /* "pygrib.pyx":917
 *             else:
 *                 inventory.append(':fcst time %s %s'% (ftime,self.fcstimeunits))
 *         elif self.valid_key('forecastTime'):             # <<<<<<<<<<<<<<
 *             ftime = repr(self['forecastTime'])
 *             inventory.append(':fcst time %s %s'% (ftime,self.fcstimeunits))
 */
  __pyx_tuple__43 = PyTuple_Pack(1, __pyx_n_s_forecastTime); if (unlikely(!__pyx_tuple__43)) __PYX_ERR(0, 917, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__43);
  __Pyx_GIVEREF(__pyx_tuple__43);

  /* "pygrib.pyx":920
 *             ftime = repr(self['forecastTime'])
 *             inventory.append(':fcst time %s %s'% (ftime,self.fcstimeunits))
 *         if self.valid_key('dataDate') and self.valid_key('dataTime'):             # <<<<<<<<<<<<<<
 *             inventory.append(
 *             ':from '+repr(self['dataDate'])+'%04i' % self['dataTime'])
 */
  __pyx_tuple__44 = PyTuple_Pack(1, __pyx_n_s_dataDate); if (unlikely(!__pyx_tuple__44)) __PYX_ERR(0, 920, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__44);
  __Pyx_GIVEREF(__pyx_tuple__44);
  __pyx_tuple__45 = PyTuple_Pack(1, __pyx_n_s_dataTime); if (unlikely(!__pyx_tuple__45)) __PYX_ERR(0, 920, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__45);
  __Pyx_GIVEREF(__pyx_tuple__45);

  /* "pygrib.pyx":926
 *         #    inventory.append(
 *         #    ':valid '+repr(self['validityDate'])+repr(self['validityTime']))
 *         if self.valid_key('perturbationNumber') and\             # <<<<<<<<<<<<<<
 *            self.valid_key('typeOfEnsembleForecast'):
 *             ens_type = self['typeOfEnsembleForecast']
 */
  __pyx_tuple__46 = PyTuple_Pack(1, __pyx_n_s_perturbationNumber); if (unlikely(!__pyx_tuple__46)) __PYX_ERR(0, 926, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__46);
  __Pyx_GIVEREF(__pyx_tuple__46);

  /* "pygrib.pyx":927
 *         #    ':valid '+repr(self['validityDate'])+repr(self['validityTime']))
 *         if self.valid_key('perturbationNumber') and\
 *            self.valid_key('typeOfEnsembleForecast'):             # <<<<<<<<<<<<<<
 *             ens_type = self['typeOfEnsembleForecast']
 *             pert_num = self['perturbationNumber']
 */
  __pyx_tuple__47 = PyTuple_Pack(1, __pyx_n_s_typeOfEnsembleForecast); if (unlikely(!__pyx_tuple__47)) __PYX_ERR(0, 927, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__47);
  __Pyx_GIVEREF(__pyx_tuple__47);

  /* "pygrib.pyx":938
 *             elif ens_type == 3:
 *                inventory.append(":pos ens pert %d" % pert_num)
 *         if self.valid_key('derivedForecast'):             # <<<<<<<<<<<<<<
 *             if self['derivedForecast'] == 0:
 *                 inventory.append(":ens mean")
 */
  __pyx_tuple__48 = PyTuple_Pack(1, __pyx_n_s_derivedForecast); if (unlikely(!__pyx_tuple__48)) __PYX_ERR(0, 938, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__48);
  __Pyx_GIVEREF(__pyx_tuple__48);

  /* "pygrib.pyx":953
 *             elif self['derivedForecast'] == 6:
 *                 inventory.append(":ens mean of cluster")
 *         if self.valid_key('probabilityTypeName'):             # <<<<<<<<<<<<<<
 *             inventory.append(":"+self['probabilityTypeName'])
 *             lowerlim = None
 */
  __pyx_tuple__49 = PyTuple_Pack(1, __pyx_n_s_probabilityTypeName); if (unlikely(!__pyx_tuple__49)) __PYX_ERR(0, 953, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__49);
  __Pyx_GIVEREF(__pyx_tuple__49);

  /* "pygrib.pyx":956
 *             inventory.append(":"+self['probabilityTypeName'])
 *             lowerlim = None
 *             if self.valid_key('scaledValueOfLowerLimit') and\             # <<<<<<<<<<<<<<
 *                self.valid_key('scaleFactorOfLowerLimit'):
 *                if self['scaledValueOfLowerLimit'] and\
 */
  __pyx_tuple__50 = PyTuple_Pack(1, __pyx_n_s_scaledValueOfLowerLimit); if (unlikely(!__pyx_tuple__50)) __PYX_ERR(0, 956, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__50);
  __Pyx_GIVEREF(__pyx_tuple__50);

  /* "pygrib.pyx":957
 *             lowerlim = None
 *             if self.valid_key('scaledValueOfLowerLimit') and\
 *                self.valid_key('scaleFactorOfLowerLimit'):             # <<<<<<<<<<<<<<
 *                if self['scaledValueOfLowerLimit'] and\
 *                   self['scaleFactorOfLowerLimit']:
 */
  __pyx_tuple__51 = PyTuple_Pack(1, __pyx_n_s_scaleFactorOfLowerLimit); if (unlikely(!__pyx_tuple__51)) __PYX_ERR(0, 957, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__51);
  __Pyx_GIVEREF(__pyx_tuple__51);

  /* "pygrib.pyx":963
 *                               np.power(10.0,self['scaleFactorOfLowerLimit'])
 *             upperlim = None
 *             if self.valid_key('scaledValueOfUpperLimit') and\             # <<<<<<<<<<<<<<
 *                self.valid_key('scaleFactorOfUpperLimit'):
 *                if self['scaledValueOfUpperLimit'] and\
 */
  __pyx_tuple__52 = PyTuple_Pack(1, __pyx_n_s_scaledValueOfUpperLimit); if (unlikely(!__pyx_tuple__52)) __PYX_ERR(0, 963, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__52);
  __Pyx_GIVEREF(__pyx_tuple__52);

  /* "pygrib.pyx":964
 *             upperlim = None
 *             if self.valid_key('scaledValueOfUpperLimit') and\
 *                self.valid_key('scaleFactorOfUpperLimit'):             # <<<<<<<<<<<<<<
 *                if self['scaledValueOfUpperLimit'] and\
 *                   self['scaleFactorOfUpperLimit']:
 */
  __pyx_tuple__53 = PyTuple_Pack(1, __pyx_n_s_scaleFactorOfUpperLimit); if (unlikely(!__pyx_tuple__53)) __PYX_ERR(0, 964, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__53);
  __Pyx_GIVEREF(__pyx_tuple__53);

  /* "pygrib.pyx":1097
 *             reduced_expand = self['gridType'] in ['reduced_ll','reduced_gg'] and self.expand_reduced
 *             if self['gridType'] in ['regular_gg','regular_ll'] or reduced_expand:
 *                 nlats = masklat[:,0].sum()             # <<<<<<<<<<<<<<
 *                 nlons = masklon[0,:].sum()
 *                 if ma.isMA(datsubset):
 */
  __pyx_slice__54 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__54)) __PYX_ERR(0, 1097, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__54);
  __Pyx_GIVEREF(__pyx_slice__54);
  __pyx_tuple__55 = PyTuple_Pack(2, __pyx_slice__54, __pyx_int_0); if (unlikely(!__pyx_tuple__55)) __PYX_ERR(0, 1097, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__55);
  __Pyx_GIVEREF(__pyx_tuple__55);

  /* "pygrib.pyx":1098
 *             if self['gridType'] in ['regular_gg','regular_ll'] or reduced_expand:
 *                 nlats = masklat[:,0].sum()
 *                 nlons = masklon[0,:].sum()             # <<<<<<<<<<<<<<
 *                 if ma.isMA(datsubset):
 *                     datsubset = ma.reshape(datsubset,(nlats,nlons))
 */
  __pyx_slice__56 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__56)) __PYX_ERR(0, 1098, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__56);
  __Pyx_GIVEREF(__pyx_slice__56);
  __pyx_tuple__57 = PyTuple_Pack(2, __pyx_int_0, __pyx_slice__56); if (unlikely(!__pyx_tuple__57)) __PYX_ERR(0, 1098, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__57);
  __Pyx_GIVEREF(__pyx_tuple__57);

  /* "pygrib.pyx":1195
 *         bytestr = _strencode(key)
 *         name = bytestr
 *         usenceplib = key == 'values' and self.packingType.startswith('grid_complex')             # <<<<<<<<<<<<<<
 *         # this workaround only needed for grib_api < 1.9.16.
 *         if usenceplib:
 */
  __pyx_tuple__58 = PyTuple_Pack(1, __pyx_n_s_grid_complex); if (unlikely(!__pyx_tuple__58)) __PYX_ERR(0, 1195, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__58);
  __Pyx_GIVEREF(__pyx_tuple__58);

  /* "pygrib.pyx":1225
 *                 return longval
 *             else: # array
 *                 if self.has_key('jPointsAreConsecutive') and\             # <<<<<<<<<<<<<<
 *                    self['jPointsAreConsecutive']:
 *                     storageorder='F'
 */
  __pyx_tuple__59 = PyTuple_Pack(1, __pyx_n_s_jPointsAreConsecutive); if (unlikely(!__pyx_tuple__59)) __PYX_ERR(0, 1225, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__59);
  __Pyx_GIVEREF(__pyx_tuple__59);

  /* "pygrib.pyx":1245
 *                 return doubleval
 *             else: # array
 *                 if self.has_key('jPointsAreConsecutive') and\             # <<<<<<<<<<<<<<
 *                    self['jPointsAreConsecutive']:
 *                     storageorder='F'
 */
  __pyx_tuple__60 = PyTuple_Pack(1, __pyx_n_s_jPointsAreConsecutive); if (unlikely(!__pyx_tuple__60)) __PYX_ERR(0, 1245, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__60);
  __Pyx_GIVEREF(__pyx_tuple__60);

  /* "pygrib.pyx":1316
 *         bytestr = b'values'
 *         name = bytestr
 *         usenceplib = self.packingType.startswith('grid_complex')             # <<<<<<<<<<<<<<
 *         # this workaround only needed for grib_api < 1.9.16.
 *         if usenceplib:
 */
  __pyx_tuple__61 = PyTuple_Pack(1, __pyx_n_s_grid_complex); if (unlikely(!__pyx_tuple__61)) __PYX_ERR(0, 1316, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__61);
  __Pyx_GIVEREF(__pyx_tuple__61);

  /* "pygrib.pyx":1332
 *         """private method for reshaping and removing mask from "values" array"""
 *         if datarr.ndim > 2:
 *             raise ValueError('array must be 1d or 2d')             # <<<<<<<<<<<<<<
 *         # if array is masked, put in masked values and convert to plain numpy array.
 *         if ma.isMA(datarr):
 */
  __pyx_tuple__62 = PyTuple_Pack(1, __pyx_kp_s_array_must_be_1d_or_2d); if (unlikely(!__pyx_tuple__62)) __PYX_ERR(0, 1332, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__62);
  __Pyx_GIVEREF(__pyx_tuple__62);

  /* "pygrib.pyx":1337
 *             datarr = datarr.filled()
 *         # raise error is expanded reduced grid array is supplied.
 *         if self['gridType'].startswith('reduced'):             # <<<<<<<<<<<<<<
 *             if datarr.ndim != 1:
 *                 raise ValueError("reduced grid data array must be 1d")
 */
  __pyx_tuple__63 = PyTuple_Pack(1, __pyx_n_s_reduced); if (unlikely(!__pyx_tuple__63)) __PYX_ERR(0, 1337, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__63);
  __Pyx_GIVEREF(__pyx_tuple__63);

  /* "pygrib.pyx":1339
 *         if self['gridType'].startswith('reduced'):
 *             if datarr.ndim != 1:
 *                 raise ValueError("reduced grid data array must be 1d")             # <<<<<<<<<<<<<<
 *         if datarr.ndim == 2:
 *             # check scan modes for rect grids.
 */
  __pyx_tuple__64 = PyTuple_Pack(1, __pyx_kp_s_reduced_grid_data_array_must_be); if (unlikely(!__pyx_tuple__64)) __PYX_ERR(0, 1339, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__64);
  __Pyx_GIVEREF(__pyx_tuple__64);

  /* "pygrib.pyx":1354
 *             if self['alternativeRowScanning']:
 *                 datsave = datarr.copy()
 *                 datarr[1::2,::-1] = datsave[1::2,:]             # <<<<<<<<<<<<<<
 *         return datarr
 *     def _reshape_mask(self, datarr):
 */
  __pyx_slice__65 = PySlice_New(__pyx_int_1, Py_None, __pyx_int_2); if (unlikely(!__pyx_slice__65)) __PYX_ERR(0, 1354, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__65);
  __Pyx_GIVEREF(__pyx_slice__65);
  __pyx_slice__66 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__66)) __PYX_ERR(0, 1354, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__66);
  __Pyx_GIVEREF(__pyx_slice__66);
  __pyx_tuple__67 = PyTuple_Pack(2, __pyx_slice__65, __pyx_slice__66); if (unlikely(!__pyx_tuple__67)) __PYX_ERR(0, 1354, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__67);
  __Pyx_GIVEREF(__pyx_tuple__67);
  __pyx_slice__68 = PySlice_New(__pyx_int_1, Py_None, __pyx_int_2); if (unlikely(!__pyx_slice__68)) __PYX_ERR(0, 1354, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__68);
  __Pyx_GIVEREF(__pyx_slice__68);
  __pyx_slice__69 = PySlice_New(Py_None, Py_None, __pyx_int_neg_1); if (unlikely(!__pyx_slice__69)) __PYX_ERR(0, 1354, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__69);
  __Pyx_GIVEREF(__pyx_slice__69);
  __pyx_tuple__70 = PyTuple_Pack(2, __pyx_slice__68, __pyx_slice__69); if (unlikely(!__pyx_tuple__70)) __PYX_ERR(0, 1354, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__70);
  __Pyx_GIVEREF(__pyx_tuple__70);

  /* "pygrib.pyx":1361
 *         from redtoreg import _redtoreg
 *         if datarr.ndim > 2:
 *             raise ValueError('array must be 1d or 2d')             # <<<<<<<<<<<<<<
 *         # reduced grid.
 *         if self['gridType'].startswith('reduced'):
 */
  __pyx_tuple__71 = PyTuple_Pack(1, __pyx_kp_s_array_must_be_1d_or_2d); if (unlikely(!__pyx_tuple__71)) __PYX_ERR(0, 1361, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__71);
  __Pyx_GIVEREF(__pyx_tuple__71);

  /* "pygrib.pyx":1363
 *             raise ValueError('array must be 1d or 2d')
 *         # reduced grid.
 *         if self['gridType'].startswith('reduced'):             # <<<<<<<<<<<<<<
 *             try:
 *                 ny = self['Ny']
 */
  __pyx_tuple__72 = PyTuple_Pack(1, __pyx_n_s_reduced); if (unlikely(!__pyx_tuple__72)) __PYX_ERR(0, 1363, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__72);
  __Pyx_GIVEREF(__pyx_tuple__72);

  /* "pygrib.pyx":1368
 *             except:
 *                 ny = self['Nj']
 *             if self.has_key('missingValue'):             # <<<<<<<<<<<<<<
 *                 missval = self['missingValue']
 *             else:
 */
  __pyx_tuple__73 = PyTuple_Pack(1, __pyx_n_s_missingValue); if (unlikely(!__pyx_tuple__73)) __PYX_ERR(0, 1368, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__73);
  __Pyx_GIVEREF(__pyx_tuple__73);

  /* "pygrib.pyx":1377
 *             else:
 *                 nx = None
 *         elif self.has_key('Nx') and self.has_key('Ny'):             # <<<<<<<<<<<<<<
 *             nx = self['Nx']
 *             ny = self['Ny']
 */
  __pyx_tuple__74 = PyTuple_Pack(1, __pyx_n_s_Nx); if (unlikely(!__pyx_tuple__74)) __PYX_ERR(0, 1377, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__74);
  __Pyx_GIVEREF(__pyx_tuple__74);
  __pyx_tuple__75 = PyTuple_Pack(1, __pyx_n_s_Ny); if (unlikely(!__pyx_tuple__75)) __PYX_ERR(0, 1377, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__75);
  __Pyx_GIVEREF(__pyx_tuple__75);

  /* "pygrib.pyx":1381
 *             ny = self['Ny']
 *         # key renamed from Ni to Nx in grib_api 1.8.0.1
 *         elif self.has_key('Ni') and self.has_key('Nj'):             # <<<<<<<<<<<<<<
 *             nx = self['Ni']
 *             ny = self['Nj']
 */
  __pyx_tuple__76 = PyTuple_Pack(1, __pyx_n_s_Ni); if (unlikely(!__pyx_tuple__76)) __PYX_ERR(0, 1381, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__76);
  __Pyx_GIVEREF(__pyx_tuple__76);
  __pyx_tuple__77 = PyTuple_Pack(1, __pyx_n_s_Nj); if (unlikely(!__pyx_tuple__77)) __PYX_ERR(0, 1381, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__77);
  __Pyx_GIVEREF(__pyx_tuple__77);

  /* "pygrib.pyx":1403
 *            if self['alternativeRowScanning']:
 *                datsave = datarr.copy()
 *                datarr[1::2,:] = datsave[1::2,::-1]             # <<<<<<<<<<<<<<
 *            # if there is a missingValue, and some values missing,
 *            # create a masked array.
 */
  __pyx_slice__78 = PySlice_New(__pyx_int_1, Py_None, __pyx_int_2); if (unlikely(!__pyx_slice__78)) __PYX_ERR(0, 1403, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__78);
  __Pyx_GIVEREF(__pyx_slice__78);
  __pyx_slice__79 = PySlice_New(Py_None, Py_None, __pyx_int_neg_1); if (unlikely(!__pyx_slice__79)) __PYX_ERR(0, 1403, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__79);
  __Pyx_GIVEREF(__pyx_slice__79);
  __pyx_tuple__80 = PyTuple_Pack(2, __pyx_slice__78, __pyx_slice__79); if (unlikely(!__pyx_tuple__80)) __PYX_ERR(0, 1403, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__80);
  __Pyx_GIVEREF(__pyx_tuple__80);
  __pyx_slice__81 = PySlice_New(__pyx_int_1, Py_None, __pyx_int_2); if (unlikely(!__pyx_slice__81)) __PYX_ERR(0, 1403, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__81);
  __Pyx_GIVEREF(__pyx_slice__81);
  __pyx_slice__82 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__82)) __PYX_ERR(0, 1403, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__82);
  __Pyx_GIVEREF(__pyx_slice__82);
  __pyx_tuple__83 = PyTuple_Pack(2, __pyx_slice__81, __pyx_slice__82); if (unlikely(!__pyx_tuple__83)) __PYX_ERR(0, 1403, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__83);
  __Pyx_GIVEREF(__pyx_tuple__83);

  /* "pygrib.pyx":1406
 *            # if there is a missingValue, and some values missing,
 *            # create a masked array.
 *            if self.has_key('missingValue') and self['numberOfMissing']:             # <<<<<<<<<<<<<<
 *                datarr = ma.masked_values(datarr, self['missingValue'])
 *         return datarr
 */
  __pyx_tuple__84 = PyTuple_Pack(1, __pyx_n_s_missingValue); if (unlikely(!__pyx_tuple__84)) __PYX_ERR(0, 1406, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__84);
  __Pyx_GIVEREF(__pyx_tuple__84);

  /* "pygrib.pyx":1419
 *         # check for radius key, if it exists just use it
 *         # and don't bother with shapeOfTheEarth
 *         if self.has_key('radius'):             # <<<<<<<<<<<<<<
 *             projparams['a'] = self['radius']
 *             projparams['b'] = self['radius']
 */
  __pyx_tuple__85 = PyTuple_Pack(1, __pyx_n_s_radius); if (unlikely(!__pyx_tuple__85)) __PYX_ERR(0, 1419, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__85);
  __Pyx_GIVEREF(__pyx_tuple__85);

  /* "pygrib.pyx":1427
 *                 projparams['b']=6371229.0
 *             elif self['shapeOfTheEarth'] in [3,7]:
 *                 if self.has_key('scaleFactorOfMajorAxisOfOblateSpheroidEarth'):             # <<<<<<<<<<<<<<
 *                     scalea = self['scaleFactorOfMajorAxisOfOblateSpheroidEarth']
 *                     scaleb = self['scaleFactorOfMinorAxisOfOblateSpheroidEarth']
 */
  __pyx_tuple__86 = PyTuple_Pack(1, __pyx_n_s_scaleFactorOfMajorAxisOfOblateSp); if (unlikely(!__pyx_tuple__86)) __PYX_ERR(0, 1427, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__86);
  __Pyx_GIVEREF(__pyx_tuple__86);

  /* "pygrib.pyx":1445
 *                     scalea = 1.
 *                     scaleb = 1.
 *                 if parse_version(grib_api_version) < parse_version('1.9.0'):             # <<<<<<<<<<<<<<
 *                     projparams['a']=self['scaledValueOfMajorAxisOfOblateSpheroidEarth']*scalea
 *                     projparams['b']=self['scaledValueOfMinorAxisOfOblateSpheroidEarth']*scaleb
 */
  __pyx_tuple__87 = PyTuple_Pack(1, __pyx_kp_s_1_9_0); if (unlikely(!__pyx_tuple__87)) __PYX_ERR(0, 1445, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__87);
  __Pyx_GIVEREF(__pyx_tuple__87);

  /* "pygrib.pyx":1455
 *                 projparams['b']=6356775.0
 *             elif self['shapeOfTheEarth'] == 1:
 *                 if self.has_key('scaleFactorOfRadiusOfSphericalEarth'):             # <<<<<<<<<<<<<<
 *                     scalea = self['scaleFactorOfRadiusOfSphericalEarth']
 *                     if scalea and scalea is not missingvalue_int:
 */
  __pyx_tuple__88 = PyTuple_Pack(1, __pyx_n_s_scaleFactorOfRadiusOfSphericalEa); if (unlikely(!__pyx_tuple__88)) __PYX_ERR(0, 1455, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__88);
  __Pyx_GIVEREF(__pyx_tuple__88);

  /* "pygrib.pyx":1477
 *                 projparams['b']=6371200.0
 *             else:
 *                 if not tolerate_badgrib: raise ValueError('unknown shape of the earth flag')             # <<<<<<<<<<<<<<
 * 
 *         if self['gridType'] in ['reduced_gg','reduced_ll','regular_gg','regular_ll']: # regular lat/lon grid
 */
  __pyx_tuple__89 = PyTuple_Pack(1, __pyx_kp_s_unknown_shape_of_the_earth_flag); if (unlikely(!__pyx_tuple__89)) __PYX_ERR(0, 1477, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__89);
  __Pyx_GIVEREF(__pyx_tuple__89);

  /* "pygrib.pyx":1484
 *             projparams['proj']='stere'
 *             projparams['lat_ts']=self['latitudeWhereDxAndDyAreSpecifiedInDegrees']
 *             if self.has_key('projectionCentreFlag'):             # <<<<<<<<<<<<<<
 *                 projcenterflag = self['projectionCentreFlag']
 *             elif self.has_key('projectionCenterFlag'):
 */
  __pyx_tuple__90 = PyTuple_Pack(1, __pyx_n_s_projectionCentreFlag); if (unlikely(!__pyx_tuple__90)) __PYX_ERR(0, 1484, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__90);
  __Pyx_GIVEREF(__pyx_tuple__90);

  /* "pygrib.pyx":1486
 *             if self.has_key('projectionCentreFlag'):
 *                 projcenterflag = self['projectionCentreFlag']
 *             elif self.has_key('projectionCenterFlag'):             # <<<<<<<<<<<<<<
 *                 projcenterflag = self['projectionCenterFlag']
 *             else:
 */
  __pyx_tuple__91 = PyTuple_Pack(1, __pyx_n_s_projectionCenterFlag); if (unlikely(!__pyx_tuple__91)) __PYX_ERR(0, 1486, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__91);
  __Pyx_GIVEREF(__pyx_tuple__91);

  /* "pygrib.pyx":1489
 *                 projcenterflag = self['projectionCenterFlag']
 *             else:
 *                 if not tolerate_badgrib: raise KeyError('cannot find projection center flag')             # <<<<<<<<<<<<<<
 *             if projcenterflag == 0:
 *                 projparams['lat_0']=90.
 */
  __pyx_tuple__92 = PyTuple_Pack(1, __pyx_kp_s_cannot_find_projection_center_fl); if (unlikely(!__pyx_tuple__92)) __PYX_ERR(0, 1489, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__92);
  __Pyx_GIVEREF(__pyx_tuple__92);

  /* "pygrib.pyx":1537
 *             projparams['proj'] = 'laea'
 *         elif self['gridType'] == 'mercator':
 *             scale = self._get_key('grib2divider',False)             # <<<<<<<<<<<<<<
 *             if scale:
 *                 scale = float(scale)
 */
  __pyx_tuple__93 = PyTuple_Pack(2, __pyx_n_s_grib2divider, Py_False); if (unlikely(!__pyx_tuple__93)) __PYX_ERR(0, 1537, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__93);
  __Pyx_GIVEREF(__pyx_tuple__93);

  /* "pygrib.pyx":1544
 *             lon1 = self['longitudeOfFirstGridPoint']/scale
 *             lon2 = self['longitudeOfLastGridPoint']/scale
 *             if self._get_key('truncateDegrees',False):             # <<<<<<<<<<<<<<
 *                 lon1 = int(lon1)
 *                 lon2 = int(lon2)
 */
  __pyx_tuple__94 = PyTuple_Pack(2, __pyx_n_s_truncateDegrees, Py_False); if (unlikely(!__pyx_tuple__94)) __PYX_ERR(0, 1544, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__94);
  __Pyx_GIVEREF(__pyx_tuple__94);

  /* "pygrib.pyx":1547
 *                 lon1 = int(lon1)
 *                 lon2 = int(lon2)
 *             if self._get_key('LaD',False):             # <<<<<<<<<<<<<<
 *                 projparams['lat_ts'] = self['LaD']/scale
 *             else:
 */
  __pyx_tuple__95 = PyTuple_Pack(2, __pyx_n_s_LaD, Py_False); if (unlikely(!__pyx_tuple__95)) __PYX_ERR(0, 1547, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__95);
  __Pyx_GIVEREF(__pyx_tuple__95);

  /* "pygrib.pyx":1598
 *             # (distinctLongitudes, distinctLatitudes throws error,
 *             #  so use np.linspace to define values)
 *             if self.packingType.startswith('grid_complex'):             # <<<<<<<<<<<<<<
 *                 # this is not strictly correct for gaussian grids,
 *                 # but the error is very small.
 */
  __pyx_tuple__96 = PyTuple_Pack(1, __pyx_n_s_grid_complex); if (unlikely(!__pyx_tuple__96)) __PYX_ERR(0, 1598, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__96);
  __Pyx_GIVEREF(__pyx_tuple__96);

  /* "pygrib.pyx":1605
 *             else:
 *                 lats = self['distinctLatitudes']
 *                 if lat2 < lat1 and lats[-1] > lats[0]: lats = lats[::-1]             # <<<<<<<<<<<<<<
 *                 lons = self['distinctLongitudes']
 *             # don't trust distinctLongitudes
 */
  __pyx_slice__97 = PySlice_New(Py_None, Py_None, __pyx_int_neg_1); if (unlikely(!__pyx_slice__97)) __PYX_ERR(0, 1605, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__97);
  __Pyx_GIVEREF(__pyx_slice__97);

  /* "pygrib.pyx":1618
 *                 lat2 = self['latitudeOfLastGridPointInDegrees']
 *                 lats = self['distinctLatitudes']
 *                 if lat2 < lat1 and lats[-1] > lats[0]: lats = lats[::-1]             # <<<<<<<<<<<<<<
 *                 ny = self['Nj']
 *                 nx = 2*ny
 */
  __pyx_slice__98 = PySlice_New(Py_None, Py_None, __pyx_int_neg_1); if (unlikely(!__pyx_slice__98)) __PYX_ERR(0, 1618, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__98);
  __Pyx_GIVEREF(__pyx_slice__98);

  /* "pygrib.pyx":1712
 *             if self.projparams['proj'] == 'nsper' and \
 *                self.projparams['a'] != self.projparams['b']:
 *                 raise ValueError('unsupported grid - earth not a perfect sphere')             # <<<<<<<<<<<<<<
 *             scale = float(self['grib2divider'])
 *             # latitude of horizon on central meridian
 */
  __pyx_tuple__99 = PyTuple_Pack(1, __pyx_kp_s_unsupported_grid_earth_not_a_per); if (unlikely(!__pyx_tuple__99)) __PYX_ERR(0, 1712, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__99);
  __Pyx_GIVEREF(__pyx_tuple__99);

  /* "pygrib.pyx":1774
 *             lons, lats = pj(x, y, inverse=True)
 *         elif self['gridType'] == 'mercator':
 *             scale = self._get_key('grib2divider',False)             # <<<<<<<<<<<<<<
 *             if scale:
 *                 scale = float(scale)
 */
  __pyx_tuple__100 = PyTuple_Pack(2, __pyx_n_s_grib2divider, Py_False); if (unlikely(!__pyx_tuple__100)) __PYX_ERR(0, 1774, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__100);
  __Pyx_GIVEREF(__pyx_tuple__100);

  /* "pygrib.pyx":1781
 *             lon1 = self['longitudeOfFirstGridPoint']/scale
 *             lon2 = self['longitudeOfLastGridPoint']/scale
 *             if self._get_key('truncateDegrees',False):             # <<<<<<<<<<<<<<
 *                 lon1 = int(lon1)
 *                 lon2 = int(lon2)
 */
  __pyx_tuple__101 = PyTuple_Pack(2, __pyx_n_s_truncateDegrees, Py_False); if (unlikely(!__pyx_tuple__101)) __PYX_ERR(0, 1781, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__101);
  __Pyx_GIVEREF(__pyx_tuple__101);

  /* "pygrib.pyx":1786
 *             lat1 = self['latitudeOfFirstGridPoint']/scale
 *             lat2 = self['latitudeOfLastGridPoint']/scale
 *             if self._get_key('truncateDegrees',False):             # <<<<<<<<<<<<<<
 *                 lat1 = int(lat1)
 *                 lat2 = int(lat2)
 */
  __pyx_tuple__102 = PyTuple_Pack(2, __pyx_n_s_truncateDegrees, Py_False); if (unlikely(!__pyx_tuple__102)) __PYX_ERR(0, 1786, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__102);
  __Pyx_GIVEREF(__pyx_tuple__102);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("self._gh cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self._gh cannot be converted to a Python object for pickling")
 */
  __pyx_tuple__103 = PyTuple_Pack(1, __pyx_kp_s_self__gh_cannot_be_converted_to); if (unlikely(!__pyx_tuple__103)) __PYX_ERR(1, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__103);
  __Pyx_GIVEREF(__pyx_tuple__103);

  /* "(tree fragment)":4
 *     raise TypeError("self._gh cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self._gh cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 */
  __pyx_tuple__104 = PyTuple_Pack(1, __pyx_kp_s_self__gh_cannot_be_converted_to); if (unlikely(!__pyx_tuple__104)) __PYX_ERR(1, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__104);
  __Pyx_GIVEREF(__pyx_tuple__104);

  /* "pygrib.pyx":1904
 *         if args != ():
 *             # is type is specified, strip it off.
 *             keys = [arg.split(':')[0] for arg in args]             # <<<<<<<<<<<<<<
 *             # if type is declared, save it (None if not declared)
 *             types = []
 */
  __pyx_tuple__106 = PyTuple_Pack(1, __pyx_kp_s__20); if (unlikely(!__pyx_tuple__106)) __PYX_ERR(0, 1904, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__106);
  __Pyx_GIVEREF(__pyx_tuple__106);

  /* "pygrib.pyx":1909
 *             for arg in args:
 *                 try:
 *                     type = arg.split(':')[1]             # <<<<<<<<<<<<<<
 *                 except IndexError:
 *                     type = None
 */
  __pyx_tuple__107 = PyTuple_Pack(1, __pyx_kp_s__20); if (unlikely(!__pyx_tuple__107)) __PYX_ERR(0, 1909, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__107);
  __Pyx_GIVEREF(__pyx_tuple__107);

  /* "pygrib.pyx":1955
 *         for k,v in kwargs.items():
 *             if self.keys is not None and k not in self.keys:
 *                 raise KeyError('key not part of grib index')             # <<<<<<<<<<<<<<
 *             if self.types is not None:
 *                 typ = self.types[self.keys.index(k)]
 */
  __pyx_tuple__108 = PyTuple_Pack(1, __pyx_kp_s_key_not_part_of_grib_index); if (unlikely(!__pyx_tuple__108)) __PYX_ERR(0, 1955, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__108);
  __Pyx_GIVEREF(__pyx_tuple__108);

  /* "pygrib.pyx":1986
 *                     raise RuntimeError(grib_get_error_message(err))
 *             else:
 *                 raise TypeError('value must be float, int or string')             # <<<<<<<<<<<<<<
 *         # if no matches found, raise an error.
 *         if sizetot == 0:
 */
  __pyx_tuple__109 = PyTuple_Pack(1, __pyx_kp_s_value_must_be_float_int_or_strin); if (unlikely(!__pyx_tuple__109)) __PYX_ERR(0, 1986, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__109);
  __Pyx_GIVEREF(__pyx_tuple__109);

  /* "pygrib.pyx":1989
 *         # if no matches found, raise an error.
 *         if sizetot == 0:
 *             raise ValueError('no matches found')             # <<<<<<<<<<<<<<
 *         # create a list of grib messages corresponding to selection.
 *         messagenumber = 0; grbs = []
 */
  __pyx_tuple__110 = PyTuple_Pack(1, __pyx_kp_s_no_matches_found); if (unlikely(!__pyx_tuple__110)) __PYX_ERR(0, 1989, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__110);
  __Pyx_GIVEREF(__pyx_tuple__110);

  /* "pygrib.pyx":2003
 *                 raise RuntimeError(grib_get_error_message(err))
 *         if not grbs:
 *             raise ValueError('no matches found')             # <<<<<<<<<<<<<<
 *         # return the list of grib messages.
 *         return grbs
 */
  __pyx_tuple__111 = PyTuple_Pack(1, __pyx_kp_s_no_matches_found); if (unlikely(!__pyx_tuple__111)) __PYX_ERR(0, 2003, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__111);
  __Pyx_GIVEREF(__pyx_tuple__111);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 */
  __pyx_tuple__112 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__112)) __PYX_ERR(1, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__112);
  __Pyx_GIVEREF(__pyx_tuple__112);

  /* "(tree fragment)":4
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
 */
  __pyx_tuple__113 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__113)) __PYX_ERR(1, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__113);
  __Pyx_GIVEREF(__pyx_tuple__113);

  /* "pygrib.pyx":185
 *         from mpl_toolkits.basemap import pyproj
 *     except:
 *         raise ImportError("either pyproj or basemap required")             # <<<<<<<<<<<<<<
 * from ncepgrib2 import Grib2Decode
 * import_array()
 */
  __pyx_tuple__114 = PyTuple_Pack(1, __pyx_kp_s_either_pyproj_or_basemap_require); if (unlikely(!__pyx_tuple__114)) __PYX_ERR(0, 185, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__114);
  __Pyx_GIVEREF(__pyx_tuple__114);

  /* "pygrib.pyx":299
 * #missingvalue_float = GRIB_MISSING_DOUBLE
 * missingvalue_float = -1.e100 # value given in grib_api.h version 1.90
 * def _get_grib_api_version():             # <<<<<<<<<<<<<<
 *     div = lambda v,d: (v/d,v%d)
 *     v = grib_get_api_version()
 */
  __pyx_tuple__115 = PyTuple_Pack(5, __pyx_n_s_div, __pyx_n_s_v, __pyx_n_s_revision, __pyx_n_s_minor, __pyx_n_s_major); if (unlikely(!__pyx_tuple__115)) __PYX_ERR(0, 299, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__115);
  __Pyx_GIVEREF(__pyx_tuple__115);
  __pyx_codeobj__116 = (PyObject*)__Pyx_PyCode_New(0, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__115, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pygrib_pyx, __pyx_n_s_get_grib_api_version, 299, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__116)) __PYX_ERR(0, 299, __pyx_L1_error)

  /* "pygrib.pyx":309
 * tolerate_badgrib = False
 * 
 * def tolerate_badgrib_on():             # <<<<<<<<<<<<<<
 *     """
 *     don't raise an exception when a missing or malformed key is encountered.
 */
  __pyx_codeobj__117 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pygrib_pyx, __pyx_n_s_tolerate_badgrib_on, 309, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__117)) __PYX_ERR(0, 309, __pyx_L1_error)

  /* "pygrib.pyx":316
 *     tolerate_badgrib = True
 * 
 * def tolerate_badgrib_off():             # <<<<<<<<<<<<<<
 *     """
 *     raise an exception when a missing or malformed key is encountered
 */
  __pyx_codeobj__118 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pygrib_pyx, __pyx_n_s_tolerate_badgrib_off, 316, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__118)) __PYX_ERR(0, 316, __pyx_L1_error)

  /* "pygrib.pyx":324
 *     tolerate_badgrib = False
 * 
 * def gaulats(object nlats):             # <<<<<<<<<<<<<<
 *     """
 *     gaulats(nlats)
 */
  __pyx_tuple__119 = PyTuple_Pack(2, __pyx_n_s_nlats, __pyx_n_s_lats); if (unlikely(!__pyx_tuple__119)) __PYX_ERR(0, 324, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__119);
  __Pyx_GIVEREF(__pyx_tuple__119);
  __pyx_codeobj__120 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__119, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pygrib_pyx, __pyx_n_s_gaulats, 324, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__120)) __PYX_ERR(0, 324, __pyx_L1_error)

  /* "pygrib.pyx":355
 * grib_multi_support_on(NULL)
 * 
 * def multi_support_on():             # <<<<<<<<<<<<<<
 *     """turn on support for multi-field grib messages (default)"""
 *     grib_multi_support_on(NULL)
 */
  __pyx_codeobj__121 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pygrib_pyx, __pyx_n_s_multi_support_on, 355, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__121)) __PYX_ERR(0, 355, __pyx_L1_error)

  /* "pygrib.pyx":359
 *     grib_multi_support_on(NULL)
 * 
 * def multi_support_off():             # <<<<<<<<<<<<<<
 *     """turn off support for multi-field grib messages"""
 *     grib_multi_support_off(NULL)
 */
  __pyx_codeobj__122 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pygrib_pyx, __pyx_n_s_multi_support_off, 359, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__122)) __PYX_ERR(0, 359, __pyx_L1_error)

  /* "pygrib.pyx":638
 * ['_gh','fcstimeunits','expand_reduced','projparams','messagenumber','_all_keys','_ro_keys']
 * 
 * def julian_to_datetime(object jd):             # <<<<<<<<<<<<<<
 *     """
 *     julian_to_datetime(julday)
 */
  __pyx_tuple__123 = PyTuple_Pack(9, __pyx_n_s_jd, __pyx_n_s_julday, __pyx_n_s_year, __pyx_n_s_month, __pyx_n_s_day, __pyx_n_s_hour, __pyx_n_s_minute, __pyx_n_s_second, __pyx_n_s_err); if (unlikely(!__pyx_tuple__123)) __PYX_ERR(0, 638, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__123);
  __Pyx_GIVEREF(__pyx_tuple__123);
  __pyx_codeobj__124 = (PyObject*)__Pyx_PyCode_New(1, 0, 9, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__123, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pygrib_pyx, __pyx_n_s_julian_to_datetime, 638, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__124)) __PYX_ERR(0, 638, __pyx_L1_error)

  /* "pygrib.pyx":655
 *     return datetime(year, month, day, hour, minute, second)
 * 
 * def datetime_to_julian(object d):             # <<<<<<<<<<<<<<
 *     """
 *     datetime_to_julian(date)
 */
  __pyx_tuple__125 = PyTuple_Pack(9, __pyx_n_s_d, __pyx_n_s_julday, __pyx_n_s_err, __pyx_n_s_year, __pyx_n_s_month, __pyx_n_s_day, __pyx_n_s_hour, __pyx_n_s_minute, __pyx_n_s_second); if (unlikely(!__pyx_tuple__125)) __PYX_ERR(0, 655, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__125);
  __Pyx_GIVEREF(__pyx_tuple__125);
  __pyx_codeobj__126 = (PyObject*)__Pyx_PyCode_New(1, 0, 9, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__125, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pygrib_pyx, __pyx_n_s_datetime_to_julian, 655, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__126)) __PYX_ERR(0, 655, __pyx_L1_error)

  /* "pygrib.pyx":681
 *     return setdates(grb)
 * 
 * def fromstring(gribstring):             # <<<<<<<<<<<<<<
 *     """
 *     fromstring(string)
 */
  __pyx_tuple__127 = PyTuple_Pack(4, __pyx_n_s_gribstring, __pyx_n_s_gribstr, __pyx_n_s_gh_2, __pyx_n_s_grb); if (unlikely(!__pyx_tuple__127)) __PYX_ERR(0, 681, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__127);
  __Pyx_GIVEREF(__pyx_tuple__127);
  __pyx_codeobj__128 = (PyObject*)__Pyx_PyCode_New(1, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__127, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pygrib_pyx, __pyx_n_s_fromstring, 681, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__128)) __PYX_ERR(0, 681, __pyx_L1_error)

  /* "pygrib.pyx":702
 *     return setdates(grb)
 * 
 * def setdates(gribmessage grb):             # <<<<<<<<<<<<<<
 *     """
 *     setdates(grb)
 */
  __pyx_tuple__129 = PyTuple_Pack(2, __pyx_n_s_grb, __pyx_n_s_ftime); if (unlikely(!__pyx_tuple__129)) __PYX_ERR(0, 702, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__129);
  __Pyx_GIVEREF(__pyx_tuple__129);
  __pyx_codeobj__130 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__129, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pygrib_pyx, __pyx_n_s_setdates, 702, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__130)) __PYX_ERR(0, 702, __pyx_L1_error)

  /* "pygrib.pyx":781
 *     return grb
 * 
 * def reload(gribmessage grb):             # <<<<<<<<<<<<<<
 *     """
 *     reload(grb)
 */
  __pyx_tuple__131 = PyTuple_Pack(1, __pyx_n_s_grb); if (unlikely(!__pyx_tuple__131)) __PYX_ERR(0, 781, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__131);
  __Pyx_GIVEREF(__pyx_tuple__131);
  __pyx_codeobj__132 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__131, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pygrib_pyx, __pyx_n_s_reload, 781, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__132)) __PYX_ERR(0, 781, __pyx_L1_error)

  /* "pygrib.pyx":2031
 *             grib_index_delete(self._gi)
 * 
 * def _is_stringlike(a):             # <<<<<<<<<<<<<<
 *     if type(a) == str or type(a) == bytes or type(a) == unicode:
 *         return True
 */
  __pyx_tuple__133 = PyTuple_Pack(1, __pyx_n_s_a); if (unlikely(!__pyx_tuple__133)) __PYX_ERR(0, 2031, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__133);
  __Pyx_GIVEREF(__pyx_tuple__133);
  __pyx_codeobj__134 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__133, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pygrib_pyx, __pyx_n_s_is_stringlike, 2031, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__134)) __PYX_ERR(0, 2031, __pyx_L1_error)

  /* "pygrib.pyx":2037
 *         return False
 * 
 * def _is_container(a):             # <<<<<<<<<<<<<<
 *     # is object container-like?  (can test for
 *     # membership with "is in", but not a string)
 */
  __pyx_tuple__135 = PyTuple_Pack(1, __pyx_n_s_a); if (unlikely(!__pyx_tuple__135)) __PYX_ERR(0, 2037, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__135);
  __Pyx_GIVEREF(__pyx_tuple__135);
  __pyx_codeobj__136 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__135, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pygrib_pyx, __pyx_n_s_is_container, 2037, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__136)) __PYX_ERR(0, 2037, __pyx_L1_error)

  /* "pygrib.pyx":2045
 *     return True
 * 
 * def _find(grb, **kwargs):             # <<<<<<<<<<<<<<
 *     # search for key/value matches in grib message.
 *     # If value is a container-like object, search for matches to any element.
 */
  __pyx_tuple__137 = PyTuple_Pack(6, __pyx_n_s_grb, __pyx_n_s_kwargs, __pyx_n_s_k, __pyx_n_s_v, __pyx_n_s_iscontainer, __pyx_n_s_iscallable); if (unlikely(!__pyx_tuple__137)) __PYX_ERR(0, 2045, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__137);
  __Pyx_GIVEREF(__pyx_tuple__137);
  __pyx_codeobj__138 = (PyObject*)__Pyx_PyCode_New(1, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_VARKEYWORDS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__137, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pygrib_pyx, __pyx_n_s_find, 2045, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__138)) __PYX_ERR(0, 2045, __pyx_L1_error)
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_RefNannyFinishContext();
  return -1;
}

static int __Pyx_InitGlobals(void) {
  __pyx_umethod_PyDict_Type_items.type = (PyObject*)&PyDict_Type;
  if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
  __pyx_float_0_ = PyFloat_FromDouble(0.); if (unlikely(!__pyx_float_0_)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_float_1_ = PyFloat_FromDouble(1.); if (unlikely(!__pyx_float_1_)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_float_2_ = PyFloat_FromDouble(2.); if (unlikely(!__pyx_float_2_)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_float_4_ = PyFloat_FromDouble(4.); if (unlikely(!__pyx_float_4_)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_float_8_ = PyFloat_FromDouble(8.); if (unlikely(!__pyx_float_8_)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_float_0_5 = PyFloat_FromDouble(0.5); if (unlikely(!__pyx_float_0_5)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_float_24_ = PyFloat_FromDouble(24.); if (unlikely(!__pyx_float_24_)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_float_90_ = PyFloat_FromDouble(90.); if (unlikely(!__pyx_float_90_)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_float_1_e3 = PyFloat_FromDouble(1.e3); if (unlikely(!__pyx_float_1_e3)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_float_1_e6 = PyFloat_FromDouble(1.e6); if (unlikely(!__pyx_float_1_e6)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_float_10_0 = PyFloat_FromDouble(10.0); if (unlikely(!__pyx_float_10_0)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_float_180_ = PyFloat_FromDouble(180.); if (unlikely(!__pyx_float_180_)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_float_360_ = PyFloat_FromDouble(360.); if (unlikely(!__pyx_float_360_)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_float_1_e20 = PyFloat_FromDouble(1.e20); if (unlikely(!__pyx_float_1_e20)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_float_1_e30 = PyFloat_FromDouble(1.e30); if (unlikely(!__pyx_float_1_e30)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_float_1000_ = PyFloat_FromDouble(1000.); if (unlikely(!__pyx_float_1000_)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_float_1440_ = PyFloat_FromDouble(1440.); if (unlikely(!__pyx_float_1440_)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_float_86400_ = PyFloat_FromDouble(86400.); if (unlikely(!__pyx_float_86400_)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_float_6356775_0 = PyFloat_FromDouble(6356775.0); if (unlikely(!__pyx_float_6356775_0)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_float_6367470_0 = PyFloat_FromDouble(6367470.0); if (unlikely(!__pyx_float_6367470_0)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_float_6371200_0 = PyFloat_FromDouble(6371200.0); if (unlikely(!__pyx_float_6371200_0)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_float_6371229_0 = PyFloat_FromDouble(6371229.0); if (unlikely(!__pyx_float_6371229_0)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_float_6378137_0 = PyFloat_FromDouble(6378137.0); if (unlikely(!__pyx_float_6378137_0)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_float_6378160_0 = PyFloat_FromDouble(6378160.0); if (unlikely(!__pyx_float_6378160_0)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_float_6356752_3142 = PyFloat_FromDouble(6356752.3142); if (unlikely(!__pyx_float_6356752_3142)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_float_neg_0_5 = PyFloat_FromDouble(-0.5); if (unlikely(!__pyx_float_neg_0_5)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_float_neg_90_ = PyFloat_FromDouble(-90.); if (unlikely(!__pyx_float_neg_90_)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_float_neg_1_e100 = PyFloat_FromDouble(-1.e100); if (unlikely(!__pyx_float_neg_1_e100)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_2 = PyInt_FromLong(2); if (unlikely(!__pyx_int_2)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_3 = PyInt_FromLong(3); if (unlikely(!__pyx_int_3)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_4 = PyInt_FromLong(4); if (unlikely(!__pyx_int_4)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_5 = PyInt_FromLong(5); if (unlikely(!__pyx_int_5)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_6 = PyInt_FromLong(6); if (unlikely(!__pyx_int_6)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_7 = PyInt_FromLong(7); if (unlikely(!__pyx_int_7)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_8 = PyInt_FromLong(8); if (unlikely(!__pyx_int_8)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_100 = PyInt_FromLong(100); if (unlikely(!__pyx_int_100)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_255 = PyInt_FromLong(255); if (unlikely(!__pyx_int_255)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_360 = PyInt_FromLong(360); if (unlikely(!__pyx_int_360)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_1000 = PyInt_FromLong(1000); if (unlikely(!__pyx_int_1000)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_int_neg_1)) __PYX_ERR(0, 1, __pyx_L1_error)
  return 0;
  __pyx_L1_error:;
  return -1;
}

static int __Pyx_modinit_global_init_code(void); /*proto*/
static int __Pyx_modinit_variable_export_code(void); /*proto*/
static int __Pyx_modinit_function_export_code(void); /*proto*/
static int __Pyx_modinit_type_init_code(void); /*proto*/
static int __Pyx_modinit_type_import_code(void); /*proto*/
static int __Pyx_modinit_variable_import_code(void); /*proto*/
static int __Pyx_modinit_function_import_code(void); /*proto*/

static int __Pyx_modinit_global_init_code(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0);
  /*--- Global init code ---*/
  __Pyx_RefNannyFinishContext();
  return 0;
}

static int __Pyx_modinit_variable_export_code(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0);
  /*--- Variable export code ---*/
  __Pyx_RefNannyFinishContext();
  return 0;
}

static int __Pyx_modinit_function_export_code(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0);
  /*--- Function export code ---*/
  __Pyx_RefNannyFinishContext();
  return 0;
}

static int __Pyx_modinit_type_init_code(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0);
  /*--- Type init code ---*/
  __pyx_ptype_6pygrib_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject), 0); if (unlikely(!__pyx_ptype_6pygrib_ndarray)) __PYX_ERR(0, 207, __pyx_L1_error)
  if (PyType_Ready(&__pyx_type_6pygrib_open) < 0) __PYX_ERR(0, 363, __pyx_L1_error)
  __pyx_type_6pygrib_open.tp_print = 0;
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_6pygrib_open.tp_dictoffset && __pyx_type_6pygrib_open.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_6pygrib_open.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_6pygrib_open, "__call__"); if (unlikely(!wrapper)) __PYX_ERR(0, 363, __pyx_L1_error)
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_6pygrib_4open_10__call__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_6pygrib_4open_10__call__.doc = __pyx_doc_6pygrib_4open_10__call__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_6pygrib_4open_10__call__;
    }
  }
  #endif
  if (PyObject_SetAttrString(__pyx_m, "open", (PyObject *)&__pyx_type_6pygrib_open) < 0) __PYX_ERR(0, 363, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_6pygrib_open) < 0) __PYX_ERR(0, 363, __pyx_L1_error)
  __pyx_ptype_6pygrib_open = &__pyx_type_6pygrib_open;
  if (PyType_Ready(&__pyx_type_6pygrib_gribmessage) < 0) __PYX_ERR(0, 793, __pyx_L1_error)
  __pyx_type_6pygrib_gribmessage.tp_print = 0;
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_6pygrib_gribmessage, "__repr__"); if (unlikely(!wrapper)) __PYX_ERR(0, 793, __pyx_L1_error)
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_6pygrib_11gribmessage_8__repr__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_6pygrib_11gribmessage_8__repr__.doc = __pyx_doc_6pygrib_11gribmessage_8__repr__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_6pygrib_11gribmessage_8__repr__;
    }
  }
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_6pygrib_gribmessage, "__setitem__"); if (unlikely(!wrapper)) __PYX_ERR(0, 793, __pyx_L1_error)
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_6pygrib_11gribmessage_22__setitem__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_6pygrib_11gribmessage_22__setitem__.doc = __pyx_doc_6pygrib_11gribmessage_22__setitem__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_6pygrib_11gribmessage_22__setitem__;
    }
  }
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_6pygrib_gribmessage, "__getitem__"); if (unlikely(!wrapper)) __PYX_ERR(0, 793, __pyx_L1_error)
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_6pygrib_11gribmessage_24__getitem__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_6pygrib_11gribmessage_24__getitem__.doc = __pyx_doc_6pygrib_11gribmessage_24__getitem__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_6pygrib_11gribmessage_24__getitem__;
    }
  }
  #endif
  if (PyObject_SetAttrString(__pyx_m, "gribmessage", (PyObject *)&__pyx_type_6pygrib_gribmessage) < 0) __PYX_ERR(0, 793, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_6pygrib_gribmessage) < 0) __PYX_ERR(0, 793, __pyx_L1_error)
  __pyx_ptype_6pygrib_gribmessage = &__pyx_type_6pygrib_gribmessage;
  if (PyType_Ready(&__pyx_type_6pygrib_index) < 0) __PYX_ERR(0, 1815, __pyx_L1_error)
  __pyx_type_6pygrib_index.tp_print = 0;
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_6pygrib_index.tp_dictoffset && __pyx_type_6pygrib_index.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_6pygrib_index.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_6pygrib_index, "__call__"); if (unlikely(!wrapper)) __PYX_ERR(0, 1815, __pyx_L1_error)
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_6pygrib_5index_4__call__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_6pygrib_5index_4__call__.doc = __pyx_doc_6pygrib_5index_4__call__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_6pygrib_5index_4__call__;
    }
  }
  #endif
  if (PyObject_SetAttrString(__pyx_m, "index", (PyObject *)&__pyx_type_6pygrib_index) < 0) __PYX_ERR(0, 1815, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_6pygrib_index) < 0) __PYX_ERR(0, 1815, __pyx_L1_error)
  __pyx_ptype_6pygrib_index = &__pyx_type_6pygrib_index;
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_RefNannyFinishContext();
  return -1;
}

static int __Pyx_modinit_type_import_code(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0);
  /*--- Type import code ---*/
  __Pyx_RefNannyFinishContext();
  return 0;
}

static int __Pyx_modinit_variable_import_code(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0);
  /*--- Variable import code ---*/
  __Pyx_RefNannyFinishContext();
  return 0;
}

static int __Pyx_modinit_function_import_code(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0);
  /*--- Function import code ---*/
  __Pyx_RefNannyFinishContext();
  return 0;
}


#if PY_MAJOR_VERSION < 3
#ifdef CYTHON_NO_PYINIT_EXPORT
#define __Pyx_PyMODINIT_FUNC void
#else
#define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
#endif
#else
#ifdef CYTHON_NO_PYINIT_EXPORT
#define __Pyx_PyMODINIT_FUNC PyObject *
#else
#define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
#endif
#endif
#ifndef CYTHON_SMALL_CODE
#if defined(__clang__)
    #define CYTHON_SMALL_CODE
#elif defined(__GNUC__) && (!(defined(__cplusplus)) || (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 4)))
    #define CYTHON_SMALL_CODE __attribute__((optimize("Os")))
#else
    #define CYTHON_SMALL_CODE
#endif
#endif


#if PY_MAJOR_VERSION < 3
__Pyx_PyMODINIT_FUNC initpygrib(void) CYTHON_SMALL_CODE; /*proto*/
__Pyx_PyMODINIT_FUNC initpygrib(void)
#else
__Pyx_PyMODINIT_FUNC PyInit_pygrib(void) CYTHON_SMALL_CODE; /*proto*/
__Pyx_PyMODINIT_FUNC PyInit_pygrib(void)
#if CYTHON_PEP489_MULTI_PHASE_INIT
{
  return PyModuleDef_Init(&__pyx_moduledef);
}
static int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict, const char* from_name, const char* to_name) {
    PyObject *value = PyObject_GetAttrString(spec, from_name);
    int result = 0;
    if (likely(value)) {
        result = PyDict_SetItemString(moddict, to_name, value);
        Py_DECREF(value);
    } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) {
        PyErr_Clear();
    } else {
        result = -1;
    }
    return result;
}
static PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNUSED PyModuleDef *def) {
    PyObject *module = NULL, *moddict, *modname;
    if (__pyx_m)
        return __Pyx_NewRef(__pyx_m);
    modname = PyObject_GetAttrString(spec, "name");
    if (unlikely(!modname)) goto bad;
    module = PyModule_NewObject(modname);
    Py_DECREF(modname);
    if (unlikely(!module)) goto bad;
    moddict = PyModule_GetDict(module);
    if (unlikely(!moddict)) goto bad;
    if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__") < 0)) goto bad;
    if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__") < 0)) goto bad;
    if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__") < 0)) goto bad;
    if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__") < 0)) goto bad;
    return module;
bad:
    Py_XDECREF(module);
    return NULL;
}


static int __pyx_pymod_exec_pygrib(PyObject *__pyx_pyinit_module)
#endif
#endif
{
  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;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  __Pyx_RefNannyDeclarations
  #if CYTHON_PEP489_MULTI_PHASE_INIT
  if (__pyx_m && __pyx_m == __pyx_pyinit_module) return 0;
  #elif PY_MAJOR_VERSION >= 3
  if (__pyx_m) return __Pyx_NewRef(__pyx_m);
  #endif
  #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("__Pyx_PyMODINIT_FUNC PyInit_pygrib(void)", 0);
  if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error)
  #ifdef __Pyx_CyFunction_USED
  if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_FusedFunction_USED
  if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_Coroutine_USED
  if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_Generator_USED
  if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_AsyncGen_USED
  if (__pyx_AsyncGen_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_StopAsyncIteration_USED
  if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __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 CYTHON_PEP489_MULTI_PHASE_INIT
  __pyx_m = __pyx_pyinit_module;
  Py_INCREF(__pyx_m);
  #else
  #if PY_MAJOR_VERSION < 3
  __pyx_m = Py_InitModule4("pygrib", __pyx_methods, __pyx_k_Introduction_Python_module_for, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
  #else
  __pyx_m = PyModule_Create(&__pyx_moduledef);
  #endif
  if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error)
  Py_INCREF(__pyx_d);
  __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error)
  #if CYTHON_COMPILING_IN_PYPY
  Py_INCREF(__pyx_b);
  #endif
  if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
  /*--- Initialize various global constants etc. ---*/
  if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __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_ERR(0, 1, __pyx_L1_error)
  #endif
  if (__pyx_module_is_main_pygrib) {
    if (PyObject_SetAttrString(__pyx_m, "__name__", __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  }
  #if PY_MAJOR_VERSION >= 3
  {
    PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error)
    if (!PyDict_GetItemString(modules, "pygrib")) {
      if (unlikely(PyDict_SetItemString(modules, "pygrib", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
    }
  }
  #endif
  /*--- Builtin init code ---*/
  if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  /*--- Constants init code ---*/
  if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  /*--- Global type/function init code ---*/
  (void)__Pyx_modinit_global_init_code();
  (void)__Pyx_modinit_variable_export_code();
  (void)__Pyx_modinit_function_export_code();
  if (unlikely(__Pyx_modinit_type_init_code() != 0)) goto __pyx_L1_error;
  (void)__Pyx_modinit_type_import_code();
  (void)__Pyx_modinit_variable_import_code();
  (void)__Pyx_modinit_function_import_code();
  /*--- Execution code ---*/
  #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
  if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif

  /* "pygrib.pyx":170
 * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
 * PERFORMANCE OF THIS SOFTWARE."""
 * __test__ = None             # <<<<<<<<<<<<<<
 * del __test__ # hack so epydoc doesn't show __test__
 * __version__ = '2.0.3'
 */
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, Py_None) < 0) __PYX_ERR(0, 170, __pyx_L1_error)

  /* "pygrib.pyx":171
 * PERFORMANCE OF THIS SOFTWARE."""
 * __test__ = None
 * del __test__ # hack so epydoc doesn't show __test__             # <<<<<<<<<<<<<<
 * __version__ = '2.0.3'
 * 
 */
  if (__Pyx_PyObject_DelAttrStr(__pyx_m, __pyx_n_s_test) < 0) __PYX_ERR(0, 171, __pyx_L1_error)

  /* "pygrib.pyx":172
 * __test__ = None
 * del __test__ # hack so epydoc doesn't show __test__
 * __version__ = '2.0.3'             # <<<<<<<<<<<<<<
 * 
 * import numpy as np
 */
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_version, __pyx_kp_s_2_0_3) < 0) __PYX_ERR(0, 172, __pyx_L1_error)

  /* "pygrib.pyx":174
 * __version__ = '2.0.3'
 * 
 * import numpy as np             # <<<<<<<<<<<<<<
 * import warnings
 * from datetime import datetime
 */
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_numpy, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 174, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_np, __pyx_t_1) < 0) __PYX_ERR(0, 174, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pygrib.pyx":175
 * 
 * import numpy as np
 * import warnings             # <<<<<<<<<<<<<<
 * from datetime import datetime
 * from pkg_resources import parse_version
 */
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_warnings, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 175, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_warnings, __pyx_t_1) < 0) __PYX_ERR(0, 175, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pygrib.pyx":176
 * import numpy as np
 * import warnings
 * from datetime import datetime             # <<<<<<<<<<<<<<
 * from pkg_resources import parse_version
 * from numpy import ma
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 176, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_datetime);
  __Pyx_GIVEREF(__pyx_n_s_datetime);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_datetime);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_datetime, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 176, __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_datetime); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 176, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_datetime, __pyx_t_1) < 0) __PYX_ERR(0, 176, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pygrib.pyx":177
 * import warnings
 * from datetime import datetime
 * from pkg_resources import parse_version             # <<<<<<<<<<<<<<
 * from numpy import ma
 * try:
 */
  __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 177, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_n_s_parse_version);
  __Pyx_GIVEREF(__pyx_n_s_parse_version);
  PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_parse_version);
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_pkg_resources, __pyx_t_2, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 177, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_parse_version); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 177, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_parse_version, __pyx_t_2) < 0) __PYX_ERR(0, 177, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pygrib.pyx":178
 * from datetime import datetime
 * from pkg_resources import parse_version
 * from numpy import ma             # <<<<<<<<<<<<<<
 * try:
 *     import pyproj
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 178, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_ma);
  __Pyx_GIVEREF(__pyx_n_s_ma);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_ma);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_numpy, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 178, __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_ma); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 178, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_ma, __pyx_t_1) < 0) __PYX_ERR(0, 178, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pygrib.pyx":179
 * from pkg_resources import parse_version
 * from numpy import ma
 * try:             # <<<<<<<<<<<<<<
 *     import pyproj
 * except ImportError:
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5);
    __Pyx_XGOTREF(__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_4);
    __Pyx_XGOTREF(__pyx_t_5);
    /*try:*/ {

      /* "pygrib.pyx":180
 * from numpy import ma
 * try:
 *     import pyproj             # <<<<<<<<<<<<<<
 * except ImportError:
 *     try:
 */
      __pyx_t_2 = __Pyx_Import(__pyx_n_s_pyproj, 0, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 180, __pyx_L2_error)
      __Pyx_GOTREF(__pyx_t_2);
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyproj, __pyx_t_2) < 0) __PYX_ERR(0, 180, __pyx_L2_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "pygrib.pyx":179
 * from pkg_resources import parse_version
 * from numpy import ma
 * try:             # <<<<<<<<<<<<<<
 *     import pyproj
 * except ImportError:
 */
    }
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    goto __pyx_L7_try_end;
    __pyx_L2_error:;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "pygrib.pyx":181
 * try:
 *     import pyproj
 * except ImportError:             # <<<<<<<<<<<<<<
 *     try:
 *         from mpl_toolkits.basemap import pyproj
 */
    __pyx_t_6 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_ImportError);
    if (__pyx_t_6) {
      __Pyx_AddTraceback("pygrib", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_1, &__pyx_t_7) < 0) __PYX_ERR(0, 181, __pyx_L4_except_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GOTREF(__pyx_t_7);

      /* "pygrib.pyx":182
 *     import pyproj
 * except ImportError:
 *     try:             # <<<<<<<<<<<<<<
 *         from mpl_toolkits.basemap import pyproj
 *     except:
 */
      {
        __Pyx_PyThreadState_declare
        __Pyx_PyThreadState_assign
        __Pyx_ExceptionSave(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10);
        __Pyx_XGOTREF(__pyx_t_8);
        __Pyx_XGOTREF(__pyx_t_9);
        __Pyx_XGOTREF(__pyx_t_10);
        /*try:*/ {

          /* "pygrib.pyx":183
 * except ImportError:
 *     try:
 *         from mpl_toolkits.basemap import pyproj             # <<<<<<<<<<<<<<
 *     except:
 *         raise ImportError("either pyproj or basemap required")
 */
          __pyx_t_11 = PyList_New(1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 183, __pyx_L10_error)
          __Pyx_GOTREF(__pyx_t_11);
          __Pyx_INCREF(__pyx_n_s_pyproj);
          __Pyx_GIVEREF(__pyx_n_s_pyproj);
          PyList_SET_ITEM(__pyx_t_11, 0, __pyx_n_s_pyproj);
          __pyx_t_12 = __Pyx_Import(__pyx_n_s_mpl_toolkits_basemap, __pyx_t_11, -1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 183, __pyx_L10_error)
          __Pyx_GOTREF(__pyx_t_12);
          __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
          __pyx_t_11 = __Pyx_ImportFrom(__pyx_t_12, __pyx_n_s_pyproj); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 183, __pyx_L10_error)
          __Pyx_GOTREF(__pyx_t_11);
          if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyproj, __pyx_t_11) < 0) __PYX_ERR(0, 183, __pyx_L10_error)
          __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;

          /* "pygrib.pyx":182
 *     import pyproj
 * except ImportError:
 *     try:             # <<<<<<<<<<<<<<
 *         from mpl_toolkits.basemap import pyproj
 *     except:
 */
        }
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
        goto __pyx_L17_try_end;
        __pyx_L10_error:;
        __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
        __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;

        /* "pygrib.pyx":184
 *     try:
 *         from mpl_toolkits.basemap import pyproj
 *     except:             # <<<<<<<<<<<<<<
 *         raise ImportError("either pyproj or basemap required")
 * from ncepgrib2 import Grib2Decode
 */
        /*except:*/ {
          __Pyx_AddTraceback("pygrib", __pyx_clineno, __pyx_lineno, __pyx_filename);
          if (__Pyx_GetException(&__pyx_t_12, &__pyx_t_11, &__pyx_t_13) < 0) __PYX_ERR(0, 184, __pyx_L12_except_error)
          __Pyx_GOTREF(__pyx_t_12);
          __Pyx_GOTREF(__pyx_t_11);
          __Pyx_GOTREF(__pyx_t_13);

          /* "pygrib.pyx":185
 *         from mpl_toolkits.basemap import pyproj
 *     except:
 *         raise ImportError("either pyproj or basemap required")             # <<<<<<<<<<<<<<
 * from ncepgrib2 import Grib2Decode
 * import_array()
 */
          __pyx_t_14 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__114, NULL); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 185, __pyx_L12_except_error)
          __Pyx_GOTREF(__pyx_t_14);
          __Pyx_Raise(__pyx_t_14, 0, 0, 0);
          __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
          __PYX_ERR(0, 185, __pyx_L12_except_error)
        }
        __pyx_L12_except_error:;

        /* "pygrib.pyx":182
 *     import pyproj
 * except ImportError:
 *     try:             # <<<<<<<<<<<<<<
 *         from mpl_toolkits.basemap import pyproj
 *     except:
 */
        __Pyx_XGIVEREF(__pyx_t_8);
        __Pyx_XGIVEREF(__pyx_t_9);
        __Pyx_XGIVEREF(__pyx_t_10);
        __Pyx_ExceptionReset(__pyx_t_8, __pyx_t_9, __pyx_t_10);
        goto __pyx_L4_except_error;
        __pyx_L17_try_end:;
      }
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L3_exception_handled;
    }
    goto __pyx_L4_except_error;
    __pyx_L4_except_error:;

    /* "pygrib.pyx":179
 * from pkg_resources import parse_version
 * from numpy import ma
 * try:             # <<<<<<<<<<<<<<
 *     import pyproj
 * except ImportError:
 */
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
    goto __pyx_L1_error;
    __pyx_L3_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
    __pyx_L7_try_end:;
  }

  /* "pygrib.pyx":186
 *     except:
 *         raise ImportError("either pyproj or basemap required")
 * from ncepgrib2 import Grib2Decode             # <<<<<<<<<<<<<<
 * import_array()
 * 
 */
  __pyx_t_7 = PyList_New(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 186, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_INCREF(__pyx_n_s_Grib2Decode);
  __Pyx_GIVEREF(__pyx_n_s_Grib2Decode);
  PyList_SET_ITEM(__pyx_t_7, 0, __pyx_n_s_Grib2Decode);
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_ncepgrib2, __pyx_t_7, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 186, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_Grib2Decode); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 186, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_Grib2Decode, __pyx_t_7) < 0) __PYX_ERR(0, 186, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pygrib.pyx":187
 *         raise ImportError("either pyproj or basemap required")
 * from ncepgrib2 import Grib2Decode
 * import_array()             # <<<<<<<<<<<<<<
 * 
 * cdef extern from "stdlib.h":
 */
  import_array();

  /* "pygrib.pyx":203
 * cdef extern from "Python.h":
 *     object PyBytes_FromStringAndSize(char *s, size_t size)
 * default_encoding = 'ascii'             # <<<<<<<<<<<<<<
 * 
 * cdef extern from "numpy/arrayobject.h":
 */
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_default_encoding, __pyx_n_s_ascii) < 0) __PYX_ERR(0, 203, __pyx_L1_error)

  /* "pygrib.pyx":295
 * 
 * 
 * missingvalue_int = GRIB_MISSING_LONG             # <<<<<<<<<<<<<<
 * #this doesn't work, since defined constants are assumed to be integers
 * #missingvalue_float = GRIB_MISSING_DOUBLE
 */
  __pyx_t_1 = __Pyx_PyInt_From_int(GRIB_MISSING_LONG); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 295, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_missingvalue_int, __pyx_t_1) < 0) __PYX_ERR(0, 295, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pygrib.pyx":298
 * #this doesn't work, since defined constants are assumed to be integers
 * #missingvalue_float = GRIB_MISSING_DOUBLE
 * missingvalue_float = -1.e100 # value given in grib_api.h version 1.90             # <<<<<<<<<<<<<<
 * def _get_grib_api_version():
 *     div = lambda v,d: (v/d,v%d)
 */
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_missingvalue_float, __pyx_float_neg_1_e100) < 0) __PYX_ERR(0, 298, __pyx_L1_error)

  /* "pygrib.pyx":299
 * #missingvalue_float = GRIB_MISSING_DOUBLE
 * missingvalue_float = -1.e100 # value given in grib_api.h version 1.90
 * def _get_grib_api_version():             # <<<<<<<<<<<<<<
 *     div = lambda v,d: (v/d,v%d)
 *     v = grib_get_api_version()
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6pygrib_1_get_grib_api_version, NULL, __pyx_n_s_pygrib); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 299, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_get_grib_api_version, __pyx_t_1) < 0) __PYX_ERR(0, 299, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pygrib.pyx":306
 *     major = v
 *     return "%d.%d.%d" % (major,minor,revision)
 * grib_api_version = _get_grib_api_version()             # <<<<<<<<<<<<<<
 * tolerate_badgrib = False
 * 
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_get_grib_api_version); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 306, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_7 = __Pyx_PyObject_CallNoArg(__pyx_t_1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 306, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_grib_api_version, __pyx_t_7) < 0) __PYX_ERR(0, 306, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "pygrib.pyx":307
 *     return "%d.%d.%d" % (major,minor,revision)
 * grib_api_version = _get_grib_api_version()
 * tolerate_badgrib = False             # <<<<<<<<<<<<<<
 * 
 * def tolerate_badgrib_on():
 */
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_tolerate_badgrib, Py_False) < 0) __PYX_ERR(0, 307, __pyx_L1_error)

  /* "pygrib.pyx":309
 * tolerate_badgrib = False
 * 
 * def tolerate_badgrib_on():             # <<<<<<<<<<<<<<
 *     """
 *     don't raise an exception when a missing or malformed key is encountered.
 */
  __pyx_t_7 = PyCFunction_NewEx(&__pyx_mdef_6pygrib_3tolerate_badgrib_on, NULL, __pyx_n_s_pygrib); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 309, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_tolerate_badgrib_on, __pyx_t_7) < 0) __PYX_ERR(0, 309, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "pygrib.pyx":316
 *     tolerate_badgrib = True
 * 
 * def tolerate_badgrib_off():             # <<<<<<<<<<<<<<
 *     """
 *     raise an exception when a missing or malformed key is encountered
 */
  __pyx_t_7 = PyCFunction_NewEx(&__pyx_mdef_6pygrib_5tolerate_badgrib_off, NULL, __pyx_n_s_pygrib); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 316, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_tolerate_badgrib_off, __pyx_t_7) < 0) __PYX_ERR(0, 316, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "pygrib.pyx":324
 *     tolerate_badgrib = False
 * 
 * def gaulats(object nlats):             # <<<<<<<<<<<<<<
 *     """
 *     gaulats(nlats)
 */
  __pyx_t_7 = PyCFunction_NewEx(&__pyx_mdef_6pygrib_7gaulats, NULL, __pyx_n_s_pygrib); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 324, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_gaulats, __pyx_t_7) < 0) __PYX_ERR(0, 324, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "pygrib.pyx":338
 * 
 * # dict for forecast time units (Code Table 4.4).
 * _ftimedict = {}             # <<<<<<<<<<<<<<
 * _ftimedict[0]='mins'
 * _ftimedict[1]='hrs'
 */
  __pyx_t_7 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 338, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_ftimedict, __pyx_t_7) < 0) __PYX_ERR(0, 338, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "pygrib.pyx":339
 * # dict for forecast time units (Code Table 4.4).
 * _ftimedict = {}
 * _ftimedict[0]='mins'             # <<<<<<<<<<<<<<
 * _ftimedict[1]='hrs'
 * _ftimedict[2]='days'
 */
  __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_ftimedict); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 339, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  if (unlikely(__Pyx_SetItemInt(__pyx_t_7, 0, __pyx_n_s_mins, long, 1, __Pyx_PyInt_From_long, 0, 0, 1) < 0)) __PYX_ERR(0, 339, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "pygrib.pyx":340
 * _ftimedict = {}
 * _ftimedict[0]='mins'
 * _ftimedict[1]='hrs'             # <<<<<<<<<<<<<<
 * _ftimedict[2]='days'
 * _ftimedict[3]='months'
 */
  __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_ftimedict); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 340, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  if (unlikely(__Pyx_SetItemInt(__pyx_t_7, 1, __pyx_n_s_hrs, long, 1, __Pyx_PyInt_From_long, 0, 0, 1) < 0)) __PYX_ERR(0, 340, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "pygrib.pyx":341
 * _ftimedict[0]='mins'
 * _ftimedict[1]='hrs'
 * _ftimedict[2]='days'             # <<<<<<<<<<<<<<
 * _ftimedict[3]='months'
 * _ftimedict[4]='yrs'
 */
  __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_ftimedict); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 341, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  if (unlikely(__Pyx_SetItemInt(__pyx_t_7, 2, __pyx_n_s_days, long, 1, __Pyx_PyInt_From_long, 0, 0, 1) < 0)) __PYX_ERR(0, 341, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "pygrib.pyx":342
 * _ftimedict[1]='hrs'
 * _ftimedict[2]='days'
 * _ftimedict[3]='months'             # <<<<<<<<<<<<<<
 * _ftimedict[4]='yrs'
 * _ftimedict[5]='decades'
 */
  __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_ftimedict); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 342, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  if (unlikely(__Pyx_SetItemInt(__pyx_t_7, 3, __pyx_n_s_months, long, 1, __Pyx_PyInt_From_long, 0, 0, 1) < 0)) __PYX_ERR(0, 342, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "pygrib.pyx":343
 * _ftimedict[2]='days'
 * _ftimedict[3]='months'
 * _ftimedict[4]='yrs'             # <<<<<<<<<<<<<<
 * _ftimedict[5]='decades'
 * _ftimedict[6]='30 yr periods'
 */
  __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_ftimedict); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 343, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  if (unlikely(__Pyx_SetItemInt(__pyx_t_7, 4, __pyx_n_s_yrs, long, 1, __Pyx_PyInt_From_long, 0, 0, 1) < 0)) __PYX_ERR(0, 343, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "pygrib.pyx":344
 * _ftimedict[3]='months'
 * _ftimedict[4]='yrs'
 * _ftimedict[5]='decades'             # <<<<<<<<<<<<<<
 * _ftimedict[6]='30 yr periods'
 * _ftimedict[7]='centuries'
 */
  __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_ftimedict); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 344, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  if (unlikely(__Pyx_SetItemInt(__pyx_t_7, 5, __pyx_n_s_decades, long, 1, __Pyx_PyInt_From_long, 0, 0, 1) < 0)) __PYX_ERR(0, 344, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "pygrib.pyx":345
 * _ftimedict[4]='yrs'
 * _ftimedict[5]='decades'
 * _ftimedict[6]='30 yr periods'             # <<<<<<<<<<<<<<
 * _ftimedict[7]='centuries'
 * _ftimedict[10]='3 hr periods'
 */
  __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_ftimedict); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 345, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  if (unlikely(__Pyx_SetItemInt(__pyx_t_7, 6, __pyx_kp_s_30_yr_periods, long, 1, __Pyx_PyInt_From_long, 0, 0, 1) < 0)) __PYX_ERR(0, 345, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "pygrib.pyx":346
 * _ftimedict[5]='decades'
 * _ftimedict[6]='30 yr periods'
 * _ftimedict[7]='centuries'             # <<<<<<<<<<<<<<
 * _ftimedict[10]='3 hr periods'
 * _ftimedict[11]='6 hr periods'
 */
  __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_ftimedict); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 346, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  if (unlikely(__Pyx_SetItemInt(__pyx_t_7, 7, __pyx_n_s_centuries, long, 1, __Pyx_PyInt_From_long, 0, 0, 1) < 0)) __PYX_ERR(0, 346, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "pygrib.pyx":347
 * _ftimedict[6]='30 yr periods'
 * _ftimedict[7]='centuries'
 * _ftimedict[10]='3 hr periods'             # <<<<<<<<<<<<<<
 * _ftimedict[11]='6 hr periods'
 * _ftimedict[12]='12 hr periods'
 */
  __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_ftimedict); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 347, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  if (unlikely(__Pyx_SetItemInt(__pyx_t_7, 10, __pyx_kp_s_3_hr_periods, long, 1, __Pyx_PyInt_From_long, 0, 0, 1) < 0)) __PYX_ERR(0, 347, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "pygrib.pyx":348
 * _ftimedict[7]='centuries'
 * _ftimedict[10]='3 hr periods'
 * _ftimedict[11]='6 hr periods'             # <<<<<<<<<<<<<<
 * _ftimedict[12]='12 hr periods'
 * _ftimedict[13]='secs'
 */
  __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_ftimedict); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 348, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  if (unlikely(__Pyx_SetItemInt(__pyx_t_7, 11, __pyx_kp_s_6_hr_periods, long, 1, __Pyx_PyInt_From_long, 0, 0, 1) < 0)) __PYX_ERR(0, 348, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "pygrib.pyx":349
 * _ftimedict[10]='3 hr periods'
 * _ftimedict[11]='6 hr periods'
 * _ftimedict[12]='12 hr periods'             # <<<<<<<<<<<<<<
 * _ftimedict[13]='secs'
 * 
 */
  __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_ftimedict); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 349, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  if (unlikely(__Pyx_SetItemInt(__pyx_t_7, 12, __pyx_kp_s_12_hr_periods, long, 1, __Pyx_PyInt_From_long, 0, 0, 1) < 0)) __PYX_ERR(0, 349, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "pygrib.pyx":350
 * _ftimedict[11]='6 hr periods'
 * _ftimedict[12]='12 hr periods'
 * _ftimedict[13]='secs'             # <<<<<<<<<<<<<<
 * 
 * # turn on support for multi-field grib messages.
 */
  __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_ftimedict); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 350, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  if (unlikely(__Pyx_SetItemInt(__pyx_t_7, 13, __pyx_n_s_secs, long, 1, __Pyx_PyInt_From_long, 0, 0, 1) < 0)) __PYX_ERR(0, 350, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "pygrib.pyx":353
 * 
 * # turn on support for multi-field grib messages.
 * grib_multi_support_on(NULL)             # <<<<<<<<<<<<<<
 * 
 * def multi_support_on():
 */
  grib_multi_support_on(NULL);

  /* "pygrib.pyx":355
 * grib_multi_support_on(NULL)
 * 
 * def multi_support_on():             # <<<<<<<<<<<<<<
 *     """turn on support for multi-field grib messages (default)"""
 *     grib_multi_support_on(NULL)
 */
  __pyx_t_7 = PyCFunction_NewEx(&__pyx_mdef_6pygrib_9multi_support_on, NULL, __pyx_n_s_pygrib); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 355, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_multi_support_on, __pyx_t_7) < 0) __PYX_ERR(0, 355, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "pygrib.pyx":359
 *     grib_multi_support_on(NULL)
 * 
 * def multi_support_off():             # <<<<<<<<<<<<<<
 *     """turn off support for multi-field grib messages"""
 *     grib_multi_support_off(NULL)
 */
  __pyx_t_7 = PyCFunction_NewEx(&__pyx_mdef_6pygrib_11multi_support_off, NULL, __pyx_n_s_pygrib); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 359, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_multi_support_off, __pyx_t_7) < 0) __PYX_ERR(0, 359, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "pygrib.pyx":636
 * # distinguished from grib keys.
 * _private_atts =\
 * ['_gh','fcstimeunits','expand_reduced','projparams','messagenumber','_all_keys','_ro_keys']             # <<<<<<<<<<<<<<
 * 
 * def julian_to_datetime(object jd):
 */
  __pyx_t_7 = PyList_New(7); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 636, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_INCREF(__pyx_n_s_gh);
  __Pyx_GIVEREF(__pyx_n_s_gh);
  PyList_SET_ITEM(__pyx_t_7, 0, __pyx_n_s_gh);
  __Pyx_INCREF(__pyx_n_s_fcstimeunits);
  __Pyx_GIVEREF(__pyx_n_s_fcstimeunits);
  PyList_SET_ITEM(__pyx_t_7, 1, __pyx_n_s_fcstimeunits);
  __Pyx_INCREF(__pyx_n_s_expand_reduced);
  __Pyx_GIVEREF(__pyx_n_s_expand_reduced);
  PyList_SET_ITEM(__pyx_t_7, 2, __pyx_n_s_expand_reduced);
  __Pyx_INCREF(__pyx_n_s_projparams);
  __Pyx_GIVEREF(__pyx_n_s_projparams);
  PyList_SET_ITEM(__pyx_t_7, 3, __pyx_n_s_projparams);
  __Pyx_INCREF(__pyx_n_s_messagenumber);
  __Pyx_GIVEREF(__pyx_n_s_messagenumber);
  PyList_SET_ITEM(__pyx_t_7, 4, __pyx_n_s_messagenumber);
  __Pyx_INCREF(__pyx_n_s_all_keys);
  __Pyx_GIVEREF(__pyx_n_s_all_keys);
  PyList_SET_ITEM(__pyx_t_7, 5, __pyx_n_s_all_keys);
  __Pyx_INCREF(__pyx_n_s_ro_keys);
  __Pyx_GIVEREF(__pyx_n_s_ro_keys);
  PyList_SET_ITEM(__pyx_t_7, 6, __pyx_n_s_ro_keys);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_private_atts, __pyx_t_7) < 0) __PYX_ERR(0, 635, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "pygrib.pyx":638
 * ['_gh','fcstimeunits','expand_reduced','projparams','messagenumber','_all_keys','_ro_keys']
 * 
 * def julian_to_datetime(object jd):             # <<<<<<<<<<<<<<
 *     """
 *     julian_to_datetime(julday)
 */
  __pyx_t_7 = PyCFunction_NewEx(&__pyx_mdef_6pygrib_13julian_to_datetime, NULL, __pyx_n_s_pygrib); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 638, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_julian_to_datetime, __pyx_t_7) < 0) __PYX_ERR(0, 638, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "pygrib.pyx":655
 *     return datetime(year, month, day, hour, minute, second)
 * 
 * def datetime_to_julian(object d):             # <<<<<<<<<<<<<<
 *     """
 *     datetime_to_julian(date)
 */
  __pyx_t_7 = PyCFunction_NewEx(&__pyx_mdef_6pygrib_15datetime_to_julian, NULL, __pyx_n_s_pygrib); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 655, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_datetime_to_julian, __pyx_t_7) < 0) __PYX_ERR(0, 655, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "pygrib.pyx":681
 *     return setdates(grb)
 * 
 * def fromstring(gribstring):             # <<<<<<<<<<<<<<
 *     """
 *     fromstring(string)
 */
  __pyx_t_7 = PyCFunction_NewEx(&__pyx_mdef_6pygrib_17fromstring, NULL, __pyx_n_s_pygrib); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 681, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_fromstring, __pyx_t_7) < 0) __PYX_ERR(0, 681, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "pygrib.pyx":702
 *     return setdates(grb)
 * 
 * def setdates(gribmessage grb):             # <<<<<<<<<<<<<<
 *     """
 *     setdates(grb)
 */
  __pyx_t_7 = PyCFunction_NewEx(&__pyx_mdef_6pygrib_19setdates, NULL, __pyx_n_s_pygrib); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 702, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_setdates, __pyx_t_7) < 0) __PYX_ERR(0, 702, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "pygrib.pyx":781
 *     return grb
 * 
 * def reload(gribmessage grb):             # <<<<<<<<<<<<<<
 *     """
 *     reload(grb)
 */
  __pyx_t_7 = PyCFunction_NewEx(&__pyx_mdef_6pygrib_21reload, NULL, __pyx_n_s_pygrib); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 781, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_reload, __pyx_t_7) < 0) __PYX_ERR(0, 781, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "pygrib.pyx":2031
 *             grib_index_delete(self._gi)
 * 
 * def _is_stringlike(a):             # <<<<<<<<<<<<<<
 *     if type(a) == str or type(a) == bytes or type(a) == unicode:
 *         return True
 */
  __pyx_t_7 = PyCFunction_NewEx(&__pyx_mdef_6pygrib_23_is_stringlike, NULL, __pyx_n_s_pygrib); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2031, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_is_stringlike, __pyx_t_7) < 0) __PYX_ERR(0, 2031, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "pygrib.pyx":2037
 *         return False
 * 
 * def _is_container(a):             # <<<<<<<<<<<<<<
 *     # is object container-like?  (can test for
 *     # membership with "is in", but not a string)
 */
  __pyx_t_7 = PyCFunction_NewEx(&__pyx_mdef_6pygrib_25_is_container, NULL, __pyx_n_s_pygrib); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2037, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_is_container, __pyx_t_7) < 0) __PYX_ERR(0, 2037, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "pygrib.pyx":2045
 *     return True
 * 
 * def _find(grb, **kwargs):             # <<<<<<<<<<<<<<
 *     # search for key/value matches in grib message.
 *     # If value is a container-like object, search for matches to any element.
 */
  __pyx_t_7 = PyCFunction_NewEx(&__pyx_mdef_6pygrib_27_find, NULL, __pyx_n_s_pygrib); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2045, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_find, __pyx_t_7) < 0) __PYX_ERR(0, 2045, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "pygrib.pyx":2068
 *     return True
 * 
 * cdef _strencode(pystr,encoding=None):             # <<<<<<<<<<<<<<
 *     # encode a string into bytes.  If already bytes, do nothing.
 *     # uses default_encoding module variable for default encoding.
 */

  /*--- Wrapped vars code ---*/

  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_XDECREF(__pyx_t_14);
  if (__pyx_m) {
    if (__pyx_d) {
      __Pyx_AddTraceback("init pygrib", 0, __pyx_lineno, __pyx_filename);
    }
    Py_DECREF(__pyx_m); __pyx_m = 0;
  } else if (!PyErr_Occurred()) {
    PyErr_SetString(PyExc_ImportError, "init pygrib");
  }
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  #if CYTHON_PEP489_MULTI_PHASE_INIT
  return (__pyx_m != NULL) ? 0 : -1;
  #elif PY_MAJOR_VERSION >= 3
  return __pyx_m;
  #else
  return;
  #endif
}

/* --- Runtime support code --- */
/* Refnanny */
#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

/* PyObjectGetAttrStr */
#if CYTHON_USE_TYPE_SLOTS
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);
}
#endif

/* GetBuiltinName */
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;
}

/* RaiseArgTupleInvalid */
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);
}

/* RaiseDoubleKeywords */
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
}

/* ParseKeywords */
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;
}

/* FetchCommonType */
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;
}

/* CythonFunction */
#include <structmember.h>
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;
    }
    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) {
    int result = 0;
    PyObject *res = op->defaults_getter((PyObject *) op);
    if (unlikely(!res))
        return -1;
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    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);
    #else
    op->defaults_tuple = PySequence_ITEM(res, 0);
    if (unlikely(!op->defaults_tuple)) result = -1;
    else {
        op->defaults_kwdict = PySequence_ITEM(res, 1);
        if (unlikely(!op->defaults_kwdict)) result = -1;
    }
    #endif
    Py_DECREF(res);
    return result;
}
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}
};
static PyMemberDef __pyx_CyFunction_members[] = {
    {(char *) "__module__", T_OBJECT, offsetof(PyCFunctionObject, 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[] = {
    {"__reduce__", (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0},
    {0, 0, 0, 0}
};
#if PY_VERSION_HEX < 0x030500A0
#define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func_weakreflist)
#else
#define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func.m_weakreflist)
#endif
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;
    __Pyx_CyFunction_weakreflist(op) = 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]);
        PyObject_Free(m->defaults);
        m->defaults = NULL;
    }
    return 0;
}
static void __Pyx__CyFunction_dealloc(__pyx_CyFunctionObject *m)
{
    if (__Pyx_CyFunction_weakreflist(m) != NULL)
        PyObject_ClearWeakRefs((PyObject *) m);
    __Pyx_CyFunction_clear(m);
    PyObject_GC_Del(m);
}
static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m)
{
    PyObject_GC_UnTrack(m);
    __Pyx__CyFunction_dealloc(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 __Pyx_PyMethod_New(func, type, (PyObject *)(Py_TYPE(type)));
    }
    if (obj == Py_None)
        obj = NULL;
    return __Pyx_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
}
static PyObject * __Pyx_CyFunction_CallMethod(PyObject *func, PyObject *self, PyObject *arg, PyObject *kw) {
    PyCFunctionObject* f = (PyCFunctionObject*)func;
    PyCFunction meth = f->m_ml->ml_meth;
    Py_ssize_t size;
    switch (f->m_ml->ml_flags & (METH_VARARGS | METH_KEYWORDS | METH_NOARGS | METH_O)) {
    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 (likely(size == 0))
                return (*meth)(self, NULL);
            PyErr_Format(PyExc_TypeError,
                "%.200s() takes no arguments (%" CYTHON_FORMAT_SSIZE_T "d 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 (likely(size == 1)) {
                PyObject *result, *arg0;
                #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
                arg0 = PyTuple_GET_ITEM(arg, 0);
                #else
                arg0 = PySequence_ITEM(arg, 0); if (unlikely(!arg0)) return NULL;
                #endif
                result = (*meth)(self, arg0);
                #if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS)
                Py_DECREF(arg0);
                #endif
                return result;
            }
            PyErr_Format(PyExc_TypeError,
                "%.200s() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d 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;
}
static CYTHON_INLINE PyObject *__Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) {
    return __Pyx_CyFunction_CallMethod(func, ((PyCFunctionObject*)func)->m_self, arg, kw);
}
static PyObject *__Pyx_CyFunction_CallAsMethod(PyObject *func, PyObject *args, PyObject *kw) {
    PyObject *result;
    __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *) func;
    if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) {
        Py_ssize_t argc;
        PyObject *new_args;
        PyObject *self;
        argc = PyTuple_GET_SIZE(args);
        new_args = PyTuple_GetSlice(args, 1, argc);
        if (unlikely(!new_args))
            return NULL;
        self = PyTuple_GetItem(args, 0);
        if (unlikely(!self)) {
            Py_DECREF(new_args);
            return NULL;
        }
        result = __Pyx_CyFunction_CallMethod(func, self, new_args, kw);
        Py_DECREF(new_args);
    } else {
        result = __Pyx_CyFunction_Call(func, args, kw);
    }
    return result;
}
static PyTypeObject __pyx_CyFunctionType_type = {
    PyVarObject_HEAD_INIT(0, 0)
    "cython_function_or_method",
    sizeof(__pyx_CyFunctionObject),
    0,
    (destructor) __Pyx_CyFunction_dealloc,
    0,
    0,
    0,
#if PY_MAJOR_VERSION < 3
    0,
#else
    0,
#endif
    (reprfunc) __Pyx_CyFunction_repr,
    0,
    0,
    0,
    0,
    __Pyx_CyFunction_CallAsMethod,
    0,
    0,
    0,
    0,
    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,
    0,
    (traverseproc) __Pyx_CyFunction_traverse,
    (inquiry) __Pyx_CyFunction_clear,
    0,
#if PY_VERSION_HEX < 0x030500A0
    offsetof(__pyx_CyFunctionObject, func_weakreflist),
#else
    offsetof(PyCFunctionObject, m_weakreflist),
#endif
    0,
    0,
    __pyx_CyFunction_methods,
    __pyx_CyFunction_members,
    __pyx_CyFunction_getsets,
    0,
    0,
    __Pyx_CyFunction_descr_get,
    0,
    offsetof(__pyx_CyFunctionObject, func_dict),
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
#if PY_VERSION_HEX >= 0x030400a1
    0,
#endif
};
static int __pyx_CyFunction_init(void) {
    __pyx_CyFunctionType = __Pyx_FetchCommonType(&__pyx_CyFunctionType_type);
    if (unlikely(__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 = PyObject_Malloc(size);
    if (unlikely(!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);
}

/* RaiseTooManyValuesToUnpack */
    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);
}

/* RaiseNeedMoreValuesToUnpack */
    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");
}

/* IterFinish */
    static CYTHON_INLINE int __Pyx_IterFinish(void) {
#if CYTHON_FAST_THREAD_STATE
    PyThreadState *tstate = __Pyx_PyThreadState_Current;
    PyObject* exc_type = tstate->curexc_type;
    if (unlikely(exc_type)) {
        if (likely(__Pyx_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
}

/* UnpackItemEndCheck */
    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;
}

/* PyIntBinop */
    #if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyInt_RemainderObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, CYTHON_UNUSED int inplace) {
    #if PY_MAJOR_VERSION < 3
    if (likely(PyInt_CheckExact(op1))) {
        const long b = intval;
        long x;
        long a = PyInt_AS_LONG(op1);
            x = a % b;
            x += ((x != 0) & ((x ^ b) < 0)) * b;
            return PyInt_FromLong(x);
    }
    #endif
    #if CYTHON_USE_PYLONG_INTERNALS
    if (likely(PyLong_CheckExact(op1))) {
        const long b = intval;
        long a, x;
#ifdef HAVE_LONG_LONG
        const PY_LONG_LONG llb = intval;
        PY_LONG_LONG lla, llx;
#endif
        const digit* digits = ((PyLongObject*)op1)->ob_digit;
        const Py_ssize_t size = Py_SIZE(op1);
        if (likely(__Pyx_sst_abs(size) <= 1)) {
            a = likely(size) ? digits[0] : 0;
            if (size == -1) a = -a;
        } else {
            switch (size) {
                case -2:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                        a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
                        lla = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case 2:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                        a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
                        lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case -3:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                        a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
                        lla = -(PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case 3:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                        a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
                        lla = (PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case -4:
                    if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                        a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
                        lla = -(PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case 4:
                    if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                        a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
                        lla = (PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                default: return PyLong_Type.tp_as_number->nb_remainder(op1, op2);
            }
        }
                x = a % b;
                x += ((x != 0) & ((x ^ b) < 0)) * b;
            return PyLong_FromLong(x);
#ifdef HAVE_LONG_LONG
        long_long:
                llx = lla % llb;
                llx += ((llx != 0) & ((llx ^ llb) < 0)) * llb;
            return PyLong_FromLongLong(llx);
#endif
        
        
    }
    #endif
    return (inplace ? PyNumber_InPlaceRemainder : PyNumber_Remainder)(op1, op2);
}
#endif

/* PyObjectCall */
    #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 (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
        return NULL;
    result = (*call)(func, arg, kw);
    Py_LeaveRecursiveCall();
    if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
        PyErr_SetString(
            PyExc_SystemError,
            "NULL result without error in PyObject_Call");
    }
    return result;
}
#endif

/* PyErrFetchRestore */
    #if CYTHON_FAST_THREAD_STATE
static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    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);
}
static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
    *type = tstate->curexc_type;
    *value = tstate->curexc_value;
    *tb = tstate->curexc_traceback;
    tstate->curexc_type = 0;
    tstate->curexc_value = 0;
    tstate->curexc_traceback = 0;
}
#endif

/* RaiseException */
    #if PY_MAJOR_VERSION < 3
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
                        CYTHON_UNUSED PyObject *cause) {
    __Pyx_PyThreadState_declare
    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 (PyType_Check(type)) {
#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;
        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;
        }
    }
    __Pyx_PyThreadState_assign
    __Pyx_ErrRestore(type, value, tb);
    return;
raise_error:
    Py_XDECREF(value);
    Py_XDECREF(type);
    Py_XDECREF(tb);
    return;
}
#else
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) {
                int is_subclass = PyObject_IsSubclass(instance_class, type);
                if (!is_subclass) {
                    instance_class = NULL;
                } else if (unlikely(is_subclass == -1)) {
                    goto bad;
                } else {
                    type = instance_class;
                }
            }
        }
        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 (cause) {
        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) {
#if CYTHON_COMPILING_IN_PYPY
        PyObject *tmp_type, *tmp_value, *tmp_tb;
        PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb);
        Py_INCREF(tb);
        PyErr_Restore(tmp_type, tmp_value, tb);
        Py_XDECREF(tmp_tb);
#else
        PyThreadState *tstate = __Pyx_PyThreadState_Current;
        PyObject* tmp_tb = tstate->curexc_traceback;
        if (tb != tmp_tb) {
            Py_INCREF(tb);
            tstate->curexc_traceback = tb;
            Py_XDECREF(tmp_tb);
        }
#endif
    }
bad:
    Py_XDECREF(owned_instance);
    return;
}
#endif

/* GetModuleGlobalName */
    static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name) {
    PyObject *result;
#if !CYTHON_AVOID_BORROWED_REFS
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1
    result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash);
    if (likely(result)) {
        Py_INCREF(result);
    } else if (unlikely(PyErr_Occurred())) {
        result = NULL;
    } else {
#else
    result = PyDict_GetItem(__pyx_d, name);
    if (likely(result)) {
        Py_INCREF(result);
    } else {
#endif
#else
    result = PyObject_GetItem(__pyx_d, name);
    if (!result) {
        PyErr_Clear();
#endif
        result = __Pyx_GetBuiltinName(name);
    }
    return result;
}

/* PyFunctionFastCall */
        #if CYTHON_FAST_PYCALL
#include "frameobject.h"
static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na,
                                               PyObject *globals) {
    PyFrameObject *f;
    PyThreadState *tstate = __Pyx_PyThreadState_Current;
    PyObject **fastlocals;
    Py_ssize_t i;
    PyObject *result;
    assert(globals != NULL);
    /* XXX Perhaps we should create a specialized
       PyFrame_New() that doesn't take locals, but does
       take builtins without sanity checking them.
       */
    assert(tstate != NULL);
    f = PyFrame_New(tstate, co, globals, NULL);
    if (f == NULL) {
        return NULL;
    }
    fastlocals = f->f_localsplus;
    for (i = 0; i < na; i++) {
        Py_INCREF(*args);
        fastlocals[i] = *args++;
    }
    result = PyEval_EvalFrameEx(f,0);
    ++tstate->recursion_depth;
    Py_DECREF(f);
    --tstate->recursion_depth;
    return result;
}
#if 1 || PY_VERSION_HEX < 0x030600B1
static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, int nargs, PyObject *kwargs) {
    PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func);
    PyObject *globals = PyFunction_GET_GLOBALS(func);
    PyObject *argdefs = PyFunction_GET_DEFAULTS(func);
    PyObject *closure;
#if PY_MAJOR_VERSION >= 3
    PyObject *kwdefs;
#endif
    PyObject *kwtuple, **k;
    PyObject **d;
    Py_ssize_t nd;
    Py_ssize_t nk;
    PyObject *result;
    assert(kwargs == NULL || PyDict_Check(kwargs));
    nk = kwargs ? PyDict_Size(kwargs) : 0;
    if (Py_EnterRecursiveCall((char*)" while calling a Python object")) {
        return NULL;
    }
    if (
#if PY_MAJOR_VERSION >= 3
            co->co_kwonlyargcount == 0 &&
#endif
            likely(kwargs == NULL || nk == 0) &&
            co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) {
        if (argdefs == NULL && co->co_argcount == nargs) {
            result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals);
            goto done;
        }
        else if (nargs == 0 && argdefs != NULL
                 && co->co_argcount == Py_SIZE(argdefs)) {
            /* function called with no arguments, but all parameters have
               a default value: use default values as arguments .*/
            args = &PyTuple_GET_ITEM(argdefs, 0);
            result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals);
            goto done;
        }
    }
    if (kwargs != NULL) {
        Py_ssize_t pos, i;
        kwtuple = PyTuple_New(2 * nk);
        if (kwtuple == NULL) {
            result = NULL;
            goto done;
        }
        k = &PyTuple_GET_ITEM(kwtuple, 0);
        pos = i = 0;
        while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) {
            Py_INCREF(k[i]);
            Py_INCREF(k[i+1]);
            i += 2;
        }
        nk = i / 2;
    }
    else {
        kwtuple = NULL;
        k = NULL;
    }
    closure = PyFunction_GET_CLOSURE(func);
#if PY_MAJOR_VERSION >= 3
    kwdefs = PyFunction_GET_KW_DEFAULTS(func);
#endif
    if (argdefs != NULL) {
        d = &PyTuple_GET_ITEM(argdefs, 0);
        nd = Py_SIZE(argdefs);
    }
    else {
        d = NULL;
        nd = 0;
    }
#if PY_MAJOR_VERSION >= 3
    result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL,
                               args, nargs,
                               k, (int)nk,
                               d, (int)nd, kwdefs, closure);
#else
    result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL,
                               args, nargs,
                               k, (int)nk,
                               d, (int)nd, closure);
#endif
    Py_XDECREF(kwtuple);
done:
    Py_LeaveRecursiveCall();
    return result;
}
#endif
#endif

/* PyCFunctionFastCall */
        #if CYTHON_FAST_PYCCALL
static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) {
    PyCFunctionObject *func = (PyCFunctionObject*)func_obj;
    PyCFunction meth = PyCFunction_GET_FUNCTION(func);
    PyObject *self = PyCFunction_GET_SELF(func);
    int flags = PyCFunction_GET_FLAGS(func);
    assert(PyCFunction_Check(func));
    assert(METH_FASTCALL == (flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS)));
    assert(nargs >= 0);
    assert(nargs == 0 || args != NULL);
    /* _PyCFunction_FastCallDict() must not be called with an exception set,
       because it may clear it (directly or indirectly) and so the
       caller loses its exception */
    assert(!PyErr_Occurred());
    if ((PY_VERSION_HEX < 0x030700A0) || unlikely(flags & METH_KEYWORDS)) {
        return (*((__Pyx_PyCFunctionFastWithKeywords)meth)) (self, args, nargs, NULL);
    } else {
        return (*((__Pyx_PyCFunctionFast)meth)) (self, args, nargs);
    }
}
#endif

/* ExtTypeTest */
        static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
    if (unlikely(!type)) {
        PyErr_SetString(PyExc_SystemError, "Missing type object");
        return 0;
    }
    if (likely(__Pyx_TypeCheck(obj, type)))
        return 1;
    PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s",
                 Py_TYPE(obj)->tp_name, type->tp_name);
    return 0;
}

/* None */
        static CYTHON_INLINE long __Pyx_div_long(long a, long b) {
    long q = a / b;
    long r = a - q*b;
    q -= ((r != 0) & ((r ^ b) < 0));
    return q;
}

/* PyIntBinop */
        #if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, CYTHON_UNUSED int inplace) {
    #if PY_MAJOR_VERSION < 3
    if (likely(PyInt_CheckExact(op1))) {
        const long b = intval;
        long x;
        long a = PyInt_AS_LONG(op1);
            x = (long)((unsigned long)a + b);
            if (likely((x^a) >= 0 || (x^b) >= 0))
                return PyInt_FromLong(x);
            return PyLong_Type.tp_as_number->nb_add(op1, op2);
    }
    #endif
    #if CYTHON_USE_PYLONG_INTERNALS
    if (likely(PyLong_CheckExact(op1))) {
        const long b = intval;
        long a, x;
#ifdef HAVE_LONG_LONG
        const PY_LONG_LONG llb = intval;
        PY_LONG_LONG lla, llx;
#endif
        const digit* digits = ((PyLongObject*)op1)->ob_digit;
        const Py_ssize_t size = Py_SIZE(op1);
        if (likely(__Pyx_sst_abs(size) <= 1)) {
            a = likely(size) ? digits[0] : 0;
            if (size == -1) a = -a;
        } else {
            switch (size) {
                case -2:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                        a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
                        lla = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case 2:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                        a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
                        lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case -3:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                        a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
                        lla = -(PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case 3:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                        a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
                        lla = (PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case -4:
                    if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                        a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
                        lla = -(PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case 4:
                    if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                        a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
                        lla = (PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                default: return PyLong_Type.tp_as_number->nb_add(op1, op2);
            }
        }
                x = a + b;
            return PyLong_FromLong(x);
#ifdef HAVE_LONG_LONG
        long_long:
                llx = lla + llb;
            return PyLong_FromLongLong(llx);
#endif
        
        
    }
    #endif
    if (PyFloat_CheckExact(op1)) {
        const long b = intval;
        double a = PyFloat_AS_DOUBLE(op1);
            double result;
            PyFPE_START_PROTECT("add", return NULL)
            result = ((double)a) + (double)b;
            PyFPE_END_PROTECT(result)
            return PyFloat_FromDouble(result);
    }
    return (inplace ? PyNumber_InPlaceAdd : PyNumber_Add)(op1, op2);
}
#endif

/* PyObjectCallMethO */
        #if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
    PyObject *self, *result;
    PyCFunction cfunc;
    cfunc = PyCFunction_GET_FUNCTION(func);
    self = PyCFunction_GET_SELF(func);
    if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
        return NULL;
    result = cfunc(self, arg);
    Py_LeaveRecursiveCall();
    if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
        PyErr_SetString(
            PyExc_SystemError,
            "NULL result without error in PyObject_Call");
    }
    return result;
}
#endif

/* PyObjectCallOneArg */
        #if CYTHON_COMPILING_IN_CPYTHON
static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) {
    PyObject *result;
    PyObject *args = PyTuple_New(1);
    if (unlikely(!args)) return NULL;
    Py_INCREF(arg);
    PyTuple_SET_ITEM(args, 0, arg);
    result = __Pyx_PyObject_Call(func, args, NULL);
    Py_DECREF(args);
    return result;
}
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
#if CYTHON_FAST_PYCALL
    if (PyFunction_Check(func)) {
        return __Pyx_PyFunction_FastCall(func, &arg, 1);
    }
#endif
    if (likely(PyCFunction_Check(func))) {
        if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) {
            return __Pyx_PyObject_CallMethO(func, arg);
#if CYTHON_FAST_PYCCALL
        } else if (PyCFunction_GET_FLAGS(func) & METH_FASTCALL) {
            return __Pyx_PyCFunction_FastCall(func, &arg, 1);
#endif
        }
    }
    return __Pyx__PyObject_CallOneArg(func, arg);
}
#else
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
    PyObject *result;
    PyObject *args = PyTuple_Pack(1, arg);
    if (unlikely(!args)) return NULL;
    result = __Pyx_PyObject_Call(func, args, NULL);
    Py_DECREF(args);
    return result;
}
#endif

/* PyObjectCallNoArg */
        #if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) {
#if CYTHON_FAST_PYCALL
    if (PyFunction_Check(func)) {
        return __Pyx_PyFunction_FastCall(func, NULL, 0);
    }
#endif
#ifdef __Pyx_CyFunction_USED
    if (likely(PyCFunction_Check(func) || __Pyx_TypeCheck(func, __pyx_CyFunctionType))) {
#else
    if (likely(PyCFunction_Check(func))) {
#endif
        if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) {
            return __Pyx_PyObject_CallMethO(func, NULL);
        }
    }
    return __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL);
}
#endif

/* KeywordStringCheck */
          static 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_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;
}

/* PyIntBinop */
          #if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyInt_EqObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, CYTHON_UNUSED int inplace) {
    if (op1 == op2) {
        Py_RETURN_TRUE;
    }
    #if PY_MAJOR_VERSION < 3
    if (likely(PyInt_CheckExact(op1))) {
        const long b = intval;
        long a = PyInt_AS_LONG(op1);
        if (a == b) {
            Py_RETURN_TRUE;
        } else {
            Py_RETURN_FALSE;
        }
    }
    #endif
    #if CYTHON_USE_PYLONG_INTERNALS
    if (likely(PyLong_CheckExact(op1))) {
        const long b = intval;
        long a;
        const digit* digits = ((PyLongObject*)op1)->ob_digit;
        const Py_ssize_t size = Py_SIZE(op1);
        if (likely(__Pyx_sst_abs(size) <= 1)) {
            a = likely(size) ? digits[0] : 0;
            if (size == -1) a = -a;
        } else {
            switch (size) {
                case -2:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                        a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
                    }
                    CYTHON_FALLTHROUGH;
                case 2:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                        a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
                    }
                    CYTHON_FALLTHROUGH;
                case -3:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                        a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
                    }
                    CYTHON_FALLTHROUGH;
                case 3:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                        a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
                    }
                    CYTHON_FALLTHROUGH;
                case -4:
                    if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                        a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
                    }
                    CYTHON_FALLTHROUGH;
                case 4:
                    if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                        a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
                    }
                    CYTHON_FALLTHROUGH;
                #if PyLong_SHIFT < 30 && PyLong_SHIFT != 15
                default: return PyLong_Type.tp_richcompare(op1, op2, Py_EQ);
                #else
                default: Py_RETURN_FALSE;
                #endif
            }
        }
            if (a == b) {
                Py_RETURN_TRUE;
            } else {
                Py_RETURN_FALSE;
            }
    }
    #endif
    if (PyFloat_CheckExact(op1)) {
        const long b = intval;
        double a = PyFloat_AS_DOUBLE(op1);
            if ((double)a == (double)b) {
                Py_RETURN_TRUE;
            } else {
                Py_RETURN_FALSE;
            }
    }
    return PyObject_RichCompare(op1, op2, Py_EQ);
}
#endif

/* GetAttr */
          static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *o, PyObject *n) {
#if CYTHON_USE_TYPE_SLOTS
#if PY_MAJOR_VERSION >= 3
    if (likely(PyUnicode_Check(n)))
#else
    if (likely(PyString_Check(n)))
#endif
        return __Pyx_PyObject_GetAttrStr(o, n);
#endif
    return PyObject_GetAttr(o, n);
}

/* HasAttr */
          static CYTHON_INLINE int __Pyx_HasAttr(PyObject *o, PyObject *n) {
    PyObject *r;
    if (unlikely(!__Pyx_PyBaseString_Check(n))) {
        PyErr_SetString(PyExc_TypeError,
                        "hasattr(): attribute name must be string");
        return -1;
    }
    r = __Pyx_GetAttr(o, n);
    if (unlikely(!r)) {
        PyErr_Clear();
        return 0;
    } else {
        Py_DECREF(r);
        return 1;
    }
}

/* IterNext */
          static PyObject *__Pyx_PyIter_Next2Default(PyObject* defval) {
    PyObject* exc_type;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    exc_type = __Pyx_PyErr_Occurred();
    if (unlikely(exc_type)) {
        if (!defval || unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)))
            return NULL;
        __Pyx_PyErr_Clear();
        Py_INCREF(defval);
        return defval;
    }
    if (defval) {
        Py_INCREF(defval);
        return defval;
    }
    __Pyx_PyErr_SetNone(PyExc_StopIteration);
    return NULL;
}
static void __Pyx_PyIter_Next_ErrorNoIterator(PyObject *iterator) {
    PyErr_Format(PyExc_TypeError,
        "%.200s object is not an iterator", Py_TYPE(iterator)->tp_name);
}
static CYTHON_INLINE PyObject *__Pyx_PyIter_Next2(PyObject* iterator, PyObject* defval) {
    PyObject* next;
    iternextfunc iternext = Py_TYPE(iterator)->tp_iternext;
    if (likely(iternext)) {
#if CYTHON_USE_TYPE_SLOTS
        next = iternext(iterator);
        if (likely(next))
            return next;
        #if PY_VERSION_HEX >= 0x02070000
        if (unlikely(iternext == &_PyObject_NextNotImplemented))
            return NULL;
        #endif
#else
        next = PyIter_Next(iterator);
        if (likely(next))
            return next;
#endif
    } else if (CYTHON_USE_TYPE_SLOTS || unlikely(!PyIter_Check(iterator))) {
        __Pyx_PyIter_Next_ErrorNoIterator(iterator);
        return NULL;
    }
#if !CYTHON_USE_TYPE_SLOTS
    else {
        next = PyIter_Next(iterator);
        if (likely(next))
            return next;
    }
#endif
    return __Pyx_PyIter_Next2Default(defval);
}

/* SaveResetException */
          #if CYTHON_FAST_THREAD_STATE
static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
    #if PY_VERSION_HEX >= 0x030700A2
    *type = tstate->exc_state.exc_type;
    *value = tstate->exc_state.exc_value;
    *tb = tstate->exc_state.exc_traceback;
    #else
    *type = tstate->exc_type;
    *value = tstate->exc_value;
    *tb = tstate->exc_traceback;
    #endif
    Py_XINCREF(*type);
    Py_XINCREF(*value);
    Py_XINCREF(*tb);
}
static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    #if PY_VERSION_HEX >= 0x030700A2
    tmp_type = tstate->exc_state.exc_type;
    tmp_value = tstate->exc_state.exc_value;
    tmp_tb = tstate->exc_state.exc_traceback;
    tstate->exc_state.exc_type = type;
    tstate->exc_state.exc_value = value;
    tstate->exc_state.exc_traceback = tb;
    #else
    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;
    #endif
    Py_XDECREF(tmp_type);
    Py_XDECREF(tmp_value);
    Py_XDECREF(tmp_tb);
}
#endif

/* PyErrExceptionMatches */
          #if CYTHON_FAST_THREAD_STATE
static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
    Py_ssize_t i, n;
    n = PyTuple_GET_SIZE(tuple);
#if PY_MAJOR_VERSION >= 3
    for (i=0; i<n; i++) {
        if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
    }
#endif
    for (i=0; i<n; i++) {
        if (__Pyx_PyErr_GivenExceptionMatches(exc_type, PyTuple_GET_ITEM(tuple, i))) return 1;
    }
    return 0;
}
static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err) {
    PyObject *exc_type = tstate->curexc_type;
    if (exc_type == err) return 1;
    if (unlikely(!exc_type)) return 0;
    if (unlikely(PyTuple_Check(err)))
        return __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err);
    return __Pyx_PyErr_GivenExceptionMatches(exc_type, err);
}
#endif

/* GetException */
          #if CYTHON_FAST_THREAD_STATE
static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
#else
static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) {
#endif
    PyObject *local_type, *local_value, *local_tb;
#if CYTHON_FAST_THREAD_STATE
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    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_FAST_THREAD_STATE
    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_FAST_THREAD_STATE
    #if PY_VERSION_HEX >= 0x030700A2
    tmp_type = tstate->exc_state.exc_type;
    tmp_value = tstate->exc_state.exc_value;
    tmp_tb = tstate->exc_state.exc_traceback;
    tstate->exc_state.exc_type = local_type;
    tstate->exc_state.exc_value = local_value;
    tstate->exc_state.exc_traceback = local_tb;
    #else
    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;
    #endif
    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;
}

/* None */
            static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname) {
    PyErr_Format(PyExc_UnboundLocalError, "local variable '%s' referenced before assignment", varname);
}

/* ArgTypeTest */
            static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact)
{
    if (unlikely(!type)) {
        PyErr_SetString(PyExc_SystemError, "Missing type object");
        return 0;
    }
    else if (exact) {
        #if PY_MAJOR_VERSION == 2
        if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1;
        #endif
    }
    else {
        if (likely(__Pyx_TypeCheck(obj, type))) return 1;
    }
    PyErr_Format(PyExc_TypeError,
        "Argument '%.200s' has incorrect type (expected %.200s, got %.200s)",
        name, type->tp_name, Py_TYPE(obj)->tp_name);
    return 0;
}

/* GetItemInt */
            static 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,
                                                              CYTHON_NCP_UNUSED int wraparound,
                                                              CYTHON_NCP_UNUSED int boundscheck) {
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    Py_ssize_t wrapped_i = i;
    if (wraparound & unlikely(i < 0)) {
        wrapped_i += PyList_GET_SIZE(o);
    }
    if ((!boundscheck) || likely((0 <= wrapped_i) & (wrapped_i < PyList_GET_SIZE(o)))) {
        PyObject *r = PyList_GET_ITEM(o, wrapped_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,
                                                              CYTHON_NCP_UNUSED int wraparound,
                                                              CYTHON_NCP_UNUSED int boundscheck) {
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    Py_ssize_t wrapped_i = i;
    if (wraparound & unlikely(i < 0)) {
        wrapped_i += PyTuple_GET_SIZE(o);
    }
    if ((!boundscheck) || likely((0 <= wrapped_i) & (wrapped_i < PyTuple_GET_SIZE(o)))) {
        PyObject *r = PyTuple_GET_ITEM(o, wrapped_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,
                                                     CYTHON_NCP_UNUSED int wraparound,
                                                     CYTHON_NCP_UNUSED int boundscheck) {
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS
    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))
                        return NULL;
                    PyErr_Clear();
                }
            }
            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));
}

/* ObjectGetItem */
            #if CYTHON_USE_TYPE_SLOTS
static PyObject *__Pyx_PyObject_GetIndex(PyObject *obj, PyObject* index) {
    PyObject *runerr;
    Py_ssize_t key_value;
    PySequenceMethods *m = Py_TYPE(obj)->tp_as_sequence;
    if (unlikely(!(m && m->sq_item))) {
        PyErr_Format(PyExc_TypeError, "'%.200s' object is not subscriptable", Py_TYPE(obj)->tp_name);
        return NULL;
    }
    key_value = __Pyx_PyIndex_AsSsize_t(index);
    if (likely(key_value != -1 || !(runerr = PyErr_Occurred()))) {
        return __Pyx_GetItemInt_Fast(obj, key_value, 0, 1, 1);
    }
    if (PyErr_GivenExceptionMatches(runerr, PyExc_OverflowError)) {
        PyErr_Clear();
        PyErr_Format(PyExc_IndexError, "cannot fit '%.200s' into an index-sized integer", Py_TYPE(index)->tp_name);
    }
    return NULL;
}
static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key) {
    PyMappingMethods *m = Py_TYPE(obj)->tp_as_mapping;
    if (likely(m && m->mp_subscript)) {
        return m->mp_subscript(obj, key);
    }
    return __Pyx_PyObject_GetIndex(obj, key);
}
#endif

/* BytesEquals */
            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;
#if CYTHON_USE_UNICODE_INTERNALS
            Py_hash_t hash1, hash2;
            hash1 = ((PyBytesObject*)s1)->ob_shash;
            hash2 = ((PyBytesObject*)s2)->ob_shash;
            if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
                return (equals == Py_NE);
            }
#endif
            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
}

/* UnicodeEquals */
            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 (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0))
            return -1;
        length = __Pyx_PyUnicode_GET_LENGTH(s1);
        if (length != __Pyx_PyUnicode_GET_LENGTH(s2)) {
            goto return_ne;
        }
#if CYTHON_USE_UNICODE_INTERNALS
        {
            Py_hash_t hash1, hash2;
        #if CYTHON_PEP393_ENABLED
            hash1 = ((PyASCIIObject*)s1)->hash;
            hash2 = ((PyASCIIObject*)s2)->hash;
        #else
            hash1 = ((PyUnicodeObject*)s1)->hash;
            hash2 = ((PyUnicodeObject*)s2)->hash;
        #endif
            if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
                goto return_ne;
            }
        }
#endif
        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
}

/* PyFloatBinop */
            #if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyFloat_DivideObjC(PyObject *op1, PyObject *op2, double floatval, CYTHON_UNUSED int inplace) {
    const double b = floatval;
    double a, result;
    if (likely(PyFloat_CheckExact(op1))) {
        a = PyFloat_AS_DOUBLE(op1);
    } else
    #if PY_MAJOR_VERSION < 3
    if (likely(PyInt_CheckExact(op1))) {
        a = (double) PyInt_AS_LONG(op1);
    } else
    #endif
    if (likely(PyLong_CheckExact(op1))) {
        #if CYTHON_USE_PYLONG_INTERNALS
        const digit* digits = ((PyLongObject*)op1)->ob_digit;
        const Py_ssize_t size = Py_SIZE(op1);
        switch (size) {
            case  0: a = 0.0; break;
            case -1: a = -(double) digits[0]; break;
            case  1: a = (double) digits[0]; break;
            case -2:
            case 2:
                if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (1 * PyLong_SHIFT < 53))) {
                    a = (double) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                    if ((8 * sizeof(unsigned long) < 53) || (2 * PyLong_SHIFT < 53) || (a < (double) ((PY_LONG_LONG)1 << 53))) {
                        if (size == -2)
                            a = -a;
                        break;
                    }
                }
                CYTHON_FALLTHROUGH;
            case -3:
            case 3:
                if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (2 * PyLong_SHIFT < 53))) {
                    a = (double) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                    if ((8 * sizeof(unsigned long) < 53) || (3 * PyLong_SHIFT < 53) || (a < (double) ((PY_LONG_LONG)1 << 53))) {
                        if (size == -3)
                            a = -a;
                        break;
                    }
                }
                CYTHON_FALLTHROUGH;
            case -4:
            case 4:
                if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (3 * PyLong_SHIFT < 53))) {
                    a = (double) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                    if ((8 * sizeof(unsigned long) < 53) || (4 * PyLong_SHIFT < 53) || (a < (double) ((PY_LONG_LONG)1 << 53))) {
                        if (size == -4)
                            a = -a;
                        break;
                    }
                }
                CYTHON_FALLTHROUGH;
            default:
        #else
        {
        #endif
            a = PyLong_AsDouble(op1);
            if (unlikely(a == -1.0 && PyErr_Occurred())) return NULL;
        }
    } else {
        return (inplace ? __Pyx_PyNumber_InPlaceDivide(op1, op2) : __Pyx_PyNumber_Divide(op1, op2));
    }
        PyFPE_START_PROTECT("divide", return NULL)
        result = a / b;
        PyFPE_END_PROTECT(result)
        return PyFloat_FromDouble(result);
}
#endif

/* StringJoin */
              #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

/* decode_c_string */
              static CYTHON_INLINE PyObject* __Pyx_decode_c_string(
         const char* cstring, Py_ssize_t start, Py_ssize_t stop,
         const char* encoding, const char* errors,
         PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors)) {
    Py_ssize_t length;
    if (unlikely((start < 0) | (stop < 0))) {
        size_t slen = strlen(cstring);
        if (unlikely(slen > (size_t) PY_SSIZE_T_MAX)) {
            PyErr_SetString(PyExc_OverflowError,
                            "c-string too long to convert to Python");
            return NULL;
        }
        length = (Py_ssize_t) slen;
        if (start < 0) {
            start += length;
            if (start < 0)
                start = 0;
        }
        if (stop < 0)
            stop += length;
    }
    length = stop - start;
    if (unlikely(length <= 0))
        return PyUnicode_FromUnicode(NULL, 0);
    cstring += start;
    if (decode_func) {
        return decode_func(cstring, length, errors);
    } else {
        return PyUnicode_Decode(cstring, length, encoding, errors);
    }
}

/* Import */
              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_MAJOR_VERSION < 3
    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_MAJOR_VERSION >= 3
        if (level == -1) {
            if (strchr(__Pyx_MODULE_NAME, '.')) {
                module = PyImport_ImportModuleLevelObject(
                    name, global_dict, empty_dict, list, 1);
                if (!module) {
                    if (!PyErr_ExceptionMatches(PyExc_ImportError))
                        goto bad;
                    PyErr_Clear();
                }
            }
            level = 0;
        }
        #endif
        if (!module) {
            #if PY_MAJOR_VERSION < 3
            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
        }
    }
bad:
    #if PY_MAJOR_VERSION < 3
    Py_XDECREF(py_import);
    #endif
    Py_XDECREF(empty_list);
    Py_XDECREF(empty_dict);
    return module;
}

/* ImportFrom */
              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;
}

/* PyObjectSetAttrStr */
              #if CYTHON_USE_TYPE_SLOTS
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);
}
#endif

/* DictGetItem */
              #if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY
static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) {
    PyObject *value;
    value = PyDict_GetItemWithError(d, key);
    if (unlikely(!value)) {
        if (!PyErr_Occurred()) {
            PyObject* args = PyTuple_Pack(1, key);
            if (likely(args))
                PyErr_SetObject(PyExc_KeyError, args);
            Py_XDECREF(args);
        }
        return NULL;
    }
    Py_INCREF(value);
    return value;
}
#endif

/* PyFloatBinop */
              #if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyFloat_EqObjC(PyObject *op1, PyObject *op2, double floatval, CYTHON_UNUSED int inplace) {
    const double b = floatval;
    double a;
    if (op1 == op2) {
        Py_RETURN_TRUE;
    }
    if (likely(PyFloat_CheckExact(op1))) {
        a = PyFloat_AS_DOUBLE(op1);
    } else
    #if PY_MAJOR_VERSION < 3
    if (likely(PyInt_CheckExact(op1))) {
        a = (double) PyInt_AS_LONG(op1);
    } else
    #endif
    if (likely(PyLong_CheckExact(op1))) {
        #if CYTHON_USE_PYLONG_INTERNALS
        const digit* digits = ((PyLongObject*)op1)->ob_digit;
        const Py_ssize_t size = Py_SIZE(op1);
        switch (size) {
            case  0: a = 0.0; break;
            case -1: a = -(double) digits[0]; break;
            case  1: a = (double) digits[0]; break;
            case -2:
            case 2:
                if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (1 * PyLong_SHIFT < 53))) {
                    a = (double) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                    if ((8 * sizeof(unsigned long) < 53) || (2 * PyLong_SHIFT < 53) || (a < (double) ((PY_LONG_LONG)1 << 53))) {
                        if (size == -2)
                            a = -a;
                        break;
                    }
                }
                CYTHON_FALLTHROUGH;
            case -3:
            case 3:
                if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (2 * PyLong_SHIFT < 53))) {
                    a = (double) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                    if ((8 * sizeof(unsigned long) < 53) || (3 * PyLong_SHIFT < 53) || (a < (double) ((PY_LONG_LONG)1 << 53))) {
                        if (size == -3)
                            a = -a;
                        break;
                    }
                }
                CYTHON_FALLTHROUGH;
            case -4:
            case 4:
                if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (3 * PyLong_SHIFT < 53))) {
                    a = (double) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                    if ((8 * sizeof(unsigned long) < 53) || (4 * PyLong_SHIFT < 53) || (a < (double) ((PY_LONG_LONG)1 << 53))) {
                        if (size == -4)
                            a = -a;
                        break;
                    }
                }
                CYTHON_FALLTHROUGH;
            default:
        #else
        {
        #endif
            return PyFloat_Type.tp_richcompare(op2, op1, Py_EQ);
        }
    } else {
        return PyObject_RichCompare(op1, op2, Py_EQ);
    }
        if (a == b) {
            Py_RETURN_TRUE;
        } else {
            Py_RETURN_FALSE;
        }
}
#endif

/* PyFloatBinop */
                #if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyFloat_AddObjC(PyObject *op1, PyObject *op2, double floatval, CYTHON_UNUSED int inplace) {
    const double b = floatval;
    double a, result;
    if (likely(PyFloat_CheckExact(op1))) {
        a = PyFloat_AS_DOUBLE(op1);
    } else
    #if PY_MAJOR_VERSION < 3
    if (likely(PyInt_CheckExact(op1))) {
        a = (double) PyInt_AS_LONG(op1);
    } else
    #endif
    if (likely(PyLong_CheckExact(op1))) {
        #if CYTHON_USE_PYLONG_INTERNALS
        const digit* digits = ((PyLongObject*)op1)->ob_digit;
        const Py_ssize_t size = Py_SIZE(op1);
        switch (size) {
            case  0: a = 0.0; break;
            case -1: a = -(double) digits[0]; break;
            case  1: a = (double) digits[0]; break;
            case -2:
            case 2:
                if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (1 * PyLong_SHIFT < 53))) {
                    a = (double) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                    if ((8 * sizeof(unsigned long) < 53) || (2 * PyLong_SHIFT < 53) || (a < (double) ((PY_LONG_LONG)1 << 53))) {
                        if (size == -2)
                            a = -a;
                        break;
                    }
                }
                CYTHON_FALLTHROUGH;
            case -3:
            case 3:
                if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (2 * PyLong_SHIFT < 53))) {
                    a = (double) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                    if ((8 * sizeof(unsigned long) < 53) || (3 * PyLong_SHIFT < 53) || (a < (double) ((PY_LONG_LONG)1 << 53))) {
                        if (size == -3)
                            a = -a;
                        break;
                    }
                }
                CYTHON_FALLTHROUGH;
            case -4:
            case 4:
                if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (3 * PyLong_SHIFT < 53))) {
                    a = (double) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                    if ((8 * sizeof(unsigned long) < 53) || (4 * PyLong_SHIFT < 53) || (a < (double) ((PY_LONG_LONG)1 << 53))) {
                        if (size == -4)
                            a = -a;
                        break;
                    }
                }
                CYTHON_FALLTHROUGH;
            default:
        #else
        {
        #endif
            a = PyLong_AsDouble(op1);
            if (unlikely(a == -1.0 && PyErr_Occurred())) return NULL;
        }
    } else {
        return (inplace ? PyNumber_InPlaceAdd : PyNumber_Add)(op1, op2);
    }
        PyFPE_START_PROTECT("add", return NULL)
        result = a + b;
        PyFPE_END_PROTECT(result)
        return PyFloat_FromDouble(result);
}
#endif

/* PyIntBinop */
                  #if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyInt_AddCObj(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, CYTHON_UNUSED int inplace) {
    #if PY_MAJOR_VERSION < 3
    if (likely(PyInt_CheckExact(op2))) {
        const long a = intval;
        long x;
        long b = PyInt_AS_LONG(op2);
            x = (long)((unsigned long)a + b);
            if (likely((x^a) >= 0 || (x^b) >= 0))
                return PyInt_FromLong(x);
            return PyLong_Type.tp_as_number->nb_add(op1, op2);
    }
    #endif
    #if CYTHON_USE_PYLONG_INTERNALS
    if (likely(PyLong_CheckExact(op2))) {
        const long a = intval;
        long b, x;
#ifdef HAVE_LONG_LONG
        const PY_LONG_LONG lla = intval;
        PY_LONG_LONG llb, llx;
#endif
        const digit* digits = ((PyLongObject*)op2)->ob_digit;
        const Py_ssize_t size = Py_SIZE(op2);
        if (likely(__Pyx_sst_abs(size) <= 1)) {
            b = likely(size) ? digits[0] : 0;
            if (size == -1) b = -b;
        } else {
            switch (size) {
                case -2:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                        b = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
                        llb = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case 2:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                        b = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
                        llb = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case -3:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                        b = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
                        llb = -(PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case 3:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                        b = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
                        llb = (PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case -4:
                    if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                        b = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
                        llb = -(PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case 4:
                    if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                        b = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
                        llb = (PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                default: return PyLong_Type.tp_as_number->nb_add(op1, op2);
            }
        }
                x = a + b;
            return PyLong_FromLong(x);
#ifdef HAVE_LONG_LONG
        long_long:
                llx = lla + llb;
            return PyLong_FromLongLong(llx);
#endif
        
        
    }
    #endif
    if (PyFloat_CheckExact(op2)) {
        const long a = intval;
        double b = PyFloat_AS_DOUBLE(op2);
            double result;
            PyFPE_START_PROTECT("add", return NULL)
            result = ((double)a) + (double)b;
            PyFPE_END_PROTECT(result)
            return PyFloat_FromDouble(result);
    }
    return (inplace ? PyNumber_InPlaceAdd : PyNumber_Add)(op1, op2);
}
#endif

/* PyIntBinop */
                  #if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyInt_SubtractObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, CYTHON_UNUSED int inplace) {
    #if PY_MAJOR_VERSION < 3
    if (likely(PyInt_CheckExact(op1))) {
        const long b = intval;
        long x;
        long a = PyInt_AS_LONG(op1);
            x = (long)((unsigned long)a - b);
            if (likely((x^a) >= 0 || (x^~b) >= 0))
                return PyInt_FromLong(x);
            return PyLong_Type.tp_as_number->nb_subtract(op1, op2);
    }
    #endif
    #if CYTHON_USE_PYLONG_INTERNALS
    if (likely(PyLong_CheckExact(op1))) {
        const long b = intval;
        long a, x;
#ifdef HAVE_LONG_LONG
        const PY_LONG_LONG llb = intval;
        PY_LONG_LONG lla, llx;
#endif
        const digit* digits = ((PyLongObject*)op1)->ob_digit;
        const Py_ssize_t size = Py_SIZE(op1);
        if (likely(__Pyx_sst_abs(size) <= 1)) {
            a = likely(size) ? digits[0] : 0;
            if (size == -1) a = -a;
        } else {
            switch (size) {
                case -2:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                        a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
                        lla = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case 2:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                        a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
                        lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case -3:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                        a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
                        lla = -(PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case 3:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                        a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
                        lla = (PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case -4:
                    if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                        a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
                        lla = -(PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case 4:
                    if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                        a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
                        lla = (PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                default: return PyLong_Type.tp_as_number->nb_subtract(op1, op2);
            }
        }
                x = a - b;
            return PyLong_FromLong(x);
#ifdef HAVE_LONG_LONG
        long_long:
                llx = lla - llb;
            return PyLong_FromLongLong(llx);
#endif
        
        
    }
    #endif
    if (PyFloat_CheckExact(op1)) {
        const long b = intval;
        double a = PyFloat_AS_DOUBLE(op1);
            double result;
            PyFPE_START_PROTECT("subtract", return NULL)
            result = ((double)a) - (double)b;
            PyFPE_END_PROTECT(result)
            return PyFloat_FromDouble(result);
    }
    return (inplace ? PyNumber_InPlaceSubtract : PyNumber_Subtract)(op1, op2);
}
#endif

/* PyFloatBinop */
                  #if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyFloat_DivideCObj(PyObject *op1, PyObject *op2, double floatval, CYTHON_UNUSED int inplace) {
    const double a = floatval;
    double b, result;
    if (likely(PyFloat_CheckExact(op2))) {
        b = PyFloat_AS_DOUBLE(op2);
    } else
    #if PY_MAJOR_VERSION < 3
    if (likely(PyInt_CheckExact(op2))) {
        b = (double) PyInt_AS_LONG(op2);
    } else
    #endif
    if (likely(PyLong_CheckExact(op2))) {
        #if CYTHON_USE_PYLONG_INTERNALS
        const digit* digits = ((PyLongObject*)op2)->ob_digit;
        const Py_ssize_t size = Py_SIZE(op2);
        switch (size) {
            case  0: b = 0.0; break;
            case -1: b = -(double) digits[0]; break;
            case  1: b = (double) digits[0]; break;
            case -2:
            case 2:
                if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (1 * PyLong_SHIFT < 53))) {
                    b = (double) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                    if ((8 * sizeof(unsigned long) < 53) || (2 * PyLong_SHIFT < 53) || (b < (double) ((PY_LONG_LONG)1 << 53))) {
                        if (size == -2)
                            b = -b;
                        break;
                    }
                }
                CYTHON_FALLTHROUGH;
            case -3:
            case 3:
                if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (2 * PyLong_SHIFT < 53))) {
                    b = (double) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                    if ((8 * sizeof(unsigned long) < 53) || (3 * PyLong_SHIFT < 53) || (b < (double) ((PY_LONG_LONG)1 << 53))) {
                        if (size == -3)
                            b = -b;
                        break;
                    }
                }
                CYTHON_FALLTHROUGH;
            case -4:
            case 4:
                if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (3 * PyLong_SHIFT < 53))) {
                    b = (double) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                    if ((8 * sizeof(unsigned long) < 53) || (4 * PyLong_SHIFT < 53) || (b < (double) ((PY_LONG_LONG)1 << 53))) {
                        if (size == -4)
                            b = -b;
                        break;
                    }
                }
                CYTHON_FALLTHROUGH;
            default:
        #else
        {
        #endif
            b = PyLong_AsDouble(op2);
            if (unlikely(b == -1.0 && PyErr_Occurred())) return NULL;
        }
    } else {
        return (inplace ? __Pyx_PyNumber_InPlaceDivide(op1, op2) : __Pyx_PyNumber_Divide(op1, op2));
    }
        PyFPE_START_PROTECT("divide", return NULL)
        result = a / b;
        PyFPE_END_PROTECT(result)
        return PyFloat_FromDouble(result);
}
#endif

/* UnpackUnboundCMethod */
                    static int __Pyx_TryUnpackUnboundCMethod(__Pyx_CachedCFunction* target) {
    PyObject *method;
    method = __Pyx_PyObject_GetAttrStr(target->type, *target->method_name);
    if (unlikely(!method))
        return -1;
    target->method = method;
#if CYTHON_COMPILING_IN_CPYTHON
    #if PY_MAJOR_VERSION >= 3
    if (likely(__Pyx_TypeCheck(method, &PyMethodDescr_Type)))
    #endif
    {
        PyMethodDescrObject *descr = (PyMethodDescrObject*) method;
        target->func = descr->d_method->ml_meth;
        target->flag = descr->d_method->ml_flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST);
    }
#endif
    return 0;
}

/* CallUnboundCMethod0 */
                    static PyObject* __Pyx__CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self) {
    PyObject *args, *result = NULL;
    if (unlikely(!cfunc->method) && unlikely(__Pyx_TryUnpackUnboundCMethod(cfunc) < 0)) return NULL;
#if CYTHON_ASSUME_SAFE_MACROS
    args = PyTuple_New(1);
    if (unlikely(!args)) goto bad;
    Py_INCREF(self);
    PyTuple_SET_ITEM(args, 0, self);
#else
    args = PyTuple_Pack(1, self);
    if (unlikely(!args)) goto bad;
#endif
    result = __Pyx_PyObject_Call(cfunc->method, args, NULL);
    Py_DECREF(args);
bad:
    return result;
}

/* py_dict_items */
                    static CYTHON_INLINE PyObject* __Pyx_PyDict_Items(PyObject* d) {
    if (PY_MAJOR_VERSION >= 3)
        return __Pyx_CallUnboundCMethod0(&__pyx_umethod_PyDict_Type_items, d);
    else
        return PyDict_Items(d);
}

/* pyobject_as_double */
                    static double __Pyx__PyObject_AsDouble(PyObject* obj) {
    PyObject* float_value;
#if !CYTHON_USE_TYPE_SLOTS
    float_value = PyNumber_Float(obj);  if (0) goto bad;
#else
    PyNumberMethods *nb = Py_TYPE(obj)->tp_as_number;
    if (likely(nb) && likely(nb->nb_float)) {
        float_value = nb->nb_float(obj);
        if (likely(float_value) && unlikely(!PyFloat_Check(float_value))) {
            PyErr_Format(PyExc_TypeError,
                "__float__ returned non-float (type %.200s)",
                Py_TYPE(float_value)->tp_name);
            Py_DECREF(float_value);
            goto bad;
        }
    } else if (PyUnicode_CheckExact(obj) || PyBytes_CheckExact(obj)) {
#if PY_MAJOR_VERSION >= 3
        float_value = PyFloat_FromString(obj);
#else
        float_value = PyFloat_FromString(obj, 0);
#endif
    } else {
        PyObject* args = PyTuple_New(1);
        if (unlikely(!args)) goto bad;
        PyTuple_SET_ITEM(args, 0, obj);
        float_value = PyObject_Call((PyObject*)&PyFloat_Type, args, 0);
        PyTuple_SET_ITEM(args, 0, 0);
        Py_DECREF(args);
    }
#endif
    if (likely(float_value)) {
        double value = PyFloat_AS_DOUBLE(float_value);
        Py_DECREF(float_value);
        return value;
    }
bad:
    return (double)-1;
}

/* PyObject_GenericGetAttrNoDict */
                    #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
static PyObject *__Pyx_RaiseGenericGetAttributeError(PyTypeObject *tp, PyObject *attr_name) {
    PyErr_Format(PyExc_AttributeError,
#if PY_MAJOR_VERSION >= 3
                 "'%.50s' object has no attribute '%U'",
                 tp->tp_name, attr_name);
#else
                 "'%.50s' object has no attribute '%.400s'",
                 tp->tp_name, PyString_AS_STRING(attr_name));
#endif
    return NULL;
}
static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name) {
    PyObject *descr;
    PyTypeObject *tp = Py_TYPE(obj);
    if (unlikely(!PyString_Check(attr_name))) {
        return PyObject_GenericGetAttr(obj, attr_name);
    }
    assert(!tp->tp_dictoffset);
    descr = _PyType_Lookup(tp, attr_name);
    if (unlikely(!descr)) {
        return __Pyx_RaiseGenericGetAttributeError(tp, attr_name);
    }
    Py_INCREF(descr);
    #if PY_MAJOR_VERSION < 3
    if (likely(PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_HAVE_CLASS)))
    #endif
    {
        descrgetfunc f = Py_TYPE(descr)->tp_descr_get;
        if (unlikely(f)) {
            PyObject *res = f(descr, obj, (PyObject *)tp);
            Py_DECREF(descr);
            return res;
        }
    }
    return descr;
}
#endif

/* PyObject_GenericGetAttr */
                    #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name) {
    if (unlikely(Py_TYPE(obj)->tp_dictoffset)) {
        return PyObject_GenericGetAttr(obj, attr_name);
    }
    return __Pyx_PyObject_GenericGetAttrNoDict(obj, attr_name);
}
#endif

/* SetupReduce */
                    static int __Pyx_setup_reduce_is_named(PyObject* meth, PyObject* name) {
  int ret;
  PyObject *name_attr;
  name_attr = __Pyx_PyObject_GetAttrStr(meth, __pyx_n_s_name_2);
  if (likely(name_attr)) {
      ret = PyObject_RichCompareBool(name_attr, name, Py_EQ);
  } else {
      ret = -1;
  }
  if (unlikely(ret < 0)) {
      PyErr_Clear();
      ret = 0;
  }
  Py_XDECREF(name_attr);
  return ret;
}
static int __Pyx_setup_reduce(PyObject* type_obj) {
    int ret = 0;
    PyObject *object_reduce = NULL;
    PyObject *object_reduce_ex = NULL;
    PyObject *reduce = NULL;
    PyObject *reduce_ex = NULL;
    PyObject *reduce_cython = NULL;
    PyObject *setstate = NULL;
    PyObject *setstate_cython = NULL;
#if CYTHON_USE_PYTYPE_LOOKUP
    if (_PyType_Lookup((PyTypeObject*)type_obj, __pyx_n_s_getstate)) goto GOOD;
#else
    if (PyObject_HasAttr(type_obj, __pyx_n_s_getstate)) goto GOOD;
#endif
#if CYTHON_USE_PYTYPE_LOOKUP
    object_reduce_ex = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto BAD;
#else
    object_reduce_ex = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto BAD;
#endif
    reduce_ex = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce_ex); if (unlikely(!reduce_ex)) goto BAD;
    if (reduce_ex == object_reduce_ex) {
#if CYTHON_USE_PYTYPE_LOOKUP
        object_reduce = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto BAD;
#else
        object_reduce = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto BAD;
#endif
        reduce = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce); if (unlikely(!reduce)) goto BAD;
        if (reduce == object_reduce || __Pyx_setup_reduce_is_named(reduce, __pyx_n_s_reduce_cython)) {
            reduce_cython = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce_cython); if (unlikely(!reduce_cython)) goto BAD;
            ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce, reduce_cython); if (unlikely(ret < 0)) goto BAD;
            ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce_cython); if (unlikely(ret < 0)) goto BAD;
            setstate = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_setstate);
            if (!setstate) PyErr_Clear();
            if (!setstate || __Pyx_setup_reduce_is_named(setstate, __pyx_n_s_setstate_cython)) {
                setstate_cython = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_setstate_cython); if (unlikely(!setstate_cython)) goto BAD;
                ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate, setstate_cython); if (unlikely(ret < 0)) goto BAD;
                ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate_cython); if (unlikely(ret < 0)) goto BAD;
            }
            PyType_Modified((PyTypeObject*)type_obj);
        }
    }
    goto GOOD;
BAD:
    if (!PyErr_Occurred())
        PyErr_Format(PyExc_RuntimeError, "Unable to initialize pickling for %s", ((PyTypeObject*)type_obj)->tp_name);
    ret = -1;
GOOD:
#if !CYTHON_USE_PYTYPE_LOOKUP
    Py_XDECREF(object_reduce);
    Py_XDECREF(object_reduce_ex);
#endif
    Py_XDECREF(reduce);
    Py_XDECREF(reduce_ex);
    Py_XDECREF(reduce_cython);
    Py_XDECREF(setstate);
    Py_XDECREF(setstate_cython);
    return ret;
}

/* SetItemInt */
                    static int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v) {
    int r;
    if (!j) return -1;
    r = PyObject_SetItem(o, j, v);
    Py_DECREF(j);
    return r;
}
static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v, int is_list,
                                               CYTHON_NCP_UNUSED int wraparound, CYTHON_NCP_UNUSED int boundscheck) {
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS
    if (is_list || PyList_CheckExact(o)) {
        Py_ssize_t n = (!wraparound) ? i : ((likely(i >= 0)) ? i : i + PyList_GET_SIZE(o));
        if ((!boundscheck) || likely((n >= 0) & (n < PyList_GET_SIZE(o)))) {
            PyObject* old = PyList_GET_ITEM(o, n);
            Py_INCREF(v);
            PyList_SET_ITEM(o, n, v);
            Py_DECREF(old);
            return 1;
        }
    } else {
        PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
        if (likely(m && m->sq_ass_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))
                        return -1;
                    PyErr_Clear();
                }
            }
            return m->sq_ass_item(o, i, v);
        }
    }
#else
#if CYTHON_COMPILING_IN_PYPY
    if (is_list || (PySequence_Check(o) && !PyDict_Check(o))) {
#else
    if (is_list || PySequence_Check(o)) {
#endif
        return PySequence_SetItem(o, i, v);
    }
#endif
    return __Pyx_SetItemInt_Generic(o, PyInt_FromSsize_t(i), v);
}

/* CLineInTraceback */
                      #ifndef CYTHON_CLINE_IN_TRACEBACK
static int __Pyx_CLineForTraceback(CYTHON_UNUSED PyThreadState *tstate, int c_line) {
    PyObject *use_cline;
    PyObject *ptype, *pvalue, *ptraceback;
#if CYTHON_COMPILING_IN_CPYTHON
    PyObject **cython_runtime_dict;
#endif
    if (unlikely(!__pyx_cython_runtime)) {
        return c_line;
    }
    __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
#if CYTHON_COMPILING_IN_CPYTHON
    cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime);
    if (likely(cython_runtime_dict)) {
      use_cline = __Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback);
    } else
#endif
    {
      PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback);
      if (use_cline_obj) {
        use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True;
        Py_DECREF(use_cline_obj);
      } else {
        PyErr_Clear();
        use_cline = NULL;
      }
    }
    if (!use_cline) {
        c_line = 0;
        PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False);
    }
    else if (PyObject_Not(use_cline) != 0) {
        c_line = 0;
    }
    __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
    return c_line;
}
#endif

/* CodeObjectCache */
                      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 - start) / 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);
}

/* AddTraceback */
                      #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,
        0,
        0,
        0,
        0,
        __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,
        __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;
    PyFrameObject *py_frame = 0;
    PyThreadState *tstate = __Pyx_PyThreadState_Current;
    if (c_line) {
        c_line = __Pyx_CLineForTraceback(tstate, c_line);
    }
    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_frame = PyFrame_New(
        tstate,            /*PyThreadState *tstate,*/
        py_code,           /*PyCodeObject *code,*/
        __pyx_d,    /*PyObject *globals,*/
        0                  /*PyObject *locals*/
    );
    if (!py_frame) goto bad;
    __Pyx_PyFrame_SetLineNumber(py_frame, py_line);
    PyTraceBack_Here(py_frame);
bad:
    Py_XDECREF(py_code);
    Py_XDECREF(py_frame);
}

/* CIntToPy */
                      static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) {
    const int neg_one = (int) -1, const_zero = (int) 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);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(int) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
#endif
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(int),
                                     little, !is_unsigned);
    }
}

/* CIntToPy */
                      static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
    const long neg_one = (long) -1, const_zero = (long) 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);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(long) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
#endif
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(long),
                                     little, !is_unsigned);
    }
}

/* CIntFromPyVerify */
                      #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\
    __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0)
#define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\
    __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1)
#define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\
    {\
        func_type value = func_value;\
        if (sizeof(target_type) < sizeof(func_type)) {\
            if (unlikely(value != (func_type) (target_type) value)) {\
                func_type zero = 0;\
                if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\
                    return (target_type) -1;\
                if (is_unsigned && unlikely(value < zero))\
                    goto raise_neg_overflow;\
                else\
                    goto raise_overflow;\
            }\
        }\
        return (target_type) value;\
    }

/* CIntFromPy */
                      static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
    const long neg_one = (long) -1, const_zero = (long) 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(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (long) val;
        }
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (long) 0;
                case  1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0])
                case 2:
                    if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) {
                            return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) {
                            return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) {
                            return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
                        }
                    }
                    break;
            }
#endif
#if CYTHON_COMPILING_IN_CPYTHON
            if (unlikely(Py_SIZE(x) < 0)) {
                goto raise_neg_overflow;
            }
#else
            {
                int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
                if (unlikely(result < 0))
                    return (long) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if (sizeof(long) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
#endif
            }
        } else {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (long) 0;
                case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0]))
                case  1: __PYX_VERIFY_RETURN_INT(long,  digit, +digits[0])
                case -2:
                    if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                            return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                            return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                            return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                            return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                            return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                            return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
            }
#endif
            if (sizeof(long) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x))
#endif
            }
        }
        {
#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_IntOrLong(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_IntOrLong(x);
        if (!tmp) return (long) -1;
        val = __Pyx_PyInt_As_long(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to long");
    return (long) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to long");
    return (long) -1;
}

/* CIntFromPy */
                      static CYTHON_INLINE size_t __Pyx_PyInt_As_size_t(PyObject *x) {
    const size_t neg_one = (size_t) -1, const_zero = (size_t) 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(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (size_t) val;
        }
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (size_t) 0;
                case  1: __PYX_VERIFY_RETURN_INT(size_t, digit, digits[0])
                case 2:
                    if (8 * sizeof(size_t) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(size_t) >= 2 * PyLong_SHIFT) {
                            return (size_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(size_t) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(size_t) >= 3 * PyLong_SHIFT) {
                            return (size_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(size_t) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(size_t) >= 4 * PyLong_SHIFT) {
                            return (size_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
                        }
                    }
                    break;
            }
#endif
#if CYTHON_COMPILING_IN_CPYTHON
            if (unlikely(Py_SIZE(x) < 0)) {
                goto raise_neg_overflow;
            }
#else
            {
                int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
                if (unlikely(result < 0))
                    return (size_t) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if (sizeof(size_t) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT_EXC(size_t, unsigned long, PyLong_AsUnsignedLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(size_t) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(size_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
#endif
            }
        } else {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (size_t) 0;
                case -1: __PYX_VERIFY_RETURN_INT(size_t, sdigit, (sdigit) (-(sdigit)digits[0]))
                case  1: __PYX_VERIFY_RETURN_INT(size_t,  digit, +digits[0])
                case -2:
                    if (8 * sizeof(size_t) - 1 > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT) {
                            return (size_t) (((size_t)-1)*(((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if (8 * sizeof(size_t) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT) {
                            return (size_t) ((((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if (8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT) {
                            return (size_t) (((size_t)-1)*(((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(size_t) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT) {
                            return (size_t) ((((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if (8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(size_t) - 1 > 4 * PyLong_SHIFT) {
                            return (size_t) (((size_t)-1)*(((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(size_t) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(size_t) - 1 > 4 * PyLong_SHIFT) {
                            return (size_t) ((((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
                        }
                    }
                    break;
            }
#endif
            if (sizeof(size_t) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT_EXC(size_t, long, PyLong_AsLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(size_t) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(size_t, PY_LONG_LONG, PyLong_AsLongLong(x))
#endif
            }
        }
        {
#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_IntOrLong(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_IntOrLong(x);
        if (!tmp) return (size_t) -1;
        val = __Pyx_PyInt_As_size_t(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to size_t");
    return (size_t) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to size_t");
    return (size_t) -1;
}

/* CIntFromPy */
                      static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
    const int neg_one = (int) -1, const_zero = (int) 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(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (int) val;
        }
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (int) 0;
                case  1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0])
                case 2:
                    if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) {
                            return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) {
                            return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) {
                            return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
                        }
                    }
                    break;
            }
#endif
#if CYTHON_COMPILING_IN_CPYTHON
            if (unlikely(Py_SIZE(x) < 0)) {
                goto raise_neg_overflow;
            }
#else
            {
                int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
                if (unlikely(result < 0))
                    return (int) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if (sizeof(int) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
#endif
            }
        } else {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (int) 0;
                case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0]))
                case  1: __PYX_VERIFY_RETURN_INT(int,  digit, +digits[0])
                case -2:
                    if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
                            return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
                            return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
                            return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
                            return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
                            return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
                            return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
            }
#endif
            if (sizeof(int) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x))
#endif
            }
        }
        {
#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_IntOrLong(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_IntOrLong(x);
        if (!tmp) return (int) -1;
        val = __Pyx_PyInt_As_int(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to int");
    return (int) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to int");
    return (int) -1;
}

/* FastTypeChecks */
                      #if CYTHON_COMPILING_IN_CPYTHON
static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) {
    while (a) {
        a = a->tp_base;
        if (a == b)
            return 1;
    }
    return b == &PyBaseObject_Type;
}
static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) {
    PyObject *mro;
    if (a == b) return 1;
    mro = a->tp_mro;
    if (likely(mro)) {
        Py_ssize_t i, n;
        n = PyTuple_GET_SIZE(mro);
        for (i = 0; i < n; i++) {
            if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b)
                return 1;
        }
        return 0;
    }
    return __Pyx_InBases(a, b);
}
#if PY_MAJOR_VERSION == 2
static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) {
    PyObject *exception, *value, *tb;
    int res;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&exception, &value, &tb);
    res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0;
    if (unlikely(res == -1)) {
        PyErr_WriteUnraisable(err);
        res = 0;
    }
    if (!res) {
        res = PyObject_IsSubclass(err, exc_type2);
        if (unlikely(res == -1)) {
            PyErr_WriteUnraisable(err);
            res = 0;
        }
    }
    __Pyx_ErrRestore(exception, value, tb);
    return res;
}
#else
static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) {
    int res = exc_type1 ? __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type1) : 0;
    if (!res) {
        res = __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2);
    }
    return res;
}
#endif
static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject* exc_type) {
    if (likely(err == exc_type)) return 1;
    if (likely(PyExceptionClass_Check(err))) {
        return __Pyx_inner_PyErr_GivenExceptionMatches2(err, NULL, exc_type);
    }
    return PyErr_GivenExceptionMatches(err, exc_type);
}
static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *exc_type1, PyObject *exc_type2) {
    if (likely(err == exc_type1 || err == exc_type2)) return 1;
    if (likely(PyExceptionClass_Check(err))) {
        return __Pyx_inner_PyErr_GivenExceptionMatches2(err, exc_type1, exc_type2);
    }
    return (PyErr_GivenExceptionMatches(err, exc_type1) || PyErr_GivenExceptionMatches(err, exc_type2));
}
#endif

/* CheckBinaryVersion */
                      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);
        return PyErr_WarnEx(NULL, message, 1);
    }
    return 0;
}

/* ModuleImport */
                      #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

/* TypeImport */
                      #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. Expected %zd, got %zd",
            module_name, class_name, basicsize, size);
        if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad;
    }
    else if ((size_t)basicsize != size) {
        PyErr_Format(PyExc_ValueError,
            "%.200s.%.200s has the wrong size, try recompiling. Expected %zd, got %zd",
            module_name, class_name, basicsize, size);
        goto bad;
    }
    return (PyTypeObject *)result;
bad:
    Py_XDECREF(py_module);
    Py_XDECREF(result);
    return NULL;
}
#endif

/* InitStrings */
                      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
        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;
        if (PyObject_Hash(*t->p) == -1)
            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 const char* __Pyx_PyObject_AsString(PyObject* o) {
    Py_ssize_t ignore;
    return __Pyx_PyObject_AsStringAndSize(o, &ignore);
}
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
#if !CYTHON_PEP393_ENABLED
static const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
    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
    *length = PyBytes_GET_SIZE(defenc);
    return defenc_c;
}
#else
static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
    if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL;
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
    if (likely(PyUnicode_IS_ASCII(o))) {
        *length = PyUnicode_GET_LENGTH(o);
        return PyUnicode_AsUTF8(o);
    } else {
        PyUnicode_AsASCIIString(o);
        return NULL;
    }
#else
    return PyUnicode_AsUTF8AndSize(o, length);
#endif
}
#endif
#endif
static CYTHON_INLINE const 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)) {
        return __Pyx_PyUnicode_AsStringAndSize(o, length);
    } else
#endif
#if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE))
    if (PyByteArray_Check(o)) {
        *length = PyByteArray_GET_SIZE(o);
        return PyByteArray_AS_STRING(o);
    } else
#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 PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result, const char* type_name) {
#if PY_MAJOR_VERSION >= 3
    if (PyLong_Check(result)) {
        if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1,
                "__int__ returned non-int (type %.200s).  "
                "The ability to return an instance of a strict subclass of int "
                "is deprecated, and may be removed in a future version of Python.",
                Py_TYPE(result)->tp_name)) {
            Py_DECREF(result);
            return NULL;
        }
        return result;
    }
#endif
    PyErr_Format(PyExc_TypeError,
                 "__%.4s__ returned non-%.4s (type %.200s)",
                 type_name, type_name, Py_TYPE(result)->tp_name);
    Py_DECREF(result);
    return NULL;
}
static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) {
#if CYTHON_USE_TYPE_SLOTS
  PyNumberMethods *m;
#endif
  const char *name = NULL;
  PyObject *res = NULL;
#if PY_MAJOR_VERSION < 3
  if (likely(PyInt_Check(x) || PyLong_Check(x)))
#else
  if (likely(PyLong_Check(x)))
#endif
    return __Pyx_NewRef(x);
#if CYTHON_USE_TYPE_SLOTS
  m = Py_TYPE(x)->tp_as_number;
  #if PY_MAJOR_VERSION < 3
  if (m && m->nb_int) {
    name = "int";
    res = m->nb_int(x);
  }
  else if (m && m->nb_long) {
    name = "long";
    res = m->nb_long(x);
  }
  #else
  if (likely(m && m->nb_int)) {
    name = "int";
    res = m->nb_int(x);
  }
  #endif
#else
  if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) {
    res = PyNumber_Int(x);
  }
#endif
  if (likely(res)) {
#if PY_MAJOR_VERSION < 3
    if (unlikely(!PyInt_Check(res) && !PyLong_Check(res))) {
#else
    if (unlikely(!PyLong_CheckExact(res))) {
#endif
        return __Pyx_PyNumber_IntOrLongWrongResultType(res, name);
    }
  }
  else if (!PyErr_Occurred()) {
    PyErr_SetString(PyExc_TypeError,
                    "an integer is required");
  }
  return res;
}
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))) {
    if (sizeof(Py_ssize_t) >= sizeof(long))
        return PyInt_AS_LONG(b);
    else
        return PyInt_AsSsize_t(x);
  }
#endif
  if (likely(PyLong_CheckExact(b))) {
    #if CYTHON_USE_PYLONG_INTERNALS
    const digit* digits = ((PyLongObject*)b)->ob_digit;
    const Py_ssize_t size = Py_SIZE(b);
    if (likely(__Pyx_sst_abs(size) <= 1)) {
        ival = likely(size) ? digits[0] : 0;
        if (size == -1) ival = -ival;
        return ival;
    } else {
      switch (size) {
         case 2:
           if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
             return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
         case -2:
           if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
             return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
         case 3:
           if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
             return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
         case -3:
           if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
             return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
         case 4:
           if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
             return (Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
         case -4:
           if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
             return -(Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
      }
    }
    #endif
    return PyLong_AsSsize_t(b);
  }
  x = PyNumber_Index(b);
  if (!x) return -1;
  ival = PyInt_AsSsize_t(x);
  Py_DECREF(x);
  return ival;
}
static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) {
  return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False);
}
static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
    return PyInt_FromSize_t(ival);
}


#endif /* Py_PYTHON_H */
