/* Generated by Cython 0.23.2 */

#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 < 0x03020000)
    #error Cython requires Python 2.6+ or Python 3.2+.
#else
#define CYTHON_ABI "0_23_2"
#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
#ifndef PY_LONG_LONG
  #define PY_LONG_LONG LONG_LONG
#endif
#ifndef Py_HUGE_VAL
  #define Py_HUGE_VAL HUGE_VAL
#endif
#ifdef PYPY_VERSION
#define CYTHON_COMPILING_IN_PYPY 1
#define CYTHON_COMPILING_IN_CPYTHON 0
#else
#define CYTHON_COMPILING_IN_PYPY 0
#define CYTHON_COMPILING_IN_CPYTHON 1
#endif
#if !defined(CYTHON_USE_PYLONG_INTERNALS) && CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x02070000
#define CYTHON_USE_PYLONG_INTERNALS 1
#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 > 0x03030000 && defined(PyUnicode_KIND)
  #define CYTHON_PEP393_ENABLED 1
  #define __Pyx_PyUnicode_READY(op)       (likely(PyUnicode_IS_READY(op)) ?\
                                              0 : _PyUnicode_Ready((PyObject *)(op)))
  #define __Pyx_PyUnicode_GET_LENGTH(u)   PyUnicode_GET_LENGTH(u)
  #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
  #define __Pyx_PyUnicode_KIND(u)         PyUnicode_KIND(u)
  #define __Pyx_PyUnicode_DATA(u)         PyUnicode_DATA(u)
  #define __Pyx_PyUnicode_READ(k, d, i)   PyUnicode_READ(k, d, i)
#else
  #define CYTHON_PEP393_ENABLED 0
  #define __Pyx_PyUnicode_READY(op)       (0)
  #define __Pyx_PyUnicode_GET_LENGTH(u)   PyUnicode_GET_SIZE(u)
  #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
  #define __Pyx_PyUnicode_KIND(u)         (sizeof(Py_UNICODE))
  #define __Pyx_PyUnicode_DATA(u)         ((void*)PyUnicode_AS_UNICODE(u))
  #define __Pyx_PyUnicode_READ(k, d, i)   ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
#endif
#if CYTHON_COMPILING_IN_PYPY
  #define __Pyx_PyUnicode_Concat(a, b)      PyNumber_Add(a, b)
  #define __Pyx_PyUnicode_ConcatSafe(a, b)  PyNumber_Add(a, b)
#else
  #define __Pyx_PyUnicode_Concat(a, b)      PyUnicode_Concat(a, b)
  #define __Pyx_PyUnicode_ConcatSafe(a, b)  ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\
      PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
#endif
#if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains)
  #define PyUnicode_Contains(u, s)  PySequence_Contains(u, s)
#endif
#define __Pyx_PyString_FormatSafe(a, b)   ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b))
#define __Pyx_PyUnicode_FormatSafe(a, b)  ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
#if PY_MAJOR_VERSION >= 3
  #define __Pyx_PyString_Format(a, b)  PyUnicode_Format(a, b)
#else
  #define __Pyx_PyString_Format(a, b)  PyString_Format(a, b)
#endif
#if PY_MAJOR_VERSION >= 3
  #define PyBaseString_Type            PyUnicode_Type
  #define PyStringObject               PyUnicodeObject
  #define PyString_Type                PyUnicode_Type
  #define PyString_Check               PyUnicode_Check
  #define PyString_CheckExact          PyUnicode_CheckExact
#endif
#if PY_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
#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
#if PY_MAJOR_VERSION >= 3
  #define PyIntObject                  PyLongObject
  #define PyInt_Type                   PyLong_Type
  #define PyInt_Check(op)              PyLong_Check(op)
  #define PyInt_CheckExact(op)         PyLong_CheckExact(op)
  #define PyInt_FromString             PyLong_FromString
  #define PyInt_FromUnicode            PyLong_FromUnicode
  #define PyInt_FromLong               PyLong_FromLong
  #define PyInt_FromSize_t             PyLong_FromSize_t
  #define PyInt_FromSsize_t            PyLong_FromSsize_t
  #define PyInt_AsLong                 PyLong_AsLong
  #define PyInt_AS_LONG                PyLong_AS_LONG
  #define PyInt_AsSsize_t              PyLong_AsSsize_t
  #define PyInt_AsUnsignedLongMask     PyLong_AsUnsignedLongMask
  #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
  #define PyNumber_Int                 PyNumber_Long
#endif
#if PY_MAJOR_VERSION >= 3
  #define PyBoolObject                 PyLongObject
#endif
#if PY_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) : PyInstanceMethod_New(func))
#else
  #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass)
#endif
#if PY_VERSION_HEX >= 0x030500B1
#define __Pyx_PyAsyncMethodsStruct PyAsyncMethods
#define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async)
#elif CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
typedef struct {
    unaryfunc am_await;
    unaryfunc am_aiter;
    unaryfunc am_anext;
} __Pyx_PyAsyncMethodsStruct;
#define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved))
#else
#define __Pyx_PyType_AsAsync(obj) NULL
#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
#define __Pyx_void_to_None(void_result) (void_result, Py_INCREF(Py_None), Py_None)

#ifndef CYTHON_INLINE
  #if defined(__GNUC__)
    #define CYTHON_INLINE __inline__
  #elif defined(_MSC_VER)
    #define CYTHON_INLINE __inline
  #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
    #define CYTHON_INLINE inline
  #else
    #define CYTHON_INLINE
  #endif
#endif

#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 PY_MAJOR_VERSION >= 3
  #define __Pyx_PyNumber_Divide(x,y)         PyNumber_TrueDivide(x,y)
  #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceTrueDivide(x,y)
#else
  #define __Pyx_PyNumber_Divide(x,y)         PyNumber_Divide(x,y)
  #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceDivide(x,y)
#endif

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

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

#ifdef PYREX_WITHOUT_ASSERTIONS
#define CYTHON_WITHOUT_ASSERTIONS
#endif

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

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


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

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


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

/*--- 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":2066
 *     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":362
 *     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":792
 *     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":1813
 *         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) --- */
#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)

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

static PyObject *__Pyx_GetBuiltinName(PyObject *name);

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);

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

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

static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type);

#define __Pyx_CyFunction_USED 1
#include <structmember.h>
#define __Pyx_CYFUNCTION_STATICMETHOD  0x01
#define __Pyx_CYFUNCTION_CLASSMETHOD   0x02
#define __Pyx_CYFUNCTION_CCLASS        0x04
#define __Pyx_CyFunction_GetClosure(f)\
    (((__pyx_CyFunctionObject *) (f))->func_closure)
#define __Pyx_CyFunction_GetClassObj(f)\
    (((__pyx_CyFunctionObject *) (f))->func_classobj)
#define __Pyx_CyFunction_Defaults(type, f)\
    ((type *)(((__pyx_CyFunctionObject *) (f))->defaults))
#define __Pyx_CyFunction_SetDefaultsGetter(f, g)\
    ((__pyx_CyFunctionObject *) (f))->defaults_getter = (g)
typedef struct {
    PyCFunctionObject func;
#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);

static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);

static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);

static CYTHON_INLINE int __Pyx_IterFinish(void);

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

#if CYTHON_COMPILING_IN_CPYTHON
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

#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

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

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

static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name);

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

static CYTHON_INLINE long __Pyx_div_long(long, long);

#if CYTHON_COMPILING_IN_CPYTHON
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

#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
#endif

static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);

#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

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

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

#if CYTHON_COMPILING_IN_CPYTHON
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

#define __Pyx_PyIter_Next(obj) __Pyx_PyIter_Next2(obj, NULL)
static CYTHON_INLINE PyObject *__Pyx_PyIter_Next2(PyObject *, PyObject *);

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

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

static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname);

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

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

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));
}

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

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

#include <string.h>

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

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

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

#if CYTHON_COMPILING_IN_CPYTHON
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

#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

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));

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

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

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

#if CYTHON_COMPILING_IN_CPYTHON
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

#if CYTHON_COMPILING_IN_CPYTHON
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

#if CYTHON_COMPILING_IN_CPYTHON
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

#if CYTHON_COMPILING_IN_CPYTHON
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

#if CYTHON_COMPILING_IN_CPYTHON
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

static CYTHON_INLINE PyObject* __Pyx_PyDict_Items(PyObject* d);

typedef struct {
    PyObject *type;
    PyObject **method_name;
    PyCFunction func;
    PyObject *method;
    int flag;
} __Pyx_CachedCFunction;

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) :\
         (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

static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *, PyObject *);

#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 CYTHON_INLINE 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);

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

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

static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value);

static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);

static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);

static CYTHON_INLINE size_t __Pyx_PyInt_As_size_t(PyObject *);

static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);

static int __Pyx_check_binary_version(void);

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

static PyObject *__Pyx_ImportModule(const char *name);

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

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"
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 char __pyx_k_C[] = "C";
static char __pyx_k_F[] = "F";
static char __pyx_k_a[] = "a";
static char __pyx_k_b[] = "b";
static char __pyx_k_d[] = "d";
static char __pyx_k_h[] = "h";
static char __pyx_k_k[] = "k";
static char __pyx_k_l[] = "l";
static char __pyx_k_s[] = " %s";
static char __pyx_k_v[] = "v";
static char __pyx_k_Dx[] = "Dx";
static char __pyx_k_Dy[] = "Dy";
static char __pyx_k_Ni[] = "Ni";
static char __pyx_k_Nj[] = "Nj";
static char __pyx_k_Nr[] = "Nr";
static char __pyx_k_Nx[] = "Nx";
static char __pyx_k_Ny[] = "Ny";
static char __pyx_k__8[] = "";
static char __pyx_k_dx[] = "dx";
static char __pyx_k_dy[] = "dy";
static char __pyx_k_gh[] = "_gh";
static char __pyx_k_jd[] = "jd";
static char __pyx_k_ma[] = "ma";
static char __pyx_k_np[] = "np";
static char __pyx_k_pi[] = "pi";
static char __pyx_k_pl[] = "pl";
static char __pyx_k_rb[] = "rb";
static char __pyx_k_04i[] = "%04i";
static char __pyx_k_LaD[] = "LaD";
static char __pyx_k_LoV[] = "LoV";
static char __pyx_k__13[] = "-";
static char __pyx_k__18[] = ":";
static char __pyx_k__23[] = " (";
static char __pyx_k__24[] = ")";
static char __pyx_k_aea[] = "aea";
static char __pyx_k_cyl[] = "cyl";
static char __pyx_k_day[] = "day";
static char __pyx_k_div[] = "div";
static char __pyx_k_err[] = "err";
static char __pyx_k_grb[] = "grb";
static char __pyx_k_hrs[] = "hrs";
static char __pyx_k_int[] = "int";
static char __pyx_k_key[] = "key";
static char __pyx_k_lcc[] = "lcc";
static char __pyx_k_max[] = "max";
static char __pyx_k_min[] = "min";
static char __pyx_k_msg[] = "msg";
static char __pyx_k_one[] = "one";
static char __pyx_k_s_2[] = " (> %s)";
static char __pyx_k_s_3[] = " (< %s)";
static char __pyx_k_s_4[] = "s";
static char __pyx_k_s_s[] = " (%s-%s)";
static char __pyx_k_sum[] = "sum";
static char __pyx_k_yrs[] = "yrs";
static char __pyx_k_7777[] = "7777";
static char __pyx_k_Proj[] = "Proj";
static char __pyx_k__100[] = ",";
static char __pyx_k_aeqd[] = "aeqd";
static char __pyx_k_call[] = "__call__";
static char __pyx_k_copy[] = "copy";
static char __pyx_k_data[] = "data";
static char __pyx_k_days[] = "days";
static char __pyx_k_dict[] = "__dict__";
static char __pyx_k_fabs[] = "fabs";
static char __pyx_k_file[] = "file";
static char __pyx_k_find[] = "_find";
static char __pyx_k_from[] = ":from ";
static char __pyx_k_geos[] = "geos";
static char __pyx_k_gh_2[] = "gh";
static char __pyx_k_hour[] = "hour";
static char __pyx_k_isMA[] = "isMA";
static char __pyx_k_join[] = "join";
static char __pyx_k_keys[] = "keys";
static char __pyx_k_laea[] = "laea";
static char __pyx_k_lat1[] = "lat1";
static char __pyx_k_lat2[] = "lat2";
static char __pyx_k_lats[] = "lats";
static char __pyx_k_lon1[] = "lon1";
static char __pyx_k_lon2[] = "lon2";
static char __pyx_k_main[] = "__main__";
static char __pyx_k_merc[] = "merc";
static char __pyx_k_mins[] = "mins";
static char __pyx_k_msgs[] = "msgs";
static char __pyx_k_name[] = "name";
static char __pyx_k_ndim[] = "ndim";
static char __pyx_k_next[] = "next";
static char __pyx_k_proj[] = "proj";
static char __pyx_k_secs[] = "secs";
static char __pyx_k_seek[] = "seek";
static char __pyx_k_size[] = "size";
static char __pyx_k_tell[] = "tell";
static char __pyx_k_test[] = "__test__";
static char __pyx_k_warn[] = "warn";
static char __pyx_k_year[] = "year";
static char __pyx_k_zero[] = "zero";
static char __pyx_k_2_0_2[] = "2.0.2";
static char __pyx_k_Latin[] = "Latin";
static char __pyx_k_ascii[] = "ascii";
static char __pyx_k_atype[] = "atype";
static char __pyx_k_close[] = "close";
static char __pyx_k_d_d_d[] = "%d.%d.%d";
static char __pyx_k_eight[] = "eight";
static char __pyx_k_empty[] = "empty";
static char __pyx_k_false[] = "false";
static char __pyx_k_float[] = "float";
static char __pyx_k_ftime[] = "ftime";
static char __pyx_k_index[] = "index";
static char __pyx_k_items[] = "items";
static char __pyx_k_lat_0[] = "lat_0";
static char __pyx_k_lat_1[] = "lat_1";
static char __pyx_k_lat_2[] = "lat_2";
static char __pyx_k_level[] = "level";
static char __pyx_k_lon_0[] = "lon_0";
static char __pyx_k_major[] = "major";
static char __pyx_k_minor[] = "minor";
static char __pyx_k_month[] = "month";
static char __pyx_k_nlats[] = "nlats";
static char __pyx_k_nmsgs[] = "nmsgs";
static char __pyx_k_nsper[] = "nsper";
static char __pyx_k_numpy[] = "numpy";
static char __pyx_k_order[] = "order";
static char __pyx_k_power[] = "power";
static char __pyx_k_range[] = "range";
static char __pyx_k_shape[] = "shape";
static char __pyx_k_split[] = "split";
static char __pyx_k_stere[] = "stere";
static char __pyx_k_units[] = "units";
static char __pyx_k_value[] = "value";
static char __pyx_k_where[] = "where";
static char __pyx_k_zeros[] = "zeros";
static char __pyx_k_Latin1[] = "Latin1";
static char __pyx_k_Latin2[] = "Latin2";
static char __pyx_k_albers[] = "albers";
static char __pyx_k_arange[] = "arange";
static char __pyx_k_arcsin[] = "arcsin";
static char __pyx_k_decode[] = "decode";
static char __pyx_k_double[] = "double";
static char __pyx_k_eleven[] = "eleven";
static char __pyx_k_encode[] = "encode";
static char __pyx_k_filled[] = "filled";
static char __pyx_k_import[] = "__import__";
static char __pyx_k_julday[] = "julday";
static char __pyx_k_kwargs[] = "kwargs";
static char __pyx_k_lat_ts[] = "lat_ts";
static char __pyx_k_minute[] = "minute";
static char __pyx_k_months[] = "months";
static char __pyx_k_o_proj[] = "o_proj";
static char __pyx_k_pygrib[] = "pygrib";
static char __pyx_k_pyproj[] = "pyproj";
static char __pyx_k_radius[] = "radius";
static char __pyx_k_reload[] = "reload";
static char __pyx_k_rewind[] = "rewind";
static char __pyx_k_rstrip[] = "rstrip";
static char __pyx_k_second[] = "second";
static char __pyx_k_select[] = "select";
static char __pyx_k_values[] = "values";
static char __pyx_k_xrange[] = "xrange";
static char __pyx_k_IOError[] = "IOError";
static char __pyx_k_advance[] = "_advance";
static char __pyx_k_asarray[] = "asarray";
static char __pyx_k_decades[] = "decades";
static char __pyx_k_default[] = "default";
static char __pyx_k_float64[] = "float64";
static char __pyx_k_gaulats[] = "gaulats";
static char __pyx_k_get_key[] = "_get_key";
static char __pyx_k_getitem[] = "__getitem__";
static char __pyx_k_gribmsg[] = "gribmsg";
static char __pyx_k_gribstr[] = "gribstr";
static char __pyx_k_has_key[] = "has_key";
static char __pyx_k_indices[] = "indices";
static char __pyx_k_instant[] = "instant";
static char __pyx_k_inverse[] = "inverse";
static char __pyx_k_lambert[] = "lambert";
static char __pyx_k_latlons[] = "latlons";
static char __pyx_k_level_s[] = ":level %s";
static char __pyx_k_longlat[] = "longlat";
static char __pyx_k_message[] = "message";
static char __pyx_k_o_lat_p[] = "o_lat_p";
static char __pyx_k_o_lon_p[] = "o_lon_p";
static char __pyx_k_ob_tran[] = "ob_tran";
static char __pyx_k_paramId[] = "paramId";
static char __pyx_k_reduced[] = "reduced";
static char __pyx_k_reshape[] = "reshape";
static char __pyx_k_ro_keys[] = "_ro_keys";
static char __pyx_k_unknown[] = "unknown";
static char __pyx_k_version[] = "__version__";
static char __pyx_k_KeyError[] = "KeyError";
static char __pyx_k_all_keys[] = "_all_keys";
static char __pyx_k_analDate[] = "analDate";
static char __pyx_k_dataDate[] = "dataDate";
static char __pyx_k_dataTime[] = "dataTime";
static char __pyx_k_datetime[] = "datetime";
static char __pyx_k_ens_mean[] = ":ens mean";
static char __pyx_k_filename[] = "filename";
static char __pyx_k_gridType[] = "gridType";
static char __pyx_k_linspace[] = "linspace";
static char __pyx_k_localDir[] = "localDir";
static char __pyx_k_mercator[] = "mercator";
static char __pyx_k_meshgrid[] = "meshgrid";
static char __pyx_k_redtoreg[] = "redtoreg";
static char __pyx_k_revision[] = "revision";
static char __pyx_k_setdates[] = "setdates";
static char __pyx_k_stepType[] = "stepType";
static char __pyx_k_thousand[] = "thousand";
static char __pyx_k_topLevel[] = "topLevel";
static char __pyx_k_tostring[] = "tostring";
static char __pyx_k_warnings[] = "warnings";
static char __pyx_k_TypeError[] = "TypeError";
static char __pyx_k_centuries[] = "centuries";
static char __pyx_k_from_what[] = "from_what";
static char __pyx_k_ftimedict[] = "_ftimedict";
static char __pyx_k_julianDay[] = "julianDay";
static char __pyx_k_latitudes[] = "latitudes";
static char __pyx_k_ncepgrib2[] = "ncepgrib2";
static char __pyx_k_stepRange[] = "stepRange";
static char __pyx_k_traceback[] = "traceback";
static char __pyx_k_validDate[] = "validDate";
static char __pyx_k_valid_key[] = "valid_key";
static char __pyx_k_DxInMetres[] = "DxInMetres";
static char __pyx_k_DyInMetres[] = "DyInMetres";
static char __pyx_k_IndexError[] = "IndexError";
static char __pyx_k_ValueError[] = "ValueError";
static char __pyx_k_ens_spread[] = ":ens spread";
static char __pyx_k_fromstring[] = "fromstring";
static char __pyx_k_gribstring[] = "gribstring";
static char __pyx_k_is_missing[] = "is_missing";
static char __pyx_k_iscallable[] = "iscallable";
static char __pyx_k_levels_s_s[] = ":levels %s-%s";
static char __pyx_k_longitudes[] = "longitudes";
static char __pyx_k_projparams[] = "projparams";
static char __pyx_k_redtoreg_2[] = "_redtoreg";
static char __pyx_k_reduced_gg[] = "reduced_gg";
static char __pyx_k_reduced_ll[] = "reduced_ll";
static char __pyx_k_regular_gg[] = "regular_gg";
static char __pyx_k_regular_ll[] = "regular_ll";
static char __pyx_k_rotated_gg[] = "rotated_gg";
static char __pyx_k_rotated_ll[] = "rotated_ll";
static char __pyx_k_space_view[] = "space_view";
static char __pyx_k_startswith[] = "startswith";
static char __pyx_k_typeOfGrid[] = "typeOfGrid";
static char __pyx_k_Grib2Decode[] = "Grib2Decode";
static char __pyx_k_ImportError[] = "ImportError";
static char __pyx_k_bottomLevel[] = "bottomLevel";
static char __pyx_k_ens_std_dev[] = ":ens std dev";
static char __pyx_k_iscontainer[] = "iscontainer";
static char __pyx_k_oneThousand[] = "oneThousand";
static char __pyx_k_packingType[] = "packingType";
static char __pyx_k_return_msgs[] = "return_msgs";
static char __pyx_k_typeOfLevel[] = "typeOfLevel";
static char __pyx_k_3_hr_periods[] = "3 hr periods";
static char __pyx_k_6_hr_periods[] = "6 hr periods";
static char __pyx_k_LaDInDegrees[] = "LaDInDegrees";
static char __pyx_k_LoVInDegrees[] = "LoVInDegrees";
static char __pyx_k_RuntimeError[] = "RuntimeError";
static char __pyx_k_fcstimeunits[] = "fcstimeunits";
static char __pyx_k_forecastTime[] = "forecastTime";
static char __pyx_k_grib2divider[] = "grib2divider";
static char __pyx_k_grid_complex[] = "grid_complex";
static char __pyx_k_is_container[] = "_is_container";
static char __pyx_k_missingValue[] = "missingValue";
static char __pyx_k_private_atts[] = "_private_atts";
static char __pyx_k_reshape_mask[] = "_reshape_mask";
static char __pyx_k_unshape_mask[] = "_unshape_mask";
static char __pyx_k_12_hr_periods[] = "12 hr periods";
static char __pyx_k_30_yr_periods[] = "30 yr periods";
static char __pyx_k_StopIteration[] = "StopIteration";
static char __pyx_k_fcst_time_s_s[] = ":fcst time %s %s";
static char __pyx_k_is_stringlike[] = "_is_stringlike";
static char __pyx_k_masked_values[] = "masked_values";
static char __pyx_k_messagenumber[] = "messagenumber";
static char __pyx_k_parameterName[] = "parameterName";
static char __pyx_k_AttributeError[] = "AttributeError";
static char __pyx_k_expand_reduced[] = "expand_reduced";
static char __pyx_k_neg_ens_pert_d[] = ":neg ens pert %d";
static char __pyx_k_numberOfValues[] = "numberOfValues";
static char __pyx_k_parameterUnits[] = "parameterUnits";
static char __pyx_k_pos_ens_pert_d[] = ":pos ens pert %d";
static char __pyx_k_read_only_keys[] = "_read_only_keys";
static char __pyx_k_set_projparams[] = "_set_projparams";
static char __pyx_k_Latin1InDegrees[] = "Latin1InDegrees";
static char __pyx_k_Latin2InDegrees[] = "Latin2InDegrees";
static char __pyx_k_derivedForecast[] = "derivedForecast";
static char __pyx_k_fcst_time_s_s_s[] = ":fcst time %s %s (%s)";
static char __pyx_k_numberOfMissing[] = "numberOfMissing";
static char __pyx_k_shapeOfTheEarth[] = "shapeOfTheEarth";
static char __pyx_k_truncateDegrees[] = "truncateDegrees";
static char __pyx_k_centralLongitude[] = "centralLongitude";
static char __pyx_k_could_not_open_s[] = "could not open %s";
static char __pyx_k_default_encoding[] = "default_encoding";
static char __pyx_k_grib_api_version[] = "grib_api_version";
static char __pyx_k_hi_res_cntl_fcst[] = ":hi res cntl fcst";
static char __pyx_k_lo_res_cntl_fcst[] = ":lo res cntl fcst";
static char __pyx_k_missingvalue_int[] = "missingvalue_int";
static char __pyx_k_multi_support_on[] = "multi_support_on";
static char __pyx_k_no_matches_found[] = "no matches found";
static char __pyx_k_standardParallel[] = "standardParallel";
static char __pyx_k_tolerate_badgrib[] = "tolerate_badgrib";
static char __pyx_k_distinctLatitudes[] = "distinctLatitudes";
static char __pyx_k_multi_support_off[] = "multi_support_off";
static char __pyx_k_weighted_ens_mean[] = ":weighted ens mean";
static char __pyx_k_datetime_to_julian[] = "datetime_to_julian";
static char __pyx_k_distinctLongitudes[] = "distinctLongitudes";
static char __pyx_k_julian_to_datetime[] = "julian_to_datetime";
static char __pyx_k_key_s_is_read_only[] = "key \"%s\" is read only";
static char __pyx_k_missingvalue_float[] = "missingvalue_float";
static char __pyx_k_nlats_must_be_even[] = "nlats must be even";
static char __pyx_k_perturbationNumber[] = "perturbationNumber";
static char __pyx_k_unsupported_grid_s[] = "unsupported grid %s";
static char __pyx_k_ens_mean_of_cluster[] = ":ens mean of cluster";
static char __pyx_k_iDirectionIncrement[] = "iDirectionIncrement";
static char __pyx_k_polar_stereographic[] = "polar_stereographic";
static char __pyx_k_probabilityTypeName[] = "probabilityTypeName";
static char __pyx_k_tolerate_badgrib_on[] = "tolerate_badgrib_on";
static char __pyx_k_get_grib_api_version[] = "_get_grib_api_version";
static char __pyx_k_mpl_toolkits_basemap[] = "mpl_toolkits.basemap";
static char __pyx_k_projectionCenterFlag[] = "projectionCenterFlag";
static char __pyx_k_projectionCentreFlag[] = "projectionCentreFlag";
static char __pyx_k_tolerate_badgrib_off[] = "tolerate_badgrib_off";
static char __pyx_k_jPointsAreConsecutive[] = "jPointsAreConsecutive";
static char __pyx_k_alternativeRowScanning[] = "alternativeRowScanning";
static char __pyx_k_array_must_be_1d_or_2d[] = "array must be 1d or 2d";
static char __pyx_k_normalized_ens_std_dev[] = ":normalized ens std dev";
static char __pyx_k_typeOfEnsembleForecast[] = "typeOfEnsembleForecast";
static char __pyx_k_ens_large_anomaly_index[] = ":ens large anomaly index";
static char __pyx_k_latitudeOfLastGridPoint[] = "latitudeOfLastGridPoint";
static char __pyx_k_scaleFactorOfLowerLimit[] = "scaleFactorOfLowerLimit";
static char __pyx_k_scaleFactorOfUpperLimit[] = "scaleFactorOfUpperLimit";
static char __pyx_k_scaledValueOfLowerLimit[] = "scaledValueOfLowerLimit";
static char __pyx_k_scaledValueOfUpperLimit[] = "scaledValueOfUpperLimit";
static char __pyx_k_typeOfFirstFixedSurface[] = "typeOfFirstFixedSurface";
static char __pyx_k_angleOfRotationInDegrees[] = "angleOfRotationInDegrees";
static char __pyx_k_latitudeOfFirstGridPoint[] = "latitudeOfFirstGridPoint";
static char __pyx_k_longitudeOfLastGridPoint[] = "longitudeOfLastGridPoint";
static char __pyx_k_typeOfSecondFixedSurface[] = "typeOfSecondFixedSurface";
static char __pyx_k_unitsOfFirstFixedSurface[] = "unitsOfFirstFixedSurface";
static char __pyx_k_unrecognized_grib_type_d[] = "unrecognized grib type % d";
static char __pyx_k_longitudeOfFirstGridPoint[] = "longitudeOfFirstGridPoint";
static char __pyx_k_indicatorOfUnitOfTimeRange[] = "indicatorOfUnitOfTimeRange";
static char __pyx_k_key_not_part_of_grib_index[] = "key not part of grib index";
static char __pyx_k_nmsgs_must_be_0_in__advance[] = "nmsgs must be >= 0 in _advance";
static char __pyx_k_scaledValueOfEarthMajorAxis[] = "scaledValueOfEarthMajorAxis";
static char __pyx_k_scaledValueOfEarthMinorAxis[] = "scaledValueOfEarthMinorAxis";
static char __pyx_k_lambert_azimuthal_equal_area[] = "lambert_azimuthal_equal_area";
static char __pyx_k_xDirectionGridLengthInMetres[] = "xDirectionGridLengthInMetres";
static char __pyx_k_yDirectionGridLengthInMetres[] = "yDirectionGridLengthInMetres";
static char __pyx_k_orientationOfTheGridInDegrees[] = "orientationOfTheGridInDegrees";
static 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 char __pyx_k_grb_message_numbers_start_at_1[] = "grb message numbers start at 1";
static char __pyx_k_not_that_many_messages_in_file[] = "not that many messages in file";
static char __pyx_k_scaleFactorOfFirstFixedSurface[] = "scaleFactorOfFirstFixedSurface";
static char __pyx_k_scaledValueOfFirstFixedSurface[] = "scaledValueOfFirstFixedSurface";
static char __pyx_k_Volumes_Drobo_python_pygrib_git[] = "/Volumes/Drobo/python/pygrib.git/pygrib.pyx";
static 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 char __pyx_k_get_grib_api_version_locals_lam[] = "_get_grib_api_version.<locals>.<lambda>";
static char __pyx_k_latitudeOfSouthernPoleInDegrees[] = "latitudeOfSouthernPoleInDegrees";
static char __pyx_k_reduced_grid_data_array_must_be[] = "reduced grid data array must be 1d";
static char __pyx_k_scaleFactorOfSecondFixedSurface[] = "scaleFactorOfSecondFixedSurface";
static char __pyx_k_scaledValueOfSecondFixedSurface[] = "scaledValueOfSecondFixedSurface";
static char __pyx_k_unknown_shape_of_the_earth_flag[] = "unknown shape of the earth flag";
static char __pyx_k_This_class_cannot_be_instantiate[] = "This class cannot be instantiated from Python";
static char __pyx_k_can_only_modify_existing_grib_ke[] = "can only modify existing grib keys (key \"%s\" not found)";
static char __pyx_k_cannot_find_projection_center_fl[] = "cannot find projection center flag";
static char __pyx_k_either_pyproj_or_basemap_require[] = "either pyproj or basemap required";
static char __pyx_k_equatorial_azimuthal_equidistant[] = "equatorial_azimuthal_equidistant";
static char __pyx_k_from_what_keyword_arg_to_seek_mu[] = "from_what keyword arg to seek must be 0,1 or 2";
static char __pyx_k_key_must_be_an_integer_message_n[] = "key must be an integer message number or a slice";
static char __pyx_k_latitudeOfFirstGridPointInDegree[] = "latitudeOfFirstGridPointInDegrees";
static char __pyx_k_latitudeOfLastGridPointInDegrees[] = "latitudeOfLastGridPointInDegrees";
static char __pyx_k_latitudeOfSubSatellitePointInDeg[] = "latitudeOfSubSatellitePointInDegrees";
static char __pyx_k_latitudeWhereDxAndDyAreSpecified[] = "latitudeWhereDxAndDyAreSpecifiedInDegrees";
static char __pyx_k_longitudeOfFirstGridPointInDegre[] = "longitudeOfFirstGridPointInDegrees";
static char __pyx_k_longitudeOfLastGridPointInDegree[] = "longitudeOfLastGridPointInDegrees";
static char __pyx_k_longitudeOfSouthernPoleInDegrees[] = "longitudeOfSouthernPoleInDegrees";
static char __pyx_k_longitudeOfSubSatellitePointInDe[] = "longitudeOfSubSatellitePointInDegrees";
static char __pyx_k_scaleFactorOfMajorAxisOfOblateSp[] = "scaleFactorOfMajorAxisOfOblateSpheroidEarth";
static char __pyx_k_scaleFactorOfMinorAxisOfOblateSp[] = "scaleFactorOfMinorAxisOfOblateSpheroidEarth";
static char __pyx_k_scaleFactorOfRadiusOfSphericalEa[] = "scaleFactorOfRadiusOfSphericalEarth";
static char __pyx_k_scaledValueOfMajorAxisOfOblateSp[] = "scaledValueOfMajorAxisOfOblateSpheroidEarth";
static char __pyx_k_scaledValueOfMinorAxisOfOblateSp[] = "scaledValueOfMinorAxisOfOblateSpheroidEarth";
static char __pyx_k_scaledValueOfRadiusOfSphericalEa[] = "scaledValueOfRadiusOfSphericalEarth";
static char __pyx_k_unsupported_grid_earth_not_a_per[] = "unsupported grid - earth not a perfect sphere";
static 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_2_0_2;
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_Volumes_Drobo_python_pygrib_git;
static PyObject *__pyx_kp_s__100;
static PyObject *__pyx_kp_s__13;
static PyObject *__pyx_kp_s__18;
static PyObject *__pyx_kp_s__23;
static PyObject *__pyx_kp_s__24;
static PyObject *__pyx_kp_s__8;
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_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_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_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_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_perturbationNumber;
static PyObject *__pyx_n_s_pi;
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_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_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_n_s_set_projparams;
static PyObject *__pyx_n_s_setdates;
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_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 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_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_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_10900;
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__9;
static PyObject *__pyx_slice__52;
static PyObject *__pyx_slice__54;
static PyObject *__pyx_slice__63;
static PyObject *__pyx_slice__64;
static PyObject *__pyx_slice__66;
static PyObject *__pyx_slice__67;
static PyObject *__pyx_slice__76;
static PyObject *__pyx_slice__77;
static PyObject *__pyx_slice__79;
static PyObject *__pyx_slice__80;
static PyObject *__pyx_slice__94;
static PyObject *__pyx_slice__95;
static PyObject *__pyx_tuple__10;
static PyObject *__pyx_tuple__11;
static PyObject *__pyx_tuple__12;
static PyObject *__pyx_tuple__14;
static PyObject *__pyx_tuple__15;
static PyObject *__pyx_tuple__16;
static PyObject *__pyx_tuple__17;
static PyObject *__pyx_tuple__19;
static PyObject *__pyx_tuple__20;
static PyObject *__pyx_tuple__21;
static PyObject *__pyx_tuple__22;
static PyObject *__pyx_tuple__25;
static PyObject *__pyx_tuple__26;
static PyObject *__pyx_tuple__27;
static PyObject *__pyx_tuple__28;
static PyObject *__pyx_tuple__29;
static PyObject *__pyx_tuple__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__53;
static PyObject *__pyx_tuple__55;
static PyObject *__pyx_tuple__56;
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__65;
static PyObject *__pyx_tuple__68;
static PyObject *__pyx_tuple__69;
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__78;
static PyObject *__pyx_tuple__81;
static PyObject *__pyx_tuple__82;
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__96;
static PyObject *__pyx_tuple__97;
static PyObject *__pyx_tuple__98;
static PyObject *__pyx_tuple__99;
static PyObject *__pyx_tuple__101;
static PyObject *__pyx_tuple__102;
static PyObject *__pyx_tuple__103;
static PyObject *__pyx_tuple__104;
static PyObject *__pyx_tuple__105;
static PyObject *__pyx_tuple__106;
static PyObject *__pyx_tuple__107;
static PyObject *__pyx_tuple__108;
static PyObject *__pyx_tuple__112;
static PyObject *__pyx_tuple__116;
static PyObject *__pyx_tuple__118;
static PyObject *__pyx_tuple__120;
static PyObject *__pyx_tuple__122;
static PyObject *__pyx_tuple__124;
static PyObject *__pyx_tuple__126;
static PyObject *__pyx_tuple__128;
static PyObject *__pyx_tuple__130;
static PyObject *__pyx_codeobj__109;
static PyObject *__pyx_codeobj__110;
static PyObject *__pyx_codeobj__111;
static PyObject *__pyx_codeobj__113;
static PyObject *__pyx_codeobj__114;
static PyObject *__pyx_codeobj__115;
static PyObject *__pyx_codeobj__117;
static PyObject *__pyx_codeobj__119;
static PyObject *__pyx_codeobj__121;
static PyObject *__pyx_codeobj__123;
static PyObject *__pyx_codeobj__125;
static PyObject *__pyx_codeobj__127;
static PyObject *__pyx_codeobj__129;
static PyObject *__pyx_codeobj__131;

/* "pygrib.pyx":298
 * #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":299
 * 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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 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);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_v)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_d)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("lambda", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "lambda") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_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_filename = __pyx_f[0]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __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_filename = __pyx_f[0]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __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":298
 * #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 *);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_get_grib_api_version", 0);

  /* "pygrib.pyx":299
 * 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_filename = __pyx_f[0]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_div = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pygrib.pyx":300
 * 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_filename = __pyx_f[0]; __pyx_lineno = 300; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_v = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pygrib.pyx":301
 *     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_filename = __pyx_f[0]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __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;
    #if CYTHON_COMPILING_IN_CPYTHON
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_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_filename = __pyx_f[0]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __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":302
 *     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_filename = __pyx_f[0]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __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;
    #if CYTHON_COMPILING_IN_CPYTHON
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    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_filename = __pyx_f[0]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __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":303
 *     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":304
 *     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_filename = __pyx_f[0]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "pygrib.pyx":298
 * #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":308
 * 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
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("tolerate_badgrib_on", 0);

  /* "pygrib.pyx":313
 *     """
 *     global tolerate_badgrib
 *     tolerate_badgrib = True             # <<<<<<<<<<<<<<
 * 
 * def tolerate_badgrib_off():
 */
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_tolerate_badgrib, Py_True) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pygrib.pyx":308
 * 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":315
 *     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
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("tolerate_badgrib_off", 0);

  /* "pygrib.pyx":321
 *     """
 *     global tolerate_badgrib
 *     tolerate_badgrib = False             # <<<<<<<<<<<<<<
 * 
 * def gaulats(object nlats):
 */
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_tolerate_badgrib, Py_False) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 321; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pygrib.pyx":315
 *     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":323
 *     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;
  Py_ssize_t __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  long __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("gaulats", 0);

  /* "pygrib.pyx":330
 *     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_filename = __pyx_f[0]; __pyx_lineno = 330; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 330; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "pygrib.pyx":331
 *     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_filename = __pyx_f[0]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "pygrib.pyx":330
 *     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":332
 *     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_filename = __pyx_f[0]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __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_COMPILING_IN_CPYTHON && 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;
    }
  }
  __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_lats = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pygrib.pyx":333
 *         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_filename = __pyx_f[0]; __pyx_lineno = 333; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  grib_get_gaussian_latitudes(__Pyx_div_long(((long)__pyx_t_8), 2), ((double *)__pyx_v_lats->data));

  /* "pygrib.pyx":334
 *     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":323
 *     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":354
 * 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":356
 * 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":354
 * 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":358
 *     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":360
 * 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":358
 *     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":387
 *     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_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_filename,0};
    PyObject* values[1] = {0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__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_filename = __pyx_f[0]; __pyx_lineno = 387; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 387; __pyx_clineno = __LINE__; goto __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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "pygrib.pyx":391
 *         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_filename = __pyx_f[0]; __pyx_lineno = 391; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_bytestr = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pygrib.pyx":392
 *         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_AsString(__pyx_v_bytestr); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 392; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_self->_fd = fopen(__pyx_t_2, __pyx_k_rb);

  /* "pygrib.pyx":393
 *         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 (__pyx_t_3) {

    /* "pygrib.pyx":394
 *         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_filename = __pyx_f[0]; __pyx_lineno = 394; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 394; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_Raise(__pyx_t_4, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 394; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

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

  /* "pygrib.pyx":395
 *         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":387
 *     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":396
 *             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_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_filename,0};
    PyObject* values[1] = {0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__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_filename = __pyx_f[0]; __pyx_lineno = 396; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 396; __pyx_clineno = __LINE__; goto __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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "pygrib.pyx":400
 *         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":401
 *         # 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":402
 *         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":404
 *         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":405
 *         # 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":406
 *         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":407
 *         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":408
 *             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":409
 *             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_filename = __pyx_f[0]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __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":410
 *             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":411
 *             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":412
 *         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":416
 *         # 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_filename = __pyx_f[0]; __pyx_lineno = 416; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 416; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 416; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__pyx_t_1) {

    /* "pygrib.pyx":417
 *         # 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":416
 *         # 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":419
 *             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":396
 *             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":420
 *         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":421
 *             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":420
 *         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":422
 *     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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__next__", 0);

  /* "pygrib.pyx":425
 *         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_filename = __pyx_f[0]; __pyx_lineno = 425; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 425; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "pygrib.pyx":426
 *         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_filename = __pyx_f[0]; __pyx_lineno = 426; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

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

  /* "pygrib.pyx":427
 *         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":428
 *             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":429
 *         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 (__pyx_t_2) {

      /* "pygrib.pyx":430
 *             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_filename = __pyx_f[0]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __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_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_Raise(__pyx_t_1, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

      /* "pygrib.pyx":429
 *         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":427
 *         if self.messagenumber == self.messages:
 *             raise StopIteration
 *         if self._gh is not NULL:             # <<<<<<<<<<<<<<
 *             err = grib_handle_delete(self._gh)
 *             if err:
 */
  }

  /* "pygrib.pyx":431
 *             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":432
 *                 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 (__pyx_t_2) {

    /* "pygrib.pyx":433
 *         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_1 = __Pyx_PyBytes_FromString(grib_get_error_message(__pyx_v_err)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 433; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 433; __pyx_clineno = __LINE__; goto __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_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 433; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 433; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "pygrib.pyx":432
 *                 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":434
 *         if err:
 *             raise RuntimeError(grib_get_error_message(err))
 *         if gh == NULL:             # <<<<<<<<<<<<<<
 *             raise StopIteration
 *         else:
 */
  __pyx_t_2 = ((__pyx_v_gh == NULL) != 0);
  if (__pyx_t_2) {

    /* "pygrib.pyx":435
 *             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_filename = __pyx_f[0]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

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

  /* "pygrib.pyx":437
 *             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":438
 *         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_filename = __pyx_f[0]; __pyx_lineno = 438; __pyx_clineno = __LINE__; goto __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":439
 *             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_filename = __pyx_f[0]; __pyx_lineno = 439; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "pygrib.pyx":422
 *     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":440
 *             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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__getitem__", 0);

  /* "pygrib.pyx":441
 *         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_filename = __pyx_f[0]; __pyx_lineno = 441; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 441; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "pygrib.pyx":443
 *         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_filename = __pyx_f[0]; __pyx_lineno = 443; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && 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_filename = __pyx_f[0]; __pyx_lineno = 443; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
    } else {
      __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 443; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 443; __pyx_clineno = __LINE__; goto __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;
      #if CYTHON_COMPILING_IN_CPYTHON
      Py_ssize_t size = Py_SIZE(sequence);
      #else
      Py_ssize_t size = PySequence_Size(sequence);
      #endif
      if (unlikely(size != 3)) {
        if (size > 3) __Pyx_RaiseTooManyValuesError(3);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 443; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      #if CYTHON_COMPILING_IN_CPYTHON
      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_filename = __pyx_f[0]; __pyx_lineno = 443; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 443; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_4 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 443; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 443; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_7 = Py_TYPE(__pyx_t_6)->tp_iternext;
      index = 0; __pyx_t_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_filename = __pyx_f[0]; __pyx_lineno = 443; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 443; __pyx_clineno = __LINE__; goto __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":444
 *             # 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_filename = __pyx_f[0]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && 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_filename = __pyx_f[0]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __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":445
 *             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_filename = __pyx_f[0]; __pyx_lineno = 445; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 445; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 445; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 445; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_9 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 445; __pyx_clineno = __LINE__; goto __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_COMPILING_IN_CPYTHON
          __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_filename = __pyx_f[0]; __pyx_lineno = 445; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          #else
          __pyx_t_5 = PySequence_ITEM(__pyx_t_4, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 445; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_5);
          #endif
        } else {
          if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
          #if CYTHON_COMPILING_IN_CPYTHON
          __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_filename = __pyx_f[0]; __pyx_lineno = 445; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          #else
          __pyx_t_5 = PySequence_ITEM(__pyx_t_4, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 445; __pyx_clineno = __LINE__; goto __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(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 445; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 445; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 445; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_10 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && 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_filename = __pyx_f[0]; __pyx_lineno = 445; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_GOTREF(__pyx_t_5);
      } else {
        __pyx_t_11 = PyTuple_New(1+1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 445; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 445; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 445; __pyx_clineno = __LINE__; goto __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":446
 *             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_filename = __pyx_f[0]; __pyx_lineno = 446; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && 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_filename = __pyx_f[0]; __pyx_lineno = 446; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
    } else {
      __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 446; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 446; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "pygrib.pyx":447
 *             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":441
 *         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":448
 *             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_filename = __pyx_f[0]; __pyx_lineno = 448; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 448; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 448; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 448; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_2 = __pyx_t_12;
  __pyx_L8_bool_binop_done:;
  if (__pyx_t_2) {

    /* "pygrib.pyx":450
 *         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_filename = __pyx_f[0]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && 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_filename = __pyx_f[0]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __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":451
 *             # 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_filename = __pyx_f[0]; __pyx_lineno = 451; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && 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_filename = __pyx_f[0]; __pyx_lineno = 451; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
    } else {
      __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 451; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 451; __pyx_clineno = __LINE__; goto __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":452
 *             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_filename = __pyx_f[0]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && 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_filename = __pyx_f[0]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
    } else {
      __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "pygrib.pyx":453
 *             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":448
 *             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":455
 *             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_filename = __pyx_f[0]; __pyx_lineno = 455; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 455; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "pygrib.pyx":440
 *             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":456
 *         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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__call__", 0);

  /* "pygrib.pyx":458
 *     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_filename = __pyx_f[0]; __pyx_lineno = 458; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 458; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "pygrib.pyx":456
 *         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":459
 *         """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":460
 *         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":459
 *         """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":461
 *     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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 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);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_atype)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_value)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__exit__", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 461; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_traceback)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__exit__", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 461; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__exit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 461; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 461; __pyx_clineno = __LINE__; goto __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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__exit__", 0);

  /* "pygrib.pyx":462
 *         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_filename = __pyx_f[0]; __pyx_lineno = 462; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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_filename = __pyx_f[0]; __pyx_lineno = 462; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 462; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pygrib.pyx":461
 *     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":463
 *     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":466
 *         """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":463
 *     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":467
 *         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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 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);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_msg)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__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_filename = __pyx_f[0]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_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_filename = __pyx_f[0]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("seek", 0);

  /* "pygrib.pyx":474
 *         (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_filename = __pyx_f[0]; __pyx_lineno = 474; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 474; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 474; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 474; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 474; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 474; __pyx_clineno = __LINE__; goto __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 (__pyx_t_4) {

    /* "pygrib.pyx":475
 *         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_filename = __pyx_f[0]; __pyx_lineno = 475; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 475; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "pygrib.pyx":474
 *         (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":476
 *         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_filename = __pyx_f[0]; __pyx_lineno = 476; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 476; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_4) {

    /* "pygrib.pyx":477
 *             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_filename = __pyx_f[0]; __pyx_lineno = 477; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 477; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (__pyx_t_4) {

      /* "pygrib.pyx":478
 *         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_filename = __pyx_f[0]; __pyx_lineno = 478; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && 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_filename = __pyx_f[0]; __pyx_lineno = 478; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 478; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "pygrib.pyx":477
 *             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":479
 *             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_filename = __pyx_f[0]; __pyx_lineno = 479; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 479; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (__pyx_t_4) {

      /* "pygrib.pyx":480
 *                 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":479
 *             if from_what == 0:
 *                 self.rewind()
 *             elif from_what == 1:             # <<<<<<<<<<<<<<
 *                 return
 *             elif from_what == 2:
 */
    }

    /* "pygrib.pyx":481
 *             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_filename = __pyx_f[0]; __pyx_lineno = 481; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 481; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (__pyx_t_4) {

      /* "pygrib.pyx":482
 *                 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_filename = __pyx_f[0]; __pyx_lineno = 482; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && 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_filename = __pyx_f[0]; __pyx_lineno = 482; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
      } else {
        __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 482; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 482; __pyx_clineno = __LINE__; goto __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":481
 *             elif from_what == 1:
 *                 return
 *             elif from_what == 2:             # <<<<<<<<<<<<<<
 *                 self.message(self.messages)
 *         else:
 */
    }
    __pyx_L8:;

    /* "pygrib.pyx":476
 *         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":484
 *                 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_filename = __pyx_f[0]; __pyx_lineno = 484; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 484; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (__pyx_t_4) {

      /* "pygrib.pyx":485
 *         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_filename = __pyx_f[0]; __pyx_lineno = 485; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_6 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && 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_filename = __pyx_f[0]; __pyx_lineno = 485; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
      } else {
        __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 485; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 485; __pyx_clineno = __LINE__; goto __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":484
 *                 self.message(self.messages)
 *         else:
 *             if from_what == 0:             # <<<<<<<<<<<<<<
 *                 self.message(msg)
 *             elif from_what == 1:
 */
      goto __pyx_L9;
    }

    /* "pygrib.pyx":486
 *             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_filename = __pyx_f[0]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (__pyx_t_4) {

      /* "pygrib.pyx":487
 *                 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_filename = __pyx_f[0]; __pyx_lineno = 487; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 487; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && 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_filename = __pyx_f[0]; __pyx_lineno = 487; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_GOTREF(__pyx_t_1);
      } else {
        __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 487; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 487; __pyx_clineno = __LINE__; goto __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":486
 *             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":488
 *             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_filename = __pyx_f[0]; __pyx_lineno = 488; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 488; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (__pyx_t_4) {

      /* "pygrib.pyx":489
 *                 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_filename = __pyx_f[0]; __pyx_lineno = 489; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 489; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_5 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && 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_filename = __pyx_f[0]; __pyx_lineno = 489; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_GOTREF(__pyx_t_1);
      } else {
        __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 489; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 489; __pyx_clineno = __LINE__; goto __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":488
 *             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":467
 *         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":490
 *             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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("readline", 0);

  /* "pygrib.pyx":496
 *         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_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":497
 *         Returns a L{gribmessage} instance, or None if an EOF is encountered."""
 *         try:
 *             if hasattr(self,'next'):             # <<<<<<<<<<<<<<
 *                 grb = self.next()
 *             else:
 */
      __pyx_t_4 = PyObject_HasAttr(((PyObject *)__pyx_v_self), __pyx_n_s_next); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 497; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __pyx_t_5 = (__pyx_t_4 != 0);
      if (__pyx_t_5) {

        /* "pygrib.pyx":498
 *         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_filename = __pyx_f[0]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_8 = NULL;
        if (CYTHON_COMPILING_IN_CPYTHON && 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_filename = __pyx_f[0]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __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":497
 *         Returns a L{gribmessage} instance, or None if an EOF is encountered."""
 *         try:
 *             if hasattr(self,'next'):             # <<<<<<<<<<<<<<
 *                 grb = self.next()
 *             else:
 */
        goto __pyx_L11;
      }

      /* "pygrib.pyx":500
 *                 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_filename = __pyx_f[0]; __pyx_lineno = 500; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_v_grb = __pyx_t_6;
        __pyx_t_6 = 0;
      }
      __pyx_L11:;

      /* "pygrib.pyx":496
 *         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_L10_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":501
 *             else:
 *                 grb = next(self)
 *         except StopIteration:             # <<<<<<<<<<<<<<
 *             grb = None
 *         return grb
 */
    __pyx_t_9 = 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_filename = __pyx_f[0]; __pyx_lineno = 501; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_GOTREF(__pyx_t_8);

      /* "pygrib.pyx":502
 *                 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":496
 *         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_L10_try_end:;
  }

  /* "pygrib.pyx":503
 *         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":490
 *             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":504
 *             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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 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);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_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_filename = __pyx_f[0]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_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_filename = __pyx_f[0]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("read", 0);

  /* "pygrib.pyx":514
 *         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":515
 *         """
 *         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_filename = __pyx_f[0]; __pyx_lineno = 515; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 515; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 515; __pyx_clineno = __LINE__; goto __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 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 515; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_return_msgs, Py_True) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 515; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 515; __pyx_clineno = __LINE__; goto __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":514
 *         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":517
 *             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_filename = __pyx_f[0]; __pyx_lineno = 517; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 517; __pyx_clineno = __LINE__; goto __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 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 517; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_return_msgs, Py_True) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 517; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 517; __pyx_clineno = __LINE__; goto __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":518
 *         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":504
 *             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":519
 *             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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("close", 0);

  /* "pygrib.pyx":525
 *         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)
 */
  fclose(__pyx_v_self->_fd);

  /* "pygrib.pyx":526
 *         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":527
 *         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":528
 *         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 (__pyx_t_1) {

      /* "pygrib.pyx":529
 *             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_filename = __pyx_f[0]; __pyx_lineno = 529; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 529; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
      __pyx_t_2 = 0;
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 529; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 529; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

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

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

  /* "pygrib.pyx":530
 *             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":531
 *                 raise RuntimeError(grib_get_error_message(err))
 *         self.closed = True
 *         self._fd = NULL             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(self):
 */
  __pyx_v_self->_fd = NULL;

  /* "pygrib.pyx":519
 *             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":533
 *         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":537
 *         # 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":538
 *         cdef int err
 *         if self._fd:
 *             fclose(self._fd)             # <<<<<<<<<<<<<<
 * 
 *     def rewind(self):
 */
    fclose(__pyx_v_self->_fd);

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

  /* "pygrib.pyx":533
 *         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":540
 *             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":545
 *         # 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":546
 *         # (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":547
 *         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":548
 *             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":549
 *             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":550
 *             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":540
 *             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":551
 *         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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("message", 0);

  /* "pygrib.pyx":557
 *         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_filename = __pyx_f[0]; __pyx_lineno = 557; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 557; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "pygrib.pyx":558
 *         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_filename = __pyx_f[0]; __pyx_lineno = 558; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 558; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "pygrib.pyx":557
 *         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":560
 *             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_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "pygrib.pyx":561
 *         # 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_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && 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_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "pygrib.pyx":560
 *             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":563
 *             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_filename = __pyx_f[0]; __pyx_lineno = 563; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 563; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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_filename = __pyx_f[0]; __pyx_lineno = 563; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 563; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 563; __pyx_clineno = __LINE__; goto __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":564
 *         # 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_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "pygrib.pyx":551
 *         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":565
 *         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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("select", 0);

  /* "pygrib.pyx":604
 * 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_filename = __pyx_f[0]; __pyx_lineno = 604; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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_filename = __pyx_f[0]; __pyx_lineno = 604; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 604; __pyx_clineno = __LINE__; goto __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":605
 * """
 *         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_filename = __pyx_f[0]; __pyx_lineno = 605; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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_filename = __pyx_f[0]; __pyx_lineno = 605; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 605; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_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.
 *         if not grbs:
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 606; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 606; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 606; __pyx_clineno = __LINE__; goto __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_COMPILING_IN_CPYTHON
        __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_filename = __pyx_f[0]; __pyx_lineno = 606; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_3 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 606; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_3);
        #endif
      } else {
        if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __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_filename = __pyx_f[0]; __pyx_lineno = 606; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_3 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 606; __pyx_clineno = __LINE__; goto __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(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 606; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 606; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 606; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 606; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 606; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 606; __pyx_clineno = __LINE__; goto __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":607
 *         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_filename = __pyx_f[0]; __pyx_lineno = 607; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_7 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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_filename = __pyx_f[0]; __pyx_lineno = 607; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 607; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 607; __pyx_clineno = __LINE__; goto __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":608
 *         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 = (__pyx_v_grbs != Py_None) && (PyList_GET_SIZE(__pyx_v_grbs) != 0);
  __pyx_t_9 = ((!__pyx_t_8) != 0);
  if (__pyx_t_9) {

    /* "pygrib.pyx":609
 *         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_filename = __pyx_f[0]; __pyx_lineno = 609; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 609; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "pygrib.pyx":608
 *         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":610
 *         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":565
 *         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":611
 *             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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 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);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_nmsgs)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__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_filename = __pyx_f[0]; __pyx_lineno = 611; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_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_filename = __pyx_f[0]; __pyx_lineno = 611; __pyx_clineno = __LINE__; goto __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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_advance", 0);

  /* "pygrib.pyx":616
 *         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_filename = __pyx_f[0]; __pyx_lineno = 616; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 616; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "pygrib.pyx":617
 *         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_filename = __pyx_f[0]; __pyx_lineno = 617; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 617; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

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

  /* "pygrib.pyx":618
 *         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_filename = __pyx_f[0]; __pyx_lineno = 618; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_2) {
    __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 618; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_grbs = ((PyObject*)__pyx_t_1);
    __pyx_t_1 = 0;
  }

  /* "pygrib.pyx":619
 *             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_filename = __pyx_f[0]; __pyx_lineno = 619; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 619; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 619; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 619; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 619; __pyx_clineno = __LINE__; goto __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_COMPILING_IN_CPYTHON
        __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_filename = __pyx_f[0]; __pyx_lineno = 619; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 619; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      } else {
        if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __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_filename = __pyx_f[0]; __pyx_lineno = 619; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 619; __pyx_clineno = __LINE__; goto __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(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 619; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_XDECREF_SET(__pyx_v_n, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "pygrib.pyx":620
 *         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":621
 *         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 (__pyx_t_2) {

      /* "pygrib.pyx":622
 *             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_filename = __pyx_f[0]; __pyx_lineno = 622; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 622; __pyx_clineno = __LINE__; goto __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 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 622; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 622; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

      /* "pygrib.pyx":621
 *         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":623
 *             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":624
 *                 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 (__pyx_t_2) {

      /* "pygrib.pyx":625
 *             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_1 = __Pyx_PyBytes_FromString(grib_get_error_message(__pyx_v_err)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 625; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 625; __pyx_clineno = __LINE__; goto __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 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 625; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_Raise(__pyx_t_1, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 625; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

      /* "pygrib.pyx":624
 *                 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":626
 *             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 (__pyx_t_2) {

      /* "pygrib.pyx":627
 *                 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_filename = __pyx_f[0]; __pyx_lineno = 627; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_Raise(__pyx_t_1, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 627; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

      /* "pygrib.pyx":626
 *             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":628
 *             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_filename = __pyx_f[0]; __pyx_lineno = 628; __pyx_clineno = __LINE__; goto __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":629
 *                 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_filename = __pyx_f[0]; __pyx_lineno = 629; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (__pyx_t_2) {
      if (unlikely(!__pyx_v_grbs)) { __Pyx_RaiseUnboundLocalError("grbs"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 629; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 629; __pyx_clineno = __LINE__; goto __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 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 629; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    }

    /* "pygrib.pyx":619
 *             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":630
 *             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_filename = __pyx_f[0]; __pyx_lineno = 630; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_2) {
    __Pyx_XDECREF(__pyx_r);
    if (unlikely(!__pyx_v_grbs)) { __Pyx_RaiseUnboundLocalError("grbs"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 630; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
    __Pyx_INCREF(__pyx_v_grbs);
    __pyx_r = __pyx_v_grbs;
    goto __pyx_L0;
  }

  /* "pygrib.pyx":611
 *             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":385
 *     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":386
 *     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;
}

/* "pygrib.pyx":637
 * ['_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;
  Py_ssize_t __pyx_t_12;
  PyObject *__pyx_t_13 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("julian_to_datetime", 0);

  /* "pygrib.pyx":648
 *     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_filename = __pyx_f[0]; __pyx_lineno = 648; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_julday = __pyx_t_1;

  /* "pygrib.pyx":649
 *     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":650
 *     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 (__pyx_t_2) {

    /* "pygrib.pyx":651
 *     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_filename = __pyx_f[0]; __pyx_lineno = 651; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 651; __pyx_clineno = __LINE__; goto __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 = 0;
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 651; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 651; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "pygrib.pyx":650
 *     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":652
 *     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_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_datetime); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 652; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyInt_From_long(__pyx_v_year); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 652; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = __Pyx_PyInt_From_long(__pyx_v_month); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 652; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = __Pyx_PyInt_From_long(__pyx_v_day); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 652; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_8 = __Pyx_PyInt_From_long(__pyx_v_hour); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 652; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_9 = __Pyx_PyInt_From_long(__pyx_v_minute); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 652; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_10 = __Pyx_PyInt_From_long(__pyx_v_second); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 652; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_11 = NULL;
  __pyx_t_12 = 0;
  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_11)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_11);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
      __pyx_t_12 = 1;
    }
  }
  __pyx_t_13 = PyTuple_New(6+__pyx_t_12); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 652; __pyx_clineno = __LINE__; goto __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_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_13, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 652; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "pygrib.pyx":637
 * ['_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":654
 *     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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("datetime_to_julian", 0);

  /* "pygrib.pyx":662
 *     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_filename = __pyx_f[0]; __pyx_lineno = 662; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 662; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 662; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 662; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 662; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 662; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 662; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 662; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_hour = __pyx_t_2;

  /* "pygrib.pyx":663
 *     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_filename = __pyx_f[0]; __pyx_lineno = 663; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 663; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 663; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 663; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_second = __pyx_t_2;

  /* "pygrib.pyx":664
 *     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":665
 *     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 (__pyx_t_3) {

    /* "pygrib.pyx":666
 *     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_filename = __pyx_f[0]; __pyx_lineno = 666; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 666; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
    __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 666; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 666; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "pygrib.pyx":665
 *     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":667
 *     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_1 = PyFloat_FromDouble(__pyx_v_julday); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 667; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "pygrib.pyx":654
 *     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":669
 *     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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_create_gribmessage", 0);

  /* "pygrib.pyx":671
 * 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 = __pyx_tp_new_6pygrib_gribmessage(((PyTypeObject *)__pyx_ptype_6pygrib_gribmessage), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 671; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_6pygrib_gribmessage)))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 671; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_grb = ((struct __pyx_obj_6pygrib_gribmessage *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pygrib.pyx":672
 *     """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":673
 *     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":674
 *     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":675
 *     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_filename = __pyx_f[0]; __pyx_lineno = 675; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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_filename = __pyx_f[0]; __pyx_lineno = 675; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 675; __pyx_clineno = __LINE__; goto __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":676
 *     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_filename = __pyx_f[0]; __pyx_lineno = 676; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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_filename = __pyx_f[0]; __pyx_lineno = 676; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 676; __pyx_clineno = __LINE__; goto __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":677
 *     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_filename = __pyx_f[0]; __pyx_lineno = 677; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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_filename = __pyx_f[0]; __pyx_lineno = 677; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 677; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pygrib.pyx":678
 *     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_filename = __pyx_f[0]; __pyx_lineno = 678; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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_filename = __pyx_f[0]; __pyx_lineno = 678; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 678; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 678; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "pygrib.pyx":669
 *     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":680
 *     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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("fromstring", 0);

  /* "pygrib.pyx":690
 *     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_AsString(__pyx_v_gribstring); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 690; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_gribstr = __pyx_t_1;

  /* "pygrib.pyx":691
 *     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 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 691; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_gh = grib_handle_new_from_message_copy(NULL, ((void *)__pyx_v_gribstr), __pyx_t_2);

  /* "pygrib.pyx":692
 *     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 = __pyx_tp_new_6pygrib_gribmessage(((PyTypeObject *)__pyx_ptype_6pygrib_gribmessage), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 692; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (!(likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_6pygrib_gribmessage)))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 692; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_grb = ((struct __pyx_obj_6pygrib_gribmessage *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "pygrib.pyx":693
 *     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":694
 *     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":695
 *     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":696
 *     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_filename = __pyx_f[0]; __pyx_lineno = 696; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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_filename = __pyx_f[0]; __pyx_lineno = 696; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 696; __pyx_clineno = __LINE__; goto __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":697
 *     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_filename = __pyx_f[0]; __pyx_lineno = 697; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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_filename = __pyx_f[0]; __pyx_lineno = 697; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 697; __pyx_clineno = __LINE__; goto __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":698
 *     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_filename = __pyx_f[0]; __pyx_lineno = 698; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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_filename = __pyx_f[0]; __pyx_lineno = 698; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 698; __pyx_clineno = __LINE__; goto __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":699
 *     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_filename = __pyx_f[0]; __pyx_lineno = 699; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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_filename = __pyx_f[0]; __pyx_lineno = 699; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
  } else {
    __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 699; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 699; __pyx_clineno = __LINE__; goto __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":680
 *     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":701
 *     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) {
  CYTHON_UNUSED int __pyx_lineno = 0;
  CYTHON_UNUSED const char *__pyx_filename = NULL;
  CYTHON_UNUSED int __pyx_clineno = 0;
  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_filename = __pyx_f[0]; __pyx_lineno = 701; __pyx_clineno = __LINE__; goto __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;
  double __pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  int __pyx_t_13;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("setdates", 0);

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

  /* "pygrib.pyx":712
 *     """
 *     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_filename = __pyx_f[0]; __pyx_lineno = 712; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__9, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 712; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 712; __pyx_clineno = __LINE__; goto __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":713
 *     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_filename = __pyx_f[0]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_ftimedict); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __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":712
 *     """
 *     grb.fcstimeunits = ""
 *     if grb.has_key('indicatorOfUnitOfTimeRange') and\             # <<<<<<<<<<<<<<
 *        grb.indicatorOfUnitOfTimeRange in _ftimedict:
 *         grb.fcstimeunits = _ftimedict[grb.indicatorOfUnitOfTimeRange]
 */
  if (__pyx_t_1) {

    /* "pygrib.pyx":714
 *     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_filename = __pyx_f[0]; __pyx_lineno = 714; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 714; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_6 = PyObject_GetItem(__pyx_t_2, __pyx_t_3); if (unlikely(__pyx_t_6 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 714; __pyx_clineno = __LINE__; goto __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":712
 *     """
 *     grb.fcstimeunits = ""
 *     if grb.has_key('indicatorOfUnitOfTimeRange') and\             # <<<<<<<<<<<<<<
 *        grb.indicatorOfUnitOfTimeRange in _ftimedict:
 *         grb.fcstimeunits = _ftimedict[grb.indicatorOfUnitOfTimeRange]
 */
  }

  /* "pygrib.pyx":715
 *        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_filename = __pyx_f[0]; __pyx_lineno = 715; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 715; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 715; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__pyx_t_1) {

    /* "pygrib.pyx":716
 *         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_filename = __pyx_f[0]; __pyx_lineno = 716; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 716; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 716; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (__pyx_t_1) {

      /* "pygrib.pyx":717
 *     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_filename = __pyx_f[0]; __pyx_lineno = 717; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_v_ftime = __pyx_t_6;
      __pyx_t_6 = 0;

      /* "pygrib.pyx":716
 *         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":718
 *         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_filename = __pyx_f[0]; __pyx_lineno = 718; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 718; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 718; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (__pyx_t_1) {

      /* "pygrib.pyx":720
 *         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 = PyObject_GetItem(((PyObject *)__pyx_v_grb), __pyx_n_s_stepRange); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 720; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_v_ftime = __pyx_t_3;
      __pyx_t_3 = 0;

      /* "pygrib.pyx":722
 *             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_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":723
 *             # 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_filename = __pyx_f[0]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
          __Pyx_GOTREF(__pyx_t_3);
          __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__14, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __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 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L8_error;};
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __pyx_t_10 = __Pyx_PyObject_AsDouble(__pyx_t_3); if (unlikely(__pyx_t_10 == ((double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __pyx_t_3 = PyFloat_FromDouble(__pyx_t_10); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_DECREF_SET(__pyx_v_ftime, __pyx_t_3);
          __pyx_t_3 = 0;

          /* "pygrib.pyx":722
 *             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_L15_try_end;
        __pyx_L8_error:;
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;

        /* "pygrib.pyx":724
 *             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_3, &__pyx_t_6, &__pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L10_except_error;}
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_GOTREF(__pyx_t_6);
          __Pyx_GOTREF(__pyx_t_2);

          /* "pygrib.pyx":725
 *                 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_3); __pyx_t_3 = 0;
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          goto __pyx_L9_exception_handled;
        }
        __pyx_L10_except_error:;

        /* "pygrib.pyx":722
 *             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_L15_try_end:;
      }

      /* "pygrib.pyx":718
 *         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":715
 *        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":727
 *                 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":728
 *     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_filename = __pyx_f[0]; __pyx_lineno = 728; __pyx_clineno = __LINE__; goto __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":729
 *         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_filename = __pyx_f[0]; __pyx_lineno = 729; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__15, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 729; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 729; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (__pyx_t_5) {

    /* "pygrib.pyx":731
 *     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_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":733
 *         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_filename = __pyx_f[0]; __pyx_lineno = 733; __pyx_clineno = __LINE__; goto __pyx_L20_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_filename = __pyx_f[0]; __pyx_lineno = 733; __pyx_clineno = __LINE__; goto __pyx_L20_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_11 = NULL;
        if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_2))) {
          __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_2);
          if (likely(__pyx_t_11)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
            __Pyx_INCREF(__pyx_t_11);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_2, function);
          }
        }
        if (!__pyx_t_11) {
          __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 733; __pyx_clineno = __LINE__; goto __pyx_L20_error;}
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_GOTREF(__pyx_t_6);
        } else {
          __pyx_t_12 = PyTuple_New(1+1); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 733; __pyx_clineno = __LINE__; goto __pyx_L20_error;}
          __Pyx_GOTREF(__pyx_t_12);
          __Pyx_GIVEREF(__pyx_t_11); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_11); __pyx_t_11 = NULL;
          __Pyx_GIVEREF(__pyx_t_3);
          PyTuple_SET_ITEM(__pyx_t_12, 0+1, __pyx_t_3);
          __pyx_t_3 = 0;
          __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_12, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 733; __pyx_clineno = __LINE__; goto __pyx_L20_error;}
          __Pyx_GOTREF(__pyx_t_6);
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        }
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

        /* "pygrib.pyx":732
 *         # 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_6);
        __Pyx_GOTREF(__pyx_v_grb->analDate);
        __Pyx_DECREF(__pyx_v_grb->analDate);
        __pyx_v_grb->analDate = __pyx_t_6;
        __pyx_t_6 = 0;

        /* "pygrib.pyx":731
 *     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_L27_try_end;
      __pyx_L20_error:;
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;

      /* "pygrib.pyx":734
 *             grb.analDate =\
 *             julian_to_datetime(grb.julianDay)
 *         except ValueError:             # <<<<<<<<<<<<<<
 *             return grb
 *         if grb.fcstimeunits == 'hrs':
 */
      __pyx_t_13 = PyErr_ExceptionMatches(__pyx_builtin_ValueError);
      if (__pyx_t_13) {
        __Pyx_AddTraceback("pygrib.setdates", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_2, &__pyx_t_12) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 734; __pyx_clineno = __LINE__; goto __pyx_L22_except_error;}
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_GOTREF(__pyx_t_12);

        /* "pygrib.pyx":735
 *             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_6); __pyx_t_6 = 0;
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        goto __pyx_L23_except_return;
      }
      goto __pyx_L22_except_error;
      __pyx_L22_except_error:;

      /* "pygrib.pyx":731
 *     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_L23_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_L27_try_end:;
    }

    /* "pygrib.pyx":736
 *         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_filename = __pyx_f[0]; __pyx_lineno = 736; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (__pyx_t_5) {

      /* "pygrib.pyx":737
 *             return grb
 *         if grb.fcstimeunits == 'hrs':
 *             try:             # <<<<<<<<<<<<<<
 *                 grb.validDate =\
 *                 julian_to_datetime(grb.julianDay+ftime/24.)
 */
      {
        __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":739
 *             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_filename = __pyx_f[0]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L31_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_filename = __pyx_f[0]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L31_error;}
          __Pyx_GOTREF(__pyx_t_6);
          if (unlikely(!__pyx_v_ftime)) { __Pyx_RaiseUnboundLocalError("ftime"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L31_error;} }
          __pyx_t_3 = __Pyx_PyFloat_DivideObjC(__pyx_v_ftime, __pyx_float_24_, 24., 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L31_error;}
          __Pyx_GOTREF(__pyx_t_3);
          __pyx_t_11 = PyNumber_Add(__pyx_t_6, __pyx_t_3); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L31_error;}
          __Pyx_GOTREF(__pyx_t_11);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __pyx_t_3 = NULL;
          if (CYTHON_COMPILING_IN_CPYTHON && 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_12 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_11); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L31_error;}
            __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
            __Pyx_GOTREF(__pyx_t_12);
          } else {
            __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L31_error;}
            __Pyx_GOTREF(__pyx_t_6);
            __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_3); __pyx_t_3 = NULL;
            __Pyx_GIVEREF(__pyx_t_11);
            PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_t_11);
            __pyx_t_11 = 0;
            __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_6, NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L31_error;}
            __Pyx_GOTREF(__pyx_t_12);
            __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          }
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

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

          /* "pygrib.pyx":737
 *             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_L38_try_end;
        __pyx_L31_error:;
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;

        /* "pygrib.pyx":740
 *                 grb.validDate =\
 *                 julian_to_datetime(grb.julianDay+ftime/24.)
 *             except ValueError:             # <<<<<<<<<<<<<<
 *                 return grb
 *         elif grb.fcstimeunits == 'mins':
 */
        __pyx_t_13 = PyErr_ExceptionMatches(__pyx_builtin_ValueError);
        if (__pyx_t_13) {
          __Pyx_AddTraceback("pygrib.setdates", __pyx_clineno, __pyx_lineno, __pyx_filename);
          if (__Pyx_GetException(&__pyx_t_12, &__pyx_t_2, &__pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 740; __pyx_clineno = __LINE__; goto __pyx_L33_except_error;}
          __Pyx_GOTREF(__pyx_t_12);
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_GOTREF(__pyx_t_6);

          /* "pygrib.pyx":741
 *                 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_6); __pyx_t_6 = 0;
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
          goto __pyx_L34_except_return;
        }
        goto __pyx_L33_except_error;
        __pyx_L33_except_error:;

        /* "pygrib.pyx":737
 *             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_L34_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_L38_try_end:;
      }

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

    /* "pygrib.pyx":742
 *             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_filename = __pyx_f[0]; __pyx_lineno = 742; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (__pyx_t_5) {

      /* "pygrib.pyx":743
 *                 return grb
 *         elif grb.fcstimeunits == 'mins':
 *             try:             # <<<<<<<<<<<<<<
 *                 grb.validDate =\
 *                 julian_to_datetime(grb.julianDay+ftime/1440.)
 */
      {
        __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":745
 *             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_filename = __pyx_f[0]; __pyx_lineno = 745; __pyx_clineno = __LINE__; goto __pyx_L41_error;}
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_12 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_grb), __pyx_n_s_julianDay); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 745; __pyx_clineno = __LINE__; goto __pyx_L41_error;}
          __Pyx_GOTREF(__pyx_t_12);
          if (unlikely(!__pyx_v_ftime)) { __Pyx_RaiseUnboundLocalError("ftime"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 745; __pyx_clineno = __LINE__; goto __pyx_L41_error;} }
          __pyx_t_11 = __Pyx_PyFloat_DivideObjC(__pyx_v_ftime, __pyx_float_1440_, 1440., 0); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 745; __pyx_clineno = __LINE__; goto __pyx_L41_error;}
          __Pyx_GOTREF(__pyx_t_11);
          __pyx_t_3 = PyNumber_Add(__pyx_t_12, __pyx_t_11); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 745; __pyx_clineno = __LINE__; goto __pyx_L41_error;}
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
          __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
          __pyx_t_11 = NULL;
          if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_2))) {
            __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_2);
            if (likely(__pyx_t_11)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
              __Pyx_INCREF(__pyx_t_11);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_2, function);
            }
          }
          if (!__pyx_t_11) {
            __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 745; __pyx_clineno = __LINE__; goto __pyx_L41_error;}
            __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
            __Pyx_GOTREF(__pyx_t_6);
          } else {
            __pyx_t_12 = PyTuple_New(1+1); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 745; __pyx_clineno = __LINE__; goto __pyx_L41_error;}
            __Pyx_GOTREF(__pyx_t_12);
            __Pyx_GIVEREF(__pyx_t_11); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_11); __pyx_t_11 = NULL;
            __Pyx_GIVEREF(__pyx_t_3);
            PyTuple_SET_ITEM(__pyx_t_12, 0+1, __pyx_t_3);
            __pyx_t_3 = 0;
            __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_12, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 745; __pyx_clineno = __LINE__; goto __pyx_L41_error;}
            __Pyx_GOTREF(__pyx_t_6);
            __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
          }
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

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

          /* "pygrib.pyx":743
 *                 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_L48_try_end;
        __pyx_L41_error:;
        __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;

        /* "pygrib.pyx":746
 *                 grb.validDate =\
 *                 julian_to_datetime(grb.julianDay+ftime/1440.)
 *             except ValueError:             # <<<<<<<<<<<<<<
 *                 return grb
 *         elif grb.fcstimeunits == 'days':
 */
        __pyx_t_13 = PyErr_ExceptionMatches(__pyx_builtin_ValueError);
        if (__pyx_t_13) {
          __Pyx_AddTraceback("pygrib.setdates", __pyx_clineno, __pyx_lineno, __pyx_filename);
          if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_2, &__pyx_t_12) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 746; __pyx_clineno = __LINE__; goto __pyx_L43_except_error;}
          __Pyx_GOTREF(__pyx_t_6);
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_GOTREF(__pyx_t_12);

          /* "pygrib.pyx":747
 *                 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_6); __pyx_t_6 = 0;
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
          goto __pyx_L44_except_return;
        }
        goto __pyx_L43_except_error;
        __pyx_L43_except_error:;

        /* "pygrib.pyx":743
 *                 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_L44_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_L48_try_end:;
      }

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

    /* "pygrib.pyx":748
 *             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_filename = __pyx_f[0]; __pyx_lineno = 748; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (__pyx_t_5) {

      /* "pygrib.pyx":749
 *                 return grb
 *         elif grb.fcstimeunits == 'days':
 *             try:             # <<<<<<<<<<<<<<
 *                 grb.validDate =\
 *                 julian_to_datetime(grb.julianDay+ftime)
 */
      {
        __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":751
 *             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_filename = __pyx_f[0]; __pyx_lineno = 751; __pyx_clineno = __LINE__; goto __pyx_L51_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_filename = __pyx_f[0]; __pyx_lineno = 751; __pyx_clineno = __LINE__; goto __pyx_L51_error;}
          __Pyx_GOTREF(__pyx_t_6);
          if (unlikely(!__pyx_v_ftime)) { __Pyx_RaiseUnboundLocalError("ftime"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 751; __pyx_clineno = __LINE__; goto __pyx_L51_error;} }
          __pyx_t_3 = PyNumber_Add(__pyx_t_6, __pyx_v_ftime); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 751; __pyx_clineno = __LINE__; goto __pyx_L51_error;}
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __pyx_t_6 = NULL;
          if (CYTHON_COMPILING_IN_CPYTHON && 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_12 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 751; __pyx_clineno = __LINE__; goto __pyx_L51_error;}
            __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
            __Pyx_GOTREF(__pyx_t_12);
          } else {
            __pyx_t_11 = PyTuple_New(1+1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 751; __pyx_clineno = __LINE__; goto __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_12 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_11, NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 751; __pyx_clineno = __LINE__; goto __pyx_L51_error;}
            __Pyx_GOTREF(__pyx_t_12);
            __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
          }
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

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

          /* "pygrib.pyx":749
 *                 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_L58_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_12); __pyx_t_12 = 0;

        /* "pygrib.pyx":752
 *                 grb.validDate =\
 *                 julian_to_datetime(grb.julianDay+ftime)
 *             except ValueError:             # <<<<<<<<<<<<<<
 *                 return grb
 *         elif grb.fcstimeunits == 'secs':
 */
        __pyx_t_13 = PyErr_ExceptionMatches(__pyx_builtin_ValueError);
        if (__pyx_t_13) {
          __Pyx_AddTraceback("pygrib.setdates", __pyx_clineno, __pyx_lineno, __pyx_filename);
          if (__Pyx_GetException(&__pyx_t_12, &__pyx_t_2, &__pyx_t_11) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 752; __pyx_clineno = __LINE__; goto __pyx_L53_except_error;}
          __Pyx_GOTREF(__pyx_t_12);
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_GOTREF(__pyx_t_11);

          /* "pygrib.pyx":753
 *                 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_11); __pyx_t_11 = 0;
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
          goto __pyx_L54_except_return;
        }
        goto __pyx_L53_except_error;
        __pyx_L53_except_error:;

        /* "pygrib.pyx":749
 *                 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_L54_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_L58_try_end:;
      }

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

    /* "pygrib.pyx":754
 *             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_filename = __pyx_f[0]; __pyx_lineno = 754; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (__pyx_t_5) {

      /* "pygrib.pyx":755
 *                 return grb
 *         elif grb.fcstimeunits == 'secs':
 *             try:             # <<<<<<<<<<<<<<
 *                 grb.validDate =\
 *                 julian_to_datetime(grb.julianDay+ftime/86400.)
 */
      {
        __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":757
 *             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_filename = __pyx_f[0]; __pyx_lineno = 757; __pyx_clineno = __LINE__; goto __pyx_L61_error;}
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_12 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_grb), __pyx_n_s_julianDay); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 757; __pyx_clineno = __LINE__; goto __pyx_L61_error;}
          __Pyx_GOTREF(__pyx_t_12);
          if (unlikely(!__pyx_v_ftime)) { __Pyx_RaiseUnboundLocalError("ftime"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 757; __pyx_clineno = __LINE__; goto __pyx_L61_error;} }
          __pyx_t_3 = __Pyx_PyFloat_DivideObjC(__pyx_v_ftime, __pyx_float_86400_, 86400., 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 757; __pyx_clineno = __LINE__; goto __pyx_L61_error;}
          __Pyx_GOTREF(__pyx_t_3);
          __pyx_t_6 = PyNumber_Add(__pyx_t_12, __pyx_t_3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 757; __pyx_clineno = __LINE__; goto __pyx_L61_error;}
          __Pyx_GOTREF(__pyx_t_6);
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __pyx_t_3 = NULL;
          if (CYTHON_COMPILING_IN_CPYTHON && 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_filename = __pyx_f[0]; __pyx_lineno = 757; __pyx_clineno = __LINE__; goto __pyx_L61_error;}
            __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
            __Pyx_GOTREF(__pyx_t_11);
          } else {
            __pyx_t_12 = PyTuple_New(1+1); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 757; __pyx_clineno = __LINE__; goto __pyx_L61_error;}
            __Pyx_GOTREF(__pyx_t_12);
            __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_3); __pyx_t_3 = NULL;
            __Pyx_GIVEREF(__pyx_t_6);
            PyTuple_SET_ITEM(__pyx_t_12, 0+1, __pyx_t_6);
            __pyx_t_6 = 0;
            __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_12, NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 757; __pyx_clineno = __LINE__; goto __pyx_L61_error;}
            __Pyx_GOTREF(__pyx_t_11);
            __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
          }
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

          /* "pygrib.pyx":756
 *         elif grb.fcstimeunits == 'secs':
 *             try:
 *                 grb.validDate =\             # <<<<<<<<<<<<<<
 *                 julian_to_datetime(grb.julianDay+ftime/86400.)
 *             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":755
 *                 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_L68_try_end;
        __pyx_L61_error:;
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;

        /* "pygrib.pyx":758
 *                 grb.validDate =\
 *                 julian_to_datetime(grb.julianDay+ftime/86400.)
 *             except ValueError:             # <<<<<<<<<<<<<<
 *                 return grb
 *         elif grb.fcstimeunits == '3 hr periods':
 */
        __pyx_t_13 = PyErr_ExceptionMatches(__pyx_builtin_ValueError);
        if (__pyx_t_13) {
          __Pyx_AddTraceback("pygrib.setdates", __pyx_clineno, __pyx_lineno, __pyx_filename);
          if (__Pyx_GetException(&__pyx_t_11, &__pyx_t_2, &__pyx_t_12) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 758; __pyx_clineno = __LINE__; goto __pyx_L63_except_error;}
          __Pyx_GOTREF(__pyx_t_11);
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_GOTREF(__pyx_t_12);

          /* "pygrib.pyx":759
 *                 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_11); __pyx_t_11 = 0;
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
          goto __pyx_L64_except_return;
        }
        goto __pyx_L63_except_error;
        __pyx_L63_except_error:;

        /* "pygrib.pyx":755
 *                 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_L64_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_L68_try_end:;
      }

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

    /* "pygrib.pyx":760
 *             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_filename = __pyx_f[0]; __pyx_lineno = 760; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (__pyx_t_5) {

      /* "pygrib.pyx":761
 *                 return grb
 *         elif grb.fcstimeunits == '3 hr periods':
 *             try:             # <<<<<<<<<<<<<<
 *                 grb.validDate =\
 *                 julian_to_datetime(grb.julianDay+ftime/8.)
 */
      {
        __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":763
 *             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_filename = __pyx_f[0]; __pyx_lineno = 763; __pyx_clineno = __LINE__; goto __pyx_L71_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_filename = __pyx_f[0]; __pyx_lineno = 763; __pyx_clineno = __LINE__; goto __pyx_L71_error;}
          __Pyx_GOTREF(__pyx_t_11);
          if (unlikely(!__pyx_v_ftime)) { __Pyx_RaiseUnboundLocalError("ftime"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 763; __pyx_clineno = __LINE__; goto __pyx_L71_error;} }
          __pyx_t_6 = __Pyx_PyFloat_DivideObjC(__pyx_v_ftime, __pyx_float_8_, 8., 0); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 763; __pyx_clineno = __LINE__; goto __pyx_L71_error;}
          __Pyx_GOTREF(__pyx_t_6);
          __pyx_t_3 = PyNumber_Add(__pyx_t_11, __pyx_t_6); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 763; __pyx_clineno = __LINE__; goto __pyx_L71_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_COMPILING_IN_CPYTHON && 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_12 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 763; __pyx_clineno = __LINE__; goto __pyx_L71_error;}
            __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
            __Pyx_GOTREF(__pyx_t_12);
          } else {
            __pyx_t_11 = PyTuple_New(1+1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 763; __pyx_clineno = __LINE__; goto __pyx_L71_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_12 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_11, NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 763; __pyx_clineno = __LINE__; goto __pyx_L71_error;}
            __Pyx_GOTREF(__pyx_t_12);
            __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
          }
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

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

          /* "pygrib.pyx":761
 *                 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_L78_try_end;
        __pyx_L71_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_12); __pyx_t_12 = 0;

        /* "pygrib.pyx":764
 *                 grb.validDate =\
 *                 julian_to_datetime(grb.julianDay+ftime/8.)
 *             except ValueError:             # <<<<<<<<<<<<<<
 *                 return grb
 *         elif grb.fcstimeunits == '6 hr periods':
 */
        __pyx_t_13 = PyErr_ExceptionMatches(__pyx_builtin_ValueError);
        if (__pyx_t_13) {
          __Pyx_AddTraceback("pygrib.setdates", __pyx_clineno, __pyx_lineno, __pyx_filename);
          if (__Pyx_GetException(&__pyx_t_12, &__pyx_t_2, &__pyx_t_11) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 764; __pyx_clineno = __LINE__; goto __pyx_L73_except_error;}
          __Pyx_GOTREF(__pyx_t_12);
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_GOTREF(__pyx_t_11);

          /* "pygrib.pyx":765
 *                 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_11); __pyx_t_11 = 0;
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
          goto __pyx_L74_except_return;
        }
        goto __pyx_L73_except_error;
        __pyx_L73_except_error:;

        /* "pygrib.pyx":761
 *                 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_L74_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_L78_try_end:;
      }

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

    /* "pygrib.pyx":766
 *             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_filename = __pyx_f[0]; __pyx_lineno = 766; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (__pyx_t_5) {

      /* "pygrib.pyx":767
 *                 return grb
 *         elif grb.fcstimeunits == '6 hr periods':
 *             try:             # <<<<<<<<<<<<<<
 *                 grb.validDate =\
 *                 julian_to_datetime(grb.julianDay+ftime/4.)
 */
      {
        __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":769
 *             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_filename = __pyx_f[0]; __pyx_lineno = 769; __pyx_clineno = __LINE__; goto __pyx_L81_error;}
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_12 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_grb), __pyx_n_s_julianDay); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 769; __pyx_clineno = __LINE__; goto __pyx_L81_error;}
          __Pyx_GOTREF(__pyx_t_12);
          if (unlikely(!__pyx_v_ftime)) { __Pyx_RaiseUnboundLocalError("ftime"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 769; __pyx_clineno = __LINE__; goto __pyx_L81_error;} }
          __pyx_t_3 = __Pyx_PyFloat_DivideObjC(__pyx_v_ftime, __pyx_float_4_, 4., 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 769; __pyx_clineno = __LINE__; goto __pyx_L81_error;}
          __Pyx_GOTREF(__pyx_t_3);
          __pyx_t_6 = PyNumber_Add(__pyx_t_12, __pyx_t_3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 769; __pyx_clineno = __LINE__; goto __pyx_L81_error;}
          __Pyx_GOTREF(__pyx_t_6);
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __pyx_t_3 = NULL;
          if (CYTHON_COMPILING_IN_CPYTHON && 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_filename = __pyx_f[0]; __pyx_lineno = 769; __pyx_clineno = __LINE__; goto __pyx_L81_error;}
            __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
            __Pyx_GOTREF(__pyx_t_11);
          } else {
            __pyx_t_12 = PyTuple_New(1+1); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 769; __pyx_clineno = __LINE__; goto __pyx_L81_error;}
            __Pyx_GOTREF(__pyx_t_12);
            __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_3); __pyx_t_3 = NULL;
            __Pyx_GIVEREF(__pyx_t_6);
            PyTuple_SET_ITEM(__pyx_t_12, 0+1, __pyx_t_6);
            __pyx_t_6 = 0;
            __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_12, NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 769; __pyx_clineno = __LINE__; goto __pyx_L81_error;}
            __Pyx_GOTREF(__pyx_t_11);
            __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
          }
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

          /* "pygrib.pyx":768
 *         elif grb.fcstimeunits == '6 hr periods':
 *             try:
 *                 grb.validDate =\             # <<<<<<<<<<<<<<
 *                 julian_to_datetime(grb.julianDay+ftime/4.)
 *             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":767
 *                 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_L88_try_end;
        __pyx_L81_error:;
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;

        /* "pygrib.pyx":770
 *                 grb.validDate =\
 *                 julian_to_datetime(grb.julianDay+ftime/4.)
 *             except ValueError:             # <<<<<<<<<<<<<<
 *                 return grb
 *         elif grb.fcstimeunits == '12 hr periods':
 */
        __pyx_t_13 = PyErr_ExceptionMatches(__pyx_builtin_ValueError);
        if (__pyx_t_13) {
          __Pyx_AddTraceback("pygrib.setdates", __pyx_clineno, __pyx_lineno, __pyx_filename);
          if (__Pyx_GetException(&__pyx_t_11, &__pyx_t_2, &__pyx_t_12) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 770; __pyx_clineno = __LINE__; goto __pyx_L83_except_error;}
          __Pyx_GOTREF(__pyx_t_11);
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_GOTREF(__pyx_t_12);

          /* "pygrib.pyx":771
 *                 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_11); __pyx_t_11 = 0;
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
          goto __pyx_L84_except_return;
        }
        goto __pyx_L83_except_error;
        __pyx_L83_except_error:;

        /* "pygrib.pyx":767
 *                 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_L84_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_L88_try_end:;
      }

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

    /* "pygrib.pyx":772
 *             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_filename = __pyx_f[0]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (__pyx_t_5) {

      /* "pygrib.pyx":773
 *                 return grb
 *         elif grb.fcstimeunits == '12 hr periods':
 *             try:             # <<<<<<<<<<<<<<
 *                 grb.validDate =\
 *                 julian_to_datetime(grb.julianDay+ftime/2.)
 */
      {
        __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":775
 *             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_filename = __pyx_f[0]; __pyx_lineno = 775; __pyx_clineno = __LINE__; goto __pyx_L91_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_filename = __pyx_f[0]; __pyx_lineno = 775; __pyx_clineno = __LINE__; goto __pyx_L91_error;}
          __Pyx_GOTREF(__pyx_t_11);
          if (unlikely(!__pyx_v_ftime)) { __Pyx_RaiseUnboundLocalError("ftime"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 775; __pyx_clineno = __LINE__; goto __pyx_L91_error;} }
          __pyx_t_6 = __Pyx_PyFloat_DivideObjC(__pyx_v_ftime, __pyx_float_2_, 2., 0); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 775; __pyx_clineno = __LINE__; goto __pyx_L91_error;}
          __Pyx_GOTREF(__pyx_t_6);
          __pyx_t_3 = PyNumber_Add(__pyx_t_11, __pyx_t_6); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 775; __pyx_clineno = __LINE__; goto __pyx_L91_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_COMPILING_IN_CPYTHON && 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_12 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 775; __pyx_clineno = __LINE__; goto __pyx_L91_error;}
            __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
            __Pyx_GOTREF(__pyx_t_12);
          } else {
            __pyx_t_11 = PyTuple_New(1+1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 775; __pyx_clineno = __LINE__; goto __pyx_L91_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_12 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_11, NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 775; __pyx_clineno = __LINE__; goto __pyx_L91_error;}
            __Pyx_GOTREF(__pyx_t_12);
            __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
          }
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

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

          /* "pygrib.pyx":773
 *                 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_L98_try_end;
        __pyx_L91_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_12); __pyx_t_12 = 0;

        /* "pygrib.pyx":776
 *                 grb.validDate =\
 *                 julian_to_datetime(grb.julianDay+ftime/2.)
 *             except ValueError:             # <<<<<<<<<<<<<<
 *                 return grb
 *     return grb
 */
        __pyx_t_13 = PyErr_ExceptionMatches(__pyx_builtin_ValueError);
        if (__pyx_t_13) {
          __Pyx_AddTraceback("pygrib.setdates", __pyx_clineno, __pyx_lineno, __pyx_filename);
          if (__Pyx_GetException(&__pyx_t_12, &__pyx_t_2, &__pyx_t_11) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 776; __pyx_clineno = __LINE__; goto __pyx_L93_except_error;}
          __Pyx_GOTREF(__pyx_t_12);
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_GOTREF(__pyx_t_11);

          /* "pygrib.pyx":777
 *                 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_11); __pyx_t_11 = 0;
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
          goto __pyx_L94_except_return;
        }
        goto __pyx_L93_except_error;
        __pyx_L93_except_error:;

        /* "pygrib.pyx":773
 *                 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_L94_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_L98_try_end:;
      }

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

    /* "pygrib.pyx":729
 *         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":778
 *             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":701
 *     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_11);
  __Pyx_XDECREF(__pyx_t_12);
  __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":780
 *     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) {
  CYTHON_UNUSED int __pyx_lineno = 0;
  CYTHON_UNUSED const char *__pyx_filename = NULL;
  CYTHON_UNUSED int __pyx_clineno = 0;
  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_filename = __pyx_f[0]; __pyx_lineno = 780; __pyx_clineno = __LINE__; goto __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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("reload", 0);

  /* "pygrib.pyx":790
 * 
 *     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_filename = __pyx_f[0]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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_filename = __pyx_f[0]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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_filename = __pyx_f[0]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __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":780
 *     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":831
 *     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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "pygrib.pyx":833
 *     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__16, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pygrib.pyx":831
 *     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":834
 *         # 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":837
 *         # 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":834
 *         # 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":838
 *         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;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__getattr__", 0);

  /* "pygrib.pyx":841
 *         # 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_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":842
 *         # 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_filename = __pyx_f[0]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && 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_filename = __pyx_f[0]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        __Pyx_GOTREF(__pyx_t_4);
      } else {
        __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __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":841
 *         # 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":843
 *         try:
 *             return self.__getitem__(item)
 *         except KeyError:             # <<<<<<<<<<<<<<
 *             raise AttributeError(item)
 *     def __setattr__(self, name, value):
 */
    __pyx_t_8 = 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_filename = __pyx_f[0]; __pyx_lineno = 843; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GOTREF(__pyx_t_7);

      /* "pygrib.pyx":844
 *             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 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_INCREF(__pyx_v_item);
      __Pyx_GIVEREF(__pyx_v_item);
      PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_item);
      __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_AttributeError, __pyx_t_6, NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_Raise(__pyx_t_9, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
    }
    goto __pyx_L5_except_error;
    __pyx_L5_except_error:;

    /* "pygrib.pyx":841
 *         # 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":838
 *         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_XDECREF(__pyx_t_9);
  __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":845
 *         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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__setattr__", 0);

  /* "pygrib.pyx":847
 *     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_filename = __pyx_f[0]; __pyx_lineno = 847; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 847; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "pygrib.pyx":849
 *         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_filename = __pyx_f[0]; __pyx_lineno = 849; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "pygrib.pyx":847
 *     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":852
 *         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_filename = __pyx_f[0]; __pyx_lineno = 852; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (unlikely(PyObject_SetItem(__pyx_t_1, __pyx_v_name, __pyx_v_value) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 852; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }
  __pyx_L3:;

  /* "pygrib.pyx":845
 *         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":853
 *             # 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;
  Py_ssize_t __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_t_11;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__repr__", 0);

  /* "pygrib.pyx":855
 *     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_filename = __pyx_f[0]; __pyx_lineno = 855; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_inventory = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pygrib.pyx":856
 *         """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_filename = __pyx_f[0]; __pyx_lineno = 856; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__17, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 856; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 856; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_3) {

    /* "pygrib.pyx":857
 *         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 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_name); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 857; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 857; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__pyx_t_3) {

      /* "pygrib.pyx":858
 *         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_filename = __pyx_f[0]; __pyx_lineno = 858; __pyx_clineno = __LINE__; goto __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__18); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 858; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_name); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 858; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 858; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_5 = __Pyx_PyList_Append(__pyx_v_inventory, __pyx_t_4); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 858; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "pygrib.pyx":857
 *         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":859
 *             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_filename = __pyx_f[0]; __pyx_lineno = 859; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_tuple__19, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 859; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 859; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (__pyx_t_3) {

      /* "pygrib.pyx":860
 *                 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_filename = __pyx_f[0]; __pyx_lineno = 860; __pyx_clineno = __LINE__; goto __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__18); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 860; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_parameterName); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 860; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 860; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_5 = __Pyx_PyList_Append(__pyx_v_inventory, __pyx_t_2); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 860; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "pygrib.pyx":859
 *             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":856
 *         """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":861
 *             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_filename = __pyx_f[0]; __pyx_lineno = 861; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__20, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 861; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 861; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__pyx_t_3) {

    /* "pygrib.pyx":862
 *                 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 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_units); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 862; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 862; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (__pyx_t_3) {

      /* "pygrib.pyx":863
 *         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 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_units); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 863; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_2 = PyNumber_Add(__pyx_kp_s__18, __pyx_t_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 863; __pyx_clineno = __LINE__; goto __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 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 863; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "pygrib.pyx":862
 *                 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":864
 *             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_filename = __pyx_f[0]; __pyx_lineno = 864; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__21, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 864; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 864; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (__pyx_t_3) {

      /* "pygrib.pyx":865
 *                 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 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_parameterUnits); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 865; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_2 = PyNumber_Add(__pyx_kp_s__18, __pyx_t_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 865; __pyx_clineno = __LINE__; goto __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 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 865; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "pygrib.pyx":864
 *             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":861
 *             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":866
 *             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_filename = __pyx_f[0]; __pyx_lineno = 866; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 866; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 866; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__pyx_t_3) {

    /* "pygrib.pyx":867
 *                 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 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_stepType); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 867; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_2 = PyNumber_Add(__pyx_kp_s__23, __pyx_t_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 867; __pyx_clineno = __LINE__; goto __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__24); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 867; __pyx_clineno = __LINE__; goto __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 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 867; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "pygrib.pyx":866
 *             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":868
 *         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_filename = __pyx_f[0]; __pyx_lineno = 868; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_tuple__25, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 868; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 868; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 868; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__26, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 868; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 868; __pyx_clineno = __LINE__; goto __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":869
 *             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_filename = __pyx_f[0]; __pyx_lineno = 869; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 869; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 869; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__pyx_t_3) {

      /* "pygrib.pyx":870
 *         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 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_typeOfGrid); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 870; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_4 = PyNumber_Add(__pyx_kp_s__18, __pyx_t_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 870; __pyx_clineno = __LINE__; goto __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 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 870; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "pygrib.pyx":869
 *             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":872
 *                inventory.append(':'+self['typeOfGrid'])
 *             else:
 *                inventory.append(':'+self['gridType'])             # <<<<<<<<<<<<<<
 *         if self.valid_key('typeOfLevel'):
 *             inventory.append(':'+self['typeOfLevel'])
 */
    /*else*/ {
      __pyx_t_4 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_gridType); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 872; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_2 = PyNumber_Add(__pyx_kp_s__18, __pyx_t_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 872; __pyx_clineno = __LINE__; goto __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 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 872; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    }
    __pyx_L11:;

    /* "pygrib.pyx":868
 *         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":873
 *             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_filename = __pyx_f[0]; __pyx_lineno = 873; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 873; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 873; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__pyx_t_3) {

    /* "pygrib.pyx":874
 *                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 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_typeOfLevel); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 874; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_2 = PyNumber_Add(__pyx_kp_s__18, __pyx_t_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 874; __pyx_clineno = __LINE__; goto __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 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 874; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "pygrib.pyx":873
 *             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":875
 *         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_filename = __pyx_f[0]; __pyx_lineno = 875; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__29, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 875; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 875; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 875; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_tuple__30, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 875; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 875; __pyx_clineno = __LINE__; goto __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":876
 *             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":877
 *         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":878
 *             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_filename = __pyx_f[0]; __pyx_lineno = 878; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 878; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 878; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (__pyx_t_3) {

      /* "pygrib.pyx":879
 *             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 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_unitsOfFirstFixedSurface); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 879; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF_SET(__pyx_v_levunits, __pyx_t_4);
      __pyx_t_4 = 0;

      /* "pygrib.pyx":878
 *             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":880
 *             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_filename = __pyx_f[0]; __pyx_lineno = 880; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 880; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 880; __pyx_clineno = __LINE__; goto __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 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_typeOfFirstFixedSurface); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 880; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 880; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 880; __pyx_clineno = __LINE__; goto __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":881
 *                 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 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_topLevel); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 881; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF_SET(__pyx_v_toplev, __pyx_t_4);
      __pyx_t_4 = 0;

      /* "pygrib.pyx":882
 *             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_filename = __pyx_f[0]; __pyx_lineno = 882; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_tuple__33, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 882; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 882; __pyx_clineno = __LINE__; goto __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":883
 *                 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_filename = __pyx_f[0]; __pyx_lineno = 883; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__34, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 883; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 883; __pyx_clineno = __LINE__; goto __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":882
 *             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":884
 *                 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 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_scaleFactorOfFirstFixedSurface); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 884; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 884; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (__pyx_t_3) {

          /* "pygrib.pyx":885
 *                    self.valid_key('scaleFactorOfFirstFixedSurface'):
 *                    if self['scaleFactorOfFirstFixedSurface']:
 *                        toplev = self['scaledValueOfFirstFixedSurface']/\             # <<<<<<<<<<<<<<
 *                                 np.power(10.0,self['scaleFactorOfFirstFixedSurface'])
 *                    else:
 */
          __pyx_t_4 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_scaledValueOfFirstFixedSurface); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 885; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
          __Pyx_GOTREF(__pyx_t_4);

          /* "pygrib.pyx":886
 *                    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_filename = __pyx_f[0]; __pyx_lineno = 886; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 886; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_scaleFactorOfFirstFixedSurface); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 886; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
          __Pyx_GOTREF(__pyx_t_1);
          __pyx_t_8 = NULL;
          __pyx_t_9 = 0;
          if (CYTHON_COMPILING_IN_CPYTHON && 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;
            }
          }
          __pyx_t_10 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 886; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 886; __pyx_clineno = __LINE__; goto __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":885
 *                    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_filename = __pyx_f[0]; __pyx_lineno = 885; __pyx_clineno = __LINE__; goto __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":884
 *                 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":888
 *                                 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 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_scaledValueOfFirstFixedSurface); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 888; __pyx_clineno = __LINE__; goto __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":882
 *             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":880
 *             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":889
 *                    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_filename = __pyx_f[0]; __pyx_lineno = 889; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_tuple__35, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 889; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 889; __pyx_clineno = __LINE__; goto __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 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_typeOfSecondFixedSurface); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 889; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 889; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 889; __pyx_clineno = __LINE__; goto __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":890
 *                        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 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_bottomLevel); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF_SET(__pyx_v_botlev, __pyx_t_7);
      __pyx_t_7 = 0;

      /* "pygrib.pyx":891
 *             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_filename = __pyx_f[0]; __pyx_lineno = 891; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_tuple__36, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 891; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 891; __pyx_clineno = __LINE__; goto __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":892
 *                 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_filename = __pyx_f[0]; __pyx_lineno = 892; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__37, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 892; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 892; __pyx_clineno = __LINE__; goto __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":891
 *             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":893
 *                 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 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_scaleFactorOfSecondFixedSurface); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        if (__pyx_t_3) {

          /* "pygrib.pyx":894
 *                    self.valid_key('scaleFactorOfSecondFixedSurface'):
 *                    if self['scaleFactorOfSecondFixedSurface']:
 *                        botlev = self['scaledValueOfSecondFixedSurface']/\             # <<<<<<<<<<<<<<
 *                                 np.power(10.0,self['scaleFactorOfSecondFixedSurface'])
 *                    else:
 */
          __pyx_t_7 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_scaledValueOfSecondFixedSurface); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 894; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
          __Pyx_GOTREF(__pyx_t_7);

          /* "pygrib.pyx":895
 *                    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_filename = __pyx_f[0]; __pyx_lineno = 895; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 895; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_10);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __pyx_t_4 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_scaleFactorOfSecondFixedSurface); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 895; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
          __Pyx_GOTREF(__pyx_t_4);
          __pyx_t_1 = NULL;
          __pyx_t_9 = 0;
          if (CYTHON_COMPILING_IN_CPYTHON && 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;
            }
          }
          __pyx_t_8 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 895; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 895; __pyx_clineno = __LINE__; goto __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":894
 *                    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_filename = __pyx_f[0]; __pyx_lineno = 894; __pyx_clineno = __LINE__; goto __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":893
 *                 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":897
 *                                 np.power(10.0,self['scaleFactorOfSecondFixedSurface'])
 *                    else:
 *                        botlev = self['scaledValueOfSecondFixedSurface']             # <<<<<<<<<<<<<<
 *             levstring = None
 *             if botlev is None or toplev == botlev:
 */
        /*else*/ {
          __pyx_t_10 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_scaledValueOfSecondFixedSurface); if (unlikely(__pyx_t_10 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 897; __pyx_clineno = __LINE__; goto __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":891
 *             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":889
 *                    else:
 *                        toplev = self['scaledValueOfFirstFixedSurface']
 *             if self.valid_key('typeOfSecondFixedSurface') and self['typeOfSecondFixedSurface'] != 255:             # <<<<<<<<<<<<<<
 *                 botlev = self['bottomLevel']
 *                 if self.valid_key('scaledValueOfSecondFixedSurface') and\
 */
    }

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

    /* "pygrib.pyx":899
 *                        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_filename = __pyx_f[0]; __pyx_lineno = 899; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 899; __pyx_clineno = __LINE__; goto __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":900
 *             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_filename = __pyx_f[0]; __pyx_lineno = 900; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF_SET(__pyx_v_levstring, __pyx_t_10);
      __pyx_t_10 = 0;

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

    /* "pygrib.pyx":902
 *                 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_filename = __pyx_f[0]; __pyx_lineno = 902; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 902; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_DECREF_SET(__pyx_v_levstring, __pyx_t_2);
      __pyx_t_2 = 0;
    }
    __pyx_L31:;

    /* "pygrib.pyx":903
 *             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_filename = __pyx_f[0]; __pyx_lineno = 903; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (__pyx_t_3) {

      /* "pygrib.pyx":904
 *                 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_filename = __pyx_f[0]; __pyx_lineno = 904; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 904; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF_SET(__pyx_v_levstring, __pyx_t_10);
      __pyx_t_10 = 0;

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

    /* "pygrib.pyx":905
 *             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 != Py_None);
    __pyx_t_11 = (__pyx_t_3 != 0);
    if (__pyx_t_11) {

      /* "pygrib.pyx":906
 *                 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 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 906; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

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

    /* "pygrib.pyx":875
 *         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":907
 *             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_filename = __pyx_f[0]; __pyx_lineno = 907; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_tuple__38, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 907; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 907; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_11) {

    /* "pygrib.pyx":908
 *                 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 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_level); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 908; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 908; __pyx_clineno = __LINE__; goto __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 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 908; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;

    /* "pygrib.pyx":907
 *             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":909
 *         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_filename = __pyx_f[0]; __pyx_lineno = 909; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_tuple__39, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 909; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 909; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_11) {

    /* "pygrib.pyx":910
 *             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 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_stepRange); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 910; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_v_ftime = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "pygrib.pyx":911
 *         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_filename = __pyx_f[0]; __pyx_lineno = 911; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__40, NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 911; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 911; __pyx_clineno = __LINE__; goto __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 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_stepType); if (unlikely(__pyx_t_10 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 911; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 911; __pyx_clineno = __LINE__; goto __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":913
 *             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_filename = __pyx_f[0]; __pyx_lineno = 913; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_10);
      __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 913; __pyx_clineno = __LINE__; goto __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":912
 *             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_filename = __pyx_f[0]; __pyx_lineno = 912; __pyx_clineno = __LINE__; goto __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 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 912; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;

      /* "pygrib.pyx":911
 *         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":915
 *                     (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_filename = __pyx_f[0]; __pyx_lineno = 915; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 915; __pyx_clineno = __LINE__; goto __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 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 915; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    }
    __pyx_L37:;

    /* "pygrib.pyx":909
 *         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":916
 *             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_filename = __pyx_f[0]; __pyx_lineno = 916; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__41, NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 916; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 916; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  if (__pyx_t_11) {

    /* "pygrib.pyx":917
 *                 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 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_forecastTime); if (unlikely(__pyx_t_10 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 917; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_2 = PyObject_Repr(__pyx_t_10); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 917; __pyx_clineno = __LINE__; goto __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":918
 *         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_filename = __pyx_f[0]; __pyx_lineno = 918; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 918; __pyx_clineno = __LINE__; goto __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 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 918; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;

    /* "pygrib.pyx":916
 *             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":919
 *             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_filename = __pyx_f[0]; __pyx_lineno = 919; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_tuple__42, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 919; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 919; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 919; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 919; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 919; __pyx_clineno = __LINE__; goto __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":921
 *         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 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_dataDate); if (unlikely(__pyx_t_10 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 921; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_2 = PyObject_Repr(__pyx_t_10); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 921; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 921; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_dataTime); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 921; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 921; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 921; __pyx_clineno = __LINE__; goto __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":920
 *             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 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 920; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "pygrib.pyx":919
 *             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":925
 *         #    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_filename = __pyx_f[0]; __pyx_lineno = 925; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__44, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 925; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 925; __pyx_clineno = __LINE__; goto __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":926
 *         #    ':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_filename = __pyx_f[0]; __pyx_lineno = 926; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_tuple__45, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 926; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 926; __pyx_clineno = __LINE__; goto __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":925
 *         #    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":927
 *         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 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_typeOfEnsembleForecast); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 927; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_v_ens_type = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "pygrib.pyx":928
 *            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 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_perturbationNumber); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 928; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_v_pert_num = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "pygrib.pyx":929
 *             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_filename = __pyx_f[0]; __pyx_lineno = 929; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 929; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__pyx_t_11) {

      /* "pygrib.pyx":930
 *             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 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 930; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

      /* "pygrib.pyx":929
 *             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":931
 *             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_filename = __pyx_f[0]; __pyx_lineno = 931; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 931; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__pyx_t_11) {

      /* "pygrib.pyx":932
 *                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 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 932; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

      /* "pygrib.pyx":931
 *             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":933
 *             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_filename = __pyx_f[0]; __pyx_lineno = 933; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 933; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__pyx_t_11) {

      /* "pygrib.pyx":934
 *                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_filename = __pyx_f[0]; __pyx_lineno = 934; __pyx_clineno = __LINE__; goto __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 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 934; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "pygrib.pyx":933
 *             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":935
 *             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_filename = __pyx_f[0]; __pyx_lineno = 935; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 935; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__pyx_t_11) {

      /* "pygrib.pyx":936
 *                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_filename = __pyx_f[0]; __pyx_lineno = 936; __pyx_clineno = __LINE__; goto __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 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 936; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "pygrib.pyx":935
 *             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":925
 *         #    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":937
 *             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_filename = __pyx_f[0]; __pyx_lineno = 937; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 937; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 937; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (__pyx_t_11) {

    /* "pygrib.pyx":938
 *                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 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_derivedForecast); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 938; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 938; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 938; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__pyx_t_11) {

      /* "pygrib.pyx":939
 *         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 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 939; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

      /* "pygrib.pyx":938
 *                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":940
 *             if self['derivedForecast'] == 0:
 *                 inventory.append(":ens mean")
 *             elif self['derivedForecast'] == 1:             # <<<<<<<<<<<<<<
 *                 inventory.append(":weighted ens mean")
 *             elif self['derivedForecast'] == 2:
 */
    __pyx_t_2 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_derivedForecast); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 940; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 940; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 940; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (__pyx_t_11) {

      /* "pygrib.pyx":941
 *                 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 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 941; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

      /* "pygrib.pyx":940
 *             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":942
 *             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 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_derivedForecast); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 942; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 942; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 942; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__pyx_t_11) {

      /* "pygrib.pyx":943
 *                 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 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 943; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

      /* "pygrib.pyx":942
 *             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":944
 *             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 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_derivedForecast); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 944; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 944; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 944; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (__pyx_t_11) {

      /* "pygrib.pyx":945
 *                 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 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 945; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

      /* "pygrib.pyx":944
 *             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":946
 *             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 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_derivedForecast); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 946; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 946; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 946; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__pyx_t_11) {

      /* "pygrib.pyx":947
 *                 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 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 947; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

      /* "pygrib.pyx":946
 *             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":948
 *             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 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_derivedForecast); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 948; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 948; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 948; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (__pyx_t_11) {

      /* "pygrib.pyx":949
 *                 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 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 949; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

      /* "pygrib.pyx":948
 *             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":950
 *             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 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_derivedForecast); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 950; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 950; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 950; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__pyx_t_11) {

      /* "pygrib.pyx":951
 *                 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 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 951; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

      /* "pygrib.pyx":950
 *             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":937
 *             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":952
 *             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_filename = __pyx_f[0]; __pyx_lineno = 952; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__47, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 952; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 952; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (__pyx_t_11) {

    /* "pygrib.pyx":953
 *                 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 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_probabilityTypeName); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 953; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_2 = PyNumber_Add(__pyx_kp_s__18, __pyx_t_7); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 953; __pyx_clineno = __LINE__; goto __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 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 953; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "pygrib.pyx":954
 *         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":955
 *             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_filename = __pyx_f[0]; __pyx_lineno = 955; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 955; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 955; __pyx_clineno = __LINE__; goto __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":956
 *             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_filename = __pyx_f[0]; __pyx_lineno = 956; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_tuple__49, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 956; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 956; __pyx_clineno = __LINE__; goto __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":955
 *             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":957
 *             if self.valid_key('scaledValueOfLowerLimit') and\
 *                self.valid_key('scaleFactorOfLowerLimit'):
 *                if self['scaledValueOfLowerLimit'] and\             # <<<<<<<<<<<<<<
 *                   self['scaleFactorOfLowerLimit']:
 *                    lowerlim = self['scaledValueOfLowerLimit']/\
 */
      __pyx_t_2 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_scaledValueOfLowerLimit); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 957; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 957; __pyx_clineno = __LINE__; goto __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":958
 *                self.valid_key('scaleFactorOfLowerLimit'):
 *                if self['scaledValueOfLowerLimit'] and\
 *                   self['scaleFactorOfLowerLimit']:             # <<<<<<<<<<<<<<
 *                    lowerlim = self['scaledValueOfLowerLimit']/\
 *                               np.power(10.0,self['scaleFactorOfLowerLimit'])
 */
      __pyx_t_2 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_scaleFactorOfLowerLimit); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 958; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 958; __pyx_clineno = __LINE__; goto __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":957
 *             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":959
 *                if self['scaledValueOfLowerLimit'] and\
 *                   self['scaleFactorOfLowerLimit']:
 *                    lowerlim = self['scaledValueOfLowerLimit']/\             # <<<<<<<<<<<<<<
 *                               np.power(10.0,self['scaleFactorOfLowerLimit'])
 *             upperlim = None
 */
        __pyx_t_2 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_scaledValueOfLowerLimit); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 959; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
        __Pyx_GOTREF(__pyx_t_2);

        /* "pygrib.pyx":960
 *                   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_filename = __pyx_f[0]; __pyx_lineno = 960; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 960; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __pyx_t_10 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_scaleFactorOfLowerLimit); if (unlikely(__pyx_t_10 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 960; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
        __Pyx_GOTREF(__pyx_t_10);
        __pyx_t_4 = NULL;
        __pyx_t_9 = 0;
        if (CYTHON_COMPILING_IN_CPYTHON && 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;
          }
        }
        __pyx_t_1 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 960; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 960; __pyx_clineno = __LINE__; goto __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":959
 *                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_filename = __pyx_f[0]; __pyx_lineno = 959; __pyx_clineno = __LINE__; goto __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":957
 *             if self.valid_key('scaledValueOfLowerLimit') and\
 *                self.valid_key('scaleFactorOfLowerLimit'):
 *                if self['scaledValueOfLowerLimit'] and\             # <<<<<<<<<<<<<<
 *                   self['scaleFactorOfLowerLimit']:
 *                    lowerlim = self['scaledValueOfLowerLimit']/\
 */
      }

      /* "pygrib.pyx":955
 *             inventory.append(":"+self['probabilityTypeName'])
 *             lowerlim = None
 *             if self.valid_key('scaledValueOfLowerLimit') and\             # <<<<<<<<<<<<<<
 *                self.valid_key('scaleFactorOfLowerLimit'):
 *                if self['scaledValueOfLowerLimit'] and\
 */
    }

    /* "pygrib.pyx":961
 *                    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":962
 *                               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_filename = __pyx_f[0]; __pyx_lineno = 962; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_tuple__50, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 962; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 962; __pyx_clineno = __LINE__; goto __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":963
 *             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_filename = __pyx_f[0]; __pyx_lineno = 963; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_tuple__51, NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 963; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 963; __pyx_clineno = __LINE__; goto __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":962
 *                               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":964
 *             if self.valid_key('scaledValueOfUpperLimit') and\
 *                self.valid_key('scaleFactorOfUpperLimit'):
 *                if self['scaledValueOfUpperLimit'] and\             # <<<<<<<<<<<<<<
 *                   self['scaleFactorOfUpperLimit']:
 *                    upperlim = self['scaledValueOfUpperLimit']/\
 */
      __pyx_t_8 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_scaledValueOfUpperLimit); if (unlikely(__pyx_t_8 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 964; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 964; __pyx_clineno = __LINE__; goto __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":965
 *                self.valid_key('scaleFactorOfUpperLimit'):
 *                if self['scaledValueOfUpperLimit'] and\
 *                   self['scaleFactorOfUpperLimit']:             # <<<<<<<<<<<<<<
 *                    upperlim = self['scaledValueOfUpperLimit']/\
 *                               np.power(10.0,self['scaleFactorOfUpperLimit'])
 */
      __pyx_t_8 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_scaleFactorOfUpperLimit); if (unlikely(__pyx_t_8 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 965; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 965; __pyx_clineno = __LINE__; goto __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":964
 *             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":966
 *                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 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_scaledValueOfUpperLimit); if (unlikely(__pyx_t_8 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 966; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
        __Pyx_GOTREF(__pyx_t_8);

        /* "pygrib.pyx":967
 *                   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_filename = __pyx_f[0]; __pyx_lineno = 967; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 967; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_2 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_scaleFactorOfUpperLimit); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 967; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_10 = NULL;
        __pyx_t_9 = 0;
        if (CYTHON_COMPILING_IN_CPYTHON && 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;
          }
        }
        __pyx_t_4 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 967; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 967; __pyx_clineno = __LINE__; goto __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":966
 *                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_filename = __pyx_f[0]; __pyx_lineno = 966; __pyx_clineno = __LINE__; goto __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":964
 *             if self.valid_key('scaledValueOfUpperLimit') and\
 *                self.valid_key('scaleFactorOfUpperLimit'):
 *                if self['scaledValueOfUpperLimit'] and\             # <<<<<<<<<<<<<<
 *                   self['scaleFactorOfUpperLimit']:
 *                    upperlim = self['scaledValueOfUpperLimit']/\
 */
      }

      /* "pygrib.pyx":962
 *                               np.power(10.0,self['scaleFactorOfLowerLimit'])
 *             upperlim = None
 *             if self.valid_key('scaledValueOfUpperLimit') and\             # <<<<<<<<<<<<<<
 *                self.valid_key('scaleFactorOfUpperLimit'):
 *                if self['scaledValueOfUpperLimit'] and\
 */
    }

    /* "pygrib.pyx":968
 *                    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":969
 *                               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_filename = __pyx_f[0]; __pyx_lineno = 969; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 969; __pyx_clineno = __LINE__; goto __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 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 969; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

      /* "pygrib.pyx":968
 *                    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":970
 *             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":971
 *                 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_filename = __pyx_f[0]; __pyx_lineno = 971; __pyx_clineno = __LINE__; goto __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 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 971; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

      /* "pygrib.pyx":970
 *             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":972
 *             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":973
 *                 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_filename = __pyx_f[0]; __pyx_lineno = 973; __pyx_clineno = __LINE__; goto __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 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 973; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

      /* "pygrib.pyx":972
 *             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":952
 *             elif self['derivedForecast'] == 6:
 *                 inventory.append(":ens mean of cluster")
 *         if self.valid_key('probabilityTypeName'):             # <<<<<<<<<<<<<<
 *             inventory.append(":"+self['probabilityTypeName'])
 *             lowerlim = None
 */
  }

  /* "pygrib.pyx":974
 *             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__8, __pyx_v_inventory); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 974; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_r = __pyx_t_7;
  __pyx_t_7 = 0;
  goto __pyx_L0;

  /* "pygrib.pyx":853
 *             # 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":976
 *         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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 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);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_key)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__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_filename = __pyx_f[0]; __pyx_lineno = 976; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_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_filename = __pyx_f[0]; __pyx_lineno = 976; __pyx_clineno = __LINE__; goto __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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_get_key", 0);

  /* "pygrib.pyx":978
 *     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_filename = __pyx_f[0]; __pyx_lineno = 978; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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_filename = __pyx_f[0]; __pyx_lineno = 978; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 978; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 978; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 978; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_5) {

    /* "pygrib.pyx":979
 *         """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 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_key); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 979; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;

    /* "pygrib.pyx":978
 *     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":981
 *             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":976
 *         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":983
 *             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":985
 *     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":983
 *             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":987
 *         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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("is_missing", 0);

  /* "pygrib.pyx":995
 *         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_filename = __pyx_f[0]; __pyx_lineno = 995; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_bytestr = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pygrib.pyx":996
 *         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_AsString(__pyx_v_bytestr); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 996; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_name = __pyx_t_2;

  /* "pygrib.pyx":997
 *         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":998
 *         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":999
 *         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":998
 *         name = bytestr
 *         miss = grib_is_missing(self._gh, name, &err)
 *         if miss or err:             # <<<<<<<<<<<<<<
 *             return True
 *         else:
 */
  }

  /* "pygrib.pyx":1001
 *             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":987
 *         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":1002
 *         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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("keys", 0);

  /* "pygrib.pyx":1012
 *         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":1014
 *         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":1016
 *         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_filename = __pyx_f[0]; __pyx_lineno = 1016; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_keys = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "pygrib.pyx":1017
 *                 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":1018
 *         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":1019
 *         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_filename = __pyx_f[0]; __pyx_lineno = 1019; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_XDECREF_SET(__pyx_v_key, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "pygrib.pyx":1021
 *             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_filename = __pyx_f[0]; __pyx_lineno = 1021; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1021; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1021; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1021; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1021; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1021; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1021; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1021; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1021; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1021; __pyx_clineno = __LINE__; goto __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":1023
 *             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":1021
 *             key = name.decode('ascii')
 *             # ignore these keys.
 *             if key in ["zero","one","eight","eleven","false","thousand","file",             # <<<<<<<<<<<<<<
 *                        "localDir","7777","oneThousand"]:
 *                 continue
 */
    }

    /* "pygrib.pyx":1024
 *                        "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":1025
 *                 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":1026
 *             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":1025
 *                 continue
 *             err = grib_get_native_type(self._gh, name, &typ)
 *             if err: # skip unreadable keys             # <<<<<<<<<<<<<<
 *                 continue
 *             # keys with these types are ignored.
 */
    }

    /* "pygrib.pyx":1028
 *                 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":1029
 *             # 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":1028
 *                 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":1030
 *             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 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1030; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

      /* "pygrib.pyx":1028
 *                 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":1031
 *             [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":1032
 *                 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 (__pyx_t_2) {

    /* "pygrib.pyx":1033
 *         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_filename = __pyx_f[0]; __pyx_lineno = 1033; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1033; __pyx_clineno = __LINE__; goto __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 = 0;
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1033; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1033; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "pygrib.pyx":1032
 *                 keys.append(key)
 *         err = grib_keys_iterator_delete(gi)
 *         if err:             # <<<<<<<<<<<<<<
 *             raise RuntimeError(grib_get_error_message(err))
 *         # add extra python keys.
 */
  }

  /* "pygrib.pyx":1035
 *             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 = PyObject_HasAttr(((PyObject *)__pyx_v_self), __pyx_n_s_analDate); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1035; __pyx_clineno = __LINE__; goto __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 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1035; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "pygrib.pyx":1036
 *         # 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 = PyObject_HasAttr(((PyObject *)__pyx_v_self), __pyx_n_s_validDate); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1036; __pyx_clineno = __LINE__; goto __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 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1036; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "pygrib.pyx":1037
 *         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":1002
 *         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":1038
 *         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 *);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_read_only_keys", 0);

  /* "pygrib.pyx":1047
 *         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":1048
 *         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_filename = __pyx_f[0]; __pyx_lineno = 1048; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && 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_filename = __pyx_f[0]; __pyx_lineno = 1048; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1048; __pyx_clineno = __LINE__; goto __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":1047
 *         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":1049
 *         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":1051
 *         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_filename = __pyx_f[0]; __pyx_lineno = 1051; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_keys_noro = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "pygrib.pyx":1052
 *                 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":1053
 *         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":1054
 *         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_filename = __pyx_f[0]; __pyx_lineno = 1054; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_XDECREF_SET(__pyx_v_key, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "pygrib.pyx":1055
 *             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 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1055; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "pygrib.pyx":1056
 *             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":1057
 *             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 (__pyx_t_2) {

    /* "pygrib.pyx":1058
 *         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_filename = __pyx_f[0]; __pyx_lineno = 1058; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1058; __pyx_clineno = __LINE__; goto __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 = 0;
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1058; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1058; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "pygrib.pyx":1057
 *             keys_noro.append(key)
 *         err = grib_keys_iterator_delete(gi)
 *         if err:             # <<<<<<<<<<<<<<
 *             raise RuntimeError(grib_get_error_message(err))
 *         keys_ro = []
 */
  }

  /* "pygrib.pyx":1059
 *         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_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1059; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_keys_ro = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "pygrib.pyx":1060
 *             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_3 = __pyx_v_self->_all_keys; __Pyx_INCREF(__pyx_t_3); __pyx_t_7 = 0;
    __pyx_t_8 = NULL;
  } else {
    __pyx_t_7 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_self->_all_keys); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1060; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_8 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1060; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  for (;;) {
    if (likely(!__pyx_t_8)) {
      if (likely(PyList_CheckExact(__pyx_t_3))) {
        if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_3)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_4 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_7); __Pyx_INCREF(__pyx_t_4); __pyx_t_7++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1060; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_3, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1060; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      } else {
        if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_7); __Pyx_INCREF(__pyx_t_4); __pyx_t_7++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1060; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_3, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1060; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      }
    } else {
      __pyx_t_4 = __pyx_t_8(__pyx_t_3);
      if (unlikely(!__pyx_t_4)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1060; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_4);
    }
    __Pyx_XDECREF_SET(__pyx_v_key, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "pygrib.pyx":1061
 *         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_filename = __pyx_f[0]; __pyx_lineno = 1061; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_1 = (__pyx_t_2 != 0);
    if (__pyx_t_1) {

      /* "pygrib.pyx":1062
 *         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 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1062; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

      /* "pygrib.pyx":1061
 *         keys_ro = []
 *         for key in self._all_keys:
 *             if key not in keys_noro:             # <<<<<<<<<<<<<<
 *                 keys_ro.append(key)
 *         return keys_ro
 */
    }

    /* "pygrib.pyx":1060
 *             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_3); __pyx_t_3 = 0;

  /* "pygrib.pyx":1063
 *             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":1038
 *         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":1064
 *                 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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 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);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_lat1);
          if (value) { values[0] = value; kw_args--; }
        }
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_lat2);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_lon1);
          if (value) { values[2] = value; kw_args--; }
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__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_filename = __pyx_f[0]; __pyx_lineno = 1064; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __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_filename = __pyx_f[0]; __pyx_lineno = 1064; __pyx_clineno = __LINE__; goto __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;
  Py_ssize_t __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __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":1078
 *         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_filename = __pyx_f[0]; __pyx_lineno = 1078; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_data = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pygrib.pyx":1079
 * 	"""
 *         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_filename = __pyx_f[0]; __pyx_lineno = 1079; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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_filename = __pyx_f[0]; __pyx_lineno = 1079; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1079; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
    PyObject* sequence = __pyx_t_1;
    #if CYTHON_COMPILING_IN_CPYTHON
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1079; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_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_filename = __pyx_f[0]; __pyx_lineno = 1079; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1079; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1079; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1079; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1079; __pyx_clineno = __LINE__; goto __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":1080
 *         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_filename = __pyx_f[0]; __pyx_lineno = 1080; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1080; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1080; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1080; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
    }
  }
  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1080; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_6) {

    /* "pygrib.pyx":1081
 *         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":1080
 *         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":1083
 *             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_filename = __pyx_f[0]; __pyx_lineno = 1083; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_2 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && 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_filename = __pyx_f[0]; __pyx_lineno = 1083; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1083; __pyx_clineno = __LINE__; goto __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":1084
 *         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_filename = __pyx_f[0]; __pyx_lineno = 1084; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_2 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && 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_filename = __pyx_f[0]; __pyx_lineno = 1084; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1084; __pyx_clineno = __LINE__; goto __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":1085
 *             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_filename = __pyx_f[0]; __pyx_lineno = 1085; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_2 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && 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_filename = __pyx_f[0]; __pyx_lineno = 1085; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1085; __pyx_clineno = __LINE__; goto __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":1086
 *             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_filename = __pyx_f[0]; __pyx_lineno = 1086; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_2 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && 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_filename = __pyx_f[0]; __pyx_lineno = 1086; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1086; __pyx_clineno = __LINE__; goto __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":1087
 *             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_filename = __pyx_f[0]; __pyx_lineno = 1087; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1087; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_2 = PyNumber_And(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1087; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_masklat = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "pygrib.pyx":1088
 *             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_filename = __pyx_f[0]; __pyx_lineno = 1088; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1088; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_1 = PyNumber_And(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1088; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_masklon = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "pygrib.pyx":1089
 *             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_filename = __pyx_f[0]; __pyx_lineno = 1089; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_mask = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "pygrib.pyx":1090
 *             masklon = (lons >= lon1) & (lons <= lon2)
 *             mask = masklat & masklon
 *             datsubset = data[mask]             # <<<<<<<<<<<<<<
 *             latsubset = lats[mask]
 *             lonsubset = lons[mask]
 */
    __pyx_t_1 = PyObject_GetItem(__pyx_v_data, __pyx_v_mask); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1090; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_datsubset = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "pygrib.pyx":1091
 *             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 = PyObject_GetItem(__pyx_v_lats, __pyx_v_mask); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1091; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_latsubset = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "pygrib.pyx":1092
 *             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 = PyObject_GetItem(__pyx_v_lons, __pyx_v_mask); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1092; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_lonsubset = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "pygrib.pyx":1094
 *             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 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_gridType); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1094; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1094; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1094; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1094; __pyx_clineno = __LINE__; goto __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":1095
 *             # 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 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_gridType); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1095; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1095; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1095; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1095; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_7 = __pyx_t_8;
    __pyx_L15_bool_binop_done:;
    if (__pyx_t_7) {

      /* "pygrib.pyx":1096
 *             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 = PyObject_GetItem(__pyx_v_masklat, __pyx_tuple__53); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1096; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1096; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && 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_filename = __pyx_f[0]; __pyx_lineno = 1096; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1096; __pyx_clineno = __LINE__; goto __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":1097
 *             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 = PyObject_GetItem(__pyx_v_masklon, __pyx_tuple__55); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1097; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1097; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && 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_filename = __pyx_f[0]; __pyx_lineno = 1097; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1097; __pyx_clineno = __LINE__; goto __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":1098
 *                 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_filename = __pyx_f[0]; __pyx_lineno = 1098; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1098; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && 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_filename = __pyx_f[0]; __pyx_lineno = 1098; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
      } else {
        __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1098; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1098; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      }
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1098; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (__pyx_t_7) {

        /* "pygrib.pyx":1099
 *                 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_filename = __pyx_f[0]; __pyx_lineno = 1099; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1099; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1099; __pyx_clineno = __LINE__; goto __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_COMPILING_IN_CPYTHON && 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;
          }
        }
        __pyx_t_10 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1099; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1099; __pyx_clineno = __LINE__; goto __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":1098
 *                 nlats = masklat[:,0].sum()
 *                 nlons = masklon[0,:].sum()
 *                 if ma.isMA(datsubset):             # <<<<<<<<<<<<<<
 *                     datsubset = ma.reshape(datsubset,(nlats,nlons))
 *                 else:
 */
        goto __pyx_L19;
      }

      /* "pygrib.pyx":1101
 *                     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_filename = __pyx_f[0]; __pyx_lineno = 1101; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1101; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1101; __pyx_clineno = __LINE__; goto __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_COMPILING_IN_CPYTHON && 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;
          }
        }
        __pyx_t_3 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1101; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_DECREF_SET(__pyx_v_datsubset, __pyx_t_1);
        __pyx_t_1 = 0;
      }
      __pyx_L19:;

      /* "pygrib.pyx":1102
 *                 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_filename = __pyx_f[0]; __pyx_lineno = 1102; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1102; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1102; __pyx_clineno = __LINE__; goto __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_COMPILING_IN_CPYTHON && 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;
        }
      }
      __pyx_t_2 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1102; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF_SET(__pyx_v_latsubset, __pyx_t_1);
      __pyx_t_1 = 0;

      /* "pygrib.pyx":1103
 *                     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_filename = __pyx_f[0]; __pyx_lineno = 1103; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1103; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1103; __pyx_clineno = __LINE__; goto __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_COMPILING_IN_CPYTHON && 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;
        }
      }
      __pyx_t_4 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1103; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF_SET(__pyx_v_lonsubset, __pyx_t_1);
      __pyx_t_1 = 0;

      /* "pygrib.pyx":1095
 *             # 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":1104
 *                 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_filename = __pyx_f[0]; __pyx_lineno = 1104; __pyx_clineno = __LINE__; goto __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":1064
 *                 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":1105
 *                 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;
  Py_ssize_t __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  long __pyx_t_10;
  size_t __pyx_t_11;
  double __pyx_t_12;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__setitem__", 0);

  /* "pygrib.pyx":1116
 *         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_filename = __pyx_f[0]; __pyx_lineno = 1116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "pygrib.pyx":1117
 *         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_filename = __pyx_f[0]; __pyx_lineno = 1117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1117; __pyx_clineno = __LINE__; goto __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 = 0;
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_KeyError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "pygrib.pyx":1116
 *         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":1118
 *         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_filename = __pyx_f[0]; __pyx_lineno = 1118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "pygrib.pyx":1120
 *         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_3 = __Pyx_PyString_Format(__pyx_kp_s_can_only_modify_existing_grib_ke, __pyx_v_key); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);

    /* "pygrib.pyx":1119
 *             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_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1119; __pyx_clineno = __LINE__; goto __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 = 0;
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_KeyError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "pygrib.pyx":1118
 *         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":1121
 *             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_filename = __pyx_f[0]; __pyx_lineno = 1121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_bytestr = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "pygrib.pyx":1122
 *                     % key )
 *         bytestr = _strencode(key)
 *         name = bytestr             # <<<<<<<<<<<<<<
 *         err = grib_get_native_type(self._gh, name, &typ)
 *         if err:
 */
  __pyx_t_5 = __Pyx_PyObject_AsString(__pyx_v_bytestr); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_name = __pyx_t_5;

  /* "pygrib.pyx":1123
 *         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":1124
 *         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 (__pyx_t_1) {

    /* "pygrib.pyx":1125
 *         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_filename = __pyx_f[0]; __pyx_lineno = 1125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1125; __pyx_clineno = __LINE__; goto __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 = 0;
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "pygrib.pyx":1124
 *         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":1126
 *         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":1128
 *         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_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_asarray); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_int); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = NULL;
    __pyx_t_8 = 0;
    if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_6);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_6, function);
        __pyx_t_8 = 1;
      }
    }
    __pyx_t_9 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    if (__pyx_t_4) {
      __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_4); __pyx_t_4 = 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_3 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_9, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_6pygrib_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_datarr = ((PyArrayObject *)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "pygrib.pyx":1129
 *             # 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":1130
 *             datarr = np.asarray(value, np.int)
 *             is_array = False
 *             if datarr.shape:             # <<<<<<<<<<<<<<
 *                 is_array = True
 *             if not is_array: # scalar
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_datarr), __pyx_n_s_shape); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (__pyx_t_1) {

      /* "pygrib.pyx":1131
 *             is_array = False
 *             if datarr.shape:
 *                 is_array = True             # <<<<<<<<<<<<<<
 *             if not is_array: # scalar
 *                 longval = value
 */
      __pyx_v_is_array = 1;

      /* "pygrib.pyx":1130
 *             datarr = np.asarray(value, np.int)
 *             is_array = False
 *             if datarr.shape:             # <<<<<<<<<<<<<<
 *                 is_array = True
 *             if not is_array: # scalar
 */
    }

    /* "pygrib.pyx":1132
 *             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":1133
 *                 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_filename = __pyx_f[0]; __pyx_lineno = 1133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_v_longval = __pyx_t_10;

      /* "pygrib.pyx":1134
 *             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":1135
 *                 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 (__pyx_t_1) {

        /* "pygrib.pyx":1136
 *                 err = grib_set_long(self._gh, name, longval)
 *                 if err:
 *                     raise RuntimeError(grib_get_error_message(err))             # <<<<<<<<<<<<<<
 *             else:
 *                 if key == 'values':
 */
        __pyx_t_3 = __Pyx_PyBytes_FromString(grib_get_error_message(__pyx_v_err)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_GIVEREF(__pyx_t_3);
        PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_3);
        __pyx_t_3 = 0;
        __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_t_6, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_Raise(__pyx_t_3, 0, 0, 0);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

        /* "pygrib.pyx":1135
 *                 longval = value
 *                 err = grib_set_long(self._gh, name, longval)
 *                 if err:             # <<<<<<<<<<<<<<
 *                     raise RuntimeError(grib_get_error_message(err))
 *             else:
 */
      }

      /* "pygrib.pyx":1132
 *             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":1138
 *                     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_filename = __pyx_f[0]; __pyx_lineno = 1138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      if (__pyx_t_1) {

        /* "pygrib.pyx":1139
 *             else:
 *                 if key == 'values':
 *                     datarr = self._unshape_mask(datarr)             # <<<<<<<<<<<<<<
 *                 if not PyArray_ISCONTIGUOUS(datarr):
 *                     datarr = datarr.copy()
 */
        __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_unshape_mask); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_9 = NULL;
        if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_6))) {
          __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_6);
          if (likely(__pyx_t_9)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
            __Pyx_INCREF(__pyx_t_9);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_6, function);
          }
        }
        if (!__pyx_t_9) {
          __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_6, ((PyObject *)__pyx_v_datarr)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_3);
        } else {
          __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1139; __pyx_clineno = __LINE__; goto __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_3 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_7, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        }
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_6pygrib_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF_SET(__pyx_v_datarr, ((PyArrayObject *)__pyx_t_3));
        __pyx_t_3 = 0;

        /* "pygrib.pyx":1138
 *                     raise RuntimeError(grib_get_error_message(err))
 *             else:
 *                 if key == 'values':             # <<<<<<<<<<<<<<
 *                     datarr = self._unshape_mask(datarr)
 *                 if not PyArray_ISCONTIGUOUS(datarr):
 */
      }

      /* "pygrib.pyx":1140
 *                 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":1141
 *                     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_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_datarr), __pyx_n_s_copy); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_7 = NULL;
        if (CYTHON_COMPILING_IN_CPYTHON && likely(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_3 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_7); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        } else {
          __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_t_6); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_6pygrib_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF_SET(__pyx_v_datarr, ((PyArrayObject *)__pyx_t_3));
        __pyx_t_3 = 0;

        /* "pygrib.pyx":1140
 *                 if key == 'values':
 *                     datarr = self._unshape_mask(datarr)
 *                 if not PyArray_ISCONTIGUOUS(datarr):             # <<<<<<<<<<<<<<
 *                     datarr = datarr.copy()
 *                 size = datarr.size
 */
      }

      /* "pygrib.pyx":1142
 *                 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_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_datarr), __pyx_n_s_size); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_11 = __Pyx_PyInt_As_size_t(__pyx_t_3); if (unlikely((__pyx_t_11 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_v_size = __pyx_t_11;

      /* "pygrib.pyx":1143
 *                     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":1144
 *                 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 (__pyx_t_1) {

        /* "pygrib.pyx":1145
 *                 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_3 = __Pyx_PyBytes_FromString(grib_get_error_message(__pyx_v_err)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_GIVEREF(__pyx_t_3);
        PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_3);
        __pyx_t_3 = 0;
        __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_t_6, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_Raise(__pyx_t_3, 0, 0, 0);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

        /* "pygrib.pyx":1144
 *                 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":1126
 *         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":1146
 *                 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":1148
 *         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_filename = __pyx_f[0]; __pyx_lineno = 1148; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1148; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1148; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1148; __pyx_clineno = __LINE__; goto __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_COMPILING_IN_CPYTHON && 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;
      }
    }
    __pyx_t_4 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    if (__pyx_t_6) {
      __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_6); __pyx_t_6 = NULL;
    }
    __Pyx_INCREF(__pyx_v_value);
    __Pyx_GIVEREF(__pyx_v_value);
    PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_8, __pyx_v_value);
    __Pyx_GIVEREF(__pyx_t_9);
    PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_8, __pyx_t_9);
    __pyx_t_9 = 0;
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1148; __pyx_clineno = __LINE__; goto __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;
    if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_6pygrib_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_datarr = ((PyArrayObject *)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "pygrib.pyx":1149
 *             # 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":1150
 *             datarr = np.asarray(value, np.float)
 *             is_array = False
 *             if datarr.shape:             # <<<<<<<<<<<<<<
 *                 is_array = True
 *             if not is_array: # scalar
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_datarr), __pyx_n_s_shape); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (__pyx_t_1) {

      /* "pygrib.pyx":1151
 *             is_array = False
 *             if datarr.shape:
 *                 is_array = True             # <<<<<<<<<<<<<<
 *             if not is_array: # scalar
 *                 doubleval = value
 */
      __pyx_v_is_array = 1;

      /* "pygrib.pyx":1150
 *             datarr = np.asarray(value, np.float)
 *             is_array = False
 *             if datarr.shape:             # <<<<<<<<<<<<<<
 *                 is_array = True
 *             if not is_array: # scalar
 */
    }

    /* "pygrib.pyx":1152
 *             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":1153
 *                 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_filename = __pyx_f[0]; __pyx_lineno = 1153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_v_doubleval = __pyx_t_12;

      /* "pygrib.pyx":1154
 *             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":1155
 *                 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 (__pyx_t_1) {

        /* "pygrib.pyx":1156
 *                 err = grib_set_double(self._gh, name, doubleval)
 *                 if err:
 *                     raise RuntimeError(grib_get_error_message(err))             # <<<<<<<<<<<<<<
 *             else:
 *                 if key == 'values':
 */
        __pyx_t_3 = __Pyx_PyBytes_FromString(grib_get_error_message(__pyx_v_err)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1156; __pyx_clineno = __LINE__; goto __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 = 0;
        __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_t_7, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_Raise(__pyx_t_3, 0, 0, 0);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

        /* "pygrib.pyx":1155
 *                 doubleval = value
 *                 err = grib_set_double(self._gh, name, doubleval)
 *                 if err:             # <<<<<<<<<<<<<<
 *                     raise RuntimeError(grib_get_error_message(err))
 *             else:
 */
      }

      /* "pygrib.pyx":1152
 *             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":1158
 *                     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_filename = __pyx_f[0]; __pyx_lineno = 1158; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      if (__pyx_t_1) {

        /* "pygrib.pyx":1159
 *             else:
 *                 if key == 'values':
 *                     datarr = self._unshape_mask(datarr)             # <<<<<<<<<<<<<<
 *                 if not PyArray_ISCONTIGUOUS(datarr):
 *                     datarr = datarr.copy()
 */
        __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_unshape_mask); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1159; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_4 = NULL;
        if (CYTHON_COMPILING_IN_CPYTHON && likely(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);
          }
        }
        if (!__pyx_t_4) {
          __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_7, ((PyObject *)__pyx_v_datarr)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1159; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_3);
        } else {
          __pyx_t_9 = PyTuple_New(1+1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1159; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_4); __pyx_t_4 = 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_3 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_9, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1159; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        }
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_6pygrib_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1159; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF_SET(__pyx_v_datarr, ((PyArrayObject *)__pyx_t_3));
        __pyx_t_3 = 0;

        /* "pygrib.pyx":1158
 *                     raise RuntimeError(grib_get_error_message(err))
 *             else:
 *                 if key == 'values':             # <<<<<<<<<<<<<<
 *                     datarr = self._unshape_mask(datarr)
 *                 if not PyArray_ISCONTIGUOUS(datarr):
 */
      }

      /* "pygrib.pyx":1160
 *                 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":1161
 *                     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_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_datarr), __pyx_n_s_copy); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_9 = NULL;
        if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_7))) {
          __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_7);
          if (likely(__pyx_t_9)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
            __Pyx_INCREF(__pyx_t_9);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_7, function);
          }
        }
        if (__pyx_t_9) {
          __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_9); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        } else {
          __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_t_7); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_6pygrib_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF_SET(__pyx_v_datarr, ((PyArrayObject *)__pyx_t_3));
        __pyx_t_3 = 0;

        /* "pygrib.pyx":1160
 *                 if key == 'values':
 *                     datarr = self._unshape_mask(datarr)
 *                 if not PyArray_ISCONTIGUOUS(datarr):             # <<<<<<<<<<<<<<
 *                     datarr = datarr.copy()
 *                 size = datarr.size
 */
      }

      /* "pygrib.pyx":1162
 *                 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_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_datarr), __pyx_n_s_size); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1162; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_11 = __Pyx_PyInt_As_size_t(__pyx_t_3); if (unlikely((__pyx_t_11 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1162; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_v_size = __pyx_t_11;

      /* "pygrib.pyx":1163
 *                     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":1164
 *                 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 (__pyx_t_1) {

        /* "pygrib.pyx":1165
 *                 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_3 = __Pyx_PyBytes_FromString(grib_get_error_message(__pyx_v_err)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1165; __pyx_clineno = __LINE__; goto __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 = 0;
        __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_t_7, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_Raise(__pyx_t_3, 0, 0, 0);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

        /* "pygrib.pyx":1164
 *                 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":1146
 *                 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":1166
 *                 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 (__pyx_t_1) {

    /* "pygrib.pyx":1167
 *                     raise RuntimeError(grib_get_error_message(err))
 *         elif typ == GRIB_TYPE_STRING:
 *             size=len(value)             # <<<<<<<<<<<<<<
 *             bytestr = _strencode(value)
 *             strdata = bytestr
 */
    __pyx_t_8 = PyObject_Length(__pyx_v_value); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1167; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_size = __pyx_t_8;

    /* "pygrib.pyx":1168
 *         elif typ == GRIB_TYPE_STRING:
 *             size=len(value)
 *             bytestr = _strencode(value)             # <<<<<<<<<<<<<<
 *             strdata = bytestr
 *             err = grib_set_string(self._gh, name, strdata, &size)
 */
    __pyx_t_3 = __pyx_f_6pygrib__strencode(__pyx_v_value, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF_SET(__pyx_v_bytestr, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "pygrib.pyx":1169
 *             size=len(value)
 *             bytestr = _strencode(value)
 *             strdata = bytestr             # <<<<<<<<<<<<<<
 *             err = grib_set_string(self._gh, name, strdata, &size)
 *             if err:
 */
    __pyx_t_5 = __Pyx_PyObject_AsString(__pyx_v_bytestr); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1169; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_strdata = __pyx_t_5;

    /* "pygrib.pyx":1170
 *             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":1171
 *             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 (__pyx_t_1) {

      /* "pygrib.pyx":1172
 *             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_3 = __Pyx_PyBytes_FromString(grib_get_error_message(__pyx_v_err)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1172; __pyx_clineno = __LINE__; goto __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 = 0;
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_t_7, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_Raise(__pyx_t_3, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

      /* "pygrib.pyx":1171
 *             strdata = bytestr
 *             err = grib_set_string(self._gh, name, strdata, &size)
 *             if err:             # <<<<<<<<<<<<<<
 *                 raise RuntimeError(grib_get_error_message(err))
 *         else:
 */
    }

    /* "pygrib.pyx":1166
 *                 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":1174
 *                 raise RuntimeError(grib_get_error_message(err))
 *         else:
 *             raise ValueError("unrecognized grib type % d" % typ)             # <<<<<<<<<<<<<<
 *     def __getitem__(self, key):
 *         """
 */
  /*else*/ {
    __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_typ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_7 = __Pyx_PyString_Format(__pyx_kp_s_unrecognized_grib_type_d, __pyx_t_3); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1174; __pyx_clineno = __LINE__; goto __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 = 0;
    __pyx_t_7 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_t_7, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_L5:;

  /* "pygrib.pyx":1105
 *                 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":1175
 *         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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__getitem__", 0);

  /* "pygrib.pyx":1192
 *         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_filename = __pyx_f[0]; __pyx_lineno = 1192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_bytestr = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pygrib.pyx":1193
 *         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_AsString(__pyx_v_bytestr); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_name = __pyx_t_2;

  /* "pygrib.pyx":1194
 *         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_filename = __pyx_f[0]; __pyx_lineno = 1194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1194; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1194; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1194; __pyx_clineno = __LINE__; goto __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__56, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1194; __pyx_clineno = __LINE__; goto __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":1196
 *         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_filename = __pyx_f[0]; __pyx_lineno = 1196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_4) {

    /* "pygrib.pyx":1197
 *         # 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_filename = __pyx_f[0]; __pyx_lineno = 1197; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1197; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_v_size = __pyx_t_6;

    /* "pygrib.pyx":1196
 *         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":1199
 *             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":1200
 *         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":1201
 *             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_filename = __pyx_f[0]; __pyx_lineno = 1201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (__pyx_t_4) {

        /* "pygrib.pyx":1202
 *             if err:
 *                 if tolerate_badgrib:
 *                     return None             # <<<<<<<<<<<<<<
 *                 else:
 *                     raise RuntimeError(grib_get_error_message(err))
 */
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(Py_None);
        __pyx_r = Py_None;
        goto __pyx_L0;

        /* "pygrib.pyx":1201
 *             err = grib_get_size(self._gh, name, &size)
 *             if err:
 *                 if tolerate_badgrib:             # <<<<<<<<<<<<<<
 *                     return None
 *                 else:
 */
      }

      /* "pygrib.pyx":1204
 *                     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_filename = __pyx_f[0]; __pyx_lineno = 1204; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1204; __pyx_clineno = __LINE__; goto __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_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1204; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_Raise(__pyx_t_1, 0, 0, 0);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1204; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }

      /* "pygrib.pyx":1200
 *         else:
 *             err = grib_get_size(self._gh, name, &size)
 *             if err:             # <<<<<<<<<<<<<<
 *                 if tolerate_badgrib:
 *                     return None
 */
    }
  }
  __pyx_L5:;

  /* "pygrib.pyx":1206
 *                     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_filename = __pyx_f[0]; __pyx_lineno = 1206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_4) {

    /* "pygrib.pyx":1207
 *         # this workaround only needed for grib_api < 1.9.16.
 *         if usenceplib:
 *             typ = 2             # <<<<<<<<<<<<<<
 *             err = 0
 *         else:
 */
    __pyx_v_typ = 2;

    /* "pygrib.pyx":1208
 *         if usenceplib:
 *             typ = 2
 *             err = 0             # <<<<<<<<<<<<<<
 *         else:
 *             err = grib_get_native_type(self._gh, name, &typ)
 */
    __pyx_v_err = 0;

    /* "pygrib.pyx":1206
 *                     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":1210
 *             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":1214
 *         # 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_filename = __pyx_f[0]; __pyx_lineno = 1214; __pyx_clineno = __LINE__; goto __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":1215
 *         # 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 (__pyx_t_4) {

    /* "pygrib.pyx":1216
 *         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_1 = __Pyx_PyBytes_FromString(grib_get_error_message(__pyx_v_err)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1216; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1216; __pyx_clineno = __LINE__; goto __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_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1216; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1216; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "pygrib.pyx":1215
 *         # 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":1217
 *         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":1218
 *             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":1219
 *         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":1220
 *             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 (__pyx_t_4) {

        /* "pygrib.pyx":1221
 *                 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_filename = __pyx_f[0]; __pyx_lineno = 1221; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1221; __pyx_clineno = __LINE__; goto __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_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1221; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_Raise(__pyx_t_1, 0, 0, 0);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1221; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

        /* "pygrib.pyx":1220
 *             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":1222
 *                 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_1 = __Pyx_PyInt_From_long(__pyx_v_longval); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1222; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_r = __pyx_t_1;
      __pyx_t_1 = 0;
      goto __pyx_L0;

      /* "pygrib.pyx":1218
 *             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":1224
 *                 return longval
 *             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_filename = __pyx_f[0]; __pyx_lineno = 1224; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__57, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1224; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1224; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_7) {
      } else {
        __pyx_t_4 = __pyx_t_7;
        goto __pyx_L16_bool_binop_done;
      }

      /* "pygrib.pyx":1225
 *             else: # array
 *                 if self.has_key('jPointsAreConsecutive') and\
 *                    self['jPointsAreConsecutive']:             # <<<<<<<<<<<<<<
 *                     storageorder='F'
 *                 else:
 */
      __pyx_t_3 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_jPointsAreConsecutive); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1225; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1225; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_4 = __pyx_t_7;
      __pyx_L16_bool_binop_done:;

      /* "pygrib.pyx":1224
 *                 return longval
 *             else: # array
 *                 if self.has_key('jPointsAreConsecutive') and\             # <<<<<<<<<<<<<<
 *                    self['jPointsAreConsecutive']:
 *                     storageorder='F'
 */
      if (__pyx_t_4) {

        /* "pygrib.pyx":1226
 *                 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":1224
 *                 return longval
 *             else: # array
 *                 if self.has_key('jPointsAreConsecutive') and\             # <<<<<<<<<<<<<<
 *                    self['jPointsAreConsecutive']:
 *                     storageorder='F'
 */
        goto __pyx_L15;
      }

      /* "pygrib.pyx":1228
 *                     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":1229
 *                 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_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1229; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1229; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = __Pyx_PyInt_FromSize_t(__pyx_v_size); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1229; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1229; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1229; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1229; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_8);
      PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_8);
      __pyx_t_3 = 0;
      __pyx_t_8 = 0;
      __pyx_t_8 = PyDict_New(); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1229; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_order, __pyx_v_storageorder) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1229; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_5, __pyx_t_8); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1229; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_6pygrib_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1229; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_v_datarr = ((PyArrayObject *)__pyx_t_3);
      __pyx_t_3 = 0;

      /* "pygrib.pyx":1230
 *                     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":1231
 *                 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 (__pyx_t_4) {

        /* "pygrib.pyx":1232
 *                 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_3 = __Pyx_PyBytes_FromString(grib_get_error_message(__pyx_v_err)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1232; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1232; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_GIVEREF(__pyx_t_3);
        PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_3);
        __pyx_t_3 = 0;
        __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_t_8, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1232; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_Raise(__pyx_t_3, 0, 0, 0);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1232; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

        /* "pygrib.pyx":1231
 *                 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":1233
 *                 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_filename = __pyx_f[0]; __pyx_lineno = 1233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      if (__pyx_t_4) {

        /* "pygrib.pyx":1234
 *                     raise RuntimeError(grib_get_error_message(err))
 *                 if key == 'values':
 *                     return self._reshape_mask(datarr)             # <<<<<<<<<<<<<<
 *                 else:
 *                     return datarr
 */
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_8 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_reshape_mask); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1234; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_8);
        __pyx_t_5 = NULL;
        if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_8))) {
          __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_8);
          if (likely(__pyx_t_5)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
            __Pyx_INCREF(__pyx_t_5);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_8, function);
          }
        }
        if (!__pyx_t_5) {
          __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_8, ((PyObject *)__pyx_v_datarr)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1234; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_3);
        } else {
          __pyx_t_1 = PyTuple_New(1+1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1234; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_1, 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_1, 0+1, ((PyObject *)__pyx_v_datarr));
          __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1234; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        }
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __pyx_r = __pyx_t_3;
        __pyx_t_3 = 0;
        goto __pyx_L0;

        /* "pygrib.pyx":1233
 *                 if err:
 *                     raise RuntimeError(grib_get_error_message(err))
 *                 if key == 'values':             # <<<<<<<<<<<<<<
 *                     return self._reshape_mask(datarr)
 *                 else:
 */
      }

      /* "pygrib.pyx":1236
 *                     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":1217
 *         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":1237
 *                 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":1238
 *                     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":1239
 *         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":1240
 *             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 (__pyx_t_4) {

        /* "pygrib.pyx":1241
 *                 err = grib_get_double(self._gh, name, &doubleval)
 *                 if err:
 *                     raise RuntimeError(grib_get_error_message(err))             # <<<<<<<<<<<<<<
 *                 return doubleval
 *             else: # array
 */
        __pyx_t_3 = __Pyx_PyBytes_FromString(grib_get_error_message(__pyx_v_err)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1241; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1241; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_GIVEREF(__pyx_t_3);
        PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_3);
        __pyx_t_3 = 0;
        __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_t_8, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1241; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_Raise(__pyx_t_3, 0, 0, 0);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1241; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

        /* "pygrib.pyx":1240
 *             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":1242
 *                 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_3 = PyFloat_FromDouble(__pyx_v_doubleval); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_r = __pyx_t_3;
      __pyx_t_3 = 0;
      goto __pyx_L0;

      /* "pygrib.pyx":1238
 *                     return datarr
 *         elif typ == GRIB_TYPE_DOUBLE:
 *             if size == 1: # scalar             # <<<<<<<<<<<<<<
 *                 err = grib_get_double(self._gh, name, &doubleval)
 *                 if err:
 */
    }

    /* "pygrib.pyx":1244
 *                 return doubleval
 *             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_filename = __pyx_f[0]; __pyx_lineno = 1244; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__58, NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1244; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1244; __pyx_clineno = __LINE__; goto __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":1245
 *             else: # array
 *                 if self.has_key('jPointsAreConsecutive') and\
 *                    self['jPointsAreConsecutive']:             # <<<<<<<<<<<<<<
 *                     storageorder='F'
 *                 else:
 */
      __pyx_t_8 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_jPointsAreConsecutive); if (unlikely(__pyx_t_8 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1245; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1245; __pyx_clineno = __LINE__; goto __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":1244
 *                 return doubleval
 *             else: # array
 *                 if self.has_key('jPointsAreConsecutive') and\             # <<<<<<<<<<<<<<
 *                    self['jPointsAreConsecutive']:
 *                     storageorder='F'
 */
      if (__pyx_t_4) {

        /* "pygrib.pyx":1246
 *                 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":1244
 *                 return doubleval
 *             else: # array
 *                 if self.has_key('jPointsAreConsecutive') and\             # <<<<<<<<<<<<<<
 *                    self['jPointsAreConsecutive']:
 *                     storageorder='F'
 */
        goto __pyx_L22;
      }

      /* "pygrib.pyx":1248
 *                     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":1249
 *                 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_filename = __pyx_f[0]; __pyx_lineno = 1249; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      if (__pyx_t_4) {

        /* "pygrib.pyx":1252
 *                     # 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_filename = __pyx_f[0]; __pyx_lineno = 1252; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_8);
        __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_tostring); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1252; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_5 = NULL;
        if (CYTHON_COMPILING_IN_CPYTHON && 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_3 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1252; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        } else {
          __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1252; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1252; __pyx_clineno = __LINE__; goto __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 = 0;
        __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1252; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_3);
        if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_gribmsg, Py_True) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1252; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1252; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_v_grb = __pyx_t_5;
        __pyx_t_5 = 0;

        /* "pygrib.pyx":1253
 *                     # 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_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_grb, __pyx_n_s_data); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1253; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_1 = NULL;
        if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_1)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_1);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
          }
        }
        if (__pyx_t_1) {
          __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1253; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        } else {
          __pyx_t_5 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1253; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_r = __pyx_t_5;
        __pyx_t_5 = 0;
        goto __pyx_L0;

        /* "pygrib.pyx":1249
 *                 else:
 *                     storageorder='C'
 *                 if usenceplib:             # <<<<<<<<<<<<<<
 *                     # use ncep lib to decode data (workaround for grib_api
 *                     # bug with second-order complex packing).
 */
      }

      /* "pygrib.pyx":1255
 *                     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_filename = __pyx_f[0]; __pyx_lineno = 1255; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1255; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __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_filename = __pyx_f[0]; __pyx_lineno = 1255; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1255; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_double); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1255; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1255; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_GIVEREF(__pyx_t_5);
        PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_5);
        __Pyx_GIVEREF(__pyx_t_8);
        PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_8);
        __pyx_t_5 = 0;
        __pyx_t_8 = 0;
        __pyx_t_8 = PyDict_New(); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1255; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_8);
        if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_order, __pyx_v_storageorder) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1255; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_1, __pyx_t_8); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1255; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 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_filename = __pyx_f[0]; __pyx_lineno = 1255; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __pyx_v_datarr = ((PyArrayObject *)__pyx_t_5);
        __pyx_t_5 = 0;

        /* "pygrib.pyx":1256
 *                 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":1257
 *                     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 (__pyx_t_4) {

          /* "pygrib.pyx":1258
 *                     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_filename = __pyx_f[0]; __pyx_lineno = 1258; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_5);
          __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1258; __pyx_clineno = __LINE__; goto __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 = 0;
          __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_t_8, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1258; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1258; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

          /* "pygrib.pyx":1257
 *                     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":1259
 *                     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_filename = __pyx_f[0]; __pyx_lineno = 1259; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        if (__pyx_t_4) {

          /* "pygrib.pyx":1260
 *                         raise RuntimeError(grib_get_error_message(err))
 *                     if key == 'values':
 *                         return self._reshape_mask(datarr)             # <<<<<<<<<<<<<<
 *                     else:
 *                         return datarr
 */
          __Pyx_XDECREF(__pyx_r);
          __pyx_t_8 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_reshape_mask); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1260; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_8);
          __pyx_t_1 = NULL;
          if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_8))) {
            __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_8);
            if (likely(__pyx_t_1)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
              __Pyx_INCREF(__pyx_t_1);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_8, function);
            }
          }
          if (!__pyx_t_1) {
            __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_8, ((PyObject *)__pyx_v_datarr)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1260; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            __Pyx_GOTREF(__pyx_t_5);
          } else {
            __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1260; __pyx_clineno = __LINE__; goto __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 = 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_5 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1260; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            __Pyx_GOTREF(__pyx_t_5);
            __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          }
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
          __pyx_r = __pyx_t_5;
          __pyx_t_5 = 0;
          goto __pyx_L0;

          /* "pygrib.pyx":1259
 *                     if err:
 *                         raise RuntimeError(grib_get_error_message(err))
 *                     if key == 'values':             # <<<<<<<<<<<<<<
 *                         return self._reshape_mask(datarr)
 *                     else:
 */
        }

        /* "pygrib.pyx":1262
 *                         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":1237
 *                 else:
 *                     return datarr
 *         elif typ == GRIB_TYPE_DOUBLE:             # <<<<<<<<<<<<<<
 *             if size == 1: # scalar
 *                 err = grib_get_double(self._gh, name, &doubleval)
 */
  }

  /* "pygrib.pyx":1263
 *                     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 (__pyx_t_4) {

    /* "pygrib.pyx":1264
 *                         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":1265
 *         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":1266
 *             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 (__pyx_t_4) {

      /* "pygrib.pyx":1267
 *             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_5 = __Pyx_PyBytes_FromString(grib_get_error_message(__pyx_v_err)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1267; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1267; __pyx_clineno = __LINE__; goto __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 = 0;
      __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_t_8, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1267; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1267; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

      /* "pygrib.pyx":1266
 *             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":1268
 *             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_filename = __pyx_f[0]; __pyx_lineno = 1268; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_decode); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1268; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __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_filename = __pyx_f[0]; __pyx_lineno = 1268; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_1 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_1)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_1);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    if (!__pyx_t_1) {
      __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_8); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1268; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_GOTREF(__pyx_t_5);
    } else {
      __pyx_t_9 = PyTuple_New(1+1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1268; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_1); __pyx_t_1 = 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_3, __pyx_t_9, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1268; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_msg = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "pygrib.pyx":1269
 *                 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_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_msg, __pyx_n_s_rstrip); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1269; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_9 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_9)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_9);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    if (__pyx_t_9) {
      __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_9); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1269; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    } else {
      __pyx_t_5 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1269; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_r = __pyx_t_5;
    __pyx_t_5 = 0;
    goto __pyx_L0;

    /* "pygrib.pyx":1263
 *                     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":1271
 *             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_filename = __pyx_f[0]; __pyx_lineno = 1271; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_unrecognized_grib_type_d, __pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1271; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1271; __pyx_clineno = __LINE__; goto __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 = 0;
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1271; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1271; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "pygrib.pyx":1175
 *         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":1272
 *         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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("has_key", 0);

  /* "pygrib.pyx":1278
 *         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_filename = __pyx_f[0]; __pyx_lineno = 1278; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "pygrib.pyx":1279
 *         """
 *         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":1278
 *         tests whether a grib message object has a specified key.
 *         """
 *         if key in self._all_keys:             # <<<<<<<<<<<<<<
 *             return True
 *         try:
 */
  }

  /* "pygrib.pyx":1280
 *         if key in self._all_keys:
 *             return True
 *         try:             # <<<<<<<<<<<<<<
 *             self[key]
 *         except:
 */
  {
    __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":1281
 *             return True
 *         try:
 *             self[key]             # <<<<<<<<<<<<<<
 *         except:
 *             return False
 */
      __pyx_t_6 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_key); if (unlikely(__pyx_t_6 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1281; __pyx_clineno = __LINE__; goto __pyx_L4_error;};
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

      /* "pygrib.pyx":1280
 *         if key in self._all_keys:
 *             return True
 *         try:             # <<<<<<<<<<<<<<
 *             self[key]
 *         except:
 */
    }

    /* "pygrib.pyx":1285
 *             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":1282
 *         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_filename = __pyx_f[0]; __pyx_lineno = 1282; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_GOTREF(__pyx_t_8);

      /* "pygrib.pyx":1283
 *             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":1280
 *         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":1272
 *         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":1286
 *         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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("valid_key", 0);

  /* "pygrib.pyx":1293
 *         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_filename = __pyx_f[0]; __pyx_lineno = 1293; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1293; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_ret = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "pygrib.pyx":1295
 *         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_filename = __pyx_f[0]; __pyx_lineno = 1295; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1295; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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_filename = __pyx_f[0]; __pyx_lineno = 1295; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
  } else {
    __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1295; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1295; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1295; __pyx_clineno = __LINE__; goto __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":1296
 *         # 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_filename = __pyx_f[0]; __pyx_lineno = 1296; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_1) {

    /* "pygrib.pyx":1297
 *         if ret and self.is_missing(key): ret = False
 *         if ret:
 *             try:             # <<<<<<<<<<<<<<
 *                 self[key]
 *             except:
 */
    {
      __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":1298
 *         if ret:
 *             try:
 *                 self[key]             # <<<<<<<<<<<<<<
 *             except:
 *                 ret = False
 */
        __pyx_t_2 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_key); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1298; __pyx_clineno = __LINE__; goto __pyx_L7_error;};
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

        /* "pygrib.pyx":1297
 *         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_L14_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":1299
 *             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_filename = __pyx_f[0]; __pyx_lineno = 1299; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_GOTREF(__pyx_t_6);

        /* "pygrib.pyx":1300
 *                 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":1297
 *         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_L14_try_end:;
    }

    /* "pygrib.pyx":1296
 *         # 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":1301
 *             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":1286
 *         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":1302
 *                 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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("tostring", 0);

  /* "pygrib.pyx":1313
 *         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":1314
 *         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_PyObject_AsString(__pyx_v_bytestr); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_name = __pyx_t_1;

  /* "pygrib.pyx":1315
 *         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_filename = __pyx_f[0]; __pyx_lineno = 1315; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1315; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__59, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1315; __pyx_clineno = __LINE__; goto __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":1317
 *         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_filename = __pyx_f[0]; __pyx_lineno = 1317; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_4) {

    /* "pygrib.pyx":1318
 *         # 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_filename = __pyx_f[0]; __pyx_lineno = 1318; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1318; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_size = __pyx_t_5;

    /* "pygrib.pyx":1317
 *         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":1320
 *             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":1321
 *         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 (__pyx_t_4) {

      /* "pygrib.pyx":1322
 *             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_filename = __pyx_f[0]; __pyx_lineno = 1322; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1322; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
      __pyx_t_2 = 0;
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1322; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1322; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

      /* "pygrib.pyx":1321
 *         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":1323
 *             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":1324
 *                 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 (__pyx_t_4) {

    /* "pygrib.pyx":1325
 *         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_2 = __Pyx_PyBytes_FromString(grib_get_error_message(__pyx_v_err)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1325; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1325; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
    __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1325; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1325; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "pygrib.pyx":1324
 *                 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":1326
 *         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_filename = __pyx_f[0]; __pyx_lineno = 1326; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_msg = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "pygrib.pyx":1327
 *             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":1302
 *                 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":1328
 *         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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_unshape_mask", 0);
  __Pyx_INCREF(__pyx_v_datarr);

  /* "pygrib.pyx":1330
 *     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_filename = __pyx_f[0]; __pyx_lineno = 1330; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1330; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1330; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_3) {

    /* "pygrib.pyx":1331
 *         """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__60, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1331; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1331; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "pygrib.pyx":1330
 *     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":1333
 *             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_filename = __pyx_f[0]; __pyx_lineno = 1333; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1333; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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_filename = __pyx_f[0]; __pyx_lineno = 1333; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
  } else {
    __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1333; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1333; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1333; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_3) {

    /* "pygrib.pyx":1334
 *         # 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_filename = __pyx_f[0]; __pyx_lineno = 1334; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && 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_filename = __pyx_f[0]; __pyx_lineno = 1334; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1334; __pyx_clineno = __LINE__; goto __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":1333
 *             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":1336
 *             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 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_gridType); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1336; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1336; __pyx_clineno = __LINE__; goto __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__61, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1336; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1336; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_3) {

    /* "pygrib.pyx":1337
 *         # 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_filename = __pyx_f[0]; __pyx_lineno = 1337; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1337; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1337; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (__pyx_t_3) {

      /* "pygrib.pyx":1338
 *         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__62, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1338; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_Raise(__pyx_t_4, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1338; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

      /* "pygrib.pyx":1337
 *         # 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":1336
 *             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":1339
 *             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_filename = __pyx_f[0]; __pyx_lineno = 1339; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1339; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1339; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_3) {

    /* "pygrib.pyx":1351
 *             # 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 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_alternativeRowScanning); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1351; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1351; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__pyx_t_3) {

      /* "pygrib.pyx":1352
 *             # (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_filename = __pyx_f[0]; __pyx_lineno = 1352; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && 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_filename = __pyx_f[0]; __pyx_lineno = 1352; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1352; __pyx_clineno = __LINE__; goto __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":1353
 *             if self['alternativeRowScanning']:
 *                 datsave = datarr.copy()
 *                 datarr[1::2,::-1] = datsave[1::2,:]             # <<<<<<<<<<<<<<
 *         return datarr
 *     def _reshape_mask(self, datarr):
 */
      __pyx_t_2 = PyObject_GetItem(__pyx_v_datsave, __pyx_tuple__65); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1353; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
      __Pyx_GOTREF(__pyx_t_2);
      if (unlikely(PyObject_SetItem(__pyx_v_datarr, __pyx_tuple__68, __pyx_t_2) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1353; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "pygrib.pyx":1351
 *             # 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":1339
 *             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":1354
 *                 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":1328
 *         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":1355
 *                 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;
  Py_ssize_t __pyx_t_12;
  PyObject *__pyx_t_13 = NULL;
  int __pyx_t_14;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_reshape_mask", 0);
  __Pyx_INCREF(__pyx_v_datarr);

  /* "pygrib.pyx":1358
 *         """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_filename = __pyx_f[0]; __pyx_lineno = 1358; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_redtoreg_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_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":1359
 *         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_filename = __pyx_f[0]; __pyx_lineno = 1359; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1359; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1359; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_3) {

    /* "pygrib.pyx":1360
 *         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__69, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1360; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1360; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "pygrib.pyx":1359
 *         cdef double missval
 *         from redtoreg import _redtoreg
 *         if datarr.ndim > 2:             # <<<<<<<<<<<<<<
 *             raise ValueError('array must be 1d or 2d')
 *         # reduced grid.
 */
  }

  /* "pygrib.pyx":1362
 *             raise ValueError('array must be 1d or 2d')
 *         # reduced grid.
 *         if self['gridType'].startswith('reduced'):             # <<<<<<<<<<<<<<
 *             try:
 *                 ny = self['Ny']
 */
  __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_gridType); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1362; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1362; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__70, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1362; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1362; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_3) {

    /* "pygrib.pyx":1363
 *         # reduced grid.
 *         if self['gridType'].startswith('reduced'):
 *             try:             # <<<<<<<<<<<<<<
 *                 ny = self['Ny']
 *             except:
 */
    {
      __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":1364
 *         if self['gridType'].startswith('reduced'):
 *             try:
 *                 ny = self['Ny']             # <<<<<<<<<<<<<<
 *             except:
 *                 ny = self['Nj']
 */
        __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_Ny); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1364; __pyx_clineno = __LINE__; goto __pyx_L5_error;};
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_v_ny = __pyx_t_1;
        __pyx_t_1 = 0;

        /* "pygrib.pyx":1363
 *         # 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_L12_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":1365
 *             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_filename = __pyx_f[0]; __pyx_lineno = 1365; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_GOTREF(__pyx_t_7);

        /* "pygrib.pyx":1366
 *                 ny = self['Ny']
 *             except:
 *                 ny = self['Nj']             # <<<<<<<<<<<<<<
 *             if self.has_key('missingValue'):
 *                 missval = self['missingValue']
 */
        __pyx_t_8 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_Nj); if (unlikely(__pyx_t_8 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1366; __pyx_clineno = __LINE__; goto __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":1363
 *         # 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_L12_try_end:;
    }

    /* "pygrib.pyx":1367
 *             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_filename = __pyx_f[0]; __pyx_lineno = 1367; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_tuple__71, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1367; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1367; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__pyx_t_3) {

      /* "pygrib.pyx":1368
 *                 ny = self['Nj']
 *             if self.has_key('missingValue'):
 *                 missval = self['missingValue']             # <<<<<<<<<<<<<<
 *             else:
 *                 missval = 1.e30
 */
      __pyx_t_2 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_missingValue); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1368; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1368; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_v_missval = __pyx_t_9;

      /* "pygrib.pyx":1367
 *             except:
 *                 ny = self['Nj']
 *             if self.has_key('missingValue'):             # <<<<<<<<<<<<<<
 *                 missval = self['missingValue']
 *             else:
 */
      goto __pyx_L15;
    }

    /* "pygrib.pyx":1370
 *                 missval = self['missingValue']
 *             else:
 *                 missval = 1.e30             # <<<<<<<<<<<<<<
 *             if self.expand_reduced:
 *                 nx = 2*ny
 */
    /*else*/ {
      __pyx_v_missval = 1.e30;
    }
    __pyx_L15:;

    /* "pygrib.pyx":1371
 *             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_filename = __pyx_f[0]; __pyx_lineno = 1371; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (__pyx_t_3) {

      /* "pygrib.pyx":1372
 *                 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_filename = __pyx_f[0]; __pyx_lineno = 1372; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_v_nx = __pyx_t_2;
      __pyx_t_2 = 0;

      /* "pygrib.pyx":1373
 *             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_filename = __pyx_f[0]; __pyx_lineno = 1373; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_pl); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1373; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_8 = PyFloat_FromDouble(__pyx_v_missval); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1373; __pyx_clineno = __LINE__; goto __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_COMPILING_IN_CPYTHON && 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;
        }
      }
      __pyx_t_13 = PyTuple_New(4+__pyx_t_12); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1373; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1373; __pyx_clineno = __LINE__; goto __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":1371
 *             else:
 *                 missval = 1.e30
 *             if self.expand_reduced:             # <<<<<<<<<<<<<<
 *                 nx = 2*ny
 *                 datarr = _redtoreg(2*ny, self['pl'], datarr, missval)
 */
      goto __pyx_L16;
    }

    /* "pygrib.pyx":1375
 *                 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_L16:;

    /* "pygrib.pyx":1362
 *             raise ValueError('array must be 1d or 2d')
 *         # reduced grid.
 *         if self['gridType'].startswith('reduced'):             # <<<<<<<<<<<<<<
 *             try:
 *                 ny = self['Ny']
 */
    goto __pyx_L4;
  }

  /* "pygrib.pyx":1376
 *             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_filename = __pyx_f[0]; __pyx_lineno = 1376; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__72, NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1376; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1376; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1376; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_tuple__73, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1376; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1376; __pyx_clineno = __LINE__; goto __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":1377
 *                 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 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_Nx); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1377; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_v_nx = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "pygrib.pyx":1378
 *         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 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_Ny); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1378; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_v_ny = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "pygrib.pyx":1376
 *             else:
 *                 nx = None
 *         elif self.has_key('Nx') and self.has_key('Ny'):             # <<<<<<<<<<<<<<
 *             nx = self['Nx']
 *             ny = self['Ny']
 */
    goto __pyx_L4;
  }

  /* "pygrib.pyx":1380
 *             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_filename = __pyx_f[0]; __pyx_lineno = 1380; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1380; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1380; __pyx_clineno = __LINE__; goto __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_L19_bool_binop_done;
  }
  __pyx_t_10 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_has_key); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1380; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1380; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1380; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_3 = __pyx_t_14;
  __pyx_L19_bool_binop_done:;
  if (__pyx_t_3) {

    /* "pygrib.pyx":1381
 *         # 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 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_Ni); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1381; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_v_nx = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "pygrib.pyx":1382
 *         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 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_Nj); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1382; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_v_ny = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "pygrib.pyx":1380
 *             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":1384
 *             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":1385
 *         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_filename = __pyx_f[0]; __pyx_lineno = 1385; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1385; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1385; __pyx_clineno = __LINE__; goto __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_L22_bool_binop_done;
  }
  __pyx_t_10 = __Pyx_PyInt_From_int(GRIB_MISSING_LONG); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1385; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1385; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1385; __pyx_clineno = __LINE__; goto __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_L22_bool_binop_done;
  }

  /* "pygrib.pyx":1386
 *             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_filename = __pyx_f[0]; __pyx_lineno = 1386; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __pyx_t_14;
  __pyx_L22_bool_binop_done:;

  /* "pygrib.pyx":1385
 *         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":1387
 *         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_filename = __pyx_f[0]; __pyx_lineno = 1387; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1387; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "pygrib.pyx":1385
 *         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":1389
 *             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_filename = __pyx_f[0]; __pyx_lineno = 1389; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1389; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1389; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  if (__pyx_t_3) {

    /* "pygrib.pyx":1400
 *            # 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 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_alternativeRowScanning); if (unlikely(__pyx_t_10 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1400; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1400; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    if (__pyx_t_3) {

      /* "pygrib.pyx":1401
 *            # (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_filename = __pyx_f[0]; __pyx_lineno = 1401; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_13 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && 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_filename = __pyx_f[0]; __pyx_lineno = 1401; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1401; __pyx_clineno = __LINE__; goto __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":1402
 *            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 = PyObject_GetItem(__pyx_v_datsave, __pyx_tuple__78); if (unlikely(__pyx_t_10 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1402; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
      __Pyx_GOTREF(__pyx_t_10);
      if (unlikely(PyObject_SetItem(__pyx_v_datarr, __pyx_tuple__81, __pyx_t_10) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1402; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;

      /* "pygrib.pyx":1400
 *            # 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":1405
 *            # 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_filename = __pyx_f[0]; __pyx_lineno = 1405; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_tuple__82, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1405; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1405; __pyx_clineno = __LINE__; goto __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_L28_bool_binop_done;
    }
    __pyx_t_2 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_numberOfMissing); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1405; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_14 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1405; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_3 = __pyx_t_14;
    __pyx_L28_bool_binop_done:;
    if (__pyx_t_3) {

      /* "pygrib.pyx":1406
 *            # 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_filename = __pyx_f[0]; __pyx_lineno = 1406; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1406; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_13);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __pyx_t_10 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_missingValue); if (unlikely(__pyx_t_10 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1406; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
      __Pyx_GOTREF(__pyx_t_10);
      __pyx_t_8 = NULL;
      __pyx_t_12 = 0;
      if (CYTHON_COMPILING_IN_CPYTHON && 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;
        }
      }
      __pyx_t_1 = PyTuple_New(2+__pyx_t_12); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1406; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1406; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      __Pyx_DECREF_SET(__pyx_v_datarr, __pyx_t_2);
      __pyx_t_2 = 0;

      /* "pygrib.pyx":1405
 *            # 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":1389
 *             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":1407
 *            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":1355
 *                 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":1409
 *         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;
  Py_ssize_t __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  double __pyx_t_10;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_set_projparams", 0);

  /* "pygrib.pyx":1414
 *         proj4 key/value pairs describing the grid.
 *         """
 *         projparams = {}             # <<<<<<<<<<<<<<
 * 
 *         # check for radius key, if it exists just use it
 */
  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1414; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_projparams = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pygrib.pyx":1418
 *         # 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_filename = __pyx_f[0]; __pyx_lineno = 1418; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__83, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1418; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1418; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_3) {

    /* "pygrib.pyx":1419
 *         # and don't bother with shapeOfTheEarth
 *         if self.has_key('radius'):
 *             projparams['a'] = self['radius']             # <<<<<<<<<<<<<<
 *             projparams['b'] = self['radius']
 *         else:
 */
    __pyx_t_2 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_radius); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1419; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_2);
    if (unlikely(PyObject_SetItem(__pyx_v_projparams, __pyx_n_s_a, __pyx_t_2) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1419; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "pygrib.pyx":1420
 *         if self.has_key('radius'):
 *             projparams['a'] = self['radius']
 *             projparams['b'] = self['radius']             # <<<<<<<<<<<<<<
 *         else:
 *             if self['shapeOfTheEarth'] == 6:
 */
    __pyx_t_2 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_radius); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1420; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_2);
    if (unlikely(PyObject_SetItem(__pyx_v_projparams, __pyx_n_s_b, __pyx_t_2) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1420; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "pygrib.pyx":1418
 *         # 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":1422
 *             projparams['b'] = self['radius']
 *         else:
 *             if self['shapeOfTheEarth'] == 6:             # <<<<<<<<<<<<<<
 *                 projparams['a']=6371229.0
 *                 projparams['b']=6371229.0
 */
  /*else*/ {
    __pyx_t_2 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_shapeOfTheEarth); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1422; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1422; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1422; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (__pyx_t_3) {

      /* "pygrib.pyx":1423
 *         else:
 *             if self['shapeOfTheEarth'] == 6:
 *                 projparams['a']=6371229.0             # <<<<<<<<<<<<<<
 *                 projparams['b']=6371229.0
 *             elif self['shapeOfTheEarth'] in [3,7]:
 */
      if (unlikely(PyObject_SetItem(__pyx_v_projparams, __pyx_n_s_a, __pyx_float_6371229_0) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1423; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

      /* "pygrib.pyx":1424
 *             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(PyObject_SetItem(__pyx_v_projparams, __pyx_n_s_b, __pyx_float_6371229_0) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1424; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

      /* "pygrib.pyx":1422
 *             projparams['b'] = self['radius']
 *         else:
 *             if self['shapeOfTheEarth'] == 6:             # <<<<<<<<<<<<<<
 *                 projparams['a']=6371229.0
 *                 projparams['b']=6371229.0
 */
      goto __pyx_L4;
    }

    /* "pygrib.pyx":1425
 *                 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 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_shapeOfTheEarth); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1425; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1425; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1425; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1425; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1425; __pyx_clineno = __LINE__; goto __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":1426
 *                 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_filename = __pyx_f[0]; __pyx_lineno = 1426; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__84, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1426; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1426; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (__pyx_t_4) {

        /* "pygrib.pyx":1427
 *             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 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_scaleFactorOfMajorAxisOfOblateSp); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1427; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_v_scalea = __pyx_t_2;
        __pyx_t_2 = 0;

        /* "pygrib.pyx":1428
 *                 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 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_scaleFactorOfMinorAxisOfOblateSp); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1428; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_v_scaleb = __pyx_t_2;
        __pyx_t_2 = 0;

        /* "pygrib.pyx":1429
 *                     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_filename = __pyx_f[0]; __pyx_lineno = 1429; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1429; __pyx_clineno = __LINE__; goto __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":1430
 *                     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_filename = __pyx_f[0]; __pyx_lineno = 1430; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1430; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1430; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_1);
          __pyx_t_7 = NULL;
          __pyx_t_8 = 0;
          if (CYTHON_COMPILING_IN_CPYTHON && 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;
            }
          }
          __pyx_t_9 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1430; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1430; __pyx_clineno = __LINE__; goto __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":1431
 *                     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 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_shapeOfTheEarth); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1431; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1431; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1431; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          if (__pyx_t_4) {

            /* "pygrib.pyx":1432
 *                         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_filename = __pyx_f[0]; __pyx_lineno = 1432; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            __Pyx_GOTREF(__pyx_t_6);
            __Pyx_DECREF_SET(__pyx_v_scalea, __pyx_t_6);
            __pyx_t_6 = 0;

            /* "pygrib.pyx":1431
 *                     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":1429
 *                     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":1434
 *                             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":1435
 *                     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_filename = __pyx_f[0]; __pyx_lineno = 1435; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1435; __pyx_clineno = __LINE__; goto __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":1436
 *                         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_filename = __pyx_f[0]; __pyx_lineno = 1436; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1436; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1436; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_1 = NULL;
          __pyx_t_8 = 0;
          if (CYTHON_COMPILING_IN_CPYTHON && 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;
            }
          }
          __pyx_t_7 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1436; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1436; __pyx_clineno = __LINE__; goto __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":1437
 *                     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 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_shapeOfTheEarth); if (unlikely(__pyx_t_6 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1437; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1437; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1437; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          if (__pyx_t_4) {

            /* "pygrib.pyx":1438
 *                         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_filename = __pyx_f[0]; __pyx_lineno = 1438; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            __Pyx_GOTREF(__pyx_t_9);
            __Pyx_DECREF_SET(__pyx_v_scaleb, __pyx_t_9);
            __pyx_t_9 = 0;

            /* "pygrib.pyx":1437
 *                     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":1435
 *                     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":1440
 *                             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":1426
 *                 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":1442
 *                         scaleb = 1.
 *                 else:
 *                     scalea = 1.             # <<<<<<<<<<<<<<
 *                     scaleb = 1.
 *                 if grib_api_version < 10900:
 */
      /*else*/ {
        __Pyx_INCREF(__pyx_float_1_);
        __pyx_v_scalea = __pyx_float_1_;

        /* "pygrib.pyx":1443
 *                 else:
 *                     scalea = 1.
 *                     scaleb = 1.             # <<<<<<<<<<<<<<
 *                 if grib_api_version < 10900:
 *                     projparams['a']=self['scaledValueOfMajorAxisOfOblateSpheroidEarth']*scalea
 */
        __Pyx_INCREF(__pyx_float_1_);
        __pyx_v_scaleb = __pyx_float_1_;
      }
      __pyx_L7:;

      /* "pygrib.pyx":1444
 *                     scalea = 1.
 *                     scaleb = 1.
 *                 if grib_api_version < 10900:             # <<<<<<<<<<<<<<
 *                     projparams['a']=self['scaledValueOfMajorAxisOfOblateSpheroidEarth']*scalea
 *                     projparams['b']=self['scaledValueOfMinorAxisOfOblateSpheroidEarth']*scaleb
 */
      __pyx_t_9 = __Pyx_GetModuleGlobalName(__pyx_n_s_grib_api_version); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1444; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_6 = PyObject_RichCompare(__pyx_t_9, __pyx_int_10900, Py_LT); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1444; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1444; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (__pyx_t_4) {

        /* "pygrib.pyx":1445
 *                     scaleb = 1.
 *                 if grib_api_version < 10900:
 *                     projparams['a']=self['scaledValueOfMajorAxisOfOblateSpheroidEarth']*scalea             # <<<<<<<<<<<<<<
 *                     projparams['b']=self['scaledValueOfMinorAxisOfOblateSpheroidEarth']*scaleb
 *                 else:
 */
        __pyx_t_6 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_scaledValueOfMajorAxisOfOblateSp); if (unlikely(__pyx_t_6 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1445; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_9 = PyNumber_Multiply(__pyx_t_6, __pyx_v_scalea); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1445; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        if (unlikely(PyObject_SetItem(__pyx_v_projparams, __pyx_n_s_a, __pyx_t_9) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1445; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

        /* "pygrib.pyx":1446
 *                 if grib_api_version < 10900:
 *                     projparams['a']=self['scaledValueOfMajorAxisOfOblateSpheroidEarth']*scalea
 *                     projparams['b']=self['scaledValueOfMinorAxisOfOblateSpheroidEarth']*scaleb             # <<<<<<<<<<<<<<
 *                 else:
 *                     projparams['a']=self['scaledValueOfEarthMajorAxis']*scalea
 */
        __pyx_t_9 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_scaledValueOfMinorAxisOfOblateSp); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1446; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
        __Pyx_GOTREF(__pyx_t_9);
        __pyx_t_6 = PyNumber_Multiply(__pyx_t_9, __pyx_v_scaleb); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1446; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        if (unlikely(PyObject_SetItem(__pyx_v_projparams, __pyx_n_s_b, __pyx_t_6) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1446; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

        /* "pygrib.pyx":1444
 *                     scalea = 1.
 *                     scaleb = 1.
 *                 if grib_api_version < 10900:             # <<<<<<<<<<<<<<
 *                     projparams['a']=self['scaledValueOfMajorAxisOfOblateSpheroidEarth']*scalea
 *                     projparams['b']=self['scaledValueOfMinorAxisOfOblateSpheroidEarth']*scaleb
 */
        goto __pyx_L16;
      }

      /* "pygrib.pyx":1448
 *                     projparams['b']=self['scaledValueOfMinorAxisOfOblateSpheroidEarth']*scaleb
 *                 else:
 *                     projparams['a']=self['scaledValueOfEarthMajorAxis']*scalea             # <<<<<<<<<<<<<<
 *                     projparams['b']=self['scaledValueOfEarthMinorAxis']*scaleb
 *             elif self['shapeOfTheEarth'] == 2:
 */
      /*else*/ {
        __pyx_t_6 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_scaledValueOfEarthMajorAxis); if (unlikely(__pyx_t_6 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1448; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_9 = PyNumber_Multiply(__pyx_t_6, __pyx_v_scalea); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1448; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        if (unlikely(PyObject_SetItem(__pyx_v_projparams, __pyx_n_s_a, __pyx_t_9) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1448; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

        /* "pygrib.pyx":1449
 *                 else:
 *                     projparams['a']=self['scaledValueOfEarthMajorAxis']*scalea
 *                     projparams['b']=self['scaledValueOfEarthMinorAxis']*scaleb             # <<<<<<<<<<<<<<
 *             elif self['shapeOfTheEarth'] == 2:
 *                 projparams['a']=6378160.0
 */
        __pyx_t_9 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_scaledValueOfEarthMinorAxis); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1449; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
        __Pyx_GOTREF(__pyx_t_9);
        __pyx_t_6 = PyNumber_Multiply(__pyx_t_9, __pyx_v_scaleb); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1449; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        if (unlikely(PyObject_SetItem(__pyx_v_projparams, __pyx_n_s_b, __pyx_t_6) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1449; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      }
      __pyx_L16:;

      /* "pygrib.pyx":1425
 *                 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":1450
 *                     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 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_shapeOfTheEarth); if (unlikely(__pyx_t_6 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1450; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_9 = __Pyx_PyInt_EqObjC(__pyx_t_6, __pyx_int_2, 2, 0); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1450; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1450; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    if (__pyx_t_4) {

      /* "pygrib.pyx":1451
 *                     projparams['b']=self['scaledValueOfEarthMinorAxis']*scaleb
 *             elif self['shapeOfTheEarth'] == 2:
 *                 projparams['a']=6378160.0             # <<<<<<<<<<<<<<
 *                 projparams['b']=6356775.0
 *             elif self['shapeOfTheEarth'] == 1:
 */
      if (unlikely(PyObject_SetItem(__pyx_v_projparams, __pyx_n_s_a, __pyx_float_6378160_0) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1451; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

      /* "pygrib.pyx":1452
 *             elif self['shapeOfTheEarth'] == 2:
 *                 projparams['a']=6378160.0
 *                 projparams['b']=6356775.0             # <<<<<<<<<<<<<<
 *             elif self['shapeOfTheEarth'] == 1:
 *                 if self.has_key('scaleFactorOfRadiusOfSphericalEarth'):
 */
      if (unlikely(PyObject_SetItem(__pyx_v_projparams, __pyx_n_s_b, __pyx_float_6356775_0) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1452; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

      /* "pygrib.pyx":1450
 *                     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":1453
 *                 projparams['a']=6378160.0
 *                 projparams['b']=6356775.0
 *             elif self['shapeOfTheEarth'] == 1:             # <<<<<<<<<<<<<<
 *                 if self.has_key('scaleFactorOfRadiusOfSphericalEarth'):
 *                     scalea = self['scaleFactorOfRadiusOfSphericalEarth']
 */
    __pyx_t_9 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_shapeOfTheEarth); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1453; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_6 = __Pyx_PyInt_EqObjC(__pyx_t_9, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1453; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1453; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (__pyx_t_4) {

      /* "pygrib.pyx":1454
 *                 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_filename = __pyx_f[0]; __pyx_lineno = 1454; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_tuple__85, NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1454; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1454; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      if (__pyx_t_4) {

        /* "pygrib.pyx":1455
 *             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_9 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_scaleFactorOfRadiusOfSphericalEa); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1455; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
        __Pyx_GOTREF(__pyx_t_9);
        __pyx_v_scalea = __pyx_t_9;
        __pyx_t_9 = 0;

        /* "pygrib.pyx":1456
 *                 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_filename = __pyx_f[0]; __pyx_lineno = 1456; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        if (__pyx_t_3) {
        } else {
          __pyx_t_4 = __pyx_t_3;
          goto __pyx_L19_bool_binop_done;
        }
        __pyx_t_9 = __Pyx_GetModuleGlobalName(__pyx_n_s_missingvalue_int); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1456; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_9);
        __pyx_t_3 = (__pyx_v_scalea != __pyx_t_9);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 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":1457
 *                     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_filename = __pyx_f[0]; __pyx_lineno = 1457; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_6);
          __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_power); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1457; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __pyx_t_6 = PyNumber_Negative(__pyx_v_scalea); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1457; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_6);
          __pyx_t_2 = NULL;
          __pyx_t_8 = 0;
          if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_7))) {
            __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_7);
            if (likely(__pyx_t_2)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
              __Pyx_INCREF(__pyx_t_2);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_7, function);
              __pyx_t_8 = 1;
            }
          }
          __pyx_t_1 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1457; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_1);
          if (__pyx_t_2) {
            __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2); __pyx_t_2 = NULL;
          }
          __Pyx_INCREF(__pyx_float_10_0);
          __Pyx_GIVEREF(__pyx_float_10_0);
          PyTuple_SET_ITEM(__pyx_t_1, 0+__pyx_t_8, __pyx_float_10_0);
          __Pyx_GIVEREF(__pyx_t_6);
          PyTuple_SET_ITEM(__pyx_t_1, 1+__pyx_t_8, __pyx_t_6);
          __pyx_t_6 = 0;
          __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_1, NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1457; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_DECREF_SET(__pyx_v_scalea, __pyx_t_9);
          __pyx_t_9 = 0;

          /* "pygrib.pyx":1456
 *                 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":1459
 *                         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":1460
 *                     else:
 *                         scalea = 1
 *                     scaleb = scalea             # <<<<<<<<<<<<<<
 *                 else:
 *                     scalea = 1.
 */
        __Pyx_INCREF(__pyx_v_scalea);
        __pyx_v_scaleb = __pyx_v_scalea;

        /* "pygrib.pyx":1454
 *                 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":1462
 *                     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":1463
 *                 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":1464
 *                     scalea = 1.
 *                     scaleb = 1.
 *                 projparams['a']=self['scaledValueOfRadiusOfSphericalEarth']*scalea             # <<<<<<<<<<<<<<
 *                 projparams['b']=self['scaledValueOfRadiusOfSphericalEarth']*scaleb
 *             elif self['shapeOfTheEarth'] == 0:
 */
      __pyx_t_9 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_scaledValueOfRadiusOfSphericalEa); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1464; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_7 = PyNumber_Multiply(__pyx_t_9, __pyx_v_scalea); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1464; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      if (unlikely(PyObject_SetItem(__pyx_v_projparams, __pyx_n_s_a, __pyx_t_7) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1464; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

      /* "pygrib.pyx":1465
 *                     scaleb = 1.
 *                 projparams['a']=self['scaledValueOfRadiusOfSphericalEarth']*scalea
 *                 projparams['b']=self['scaledValueOfRadiusOfSphericalEarth']*scaleb             # <<<<<<<<<<<<<<
 *             elif self['shapeOfTheEarth'] == 0:
 *                 projparams['a']=6367470.0
 */
      __pyx_t_7 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_scaledValueOfRadiusOfSphericalEa); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1465; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_9 = PyNumber_Multiply(__pyx_t_7, __pyx_v_scaleb); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1465; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (unlikely(PyObject_SetItem(__pyx_v_projparams, __pyx_n_s_b, __pyx_t_9) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1465; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

      /* "pygrib.pyx":1453
 *                 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":1466
 *                 projparams['a']=self['scaledValueOfRadiusOfSphericalEarth']*scalea
 *                 projparams['b']=self['scaledValueOfRadiusOfSphericalEarth']*scaleb
 *             elif self['shapeOfTheEarth'] == 0:             # <<<<<<<<<<<<<<
 *                 projparams['a']=6367470.0
 *                 projparams['b']=6367470.0
 */
    __pyx_t_9 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_shapeOfTheEarth); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1466; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_7 = __Pyx_PyInt_EqObjC(__pyx_t_9, __pyx_int_0, 0, 0); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1466; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1466; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (__pyx_t_4) {

      /* "pygrib.pyx":1467
 *                 projparams['b']=self['scaledValueOfRadiusOfSphericalEarth']*scaleb
 *             elif self['shapeOfTheEarth'] == 0:
 *                 projparams['a']=6367470.0             # <<<<<<<<<<<<<<
 *                 projparams['b']=6367470.0
 *             elif self['shapeOfTheEarth'] == 5: # WGS84
 */
      if (unlikely(PyObject_SetItem(__pyx_v_projparams, __pyx_n_s_a, __pyx_float_6367470_0) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

      /* "pygrib.pyx":1468
 *             elif self['shapeOfTheEarth'] == 0:
 *                 projparams['a']=6367470.0
 *                 projparams['b']=6367470.0             # <<<<<<<<<<<<<<
 *             elif self['shapeOfTheEarth'] == 5: # WGS84
 *                 projparams['a']=6378137.0
 */
      if (unlikely(PyObject_SetItem(__pyx_v_projparams, __pyx_n_s_b, __pyx_float_6367470_0) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1468; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

      /* "pygrib.pyx":1466
 *                 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":1469
 *                 projparams['a']=6367470.0
 *                 projparams['b']=6367470.0
 *             elif self['shapeOfTheEarth'] == 5: # WGS84             # <<<<<<<<<<<<<<
 *                 projparams['a']=6378137.0
 *                 projparams['b']=6356752.3142
 */
    __pyx_t_7 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_shapeOfTheEarth); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1469; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_9 = __Pyx_PyInt_EqObjC(__pyx_t_7, __pyx_int_5, 5, 0); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    if (__pyx_t_4) {

      /* "pygrib.pyx":1470
 *                 projparams['b']=6367470.0
 *             elif self['shapeOfTheEarth'] == 5: # WGS84
 *                 projparams['a']=6378137.0             # <<<<<<<<<<<<<<
 *                 projparams['b']=6356752.3142
 *             elif self['shapeOfTheEarth'] == 8:
 */
      if (unlikely(PyObject_SetItem(__pyx_v_projparams, __pyx_n_s_a, __pyx_float_6378137_0) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1470; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

      /* "pygrib.pyx":1471
 *             elif self['shapeOfTheEarth'] == 5: # WGS84
 *                 projparams['a']=6378137.0
 *                 projparams['b']=6356752.3142             # <<<<<<<<<<<<<<
 *             elif self['shapeOfTheEarth'] == 8:
 *                 projparams['a']=6371200.0
 */
      if (unlikely(PyObject_SetItem(__pyx_v_projparams, __pyx_n_s_b, __pyx_float_6356752_3142) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1471; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

      /* "pygrib.pyx":1469
 *                 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":1472
 *                 projparams['a']=6378137.0
 *                 projparams['b']=6356752.3142
 *             elif self['shapeOfTheEarth'] == 8:             # <<<<<<<<<<<<<<
 *                 projparams['a']=6371200.0
 *                 projparams['b']=6371200.0
 */
    __pyx_t_9 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_shapeOfTheEarth); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1472; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_7 = __Pyx_PyInt_EqObjC(__pyx_t_9, __pyx_int_8, 8, 0); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1472; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1472; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (__pyx_t_4) {

      /* "pygrib.pyx":1473
 *                 projparams['b']=6356752.3142
 *             elif self['shapeOfTheEarth'] == 8:
 *                 projparams['a']=6371200.0             # <<<<<<<<<<<<<<
 *                 projparams['b']=6371200.0
 *             else:
 */
      if (unlikely(PyObject_SetItem(__pyx_v_projparams, __pyx_n_s_a, __pyx_float_6371200_0) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1473; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

      /* "pygrib.pyx":1474
 *             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(PyObject_SetItem(__pyx_v_projparams, __pyx_n_s_b, __pyx_float_6371200_0) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1474; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

      /* "pygrib.pyx":1472
 *                 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":1476
 *                 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_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_tolerate_badgrib); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1476; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1476; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_5 = ((!__pyx_t_4) != 0);
      if (__pyx_t_5) {
        __pyx_t_7 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__86, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1476; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_Raise(__pyx_t_7, 0, 0, 0);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1476; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
    }
    __pyx_L4:;
  }
  __pyx_L3:;

  /* "pygrib.pyx":1478
 *                 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_7 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_gridType); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1478; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_4 = (__Pyx_PyString_Equals(__pyx_t_7, __pyx_n_s_reduced_gg, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1478; __pyx_clineno = __LINE__; goto __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_7, __pyx_n_s_reduced_ll, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1478; __pyx_clineno = __LINE__; goto __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_7, __pyx_n_s_regular_gg, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1478; __pyx_clineno = __LINE__; goto __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_7, __pyx_n_s_regular_ll, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1478; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_5 = __pyx_t_4;
  __pyx_L23_bool_binop_done:;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_4 = (__pyx_t_5 != 0);
  if (__pyx_t_4) {

    /* "pygrib.pyx":1479
 * 
 *         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(PyObject_SetItem(__pyx_v_projparams, __pyx_n_s_proj, __pyx_n_s_cyl) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1479; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "pygrib.pyx":1478
 *                 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":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'
 *             projparams['lat_ts']=self['latitudeWhereDxAndDyAreSpecifiedInDegrees']
 */
  __pyx_t_7 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_gridType); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1480; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_4 = (__Pyx_PyString_Equals(__pyx_t_7, __pyx_n_s_polar_stereographic, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1480; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (__pyx_t_4) {

    /* "pygrib.pyx":1481
 *             projparams['proj']='cyl'
 *         elif self['gridType'] == 'polar_stereographic':
 *             projparams['proj']='stere'             # <<<<<<<<<<<<<<
 *             projparams['lat_ts']=self['latitudeWhereDxAndDyAreSpecifiedInDegrees']
 *             if self.has_key('projectionCentreFlag'):
 */
    if (unlikely(PyObject_SetItem(__pyx_v_projparams, __pyx_n_s_proj, __pyx_n_s_stere) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1481; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "pygrib.pyx":1482
 *         elif self['gridType'] == 'polar_stereographic':
 *             projparams['proj']='stere'
 *             projparams['lat_ts']=self['latitudeWhereDxAndDyAreSpecifiedInDegrees']             # <<<<<<<<<<<<<<
 *             if self.has_key('projectionCentreFlag'):
 *                 projcenterflag = self['projectionCentreFlag']
 */
    __pyx_t_7 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_latitudeWhereDxAndDyAreSpecified); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1482; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_7);
    if (unlikely(PyObject_SetItem(__pyx_v_projparams, __pyx_n_s_lat_ts, __pyx_t_7) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1482; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

    /* "pygrib.pyx":1483
 *             projparams['proj']='stere'
 *             projparams['lat_ts']=self['latitudeWhereDxAndDyAreSpecifiedInDegrees']
 *             if self.has_key('projectionCentreFlag'):             # <<<<<<<<<<<<<<
 *                 projcenterflag = self['projectionCentreFlag']
 *             elif self.has_key('projectionCenterFlag'):
 */
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_has_key); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1483; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_tuple__87, NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1483; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1483; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    if (__pyx_t_4) {

      /* "pygrib.pyx":1484
 *             projparams['lat_ts']=self['latitudeWhereDxAndDyAreSpecifiedInDegrees']
 *             if self.has_key('projectionCentreFlag'):
 *                 projcenterflag = self['projectionCentreFlag']             # <<<<<<<<<<<<<<
 *             elif self.has_key('projectionCenterFlag'):
 *                 projcenterflag = self['projectionCenterFlag']
 */
      __pyx_t_9 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_projectionCentreFlag); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1484; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_v_projcenterflag = __pyx_t_9;
      __pyx_t_9 = 0;

      /* "pygrib.pyx":1483
 *             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":1485
 *             if self.has_key('projectionCentreFlag'):
 *                 projcenterflag = self['projectionCentreFlag']
 *             elif self.has_key('projectionCenterFlag'):             # <<<<<<<<<<<<<<
 *                 projcenterflag = self['projectionCenterFlag']
 *             else:
 */
    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_has_key); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1485; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_tuple__88, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1485; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1485; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (__pyx_t_4) {

      /* "pygrib.pyx":1486
 *                 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_7 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_projectionCenterFlag); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1486; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_v_projcenterflag = __pyx_t_7;
      __pyx_t_7 = 0;

      /* "pygrib.pyx":1485
 *             if self.has_key('projectionCentreFlag'):
 *                 projcenterflag = self['projectionCentreFlag']
 *             elif self.has_key('projectionCenterFlag'):             # <<<<<<<<<<<<<<
 *                 projcenterflag = self['projectionCenterFlag']
 *             else:
 */
      goto __pyx_L27;
    }

    /* "pygrib.pyx":1488
 *                 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_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_tolerate_badgrib); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1488; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1488; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_5 = ((!__pyx_t_4) != 0);
      if (__pyx_t_5) {
        __pyx_t_7 = __Pyx_PyObject_Call(__pyx_builtin_KeyError, __pyx_tuple__89, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1488; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_Raise(__pyx_t_7, 0, 0, 0);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1488; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
    }
    __pyx_L27:;

    /* "pygrib.pyx":1489
 *             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_filename = __pyx_f[0]; __pyx_lineno = 1489; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
    __pyx_t_7 = __Pyx_PyInt_EqObjC(__pyx_v_projcenterflag, __pyx_int_0, 0, 0); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1489; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1489; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (__pyx_t_5) {

      /* "pygrib.pyx":1490
 *                 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(PyObject_SetItem(__pyx_v_projparams, __pyx_n_s_lat_0, __pyx_float_90_) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1490; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

      /* "pygrib.pyx":1489
 *             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":1492
 *                 projparams['lat_0']=90.
 *             else:
 *                 projparams['lat_0']=-90.             # <<<<<<<<<<<<<<
 *             projparams['lon_0']=self['orientationOfTheGridInDegrees']
 *         elif self['gridType'] == 'lambert':
 */
    /*else*/ {
      if (unlikely(PyObject_SetItem(__pyx_v_projparams, __pyx_n_s_lat_0, __pyx_float_neg_90_) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1492; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_L29:;

    /* "pygrib.pyx":1493
 *             else:
 *                 projparams['lat_0']=-90.
 *             projparams['lon_0']=self['orientationOfTheGridInDegrees']             # <<<<<<<<<<<<<<
 *         elif self['gridType'] == 'lambert':
 *             projparams['proj']='lcc'
 */
    __pyx_t_7 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_orientationOfTheGridInDegrees); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1493; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_7);
    if (unlikely(PyObject_SetItem(__pyx_v_projparams, __pyx_n_s_lon_0, __pyx_t_7) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1493; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

    /* "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'
 *             projparams['lat_ts']=self['latitudeWhereDxAndDyAreSpecifiedInDegrees']
 */
    goto __pyx_L22;
  }

  /* "pygrib.pyx":1494
 *                 projparams['lat_0']=-90.
 *             projparams['lon_0']=self['orientationOfTheGridInDegrees']
 *         elif self['gridType'] == 'lambert':             # <<<<<<<<<<<<<<
 *             projparams['proj']='lcc'
 *             projparams['lon_0']=self['LoVInDegrees']
 */
  __pyx_t_7 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_gridType); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1494; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_5 = (__Pyx_PyString_Equals(__pyx_t_7, __pyx_n_s_lambert, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1494; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (__pyx_t_5) {

    /* "pygrib.pyx":1495
 *             projparams['lon_0']=self['orientationOfTheGridInDegrees']
 *         elif self['gridType'] == 'lambert':
 *             projparams['proj']='lcc'             # <<<<<<<<<<<<<<
 *             projparams['lon_0']=self['LoVInDegrees']
 *             projparams['lat_0']=self['LaDInDegrees']
 */
    if (unlikely(PyObject_SetItem(__pyx_v_projparams, __pyx_n_s_proj, __pyx_n_s_lcc) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1495; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "pygrib.pyx":1496
 *         elif self['gridType'] == 'lambert':
 *             projparams['proj']='lcc'
 *             projparams['lon_0']=self['LoVInDegrees']             # <<<<<<<<<<<<<<
 *             projparams['lat_0']=self['LaDInDegrees']
 *             projparams['lat_1']=self['Latin1InDegrees']
 */
    __pyx_t_7 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_LoVInDegrees); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1496; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_7);
    if (unlikely(PyObject_SetItem(__pyx_v_projparams, __pyx_n_s_lon_0, __pyx_t_7) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1496; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

    /* "pygrib.pyx":1497
 *             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_7 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_LaDInDegrees); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1497; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_7);
    if (unlikely(PyObject_SetItem(__pyx_v_projparams, __pyx_n_s_lat_0, __pyx_t_7) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1497; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

    /* "pygrib.pyx":1498
 *             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_7 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_Latin1InDegrees); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1498; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_7);
    if (unlikely(PyObject_SetItem(__pyx_v_projparams, __pyx_n_s_lat_1, __pyx_t_7) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1498; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

    /* "pygrib.pyx":1499
 *             projparams['lat_0']=self['LaDInDegrees']
 *             projparams['lat_1']=self['Latin1InDegrees']
 *             projparams['lat_2']=self['Latin2InDegrees']             # <<<<<<<<<<<<<<
 *         elif self['gridType'] =='albers':
 *             projparams['proj']='aea'
 */
    __pyx_t_7 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_Latin2InDegrees); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1499; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_7);
    if (unlikely(PyObject_SetItem(__pyx_v_projparams, __pyx_n_s_lat_2, __pyx_t_7) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1499; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

    /* "pygrib.pyx":1494
 *                 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":1500
 *             projparams['lat_1']=self['Latin1InDegrees']
 *             projparams['lat_2']=self['Latin2InDegrees']
 *         elif self['gridType'] =='albers':             # <<<<<<<<<<<<<<
 *             projparams['proj']='aea'
 *             scale = float(self['grib2divider'])
 */
  __pyx_t_7 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_gridType); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1500; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_5 = (__Pyx_PyString_Equals(__pyx_t_7, __pyx_n_s_albers, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1500; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (__pyx_t_5) {

    /* "pygrib.pyx":1501
 *             projparams['lat_2']=self['Latin2InDegrees']
 *         elif self['gridType'] =='albers':
 *             projparams['proj']='aea'             # <<<<<<<<<<<<<<
 *             scale = float(self['grib2divider'])
 *             projparams['lon_0']=self['LoV']/scale
 */
    if (unlikely(PyObject_SetItem(__pyx_v_projparams, __pyx_n_s_proj, __pyx_n_s_aea) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1501; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "pygrib.pyx":1502
 *         elif self['gridType'] =='albers':
 *             projparams['proj']='aea'
 *             scale = float(self['grib2divider'])             # <<<<<<<<<<<<<<
 *             projparams['lon_0']=self['LoV']/scale
 *             if self['truncateDegrees']:
 */
    __pyx_t_7 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_grib2divider); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1502; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_10 = __Pyx_PyObject_AsDouble(__pyx_t_7); if (unlikely(__pyx_t_10 == ((double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1502; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = PyFloat_FromDouble(__pyx_t_10); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1502; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_v_scale = __pyx_t_7;
    __pyx_t_7 = 0;

    /* "pygrib.pyx":1503
 *             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_7 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_LoV); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1503; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_9 = __Pyx_PyNumber_Divide(__pyx_t_7, __pyx_v_scale); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1503; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (unlikely(PyObject_SetItem(__pyx_v_projparams, __pyx_n_s_lon_0, __pyx_t_9) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1503; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

    /* "pygrib.pyx":1504
 *             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 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_truncateDegrees); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1504; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1504; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    if (__pyx_t_5) {

      /* "pygrib.pyx":1505
 *             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 = PyObject_GetItem(__pyx_v_projparams, __pyx_n_s_lon_0); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1505; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_7 = PyNumber_Int(__pyx_t_9); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1505; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      if (unlikely(PyObject_SetItem(__pyx_v_projparams, __pyx_n_s_lon_0, __pyx_t_7) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1505; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

      /* "pygrib.pyx":1504
 *             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":1506
 *             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_7 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_LaD); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1506; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_9 = __Pyx_PyNumber_Divide(__pyx_t_7, __pyx_v_scale); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1506; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (unlikely(PyObject_SetItem(__pyx_v_projparams, __pyx_n_s_lat_0, __pyx_t_9) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1506; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

    /* "pygrib.pyx":1507
 *                 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 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_truncateDegrees); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1507; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1507; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    if (__pyx_t_5) {

      /* "pygrib.pyx":1508
 *             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 = PyObject_GetItem(__pyx_v_projparams, __pyx_n_s_lat_0); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1508; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_7 = PyNumber_Int(__pyx_t_9); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1508; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      if (unlikely(PyObject_SetItem(__pyx_v_projparams, __pyx_n_s_lat_0, __pyx_t_7) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1508; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

      /* "pygrib.pyx":1507
 *                 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":1509
 *             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_7 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_Latin1); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1509; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_9 = __Pyx_PyNumber_Divide(__pyx_t_7, __pyx_v_scale); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1509; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (unlikely(PyObject_SetItem(__pyx_v_projparams, __pyx_n_s_lat_1, __pyx_t_9) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1509; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

    /* "pygrib.pyx":1510
 *                 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 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_truncateDegrees); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1510; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1510; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    if (__pyx_t_5) {

      /* "pygrib.pyx":1511
 *             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 = PyObject_GetItem(__pyx_v_projparams, __pyx_n_s_lat_1); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1511; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_7 = PyNumber_Int(__pyx_t_9); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1511; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      if (unlikely(PyObject_SetItem(__pyx_v_projparams, __pyx_n_s_lat_1, __pyx_t_7) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1511; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

      /* "pygrib.pyx":1510
 *                 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":1512
 *             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_7 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_Latin2); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1512; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_9 = __Pyx_PyNumber_Divide(__pyx_t_7, __pyx_v_scale); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1512; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (unlikely(PyObject_SetItem(__pyx_v_projparams, __pyx_n_s_lat_2, __pyx_t_9) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1512; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

    /* "pygrib.pyx":1513
 *                 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 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_truncateDegrees); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1513; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1513; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    if (__pyx_t_5) {

      /* "pygrib.pyx":1514
 *             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 = PyObject_GetItem(__pyx_v_projparams, __pyx_n_s_lat_2); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1514; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_7 = PyNumber_Int(__pyx_t_9); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1514; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      if (unlikely(PyObject_SetItem(__pyx_v_projparams, __pyx_n_s_lat_2, __pyx_t_7) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1514; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

      /* "pygrib.pyx":1513
 *                 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":1500
 *             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":1515
 *             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_7 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_gridType); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1515; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_5 = (__Pyx_PyString_Equals(__pyx_t_7, __pyx_n_s_space_view, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1515; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (__pyx_t_5) {

    /* "pygrib.pyx":1516
 *                 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_7 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_longitudeOfSubSatellitePointInDe); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1516; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_7);
    if (unlikely(PyObject_SetItem(__pyx_v_projparams, __pyx_n_s_lon_0, __pyx_t_7) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1516; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

    /* "pygrib.pyx":1517
 *         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_7 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_latitudeOfSubSatellitePointInDeg); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1517; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_7);
    if (unlikely(PyObject_SetItem(__pyx_v_projparams, __pyx_n_s_lat_0, __pyx_t_7) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1517; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

    /* "pygrib.pyx":1518
 *             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_7 = PyObject_GetItem(__pyx_v_projparams, __pyx_n_s_lat_0); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1518; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_9 = __Pyx_PyFloat_EqObjC(__pyx_t_7, __pyx_float_0_, 0., 0); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1518; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1518; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    if (__pyx_t_5) {

      /* "pygrib.pyx":1519
 *             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(PyObject_SetItem(__pyx_v_projparams, __pyx_n_s_proj, __pyx_n_s_geos) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1519; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

      /* "pygrib.pyx":1518
 *             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":1522
 *             # 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(PyObject_SetItem(__pyx_v_projparams, __pyx_n_s_proj, __pyx_n_s_nsper) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1522; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_L34:;

    /* "pygrib.pyx":1523
 *             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 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_grib2divider); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1523; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_10 = __Pyx_PyObject_AsDouble(__pyx_t_9); if (unlikely(__pyx_t_10 == ((double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1523; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_9 = PyFloat_FromDouble(__pyx_t_10); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1523; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_v_scale = __pyx_t_9;
    __pyx_t_9 = 0;

    /* "pygrib.pyx":1524
 *                 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_9 = PyObject_GetItem(__pyx_v_projparams, __pyx_n_s_a); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1524; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_7 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_Nr); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1524; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_1 = PyNumber_Multiply(__pyx_t_9, __pyx_t_7); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1524; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = __Pyx_PyNumber_Divide(__pyx_t_1, __pyx_v_scale); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1524; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(PyObject_SetItem(__pyx_v_projparams, __pyx_n_s_h, __pyx_t_7) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1524; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

    /* "pygrib.pyx":1526
 *             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_7 = PyObject_GetItem(__pyx_v_projparams, __pyx_n_s_h); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1526; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_1 = PyObject_GetItem(__pyx_v_projparams, __pyx_n_s_a); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1526; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_9 = PyNumber_Subtract(__pyx_t_7, __pyx_t_1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1526; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(PyObject_SetItem(__pyx_v_projparams, __pyx_n_s_h, __pyx_t_9) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1526; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

    /* "pygrib.pyx":1515
 *             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":1527
 *             # 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_9 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_gridType); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1527; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_5 = (__Pyx_PyString_Equals(__pyx_t_9, __pyx_n_s_equatorial_azimuthal_equidistant, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1527; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  if (__pyx_t_5) {

    /* "pygrib.pyx":1528
 *             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_9 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_standardParallel); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1528; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_1 = __Pyx_PyFloat_DivideObjC(__pyx_t_9, __pyx_float_1_e6, 1.e6, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1528; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    if (unlikely(PyObject_SetItem(__pyx_v_projparams, __pyx_n_s_lat_0, __pyx_t_1) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1528; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "pygrib.pyx":1529
 *         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_1 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_centralLongitude); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1529; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_9 = __Pyx_PyFloat_DivideObjC(__pyx_t_1, __pyx_float_1_e6, 1.e6, 0); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1529; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(PyObject_SetItem(__pyx_v_projparams, __pyx_n_s_lon_0, __pyx_t_9) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1529; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

    /* "pygrib.pyx":1530
 *             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(PyObject_SetItem(__pyx_v_projparams, __pyx_n_s_proj, __pyx_n_s_aeqd) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "pygrib.pyx":1527
 *             # 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":1531
 *             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_9 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_gridType); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1531; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_5 = (__Pyx_PyString_Equals(__pyx_t_9, __pyx_n_s_lambert_azimuthal_equal_area, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1531; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  if (__pyx_t_5) {

    /* "pygrib.pyx":1532
 *             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_9 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_standardParallel); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1532; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_1 = __Pyx_PyFloat_DivideObjC(__pyx_t_9, __pyx_float_1_e6, 1.e6, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1532; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    if (unlikely(PyObject_SetItem(__pyx_v_projparams, __pyx_n_s_lat_0, __pyx_t_1) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1532; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "pygrib.pyx":1533
 *         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_1 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_centralLongitude); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1533; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_9 = __Pyx_PyFloat_DivideObjC(__pyx_t_1, __pyx_float_1_e6, 1.e6, 0); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1533; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(PyObject_SetItem(__pyx_v_projparams, __pyx_n_s_lon_0, __pyx_t_9) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1533; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

    /* "pygrib.pyx":1534
 *             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(PyObject_SetItem(__pyx_v_projparams, __pyx_n_s_proj, __pyx_n_s_laea) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1534; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "pygrib.pyx":1531
 *             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":1535
 *             projparams['lon_0'] = self['centralLongitude']/1.e6
 *             projparams['proj'] = 'laea'
 *         elif self['gridType'] == 'mercator':             # <<<<<<<<<<<<<<
 *             scale = self._get_key('grib2divider',False)
 *             if scale:
 */
  __pyx_t_9 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_gridType); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1535; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_5 = (__Pyx_PyString_Equals(__pyx_t_9, __pyx_n_s_mercator, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1535; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  if (__pyx_t_5) {

    /* "pygrib.pyx":1536
 *             projparams['proj'] = 'laea'
 *         elif self['gridType'] == 'mercator':
 *             scale = self._get_key('grib2divider',False)             # <<<<<<<<<<<<<<
 *             if scale:
 *                 scale = float(scale)
 */
    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_get_key); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1536; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1536; __pyx_clineno = __LINE__; goto __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":1537
 *         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_filename = __pyx_f[0]; __pyx_lineno = 1537; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (__pyx_t_5) {

      /* "pygrib.pyx":1538
 *             scale = self._get_key('grib2divider',False)
 *             if scale:
 *                 scale = float(scale)             # <<<<<<<<<<<<<<
 *             else:
 *                 scale = 1000.
 */
      __pyx_t_10 = __Pyx_PyObject_AsDouble(__pyx_v_scale); if (unlikely(__pyx_t_10 == ((double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1538; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_1 = PyFloat_FromDouble(__pyx_t_10); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1538; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF_SET(__pyx_v_scale, __pyx_t_1);
      __pyx_t_1 = 0;

      /* "pygrib.pyx":1537
 *         elif self['gridType'] == 'mercator':
 *             scale = self._get_key('grib2divider',False)
 *             if scale:             # <<<<<<<<<<<<<<
 *                 scale = float(scale)
 *             else:
 */
      goto __pyx_L35;
    }

    /* "pygrib.pyx":1540
 *                 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":1541
 *             else:
 *                 scale = 1000.
 *             lon1 = self['longitudeOfFirstGridPoint']/scale             # <<<<<<<<<<<<<<
 *             lon2 = self['longitudeOfLastGridPoint']/scale
 *             if self._get_key('truncateDegrees',False):
 */
    __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_longitudeOfFirstGridPoint); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1541; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1541; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_v_lon1 = __pyx_t_9;
    __pyx_t_9 = 0;

    /* "pygrib.pyx":1542
 *                 scale = 1000.
 *             lon1 = self['longitudeOfFirstGridPoint']/scale
 *             lon2 = self['longitudeOfLastGridPoint']/scale             # <<<<<<<<<<<<<<
 *             if self._get_key('truncateDegrees',False):
 *                 lon1 = int(lon1)
 */
    __pyx_t_9 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_longitudeOfLastGridPoint); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1542; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_1 = __Pyx_PyNumber_Divide(__pyx_t_9, __pyx_v_scale); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1542; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_v_lon2 = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "pygrib.pyx":1543
 *             lon1 = self['longitudeOfFirstGridPoint']/scale
 *             lon2 = self['longitudeOfLastGridPoint']/scale
 *             if self._get_key('truncateDegrees',False):             # <<<<<<<<<<<<<<
 *                 lon1 = int(lon1)
 *                 lon2 = int(lon2)
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_get_key); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1543; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1543; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1543; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    if (__pyx_t_5) {

      /* "pygrib.pyx":1544
 *             lon2 = self['longitudeOfLastGridPoint']/scale
 *             if self._get_key('truncateDegrees',False):
 *                 lon1 = int(lon1)             # <<<<<<<<<<<<<<
 *                 lon2 = int(lon2)
 *             if self._get_key('LaD',False):
 */
      __pyx_t_9 = PyNumber_Int(__pyx_v_lon1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1544; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF_SET(__pyx_v_lon1, __pyx_t_9);
      __pyx_t_9 = 0;

      /* "pygrib.pyx":1545
 *             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_9 = PyNumber_Int(__pyx_v_lon2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1545; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF_SET(__pyx_v_lon2, __pyx_t_9);
      __pyx_t_9 = 0;

      /* "pygrib.pyx":1543
 *             lon1 = self['longitudeOfFirstGridPoint']/scale
 *             lon2 = self['longitudeOfLastGridPoint']/scale
 *             if self._get_key('truncateDegrees',False):             # <<<<<<<<<<<<<<
 *                 lon1 = int(lon1)
 *                 lon2 = int(lon2)
 */
    }

    /* "pygrib.pyx":1546
 *                 lon1 = int(lon1)
 *                 lon2 = int(lon2)
 *             if self._get_key('LaD',False):             # <<<<<<<<<<<<<<
 *                 projparams['lat_ts'] = self['LaD']/scale
 *             else:
 */
    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_get_key); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1546; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_tuple__92, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1546; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1546; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (__pyx_t_5) {

      /* "pygrib.pyx":1547
 *                 lon2 = int(lon2)
 *             if self._get_key('LaD',False):
 *                 projparams['lat_ts'] = self['LaD']/scale             # <<<<<<<<<<<<<<
 *             else:
 *                 projparams['lat_ts'] = self['Latin']/scale
 */
      __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_LaD); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1547; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1547; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (unlikely(PyObject_SetItem(__pyx_v_projparams, __pyx_n_s_lat_ts, __pyx_t_9) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1547; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

      /* "pygrib.pyx":1546
 *                 lon1 = int(lon1)
 *                 lon2 = int(lon2)
 *             if self._get_key('LaD',False):             # <<<<<<<<<<<<<<
 *                 projparams['lat_ts'] = self['LaD']/scale
 *             else:
 */
      goto __pyx_L37;
    }

    /* "pygrib.pyx":1549
 *                 projparams['lat_ts'] = self['LaD']/scale
 *             else:
 *                 projparams['lat_ts'] = self['Latin']/scale             # <<<<<<<<<<<<<<
 *             projparams['lon_0']=0.5*(lon1+lon2)
 *             projparams['proj']='merc'
 */
    /*else*/ {
      __pyx_t_9 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_Latin); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1549; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_1 = __Pyx_PyNumber_Divide(__pyx_t_9, __pyx_v_scale); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1549; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      if (unlikely(PyObject_SetItem(__pyx_v_projparams, __pyx_n_s_lat_ts, __pyx_t_1) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1549; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    }
    __pyx_L37:;

    /* "pygrib.pyx":1550
 *             else:
 *                 projparams['lat_ts'] = self['Latin']/scale
 *             projparams['lon_0']=0.5*(lon1+lon2)             # <<<<<<<<<<<<<<
 *             projparams['proj']='merc'
 *         elif self['gridType'] in ['rotated_ll','rotated_gg']:
 */
    __pyx_t_1 = PyNumber_Add(__pyx_v_lon1, __pyx_v_lon2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1550; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_9 = PyNumber_Multiply(__pyx_float_0_5, __pyx_t_1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1550; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(PyObject_SetItem(__pyx_v_projparams, __pyx_n_s_lon_0, __pyx_t_9) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1550; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

    /* "pygrib.pyx":1551
 *                 projparams['lat_ts'] = self['Latin']/scale
 *             projparams['lon_0']=0.5*(lon1+lon2)
 *             projparams['proj']='merc'             # <<<<<<<<<<<<<<
 *         elif self['gridType'] in ['rotated_ll','rotated_gg']:
 *             rot_angle = self['angleOfRotationInDegrees']
 */
    if (unlikely(PyObject_SetItem(__pyx_v_projparams, __pyx_n_s_proj, __pyx_n_s_merc) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1551; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "pygrib.pyx":1535
 *             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":1552
 *             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_9 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_gridType); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1552; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_4 = (__Pyx_PyString_Equals(__pyx_t_9, __pyx_n_s_rotated_ll, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1552; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (!__pyx_t_4) {
  } else {
    __pyx_t_5 = __pyx_t_4;
    goto __pyx_L38_bool_binop_done;
  }
  __pyx_t_4 = (__Pyx_PyString_Equals(__pyx_t_9, __pyx_n_s_rotated_gg, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1552; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_5 = __pyx_t_4;
  __pyx_L38_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":1553
 *             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_9 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_angleOfRotationInDegrees); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1553; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_v_rot_angle = __pyx_t_9;
    __pyx_t_9 = 0;

    /* "pygrib.pyx":1554
 *         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_9 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_latitudeOfSouthernPoleInDegrees); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1554; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_v_pole_lat = __pyx_t_9;
    __pyx_t_9 = 0;

    /* "pygrib.pyx":1555
 *             rot_angle = self['angleOfRotationInDegrees']
 *             pole_lat = self['latitudeOfSouthernPoleInDegrees']
 *             pole_lon = self['longitudeOfSouthernPoleInDegrees']             # <<<<<<<<<<<<<<
 *             projparams['o_proj']='longlat'
 *             projparams['proj']='ob_tran'
 */
    __pyx_t_9 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_longitudeOfSouthernPoleInDegrees); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1555; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_v_pole_lon = __pyx_t_9;
    __pyx_t_9 = 0;

    /* "pygrib.pyx":1556
 *             pole_lat = self['latitudeOfSouthernPoleInDegrees']
 *             pole_lon = self['longitudeOfSouthernPoleInDegrees']
 *             projparams['o_proj']='longlat'             # <<<<<<<<<<<<<<
 *             projparams['proj']='ob_tran'
 *             projparams['o_lat_p']=-pole_lat
 */
    if (unlikely(PyObject_SetItem(__pyx_v_projparams, __pyx_n_s_o_proj, __pyx_n_s_longlat) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1556; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "pygrib.pyx":1557
 *             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(PyObject_SetItem(__pyx_v_projparams, __pyx_n_s_proj, __pyx_n_s_ob_tran) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1557; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "pygrib.pyx":1558
 *             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_9 = PyNumber_Negative(__pyx_v_pole_lat); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1558; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    if (unlikely(PyObject_SetItem(__pyx_v_projparams, __pyx_n_s_o_lat_p, __pyx_t_9) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1558; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

    /* "pygrib.pyx":1559
 *             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(PyObject_SetItem(__pyx_v_projparams, __pyx_n_s_o_lon_p, __pyx_v_rot_angle) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1559; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "pygrib.pyx":1560
 *             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(PyObject_SetItem(__pyx_v_projparams, __pyx_n_s_lon_0, __pyx_v_pole_lon) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1560; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "pygrib.pyx":1552
 *             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":1562
 *             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, Py_None);
  }
  __pyx_L22:;

  /* "pygrib.pyx":1563
 *         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":1409
 *         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":1565
 *         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;
  Py_ssize_t __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;
  double __pyx_t_12;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  PyObject *__pyx_t_15 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("latlons", 0);

  /* "pygrib.pyx":1579
 *         """
 * 
 *         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 (__pyx_t_2) {

    /* "pygrib.pyx":1580
 * 
 *         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 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_gridType); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1580; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1580; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1580; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
    __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1580; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1580; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "pygrib.pyx":1579
 *         """
 * 
 *         if self.projparams is None:             # <<<<<<<<<<<<<<
 *             raise ValueError('unsupported grid %s' % self['gridType'])
 * 
 */
  }

  /* "pygrib.pyx":1582
 *             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_4 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_gridType); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1582; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_t_4, __pyx_n_s_regular_gg, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1582; __pyx_clineno = __LINE__; goto __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_4, __pyx_n_s_regular_ll, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1582; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_2 = __pyx_t_1;
  __pyx_L5_bool_binop_done:;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "pygrib.pyx":1583
 * 
 *         if self['gridType'] in ['regular_gg','regular_ll']: # regular lat/lon grid
 *             nx = self['Ni']             # <<<<<<<<<<<<<<
 *             ny = self['Nj']
 *             lon1 = self['longitudeOfFirstGridPointInDegrees']
 */
    __pyx_t_4 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_Ni); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1583; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_v_nx = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "pygrib.pyx":1584
 *         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_4 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_Nj); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1584; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_v_ny = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "pygrib.pyx":1585
 *             nx = self['Ni']
 *             ny = self['Nj']
 *             lon1 = self['longitudeOfFirstGridPointInDegrees']             # <<<<<<<<<<<<<<
 *             lon2 = self['longitudeOfLastGridPointInDegrees']
 *             if lon1 >= 0 and lon2 < 0 and self.iDirectionIncrement > 0:
 */
    __pyx_t_4 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_longitudeOfFirstGridPointInDegre); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1585; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_v_lon1 = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "pygrib.pyx":1586
 *             ny = self['Nj']
 *             lon1 = self['longitudeOfFirstGridPointInDegrees']
 *             lon2 = self['longitudeOfLastGridPointInDegrees']             # <<<<<<<<<<<<<<
 *             if lon1 >= 0 and lon2 < 0 and self.iDirectionIncrement > 0:
 *                 lon2 = 360+lon2
 */
    __pyx_t_4 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_longitudeOfLastGridPointInDegree); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1586; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_v_lon2 = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "pygrib.pyx":1587
 *             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_4 = PyObject_RichCompare(__pyx_v_lon1, __pyx_int_0, Py_GE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1587; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1587; __pyx_clineno = __LINE__; goto __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_L8_bool_binop_done;
    }
    __pyx_t_4 = PyObject_RichCompare(__pyx_v_lon2, __pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1587; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1587; __pyx_clineno = __LINE__; goto __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_L8_bool_binop_done;
    }
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_iDirectionIncrement); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1587; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1587; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1587; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_1 = __pyx_t_2;
    __pyx_L8_bool_binop_done:;
    if (__pyx_t_1) {

      /* "pygrib.pyx":1588
 *             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_3 = __Pyx_PyInt_AddCObj(__pyx_int_360, __pyx_v_lon2, 0x168, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1588; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF_SET(__pyx_v_lon2, __pyx_t_3);
      __pyx_t_3 = 0;

      /* "pygrib.pyx":1587
 *             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":1589
 *             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_3 = PyObject_RichCompare(__pyx_v_lon1, __pyx_int_0, Py_GE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1589; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1589; __pyx_clineno = __LINE__; goto __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_L12_bool_binop_done;
    }
    __pyx_t_3 = PyObject_RichCompare(__pyx_v_lon2, __pyx_v_lon1, Py_LT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1589; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1589; __pyx_clineno = __LINE__; goto __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_L12_bool_binop_done;
    }
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_iDirectionIncrement); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1589; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1589; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1589; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_1 = __pyx_t_2;
    __pyx_L12_bool_binop_done:;
    if (__pyx_t_1) {

      /* "pygrib.pyx":1590
 *                 lon2 = 360+lon2
 *             if lon1 >= 0 and lon2 < lon1 and self.iDirectionIncrement > 0:
 *                 lon1 = lon1-360             # <<<<<<<<<<<<<<
 *             lat1 = self['latitudeOfFirstGridPointInDegrees']
 *             lat2 = self['latitudeOfLastGridPointInDegrees']
 */
      __pyx_t_4 = __Pyx_PyInt_SubtractObjC(__pyx_v_lon1, __pyx_int_360, 0x168, 0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1590; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF_SET(__pyx_v_lon1, __pyx_t_4);
      __pyx_t_4 = 0;

      /* "pygrib.pyx":1589
 *             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":1591
 *             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_4 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_latitudeOfFirstGridPointInDegree); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1591; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_v_lat1 = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "pygrib.pyx":1592
 *                 lon1 = lon1-360
 *             lat1 = self['latitudeOfFirstGridPointInDegrees']
 *             lat2 = self['latitudeOfLastGridPointInDegrees']             # <<<<<<<<<<<<<<
 *             # workaround for grib_api bug with complex packing.
 *             # (distinctLongitudes, distinctLatitudes throws error,
 */
    __pyx_t_4 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_latitudeOfLastGridPointInDegrees); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1592; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_v_lat2 = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "pygrib.pyx":1596
 *             # (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_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_packingType); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1596; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_startswith); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1596; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__93, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1596; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1596; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (__pyx_t_1) {

      /* "pygrib.pyx":1599
 *                 # 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_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1599; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_linspace); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1599; __pyx_clineno = __LINE__; goto __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_COMPILING_IN_CPYTHON && 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;
        }
      }
      __pyx_t_7 = PyTuple_New(3+__pyx_t_6); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1599; __pyx_clineno = __LINE__; goto __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_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_7, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1599; __pyx_clineno = __LINE__; goto __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_lats = __pyx_t_4;
      __pyx_t_4 = 0;

      /* "pygrib.pyx":1600
 *                 # 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_filename = __pyx_f[0]; __pyx_lineno = 1600; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1600; __pyx_clineno = __LINE__; goto __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_COMPILING_IN_CPYTHON && 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;
        }
      }
      __pyx_t_3 = PyTuple_New(3+__pyx_t_6); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1600; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      if (__pyx_t_5) {
        __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5); __pyx_t_5 = 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_4 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1600; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_v_lons = __pyx_t_4;
      __pyx_t_4 = 0;

      /* "pygrib.pyx":1596
 *             # (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":1602
 *                 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_4 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_distinctLatitudes); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1602; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_v_lats = __pyx_t_4;
      __pyx_t_4 = 0;

      /* "pygrib.pyx":1603
 *             else:
 *                 lats = self['distinctLatitudes']
 *                 if lat2 < lat1 and lats[-1] > lats[0]: lats = lats[::-1]             # <<<<<<<<<<<<<<
 *                 lons = self['distinctLongitudes']
 *             # don't trust distinctLongitudes
 */
      __pyx_t_4 = PyObject_RichCompare(__pyx_v_lat2, __pyx_v_lat1, Py_LT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1603; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1603; __pyx_clineno = __LINE__; goto __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_L17_bool_binop_done;
      }
      __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_lats, -1, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1603; __pyx_clineno = __LINE__; goto __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 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1603; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_3 = PyObject_RichCompare(__pyx_t_4, __pyx_t_7, Py_GT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1603; __pyx_clineno = __LINE__; goto __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_3); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1603; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_1 = __pyx_t_2;
      __pyx_L17_bool_binop_done:;
      if (__pyx_t_1) {
        __pyx_t_3 = PyObject_GetItem(__pyx_v_lats, __pyx_slice__94); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1603; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF_SET(__pyx_v_lats, __pyx_t_3);
        __pyx_t_3 = 0;
      }

      /* "pygrib.pyx":1604
 *                 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_3 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_distinctLongitudes); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1604; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_v_lons = __pyx_t_3;
      __pyx_t_3 = 0;
    }
    __pyx_L15:;

    /* "pygrib.pyx":1608
 *             # 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_3 = PyObject_RichCompare(__pyx_v_lon2, __pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1608; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1608; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (__pyx_t_1) {

      /* "pygrib.pyx":1609
 *             # (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_filename = __pyx_f[0]; __pyx_lineno = 1609; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1609; __pyx_clineno = __LINE__; goto __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_COMPILING_IN_CPYTHON && 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;
        }
      }
      __pyx_t_5 = PyTuple_New(3+__pyx_t_6); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1609; __pyx_clineno = __LINE__; goto __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_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1609; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF_SET(__pyx_v_lons, __pyx_t_3);
      __pyx_t_3 = 0;

      /* "pygrib.pyx":1608
 *             # 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":1610
 *             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_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1610; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_meshgrid); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1610; __pyx_clineno = __LINE__; goto __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_COMPILING_IN_CPYTHON && 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;
      }
    }
    __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1610; __pyx_clineno = __LINE__; goto __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_3 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_7, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1610; __pyx_clineno = __LINE__; goto __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;
      #if CYTHON_COMPILING_IN_CPYTHON
      Py_ssize_t size = Py_SIZE(sequence);
      #else
      Py_ssize_t size = PySequence_Size(sequence);
      #endif
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1610; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      #if CYTHON_COMPILING_IN_CPYTHON
      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_filename = __pyx_f[0]; __pyx_lineno = 1610; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_7 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1610; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1610; __pyx_clineno = __LINE__; goto __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_L20_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_L20_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_7);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_4), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1610; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_8 = NULL;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      goto __pyx_L21_unpacking_done;
      __pyx_L20_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_8 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1610; __pyx_clineno = __LINE__; goto __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":1582
 *             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":1611
 *                 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_3 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_gridType); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1611; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_t_3, __pyx_n_s_reduced_gg, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1611; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__pyx_t_1) {

    /* "pygrib.pyx":1612
 *             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_filename = __pyx_f[0]; __pyx_lineno = 1612; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (__pyx_t_1) {

      /* "pygrib.pyx":1613
 *         elif self['gridType'] == 'reduced_gg': # reduced global gaussian grid
 *             if self.expand_reduced:
 *                 lat1 = self['latitudeOfFirstGridPointInDegrees']             # <<<<<<<<<<<<<<
 *                 lat2 = self['latitudeOfLastGridPointInDegrees']
 *                 lats = self['distinctLatitudes']
 */
      __pyx_t_3 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_latitudeOfFirstGridPointInDegree); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1613; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_v_lat1 = __pyx_t_3;
      __pyx_t_3 = 0;

      /* "pygrib.pyx":1614
 *             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_3 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_latitudeOfLastGridPointInDegrees); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1614; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_v_lat2 = __pyx_t_3;
      __pyx_t_3 = 0;

      /* "pygrib.pyx":1615
 *                 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_3 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_distinctLatitudes); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1615; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_v_lats = __pyx_t_3;
      __pyx_t_3 = 0;

      /* "pygrib.pyx":1616
 *                 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_3 = PyObject_RichCompare(__pyx_v_lat2, __pyx_v_lat1, Py_LT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1616; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1616; __pyx_clineno = __LINE__; goto __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_L24_bool_binop_done;
      }
      __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_lats, -1, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1616; __pyx_clineno = __LINE__; goto __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 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1616; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_5 = PyObject_RichCompare(__pyx_t_3, __pyx_t_7, Py_GT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1616; __pyx_clineno = __LINE__; goto __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_5); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1616; __pyx_clineno = __LINE__; goto __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 = PyObject_GetItem(__pyx_v_lats, __pyx_slice__95); if (unlikely(__pyx_t_5 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1616; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF_SET(__pyx_v_lats, __pyx_t_5);
        __pyx_t_5 = 0;
      }

      /* "pygrib.pyx":1617
 *                 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 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_Nj); if (unlikely(__pyx_t_5 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1617; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_v_ny = __pyx_t_5;
      __pyx_t_5 = 0;

      /* "pygrib.pyx":1618
 *                 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_filename = __pyx_f[0]; __pyx_lineno = 1618; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_v_nx = __pyx_t_5;
      __pyx_t_5 = 0;

      /* "pygrib.pyx":1619
 *                 ny = self['Nj']
 *                 nx = 2*ny
 *                 lon1 = self['longitudeOfFirstGridPointInDegrees']             # <<<<<<<<<<<<<<
 *                 lon2 = self['longitudeOfLastGridPointInDegrees']
 *                 lons = np.linspace(lon1,lon2,nx)
 */
      __pyx_t_5 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_longitudeOfFirstGridPointInDegre); if (unlikely(__pyx_t_5 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1619; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_v_lon1 = __pyx_t_5;
      __pyx_t_5 = 0;

      /* "pygrib.pyx":1620
 *                 nx = 2*ny
 *                 lon1 = self['longitudeOfFirstGridPointInDegrees']
 *                 lon2 = self['longitudeOfLastGridPointInDegrees']             # <<<<<<<<<<<<<<
 *                 lons = np.linspace(lon1,lon2,nx)
 *                 lons,lats = np.meshgrid(lons,lats)
 */
      __pyx_t_5 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_longitudeOfLastGridPointInDegree); if (unlikely(__pyx_t_5 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1620; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_v_lon2 = __pyx_t_5;
      __pyx_t_5 = 0;

      /* "pygrib.pyx":1621
 *                 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_filename = __pyx_f[0]; __pyx_lineno = 1621; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1621; __pyx_clineno = __LINE__; goto __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_COMPILING_IN_CPYTHON && 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;
        }
      }
      __pyx_t_4 = PyTuple_New(3+__pyx_t_6); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1621; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1621; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_v_lons = __pyx_t_5;
      __pyx_t_5 = 0;

      /* "pygrib.pyx":1622
 *                 lon2 = self['longitudeOfLastGridPointInDegrees']
 *                 lons = np.linspace(lon1,lon2,nx)
 *                 lons,lats = np.meshgrid(lons,lats)             # <<<<<<<<<<<<<<
 *             else:
 *                 lats = self['latitudes']
 */
      __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1622; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_meshgrid); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1622; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = NULL;
      __pyx_t_6 = 0;
      if (CYTHON_COMPILING_IN_CPYTHON && 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;
        }
      }
      __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1622; __pyx_clineno = __LINE__; goto __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_5 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_7, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1622; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_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;
        #if CYTHON_COMPILING_IN_CPYTHON
        Py_ssize_t size = Py_SIZE(sequence);
        #else
        Py_ssize_t size = PySequence_Size(sequence);
        #endif
        if (unlikely(size != 2)) {
          if (size > 2) __Pyx_RaiseTooManyValuesError(2);
          else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1622; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        #if CYTHON_COMPILING_IN_CPYTHON
        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_filename = __pyx_f[0]; __pyx_lineno = 1622; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_7 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1622; __pyx_clineno = __LINE__; goto __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_3 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1622; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_t_8 = Py_TYPE(__pyx_t_3)->tp_iternext;
        index = 0; __pyx_t_4 = __pyx_t_8(__pyx_t_3); if (unlikely(!__pyx_t_4)) goto __pyx_L26_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_4);
        index = 1; __pyx_t_7 = __pyx_t_8(__pyx_t_3); if (unlikely(!__pyx_t_7)) goto __pyx_L26_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_7);
        if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_3), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1622; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __pyx_t_8 = NULL;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        goto __pyx_L27_unpacking_done;
        __pyx_L26_unpacking_failed:;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_t_8 = NULL;
        if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1622; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __pyx_L27_unpacking_done:;
      }
      __Pyx_DECREF_SET(__pyx_v_lons, __pyx_t_4);
      __pyx_t_4 = 0;
      __Pyx_DECREF_SET(__pyx_v_lats, __pyx_t_7);
      __pyx_t_7 = 0;

      /* "pygrib.pyx":1612
 *             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":1624
 *                 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 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_latitudes); if (unlikely(__pyx_t_5 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1624; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_v_lats = __pyx_t_5;
      __pyx_t_5 = 0;

      /* "pygrib.pyx":1625
 *             else:
 *                 lats = self['latitudes']
 *                 lons = self['longitudes']             # <<<<<<<<<<<<<<
 *         elif self['gridType'] == 'reduced_ll': # reduced lat/lon grid
 *             if self.expand_reduced:
 */
      __pyx_t_5 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_longitudes); if (unlikely(__pyx_t_5 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1625; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_v_lons = __pyx_t_5;
      __pyx_t_5 = 0;
    }
    __pyx_L22:;

    /* "pygrib.pyx":1611
 *                 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":1626
 *                 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 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_gridType); if (unlikely(__pyx_t_5 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1626; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1626; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (__pyx_t_1) {

    /* "pygrib.pyx":1627
 *                 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_filename = __pyx_f[0]; __pyx_lineno = 1627; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (__pyx_t_1) {

      /* "pygrib.pyx":1628
 *         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 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_Nj); if (unlikely(__pyx_t_5 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1628; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_v_ny = __pyx_t_5;
      __pyx_t_5 = 0;

      /* "pygrib.pyx":1629
 *             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_filename = __pyx_f[0]; __pyx_lineno = 1629; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_v_nx = __pyx_t_5;
      __pyx_t_5 = 0;

      /* "pygrib.pyx":1630
 *                 ny = self['Nj']
 *                 nx = 2*ny
 *                 lat1 = self['latitudeOfFirstGridPointInDegrees']             # <<<<<<<<<<<<<<
 *                 lat2 = self['latitudeOfLastGridPointInDegrees']
 *                 lon1 = self['longitudeOfFirstGridPointInDegrees']
 */
      __pyx_t_5 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_latitudeOfFirstGridPointInDegree); if (unlikely(__pyx_t_5 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1630; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_v_lat1 = __pyx_t_5;
      __pyx_t_5 = 0;

      /* "pygrib.pyx":1631
 *                 nx = 2*ny
 *                 lat1 = self['latitudeOfFirstGridPointInDegrees']
 *                 lat2 = self['latitudeOfLastGridPointInDegrees']             # <<<<<<<<<<<<<<
 *                 lon1 = self['longitudeOfFirstGridPointInDegrees']
 *                 lon2 = self['longitudeOfLastGridPointInDegrees']
 */
      __pyx_t_5 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_latitudeOfLastGridPointInDegrees); if (unlikely(__pyx_t_5 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1631; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_v_lat2 = __pyx_t_5;
      __pyx_t_5 = 0;

      /* "pygrib.pyx":1632
 *                 lat1 = self['latitudeOfFirstGridPointInDegrees']
 *                 lat2 = self['latitudeOfLastGridPointInDegrees']
 *                 lon1 = self['longitudeOfFirstGridPointInDegrees']             # <<<<<<<<<<<<<<
 *                 lon2 = self['longitudeOfLastGridPointInDegrees']
 *                 lons = np.linspace(lon1,lon2,nx)
 */
      __pyx_t_5 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_longitudeOfFirstGridPointInDegre); if (unlikely(__pyx_t_5 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1632; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_v_lon1 = __pyx_t_5;
      __pyx_t_5 = 0;

      /* "pygrib.pyx":1633
 *                 lat2 = self['latitudeOfLastGridPointInDegrees']
 *                 lon1 = self['longitudeOfFirstGridPointInDegrees']
 *                 lon2 = self['longitudeOfLastGridPointInDegrees']             # <<<<<<<<<<<<<<
 *                 lons = np.linspace(lon1,lon2,nx)
 *                 lats = np.linspace(lat1,lat2,ny)
 */
      __pyx_t_5 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_longitudeOfLastGridPointInDegree); if (unlikely(__pyx_t_5 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1633; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_v_lon2 = __pyx_t_5;
      __pyx_t_5 = 0;

      /* "pygrib.pyx":1634
 *                 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_filename = __pyx_f[0]; __pyx_lineno = 1634; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1634; __pyx_clineno = __LINE__; goto __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_COMPILING_IN_CPYTHON && 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;
        }
      }
      __pyx_t_3 = PyTuple_New(3+__pyx_t_6); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1634; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1634; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_v_lons = __pyx_t_5;
      __pyx_t_5 = 0;

      /* "pygrib.pyx":1635
 *                 lon2 = self['longitudeOfLastGridPointInDegrees']
 *                 lons = np.linspace(lon1,lon2,nx)
 *                 lats = np.linspace(lat1,lat2,ny)             # <<<<<<<<<<<<<<
 *                 lons,lats = np.meshgrid(lons,lats)
 *             else:
 */
      __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1635; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_linspace); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1635; __pyx_clineno = __LINE__; goto __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_COMPILING_IN_CPYTHON && 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;
        }
      }
      __pyx_t_7 = PyTuple_New(3+__pyx_t_6); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1635; __pyx_clineno = __LINE__; goto __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_5 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_7, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1635; __pyx_clineno = __LINE__; goto __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;
      __pyx_v_lats = __pyx_t_5;
      __pyx_t_5 = 0;

      /* "pygrib.pyx":1636
 *                 lons = np.linspace(lon1,lon2,nx)
 *                 lats = np.linspace(lat1,lat2,ny)
 *                 lons,lats = np.meshgrid(lons,lats)             # <<<<<<<<<<<<<<
 *             else:
 *                 lats = self['latitudes']
 */
      __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1636; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_meshgrid); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1636; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = NULL;
      __pyx_t_6 = 0;
      if (CYTHON_COMPILING_IN_CPYTHON && 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);
          __pyx_t_6 = 1;
        }
      }
      __pyx_t_4 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1636; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      if (__pyx_t_3) {
        __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __pyx_t_3 = NULL;
      }
      __Pyx_INCREF(__pyx_v_lons);
      __Pyx_GIVEREF(__pyx_v_lons);
      PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_6, __pyx_v_lons);
      __Pyx_INCREF(__pyx_v_lats);
      __Pyx_GIVEREF(__pyx_v_lats);
      PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_6, __pyx_v_lats);
      __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1636; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      if ((likely(PyTuple_CheckExact(__pyx_t_5))) || (PyList_CheckExact(__pyx_t_5))) {
        PyObject* sequence = __pyx_t_5;
        #if CYTHON_COMPILING_IN_CPYTHON
        Py_ssize_t size = Py_SIZE(sequence);
        #else
        Py_ssize_t size = PySequence_Size(sequence);
        #endif
        if (unlikely(size != 2)) {
          if (size > 2) __Pyx_RaiseTooManyValuesError(2);
          else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1636; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        #if CYTHON_COMPILING_IN_CPYTHON
        if (likely(PyTuple_CheckExact(sequence))) {
          __pyx_t_7 = PyTuple_GET_ITEM(sequence, 0); 
          __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); 
        } else {
          __pyx_t_7 = PyList_GET_ITEM(sequence, 0); 
          __pyx_t_4 = PyList_GET_ITEM(sequence, 1); 
        }
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_4);
        #else
        __pyx_t_7 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1636; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1636; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_4);
        #endif
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      } else {
        Py_ssize_t index = -1;
        __pyx_t_3 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1636; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_t_8 = Py_TYPE(__pyx_t_3)->tp_iternext;
        index = 0; __pyx_t_7 = __pyx_t_8(__pyx_t_3); if (unlikely(!__pyx_t_7)) goto __pyx_L29_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_7);
        index = 1; __pyx_t_4 = __pyx_t_8(__pyx_t_3); if (unlikely(!__pyx_t_4)) goto __pyx_L29_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_4);
        if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_3), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1636; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __pyx_t_8 = NULL;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        goto __pyx_L30_unpacking_done;
        __pyx_L29_unpacking_failed:;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_t_8 = NULL;
        if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1636; __pyx_clineno = __LINE__; goto __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_4);
      __pyx_t_4 = 0;

      /* "pygrib.pyx":1627
 *                 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":1638
 *                 lons,lats = np.meshgrid(lons,lats)
 *             else:
 *                 lats = self['latitudes']             # <<<<<<<<<<<<<<
 *                 lons = self['longitudes']
 *         elif self['gridType'] == 'polar_stereographic':
 */
    /*else*/ {
      __pyx_t_5 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_latitudes); if (unlikely(__pyx_t_5 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1638; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_v_lats = __pyx_t_5;
      __pyx_t_5 = 0;

      /* "pygrib.pyx":1639
 *             else:
 *                 lats = self['latitudes']
 *                 lons = self['longitudes']             # <<<<<<<<<<<<<<
 *         elif self['gridType'] == 'polar_stereographic':
 *             lat1 = self['latitudeOfFirstGridPointInDegrees']
 */
      __pyx_t_5 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_longitudes); if (unlikely(__pyx_t_5 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1639; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_v_lons = __pyx_t_5;
      __pyx_t_5 = 0;
    }
    __pyx_L28:;

    /* "pygrib.pyx":1626
 *                 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":1640
 *                 lats = self['latitudes']
 *                 lons = self['longitudes']
 *         elif self['gridType'] == 'polar_stereographic':             # <<<<<<<<<<<<<<
 *             lat1 = self['latitudeOfFirstGridPointInDegrees']
 *             lon1 = self['longitudeOfFirstGridPointInDegrees']
 */
  __pyx_t_5 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_gridType); if (unlikely(__pyx_t_5 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1640; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1640; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (__pyx_t_1) {

    /* "pygrib.pyx":1641
 *                 lons = self['longitudes']
 *         elif self['gridType'] == 'polar_stereographic':
 *             lat1 = self['latitudeOfFirstGridPointInDegrees']             # <<<<<<<<<<<<<<
 *             lon1 = self['longitudeOfFirstGridPointInDegrees']
 *             try:
 */
    __pyx_t_5 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_latitudeOfFirstGridPointInDegree); if (unlikely(__pyx_t_5 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1641; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_v_lat1 = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "pygrib.pyx":1642
 *         elif self['gridType'] == 'polar_stereographic':
 *             lat1 = self['latitudeOfFirstGridPointInDegrees']
 *             lon1 = self['longitudeOfFirstGridPointInDegrees']             # <<<<<<<<<<<<<<
 *             try:
 *                 nx = self['Nx']
 */
    __pyx_t_5 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_longitudeOfFirstGridPointInDegre); if (unlikely(__pyx_t_5 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1642; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_v_lon1 = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "pygrib.pyx":1643
 *             lat1 = self['latitudeOfFirstGridPointInDegrees']
 *             lon1 = self['longitudeOfFirstGridPointInDegrees']
 *             try:             # <<<<<<<<<<<<<<
 *                 nx = self['Nx']
 *                 ny = self['Ny']
 */
    {
      __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":1644
 *             lon1 = self['longitudeOfFirstGridPointInDegrees']
 *             try:
 *                 nx = self['Nx']             # <<<<<<<<<<<<<<
 *                 ny = self['Ny']
 *             except:
 */
        __pyx_t_5 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_Nx); if (unlikely(__pyx_t_5 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1644; __pyx_clineno = __LINE__; goto __pyx_L31_error;};
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_v_nx = __pyx_t_5;
        __pyx_t_5 = 0;

        /* "pygrib.pyx":1645
 *             try:
 *                 nx = self['Nx']
 *                 ny = self['Ny']             # <<<<<<<<<<<<<<
 *             except:
 *                 nx = self['Ni']
 */
        __pyx_t_5 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_Ny); if (unlikely(__pyx_t_5 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1645; __pyx_clineno = __LINE__; goto __pyx_L31_error;};
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_v_ny = __pyx_t_5;
        __pyx_t_5 = 0;

        /* "pygrib.pyx":1643
 *             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_L38_try_end;
      __pyx_L31_error:;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;

      /* "pygrib.pyx":1646
 *                 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_4, &__pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1646; __pyx_clineno = __LINE__; goto __pyx_L33_except_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_GOTREF(__pyx_t_7);

        /* "pygrib.pyx":1647
 *                 ny = self['Ny']
 *             except:
 *                 nx = self['Ni']             # <<<<<<<<<<<<<<
 *                 ny = self['Nj']
 *             # key renamed from xDirectionGridLengthInMetres to
 */
        __pyx_t_3 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_Ni); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1647; __pyx_clineno = __LINE__; goto __pyx_L33_except_error;};
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_XDECREF_SET(__pyx_v_nx, __pyx_t_3);
        __pyx_t_3 = 0;

        /* "pygrib.pyx":1648
 *             except:
 *                 nx = self['Ni']
 *                 ny = self['Nj']             # <<<<<<<<<<<<<<
 *             # key renamed from xDirectionGridLengthInMetres to
 *             # DxInMetres grib_api 1.8.0.1.
 */
        __pyx_t_3 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_Nj); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1648; __pyx_clineno = __LINE__; goto __pyx_L33_except_error;};
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_XDECREF_SET(__pyx_v_ny, __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_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        goto __pyx_L32_exception_handled;
      }
      __pyx_L33_except_error:;

      /* "pygrib.pyx":1643
 *             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_L38_try_end:;
    }

    /* "pygrib.pyx":1651
 *             # key renamed from xDirectionGridLengthInMetres to
 *             # DxInMetres grib_api 1.8.0.1.
 *             try:             # <<<<<<<<<<<<<<
 *                 dx = self['DxInMetres']
 *             except:
 */
    {
      __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":1652
 *             # DxInMetres grib_api 1.8.0.1.
 *             try:
 *                 dx = self['DxInMetres']             # <<<<<<<<<<<<<<
 *             except:
 *                 dx = self['xDirectionGridLengthInMetres']
 */
        __pyx_t_7 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_DxInMetres); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1652; __pyx_clineno = __LINE__; goto __pyx_L41_error;};
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_v_dx = __pyx_t_7;
        __pyx_t_7 = 0;

        /* "pygrib.pyx":1651
 *             # 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_L48_try_end;
      __pyx_L41_error:;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 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;

      /* "pygrib.pyx":1653
 *             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_4, &__pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1653; __pyx_clineno = __LINE__; goto __pyx_L43_except_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_GOTREF(__pyx_t_5);

        /* "pygrib.pyx":1654
 *                 dx = self['DxInMetres']
 *             except:
 *                 dx = self['xDirectionGridLengthInMetres']             # <<<<<<<<<<<<<<
 *             try:
 *                 dy = self['DyInMetres']
 */
        __pyx_t_3 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_xDirectionGridLengthInMetres); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1654; __pyx_clineno = __LINE__; goto __pyx_L43_except_error;};
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_XDECREF_SET(__pyx_v_dx, __pyx_t_3);
        __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        goto __pyx_L42_exception_handled;
      }
      __pyx_L43_except_error:;

      /* "pygrib.pyx":1651
 *             # 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_L42_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_L48_try_end:;
    }

    /* "pygrib.pyx":1655
 *             except:
 *                 dx = self['xDirectionGridLengthInMetres']
 *             try:             # <<<<<<<<<<<<<<
 *                 dy = self['DyInMetres']
 *             except:
 */
    {
      __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":1656
 *                 dx = self['xDirectionGridLengthInMetres']
 *             try:
 *                 dy = self['DyInMetres']             # <<<<<<<<<<<<<<
 *             except:
 *                 dy = self['yDirectionGridLengthInMetres']
 */
        __pyx_t_5 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_DyInMetres); if (unlikely(__pyx_t_5 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1656; __pyx_clineno = __LINE__; goto __pyx_L51_error;};
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_v_dy = __pyx_t_5;
        __pyx_t_5 = 0;

        /* "pygrib.pyx":1655
 *             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_L58_try_end;
      __pyx_L51_error:;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;

      /* "pygrib.pyx":1657
 *             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_4, &__pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1657; __pyx_clineno = __LINE__; goto __pyx_L53_except_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_GOTREF(__pyx_t_7);

        /* "pygrib.pyx":1658
 *                 dy = self['DyInMetres']
 *             except:
 *                 dy = self['yDirectionGridLengthInMetres']             # <<<<<<<<<<<<<<
 *             pj = pyproj.Proj(self.projparams)
 *             llcrnrx, llcrnry = pj(lon1,lat1)
 */
        __pyx_t_3 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_yDirectionGridLengthInMetres); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1658; __pyx_clineno = __LINE__; goto __pyx_L53_except_error;};
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_XDECREF_SET(__pyx_v_dy, __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_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        goto __pyx_L52_exception_handled;
      }
      __pyx_L53_except_error:;

      /* "pygrib.pyx":1655
 *             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_L52_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_L58_try_end:;
    }

    /* "pygrib.pyx":1659
 *             except:
 *                 dy = self['yDirectionGridLengthInMetres']
 *             pj = pyproj.Proj(self.projparams)             # <<<<<<<<<<<<<<
 *             llcrnrx, llcrnry = pj(lon1,lat1)
 *             x = llcrnrx+dx*np.arange(nx)
 */
    __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_pyproj); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1659; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_Proj); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1659; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && 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_self->projparams); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1659; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
    } else {
      __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1659; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4); __pyx_t_4 = NULL;
      __Pyx_INCREF(__pyx_v_self->projparams);
      __Pyx_GIVEREF(__pyx_v_self->projparams);
      PyTuple_SET_ITEM(__pyx_t_3, 0+1, __pyx_v_self->projparams);
      __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_3, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1659; __pyx_clineno = __LINE__; goto __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;
    __pyx_v_pj = __pyx_t_7;
    __pyx_t_7 = 0;

    /* "pygrib.pyx":1660
 *                 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_3 = NULL;
    __pyx_t_6 = 0;
    if (CYTHON_COMPILING_IN_CPYTHON && 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;
      }
    }
    __pyx_t_4 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1660; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    if (__pyx_t_3) {
      __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __pyx_t_3 = 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_lat1);
    __Pyx_GIVEREF(__pyx_v_lat1);
    PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_6, __pyx_v_lat1);
    __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_4, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1660; __pyx_clineno = __LINE__; goto __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;
      #if CYTHON_COMPILING_IN_CPYTHON
      Py_ssize_t size = Py_SIZE(sequence);
      #else
      Py_ssize_t size = PySequence_Size(sequence);
      #endif
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1660; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      #if CYTHON_COMPILING_IN_CPYTHON
      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_filename = __pyx_f[0]; __pyx_lineno = 1660; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1660; __pyx_clineno = __LINE__; goto __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_3 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1660; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 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_L61_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_5);
      index = 1; __pyx_t_4 = __pyx_t_8(__pyx_t_3); if (unlikely(!__pyx_t_4)) goto __pyx_L61_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_4);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_3), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1660; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_8 = NULL;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      goto __pyx_L62_unpacking_done;
      __pyx_L61_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_8 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1660; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_L62_unpacking_done:;
    }
    __pyx_v_llcrnrx = __pyx_t_5;
    __pyx_t_5 = 0;
    __pyx_v_llcrnry = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "pygrib.pyx":1661
 *             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_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1661; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1661; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && 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_nx); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1661; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
    } else {
      __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1661; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4); __pyx_t_4 = NULL;
      __Pyx_INCREF(__pyx_v_nx);
      __Pyx_GIVEREF(__pyx_v_nx);
      PyTuple_SET_ITEM(__pyx_t_3, 0+1, __pyx_v_nx);
      __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_3, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1661; __pyx_clineno = __LINE__; goto __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;
    __pyx_t_5 = PyNumber_Multiply(__pyx_v_dx, __pyx_t_7); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1661; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1661; __pyx_clineno = __LINE__; goto __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":1662
 *             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_filename = __pyx_f[0]; __pyx_lineno = 1662; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_arange); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1662; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && unlikely(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_7 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_ny); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1662; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
    } else {
      __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1662; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5); __pyx_t_5 = NULL;
      __Pyx_INCREF(__pyx_v_ny);
      __Pyx_GIVEREF(__pyx_v_ny);
      PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_ny);
      __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1662; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __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_dy, __pyx_t_7); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1662; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = PyNumber_Add(__pyx_v_llcrnry, __pyx_t_3); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1662; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_y = __pyx_t_7;
    __pyx_t_7 = 0;

    /* "pygrib.pyx":1663
 *             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_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1663; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_meshgrid); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1663; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = NULL;
    __pyx_t_6 = 0;
    if (CYTHON_COMPILING_IN_CPYTHON && 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;
      }
    }
    __pyx_t_5 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1663; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    if (__pyx_t_3) {
      __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = 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_4, __pyx_t_5, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1663; __pyx_clineno = __LINE__; goto __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;
    if ((likely(PyTuple_CheckExact(__pyx_t_7))) || (PyList_CheckExact(__pyx_t_7))) {
      PyObject* sequence = __pyx_t_7;
      #if CYTHON_COMPILING_IN_CPYTHON
      Py_ssize_t size = Py_SIZE(sequence);
      #else
      Py_ssize_t size = PySequence_Size(sequence);
      #endif
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1663; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      #if CYTHON_COMPILING_IN_CPYTHON
      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_filename = __pyx_f[0]; __pyx_lineno = 1663; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1663; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      #endif
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_3 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1663; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_8 = Py_TYPE(__pyx_t_3)->tp_iternext;
      index = 0; __pyx_t_4 = __pyx_t_8(__pyx_t_3); if (unlikely(!__pyx_t_4)) goto __pyx_L63_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_4);
      index = 1; __pyx_t_5 = __pyx_t_8(__pyx_t_3); if (unlikely(!__pyx_t_5)) goto __pyx_L63_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_5);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_3), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1663; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_8 = NULL;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      goto __pyx_L64_unpacking_done;
      __pyx_L63_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_8 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1663; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_L64_unpacking_done:;
    }
    __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_4);
    __pyx_t_4 = 0;
    __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_5);
    __pyx_t_5 = 0;

    /* "pygrib.pyx":1664
 *             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_filename = __pyx_f[0]; __pyx_lineno = 1664; __pyx_clineno = __LINE__; goto __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 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1664; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_inverse, Py_True) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1664; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_v_pj, __pyx_t_7, __pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1664; __pyx_clineno = __LINE__; goto __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;
      #if CYTHON_COMPILING_IN_CPYTHON
      Py_ssize_t size = Py_SIZE(sequence);
      #else
      Py_ssize_t size = PySequence_Size(sequence);
      #endif
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1664; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      #if CYTHON_COMPILING_IN_CPYTHON
      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_filename = __pyx_f[0]; __pyx_lineno = 1664; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_7 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1664; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1664; __pyx_clineno = __LINE__; goto __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_L65_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_L65_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_7);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_3), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1664; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_8 = NULL;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      goto __pyx_L66_unpacking_done;
      __pyx_L65_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_8 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1664; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_L66_unpacking_done:;
    }
    __pyx_v_lons = __pyx_t_5;
    __pyx_t_5 = 0;
    __pyx_v_lats = __pyx_t_7;
    __pyx_t_7 = 0;

    /* "pygrib.pyx":1640
 *                 lats = self['latitudes']
 *                 lons = self['longitudes']
 *         elif self['gridType'] == 'polar_stereographic':             # <<<<<<<<<<<<<<
 *             lat1 = self['latitudeOfFirstGridPointInDegrees']
 *             lon1 = self['longitudeOfFirstGridPointInDegrees']
 */
    goto __pyx_L4;
  }

  /* "pygrib.pyx":1665
 *             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_4 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_gridType); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1665; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_t_4, __pyx_n_s_lambert, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1665; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__pyx_t_1) {

    /* "pygrib.pyx":1666
 *             lons, lats = pj(x, y, inverse=True)
 *         elif self['gridType'] == 'lambert':
 *             lat1 = self['latitudeOfFirstGridPointInDegrees']             # <<<<<<<<<<<<<<
 *             lon1 = self['longitudeOfFirstGridPointInDegrees']
 *             try:
 */
    __pyx_t_4 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_latitudeOfFirstGridPointInDegree); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1666; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_v_lat1 = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "pygrib.pyx":1667
 *         elif self['gridType'] == 'lambert':
 *             lat1 = self['latitudeOfFirstGridPointInDegrees']
 *             lon1 = self['longitudeOfFirstGridPointInDegrees']             # <<<<<<<<<<<<<<
 *             try:
 *                 nx = self['Nx']
 */
    __pyx_t_4 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_longitudeOfFirstGridPointInDegre); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1667; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_v_lon1 = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "pygrib.pyx":1668
 *             lat1 = self['latitudeOfFirstGridPointInDegrees']
 *             lon1 = self['longitudeOfFirstGridPointInDegrees']
 *             try:             # <<<<<<<<<<<<<<
 *                 nx = self['Nx']
 *                 ny = self['Ny']
 */
    {
      __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":1669
 *             lon1 = self['longitudeOfFirstGridPointInDegrees']
 *             try:
 *                 nx = self['Nx']             # <<<<<<<<<<<<<<
 *                 ny = self['Ny']
 *             except:
 */
        __pyx_t_4 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_Nx); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1669; __pyx_clineno = __LINE__; goto __pyx_L67_error;};
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_v_nx = __pyx_t_4;
        __pyx_t_4 = 0;

        /* "pygrib.pyx":1670
 *             try:
 *                 nx = self['Nx']
 *                 ny = self['Ny']             # <<<<<<<<<<<<<<
 *             except:
 *                 nx = self['Ni']
 */
        __pyx_t_4 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_Ny); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1670; __pyx_clineno = __LINE__; goto __pyx_L67_error;};
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_v_ny = __pyx_t_4;
        __pyx_t_4 = 0;

        /* "pygrib.pyx":1668
 *             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_L74_try_end;
      __pyx_L67_error:;
      __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;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "pygrib.pyx":1671
 *                 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_7, &__pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1671; __pyx_clineno = __LINE__; goto __pyx_L69_except_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_GOTREF(__pyx_t_5);

        /* "pygrib.pyx":1672
 *                 ny = self['Ny']
 *             except:
 *                 nx = self['Ni']             # <<<<<<<<<<<<<<
 *                 ny = self['Nj']
 *             dx = self['DxInMetres']
 */
        __pyx_t_3 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_Ni); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1672; __pyx_clineno = __LINE__; goto __pyx_L69_except_error;};
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_XDECREF_SET(__pyx_v_nx, __pyx_t_3);
        __pyx_t_3 = 0;

        /* "pygrib.pyx":1673
 *             except:
 *                 nx = self['Ni']
 *                 ny = self['Nj']             # <<<<<<<<<<<<<<
 *             dx = self['DxInMetres']
 *             dy = self['DyInMetres']
 */
        __pyx_t_3 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_Nj); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1673; __pyx_clineno = __LINE__; goto __pyx_L69_except_error;};
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_XDECREF_SET(__pyx_v_ny, __pyx_t_3);
        __pyx_t_3 = 0;
        __Pyx_DECREF(__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;
        goto __pyx_L68_exception_handled;
      }
      __pyx_L69_except_error:;

      /* "pygrib.pyx":1668
 *             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_L68_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_L74_try_end:;
    }

    /* "pygrib.pyx":1674
 *                 nx = self['Ni']
 *                 ny = self['Nj']
 *             dx = self['DxInMetres']             # <<<<<<<<<<<<<<
 *             dy = self['DyInMetres']
 *             pj = pyproj.Proj(self.projparams)
 */
    __pyx_t_5 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_DxInMetres); if (unlikely(__pyx_t_5 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1674; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_v_dx = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "pygrib.pyx":1675
 *                 ny = self['Nj']
 *             dx = self['DxInMetres']
 *             dy = self['DyInMetres']             # <<<<<<<<<<<<<<
 *             pj = pyproj.Proj(self.projparams)
 *             llcrnrx, llcrnry = pj(lon1,lat1)
 */
    __pyx_t_5 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_DyInMetres); if (unlikely(__pyx_t_5 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1675; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_v_dy = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "pygrib.pyx":1676
 *             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_filename = __pyx_f[0]; __pyx_lineno = 1676; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1676; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && 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_self->projparams); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1676; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
    } else {
      __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1676; __pyx_clineno = __LINE__; goto __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_self->projparams);
      __Pyx_GIVEREF(__pyx_v_self->projparams);
      PyTuple_SET_ITEM(__pyx_t_3, 0+1, __pyx_v_self->projparams);
      __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1676; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_v_pj = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "pygrib.pyx":1677
 *             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_4 = __pyx_v_pj; __pyx_t_3 = NULL;
    __pyx_t_6 = 0;
    if (CYTHON_COMPILING_IN_CPYTHON && 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;
      }
    }
    __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1677; __pyx_clineno = __LINE__; goto __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_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_4, __pyx_t_7, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1677; __pyx_clineno = __LINE__; goto __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;
      #if CYTHON_COMPILING_IN_CPYTHON
      Py_ssize_t size = Py_SIZE(sequence);
      #else
      Py_ssize_t size = PySequence_Size(sequence);
      #endif
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1677; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      #if CYTHON_COMPILING_IN_CPYTHON
      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_filename = __pyx_f[0]; __pyx_lineno = 1677; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_7 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1677; __pyx_clineno = __LINE__; goto __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_3 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1677; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_8 = Py_TYPE(__pyx_t_3)->tp_iternext;
      index = 0; __pyx_t_4 = __pyx_t_8(__pyx_t_3); if (unlikely(!__pyx_t_4)) goto __pyx_L77_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_4);
      index = 1; __pyx_t_7 = __pyx_t_8(__pyx_t_3); if (unlikely(!__pyx_t_7)) goto __pyx_L77_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_7);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_3), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1677; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_8 = NULL;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      goto __pyx_L78_unpacking_done;
      __pyx_L77_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_8 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1677; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_L78_unpacking_done:;
    }
    __pyx_v_llcrnrx = __pyx_t_4;
    __pyx_t_4 = 0;
    __pyx_v_llcrnry = __pyx_t_7;
    __pyx_t_7 = 0;

    /* "pygrib.pyx":1678
 *             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_filename = __pyx_f[0]; __pyx_lineno = 1678; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1678; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && 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_nx); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1678; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
    } else {
      __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1678; __pyx_clineno = __LINE__; goto __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_nx);
      __Pyx_GIVEREF(__pyx_v_nx);
      PyTuple_SET_ITEM(__pyx_t_3, 0+1, __pyx_v_nx);
      __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1678; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyNumber_Multiply(__pyx_v_dx, __pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1678; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = PyNumber_Add(__pyx_v_llcrnrx, __pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1678; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_v_x = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "pygrib.pyx":1679
 *             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_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1679; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_arange); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1679; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && 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);
      }
    }
    if (!__pyx_t_4) {
      __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_ny); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1679; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
    } else {
      __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1679; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_4); __pyx_t_4 = 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_3, __pyx_t_7, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1679; __pyx_clineno = __LINE__; goto __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;
    __pyx_t_3 = PyNumber_Multiply(__pyx_v_dy, __pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1679; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = PyNumber_Add(__pyx_v_llcrnry, __pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1679; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_y = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "pygrib.pyx":1680
 *             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_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1680; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_meshgrid); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1680; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = NULL;
    __pyx_t_6 = 0;
    if (CYTHON_COMPILING_IN_CPYTHON && 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);
        __pyx_t_6 = 1;
      }
    }
    __pyx_t_4 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1680; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    if (__pyx_t_3) {
      __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __pyx_t_3 = 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_5 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1680; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if ((likely(PyTuple_CheckExact(__pyx_t_5))) || (PyList_CheckExact(__pyx_t_5))) {
      PyObject* sequence = __pyx_t_5;
      #if CYTHON_COMPILING_IN_CPYTHON
      Py_ssize_t size = Py_SIZE(sequence);
      #else
      Py_ssize_t size = PySequence_Size(sequence);
      #endif
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1680; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      #if CYTHON_COMPILING_IN_CPYTHON
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_7 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_7 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_4 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_4);
      #else
      __pyx_t_7 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1680; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1680; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      #endif
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_3 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1680; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_8 = Py_TYPE(__pyx_t_3)->tp_iternext;
      index = 0; __pyx_t_7 = __pyx_t_8(__pyx_t_3); if (unlikely(!__pyx_t_7)) goto __pyx_L79_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_7);
      index = 1; __pyx_t_4 = __pyx_t_8(__pyx_t_3); if (unlikely(!__pyx_t_4)) goto __pyx_L79_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_4);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_3), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1680; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_8 = NULL;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      goto __pyx_L80_unpacking_done;
      __pyx_L79_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_8 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1680; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_L80_unpacking_done:;
    }
    __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_7);
    __pyx_t_7 = 0;
    __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "pygrib.pyx":1681
 *             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_filename = __pyx_f[0]; __pyx_lineno = 1681; __pyx_clineno = __LINE__; goto __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_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1681; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_inverse, Py_True) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1681; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_7 = __Pyx_PyObject_Call(__pyx_v_pj, __pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1681; __pyx_clineno = __LINE__; goto __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;
    if ((likely(PyTuple_CheckExact(__pyx_t_7))) || (PyList_CheckExact(__pyx_t_7))) {
      PyObject* sequence = __pyx_t_7;
      #if CYTHON_COMPILING_IN_CPYTHON
      Py_ssize_t size = Py_SIZE(sequence);
      #else
      Py_ssize_t size = PySequence_Size(sequence);
      #endif
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1681; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      #if CYTHON_COMPILING_IN_CPYTHON
      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_filename = __pyx_f[0]; __pyx_lineno = 1681; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1681; __pyx_clineno = __LINE__; goto __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_3 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1681; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_8 = Py_TYPE(__pyx_t_3)->tp_iternext;
      index = 0; __pyx_t_4 = __pyx_t_8(__pyx_t_3); if (unlikely(!__pyx_t_4)) goto __pyx_L81_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_4);
      index = 1; __pyx_t_5 = __pyx_t_8(__pyx_t_3); if (unlikely(!__pyx_t_5)) goto __pyx_L81_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_5);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_3), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1681; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_8 = NULL;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      goto __pyx_L82_unpacking_done;
      __pyx_L81_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_8 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1681; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_L82_unpacking_done:;
    }
    __pyx_v_lons = __pyx_t_4;
    __pyx_t_4 = 0;
    __pyx_v_lats = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "pygrib.pyx":1665
 *             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":1682
 *             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 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_gridType); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1682; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1682; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (__pyx_t_1) {

    /* "pygrib.pyx":1683
 *             lons, lats = pj(x, y, inverse=True)
 *         elif self['gridType'] =='albers':
 *             lat1 = self['latitudeOfFirstGridPointInDegrees']             # <<<<<<<<<<<<<<
 *             lon1 = self['longitudeOfFirstGridPointInDegrees']
 *             try:
 */
    __pyx_t_7 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_latitudeOfFirstGridPointInDegree); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1683; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_v_lat1 = __pyx_t_7;
    __pyx_t_7 = 0;

    /* "pygrib.pyx":1684
 *         elif self['gridType'] =='albers':
 *             lat1 = self['latitudeOfFirstGridPointInDegrees']
 *             lon1 = self['longitudeOfFirstGridPointInDegrees']             # <<<<<<<<<<<<<<
 *             try:
 *                 nx = self['Nx']
 */
    __pyx_t_7 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_longitudeOfFirstGridPointInDegre); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1684; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_v_lon1 = __pyx_t_7;
    __pyx_t_7 = 0;

    /* "pygrib.pyx":1685
 *             lat1 = self['latitudeOfFirstGridPointInDegrees']
 *             lon1 = self['longitudeOfFirstGridPointInDegrees']
 *             try:             # <<<<<<<<<<<<<<
 *                 nx = self['Nx']
 *                 ny = self['Ny']
 */
    {
      __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":1686
 *             lon1 = self['longitudeOfFirstGridPointInDegrees']
 *             try:
 *                 nx = self['Nx']             # <<<<<<<<<<<<<<
 *                 ny = self['Ny']
 *             except:
 */
        __pyx_t_7 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_Nx); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1686; __pyx_clineno = __LINE__; goto __pyx_L83_error;};
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_v_nx = __pyx_t_7;
        __pyx_t_7 = 0;

        /* "pygrib.pyx":1687
 *             try:
 *                 nx = self['Nx']
 *                 ny = self['Ny']             # <<<<<<<<<<<<<<
 *             except:
 *                 nx = self['Ni']
 */
        __pyx_t_7 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_Ny); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1687; __pyx_clineno = __LINE__; goto __pyx_L83_error;};
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_v_ny = __pyx_t_7;
        __pyx_t_7 = 0;

        /* "pygrib.pyx":1685
 *             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_L90_try_end;
      __pyx_L83_error:;
      __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;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;

      /* "pygrib.pyx":1688
 *                 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_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1688; __pyx_clineno = __LINE__; goto __pyx_L85_except_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_GOTREF(__pyx_t_4);

        /* "pygrib.pyx":1689
 *                 ny = self['Ny']
 *             except:
 *                 nx = self['Ni']             # <<<<<<<<<<<<<<
 *                 ny = self['Nj']
 *             dx = self['Dx']/1000.
 */
        __pyx_t_3 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_Ni); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1689; __pyx_clineno = __LINE__; goto __pyx_L85_except_error;};
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_XDECREF_SET(__pyx_v_nx, __pyx_t_3);
        __pyx_t_3 = 0;

        /* "pygrib.pyx":1690
 *             except:
 *                 nx = self['Ni']
 *                 ny = self['Nj']             # <<<<<<<<<<<<<<
 *             dx = self['Dx']/1000.
 *             dy = self['Dy']/1000.
 */
        __pyx_t_3 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_Nj); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1690; __pyx_clineno = __LINE__; goto __pyx_L85_except_error;};
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_XDECREF_SET(__pyx_v_ny, __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;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        goto __pyx_L84_exception_handled;
      }
      __pyx_L85_except_error:;

      /* "pygrib.pyx":1685
 *             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_L84_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_L90_try_end:;
    }

    /* "pygrib.pyx":1691
 *                 nx = self['Ni']
 *                 ny = self['Nj']
 *             dx = self['Dx']/1000.             # <<<<<<<<<<<<<<
 *             dy = self['Dy']/1000.
 *             scale = float(self['grib2divider'])
 */
    __pyx_t_4 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_Dx); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1691; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = __Pyx_PyFloat_DivideObjC(__pyx_t_4, __pyx_float_1000_, 1000., 0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1691; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_v_dx = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "pygrib.pyx":1692
 *                 ny = self['Nj']
 *             dx = self['Dx']/1000.
 *             dy = self['Dy']/1000.             # <<<<<<<<<<<<<<
 *             scale = float(self['grib2divider'])
 *             pj = pyproj.Proj(self.projparams)
 */
    __pyx_t_5 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_Dy); if (unlikely(__pyx_t_5 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1692; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_4 = __Pyx_PyFloat_DivideObjC(__pyx_t_5, __pyx_float_1000_, 1000., 0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1692; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_v_dy = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "pygrib.pyx":1693
 *             dx = self['Dx']/1000.
 *             dy = self['Dy']/1000.
 *             scale = float(self['grib2divider'])             # <<<<<<<<<<<<<<
 *             pj = pyproj.Proj(self.projparams)
 *             llcrnrx, llcrnry = pj(lon1,lat1)
 */
    __pyx_t_4 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_grib2divider); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1693; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_12 = __Pyx_PyObject_AsDouble(__pyx_t_4); if (unlikely(__pyx_t_12 == ((double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1693; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyFloat_FromDouble(__pyx_t_12); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1693; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_v_scale = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "pygrib.pyx":1694
 *             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_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_pyproj); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1694; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_Proj); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1694; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && 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_self->projparams); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1694; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
    } else {
      __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1694; __pyx_clineno = __LINE__; goto __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_self->projparams);
      __Pyx_GIVEREF(__pyx_v_self->projparams);
      PyTuple_SET_ITEM(__pyx_t_3, 0+1, __pyx_v_self->projparams);
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1694; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_v_pj = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "pygrib.pyx":1695
 *             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_3 = NULL;
    __pyx_t_6 = 0;
    if (CYTHON_COMPILING_IN_CPYTHON && 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);
        __pyx_t_6 = 1;
      }
    }
    __pyx_t_5 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1695; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    if (__pyx_t_3) {
      __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = 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_lat1);
    __Pyx_GIVEREF(__pyx_v_lat1);
    PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_6, __pyx_v_lat1);
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1695; __pyx_clineno = __LINE__; goto __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;
      #if CYTHON_COMPILING_IN_CPYTHON
      Py_ssize_t size = Py_SIZE(sequence);
      #else
      Py_ssize_t size = PySequence_Size(sequence);
      #endif
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1695; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      #if CYTHON_COMPILING_IN_CPYTHON
      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_filename = __pyx_f[0]; __pyx_lineno = 1695; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1695; __pyx_clineno = __LINE__; goto __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_3 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1695; __pyx_clineno = __LINE__; goto __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_7 = __pyx_t_8(__pyx_t_3); if (unlikely(!__pyx_t_7)) goto __pyx_L93_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_7);
      index = 1; __pyx_t_5 = __pyx_t_8(__pyx_t_3); if (unlikely(!__pyx_t_5)) goto __pyx_L93_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_5);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_3), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1695; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_8 = NULL;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      goto __pyx_L94_unpacking_done;
      __pyx_L93_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_8 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1695; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_L94_unpacking_done:;
    }
    __pyx_v_llcrnrx = __pyx_t_7;
    __pyx_t_7 = 0;
    __pyx_v_llcrnry = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "pygrib.pyx":1696
 *             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_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1696; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_arange); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1696; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && 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_nx); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1696; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
    } else {
      __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1696; __pyx_clineno = __LINE__; goto __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_nx);
      __Pyx_GIVEREF(__pyx_v_nx);
      PyTuple_SET_ITEM(__pyx_t_3, 0+1, __pyx_v_nx);
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1696; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = PyNumber_Multiply(__pyx_v_dx, __pyx_t_4); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1696; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyNumber_Add(__pyx_v_llcrnrx, __pyx_t_7); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1696; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_v_x = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "pygrib.pyx":1697
 *             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_filename = __pyx_f[0]; __pyx_lineno = 1697; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1697; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && 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_4 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_ny); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1697; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
    } else {
      __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1697; __pyx_clineno = __LINE__; goto __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_ny);
      __Pyx_GIVEREF(__pyx_v_ny);
      PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_v_ny);
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1697; __pyx_clineno = __LINE__; goto __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_t_3 = PyNumber_Multiply(__pyx_v_dy, __pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1697; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyNumber_Add(__pyx_v_llcrnry, __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1697; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_y = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "pygrib.pyx":1698
 *             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_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1698; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1698; __pyx_clineno = __LINE__; goto __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_COMPILING_IN_CPYTHON && 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;
      }
    }
    __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1698; __pyx_clineno = __LINE__; goto __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_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_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_7, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1698; __pyx_clineno = __LINE__; goto __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;
      #if CYTHON_COMPILING_IN_CPYTHON
      Py_ssize_t size = Py_SIZE(sequence);
      #else
      Py_ssize_t size = PySequence_Size(sequence);
      #endif
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1698; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      #if CYTHON_COMPILING_IN_CPYTHON
      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_filename = __pyx_f[0]; __pyx_lineno = 1698; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_7 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1698; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1698; __pyx_clineno = __LINE__; goto __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_L95_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_L95_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_7);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_3), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1698; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_8 = NULL;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      goto __pyx_L96_unpacking_done;
      __pyx_L95_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_8 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1698; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_L96_unpacking_done:;
    }
    __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_5);
    __pyx_t_5 = 0;
    __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_7);
    __pyx_t_7 = 0;

    /* "pygrib.pyx":1699
 *             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_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1699; __pyx_clineno = __LINE__; goto __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_7 = PyDict_New(); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1699; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_inverse, Py_True) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1699; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_5 = __Pyx_PyObject_Call(__pyx_v_pj, __pyx_t_4, __pyx_t_7); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1699; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if ((likely(PyTuple_CheckExact(__pyx_t_5))) || (PyList_CheckExact(__pyx_t_5))) {
      PyObject* sequence = __pyx_t_5;
      #if CYTHON_COMPILING_IN_CPYTHON
      Py_ssize_t size = Py_SIZE(sequence);
      #else
      Py_ssize_t size = PySequence_Size(sequence);
      #endif
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1699; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      #if CYTHON_COMPILING_IN_CPYTHON
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_7 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_7 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_4 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_4);
      #else
      __pyx_t_7 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1699; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1699; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      #endif
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_3 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1699; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_8 = Py_TYPE(__pyx_t_3)->tp_iternext;
      index = 0; __pyx_t_7 = __pyx_t_8(__pyx_t_3); if (unlikely(!__pyx_t_7)) goto __pyx_L97_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_7);
      index = 1; __pyx_t_4 = __pyx_t_8(__pyx_t_3); if (unlikely(!__pyx_t_4)) goto __pyx_L97_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_4);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_3), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1699; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_8 = NULL;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      goto __pyx_L98_unpacking_done;
      __pyx_L97_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_8 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1699; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_L98_unpacking_done:;
    }
    __pyx_v_lons = __pyx_t_7;
    __pyx_t_7 = 0;
    __pyx_v_lats = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "pygrib.pyx":1682
 *             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":1700
 *             x, y = np.meshgrid(x, y)
 *             lons, lats = pj(x, y, inverse=True)
 *         elif self['gridType'] == 'space_view':             # <<<<<<<<<<<<<<
 *             try:
 *                 nx = self['Nx']
 */
  __pyx_t_5 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_gridType); if (unlikely(__pyx_t_5 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1700; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_t_5, __pyx_n_s_space_view, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1700; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (__pyx_t_1) {

    /* "pygrib.pyx":1701
 *             lons, lats = pj(x, y, inverse=True)
 *         elif self['gridType'] == 'space_view':
 *             try:             # <<<<<<<<<<<<<<
 *                 nx = self['Nx']
 *                 ny = self['Ny']
 */
    {
      __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":1702
 *         elif self['gridType'] == 'space_view':
 *             try:
 *                 nx = self['Nx']             # <<<<<<<<<<<<<<
 *                 ny = self['Ny']
 *             except:
 */
        __pyx_t_5 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_Nx); if (unlikely(__pyx_t_5 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1702; __pyx_clineno = __LINE__; goto __pyx_L99_error;};
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_v_nx = __pyx_t_5;
        __pyx_t_5 = 0;

        /* "pygrib.pyx":1703
 *             try:
 *                 nx = self['Nx']
 *                 ny = self['Ny']             # <<<<<<<<<<<<<<
 *             except:
 *                 nx = self['Ni']
 */
        __pyx_t_5 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_Ny); if (unlikely(__pyx_t_5 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1703; __pyx_clineno = __LINE__; goto __pyx_L99_error;};
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_v_ny = __pyx_t_5;
        __pyx_t_5 = 0;

        /* "pygrib.pyx":1701
 *             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_L106_try_end;
      __pyx_L99_error:;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;

      /* "pygrib.pyx":1704
 *                 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_4, &__pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1704; __pyx_clineno = __LINE__; goto __pyx_L101_except_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_GOTREF(__pyx_t_7);

        /* "pygrib.pyx":1705
 *                 ny = self['Ny']
 *             except:
 *                 nx = self['Ni']             # <<<<<<<<<<<<<<
 *                 ny = self['Nj']
 *             # general case of 'near-side perspective projection' (untested)
 */
        __pyx_t_3 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_Ni); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1705; __pyx_clineno = __LINE__; goto __pyx_L101_except_error;};
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_XDECREF_SET(__pyx_v_nx, __pyx_t_3);
        __pyx_t_3 = 0;

        /* "pygrib.pyx":1706
 *             except:
 *                 nx = self['Ni']
 *                 ny = self['Nj']             # <<<<<<<<<<<<<<
 *             # general case of 'near-side perspective projection' (untested)
 *             if self.projparams['proj'] == 'nsper' and \
 */
        __pyx_t_3 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_Nj); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1706; __pyx_clineno = __LINE__; goto __pyx_L101_except_error;};
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_XDECREF_SET(__pyx_v_ny, __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_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        goto __pyx_L100_exception_handled;
      }
      __pyx_L101_except_error:;

      /* "pygrib.pyx":1701
 *             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_L100_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_L106_try_end:;
    }

    /* "pygrib.pyx":1708
 *                 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 = PyObject_GetItem(__pyx_v_self->projparams, __pyx_n_s_proj); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1708; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1708; __pyx_clineno = __LINE__; goto __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_L110_bool_binop_done;
    }

    /* "pygrib.pyx":1709
 *             # 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 = PyObject_GetItem(__pyx_v_self->projparams, __pyx_n_s_a); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1709; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_4 = PyObject_GetItem(__pyx_v_self->projparams, __pyx_n_s_b); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1709; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PyObject_RichCompare(__pyx_t_7, __pyx_t_4, Py_NE); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1709; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1709; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_1 = __pyx_t_2;
    __pyx_L110_bool_binop_done:;

    /* "pygrib.pyx":1708
 *                 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 (__pyx_t_1) {

      /* "pygrib.pyx":1710
 *             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_5 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__96, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1710; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_Raise(__pyx_t_5, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1710; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

      /* "pygrib.pyx":1708
 *                 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":1711
 *                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_5 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_grib2divider); if (unlikely(__pyx_t_5 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1711; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_12 = __Pyx_PyObject_AsDouble(__pyx_t_5); if (unlikely(__pyx_t_12 == ((double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1711; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = PyFloat_FromDouble(__pyx_t_12); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1711; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_v_scale = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "pygrib.pyx":1713
 *             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 = PyObject_GetItem(__pyx_v_self->projparams, __pyx_n_s_lon_0); if (unlikely(__pyx_t_5 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1713; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_v_lon_0 = __pyx_t_5;
    __pyx_t_5 = 0;
    __pyx_t_5 = PyObject_GetItem(__pyx_v_self->projparams, __pyx_n_s_lat_0); if (unlikely(__pyx_t_5 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1713; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_v_lat_0 = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "pygrib.pyx":1715
 *             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_filename = __pyx_f[0]; __pyx_lineno = 1715; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1715; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_pi); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1715; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyFloat_DivideCObj(__pyx_float_180_, __pyx_t_7, 180., 0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1715; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1715; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_arcsin); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1715; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_13);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_Nr); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1715; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_14 = __Pyx_PyNumber_Divide(__pyx_v_scale, __pyx_t_3); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1715; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_14);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_13))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_13);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_13);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_13, function);
      }
    }
    if (!__pyx_t_3) {
      __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_t_13, __pyx_t_14); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1715; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
      __Pyx_GOTREF(__pyx_t_7);
    } else {
      __pyx_t_15 = PyTuple_New(1+1); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1715; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_15);
      __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_3); __pyx_t_3 = NULL;
      __Pyx_GIVEREF(__pyx_t_14);
      PyTuple_SET_ITEM(__pyx_t_15, 0+1, __pyx_t_14);
      __pyx_t_14 = 0;
      __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_13, __pyx_t_15, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1715; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    }
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    __pyx_t_13 = PyNumber_Multiply(__pyx_t_4, __pyx_t_7); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1715; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_13);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = PyNumber_Subtract(__pyx_t_5, __pyx_t_13); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1715; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    __pyx_v_lonmax = __pyx_t_7;
    __pyx_t_7 = 0;

    /* "pygrib.pyx":1718
 *             # 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_filename = __pyx_f[0]; __pyx_lineno = 1718; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_13 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1718; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_13);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s_pi); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1718; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    __pyx_t_13 = __Pyx_PyFloat_DivideCObj(__pyx_float_180_, __pyx_t_5, 180., 0); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1718; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_13);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1718; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_arcsin); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1718; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_15);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_Nr); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1718; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_14 = __Pyx_PyNumber_Divide(__pyx_v_scale, __pyx_t_4); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1718; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_14);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_15))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_15);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_15);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_15, function);
      }
    }
    if (!__pyx_t_4) {
      __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_15, __pyx_t_14); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1718; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
      __Pyx_GOTREF(__pyx_t_5);
    } else {
      __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1718; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4); __pyx_t_4 = NULL;
      __Pyx_GIVEREF(__pyx_t_14);
      PyTuple_SET_ITEM(__pyx_t_3, 0+1, __pyx_t_14);
      __pyx_t_14 = 0;
      __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_15, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1718; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    __pyx_t_15 = PyNumber_Multiply(__pyx_t_13, __pyx_t_5); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1718; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_15);
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = PyNumber_Subtract(__pyx_t_7, __pyx_t_15); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1718; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    __pyx_v_latmax = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "pygrib.pyx":1721
 *             # 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_filename = __pyx_f[0]; __pyx_lineno = 1721; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_15 = PyNumber_Int(__pyx_t_5); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1721; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_15);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_PyFloat_DivideObjC(__pyx_t_15, __pyx_float_1000_, 1000., 0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1721; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    __Pyx_DECREF_SET(__pyx_v_latmax, __pyx_t_5);
    __pyx_t_5 = 0;

    /* "pygrib.pyx":1722
 *             # 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_filename = __pyx_f[0]; __pyx_lineno = 1722; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_15 = PyNumber_Int(__pyx_t_5); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1722; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_15);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_PyFloat_DivideObjC(__pyx_t_15, __pyx_float_1000_, 1000., 0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1722; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    __Pyx_DECREF_SET(__pyx_v_lonmax, __pyx_t_5);
    __pyx_t_5 = 0;

    /* "pygrib.pyx":1723
 *             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_15 = __Pyx_GetModuleGlobalName(__pyx_n_s_pyproj); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_15);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_15, __pyx_n_s_Proj); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    __pyx_t_15 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_15 = PyMethod_GET_SELF(__pyx_t_7);
      if (likely(__pyx_t_15)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_15);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_7, function);
      }
    }
    if (!__pyx_t_15) {
      __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_v_self->projparams); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
    } else {
      __pyx_t_13 = PyTuple_New(1+1); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_13);
      __Pyx_GIVEREF(__pyx_t_15); PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_15); __pyx_t_15 = NULL;
      __Pyx_INCREF(__pyx_v_self->projparams);
      __Pyx_GIVEREF(__pyx_v_self->projparams);
      PyTuple_SET_ITEM(__pyx_t_13, 0+1, __pyx_v_self->projparams);
      __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_13, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    }
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_v_pj = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "pygrib.pyx":1724
 *             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_13 = NULL;
    __pyx_t_6 = 0;
    if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_7);
      if (likely(__pyx_t_13)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_13);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_7, function);
        __pyx_t_6 = 1;
      }
    }
    __pyx_t_15 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_15);
    if (__pyx_t_13) {
      __Pyx_GIVEREF(__pyx_t_13); PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_13); __pyx_t_13 = NULL;
    }
    __Pyx_INCREF(__pyx_v_lon_0);
    __Pyx_GIVEREF(__pyx_v_lon_0);
    PyTuple_SET_ITEM(__pyx_t_15, 0+__pyx_t_6, __pyx_v_lon_0);
    __Pyx_INCREF(__pyx_v_latmax);
    __Pyx_GIVEREF(__pyx_v_latmax);
    PyTuple_SET_ITEM(__pyx_t_15, 1+__pyx_t_6, __pyx_v_latmax);
    __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_15, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 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;
      #if CYTHON_COMPILING_IN_CPYTHON
      Py_ssize_t size = Py_SIZE(sequence);
      #else
      Py_ssize_t size = PySequence_Size(sequence);
      #endif
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      #if CYTHON_COMPILING_IN_CPYTHON
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_7 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_15 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_7 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_15 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_15);
      #else
      __pyx_t_7 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_15 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_15);
      #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_filename = __pyx_f[0]; __pyx_lineno = 1724; __pyx_clineno = __LINE__; goto __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_7 = __pyx_t_8(__pyx_t_13); if (unlikely(!__pyx_t_7)) goto __pyx_L112_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_7);
      index = 1; __pyx_t_15 = __pyx_t_8(__pyx_t_13); if (unlikely(!__pyx_t_15)) goto __pyx_L112_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_15);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_13), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_8 = NULL;
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      goto __pyx_L113_unpacking_done;
      __pyx_L112_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      __pyx_t_8 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_L113_unpacking_done:;
    }
    __pyx_v_x1 = __pyx_t_7;
    __pyx_t_7 = 0;
    __pyx_v_y1 = __pyx_t_15;
    __pyx_t_15 = 0;
    __Pyx_INCREF(__pyx_v_pj);
    __pyx_t_15 = __pyx_v_pj; __pyx_t_7 = NULL;
    __pyx_t_6 = 0;
    if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_15))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_15);
      if (likely(__pyx_t_7)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_15);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_15, function);
        __pyx_t_6 = 1;
      }
    }
    __pyx_t_13 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_13);
    if (__pyx_t_7) {
      __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_7); __pyx_t_7 = NULL;
    }
    __Pyx_INCREF(__pyx_v_lonmax);
    __Pyx_GIVEREF(__pyx_v_lonmax);
    PyTuple_SET_ITEM(__pyx_t_13, 0+__pyx_t_6, __pyx_v_lonmax);
    __Pyx_INCREF(__pyx_v_lat_0);
    __Pyx_GIVEREF(__pyx_v_lat_0);
    PyTuple_SET_ITEM(__pyx_t_13, 1+__pyx_t_6, __pyx_v_lat_0);
    __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_15, __pyx_t_13, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    if ((likely(PyTuple_CheckExact(__pyx_t_5))) || (PyList_CheckExact(__pyx_t_5))) {
      PyObject* sequence = __pyx_t_5;
      #if CYTHON_COMPILING_IN_CPYTHON
      Py_ssize_t size = Py_SIZE(sequence);
      #else
      Py_ssize_t size = PySequence_Size(sequence);
      #endif
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      #if CYTHON_COMPILING_IN_CPYTHON
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_15 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_13 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_15 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_13 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_15);
      __Pyx_INCREF(__pyx_t_13);
      #else
      __pyx_t_15 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_15);
      __pyx_t_13 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_13);
      #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_filename = __pyx_f[0]; __pyx_lineno = 1724; __pyx_clineno = __LINE__; goto __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_15 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_15)) goto __pyx_L114_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_15);
      index = 1; __pyx_t_13 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_13)) goto __pyx_L114_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_13);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_8 = NULL;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L115_unpacking_done;
      __pyx_L114_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_8 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_L115_unpacking_done:;
    }
    __pyx_v_x2 = __pyx_t_15;
    __pyx_t_15 = 0;
    __pyx_v_y2 = __pyx_t_13;
    __pyx_t_13 = 0;

    /* "pygrib.pyx":1725
 *             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_filename = __pyx_f[0]; __pyx_lineno = 1725; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1725; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_v_height = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "pygrib.pyx":1726
 *             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 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_dx); if (unlikely(__pyx_t_5 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1726; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_13 = __Pyx_PyNumber_Divide(__pyx_v_width, __pyx_t_5); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1726; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_13);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_v_dx = __pyx_t_13;
    __pyx_t_13 = 0;

    /* "pygrib.pyx":1727
 *             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_13 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_dy); if (unlikely(__pyx_t_13 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1727; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_13);
    __pyx_t_5 = __Pyx_PyNumber_Divide(__pyx_v_height, __pyx_t_13); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1727; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    __pyx_v_dy = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "pygrib.pyx":1728
 *             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_filename = __pyx_f[0]; __pyx_lineno = 1728; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_13 = PyNumber_Multiply(__pyx_v_dx, __pyx_t_5); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1728; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_13);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_v_xmax = __pyx_t_13;
    __pyx_t_13 = 0;
    __pyx_t_13 = __Pyx_PyInt_SubtractObjC(__pyx_v_ny, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1728; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_13);
    __pyx_t_5 = PyNumber_Multiply(__pyx_v_dy, __pyx_t_13); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1728; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    __pyx_v_ymax = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "pygrib.pyx":1729
 *             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_13 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1729; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_13);
    __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s_linspace); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1729; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_15);
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    __pyx_t_13 = PyNumber_Multiply(__pyx_float_neg_0_5, __pyx_v_xmax); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1729; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_13);
    __pyx_t_7 = PyNumber_Multiply(__pyx_float_0_5, __pyx_v_xmax); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1729; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_3 = NULL;
    __pyx_t_6 = 0;
    if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_15))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_15);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_15);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_15, function);
        __pyx_t_6 = 1;
      }
    }
    __pyx_t_14 = PyTuple_New(3+__pyx_t_6); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1729; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_14);
    if (__pyx_t_3) {
      __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_3); __pyx_t_3 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_13);
    PyTuple_SET_ITEM(__pyx_t_14, 0+__pyx_t_6, __pyx_t_13);
    __Pyx_GIVEREF(__pyx_t_7);
    PyTuple_SET_ITEM(__pyx_t_14, 1+__pyx_t_6, __pyx_t_7);
    __Pyx_INCREF(__pyx_v_nx);
    __Pyx_GIVEREF(__pyx_v_nx);
    PyTuple_SET_ITEM(__pyx_t_14, 2+__pyx_t_6, __pyx_v_nx);
    __pyx_t_13 = 0;
    __pyx_t_7 = 0;
    __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_15, __pyx_t_14, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1729; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    __pyx_v_x = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "pygrib.pyx":1730
 *             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_15 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1730; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_15);
    __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_15, __pyx_n_s_linspace); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1730; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_14);
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    __pyx_t_15 = PyNumber_Multiply(__pyx_float_neg_0_5, __pyx_v_ymax); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1730; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_15);
    __pyx_t_7 = PyNumber_Multiply(__pyx_float_0_5, __pyx_v_ymax); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1730; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_13 = NULL;
    __pyx_t_6 = 0;
    if (CYTHON_COMPILING_IN_CPYTHON && 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;
      }
    }
    __pyx_t_3 = PyTuple_New(3+__pyx_t_6); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1730; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    if (__pyx_t_13) {
      __Pyx_GIVEREF(__pyx_t_13); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_13); __pyx_t_13 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_15);
    PyTuple_SET_ITEM(__pyx_t_3, 0+__pyx_t_6, __pyx_t_15);
    __Pyx_GIVEREF(__pyx_t_7);
    PyTuple_SET_ITEM(__pyx_t_3, 1+__pyx_t_6, __pyx_t_7);
    __Pyx_INCREF(__pyx_v_ny);
    __Pyx_GIVEREF(__pyx_v_ny);
    PyTuple_SET_ITEM(__pyx_t_3, 2+__pyx_t_6, __pyx_v_ny);
    __pyx_t_15 = 0;
    __pyx_t_7 = 0;
    __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_14, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1730; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    __pyx_v_y = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "pygrib.pyx":1731
 *             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_14 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1731; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_14);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_14, __pyx_n_s_meshgrid); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1731; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    __pyx_t_14 = NULL;
    __pyx_t_6 = 0;
    if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_14)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_14);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
        __pyx_t_6 = 1;
      }
    }
    __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1731; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    if (__pyx_t_14) {
      __Pyx_GIVEREF(__pyx_t_14); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_14); __pyx_t_14 = 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_filename = __pyx_f[0]; __pyx_lineno = 1731; __pyx_clineno = __LINE__; goto __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;
      #if CYTHON_COMPILING_IN_CPYTHON
      Py_ssize_t size = Py_SIZE(sequence);
      #else
      Py_ssize_t size = PySequence_Size(sequence);
      #endif
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1731; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      #if CYTHON_COMPILING_IN_CPYTHON
      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_filename = __pyx_f[0]; __pyx_lineno = 1731; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_7 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1731; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1731; __pyx_clineno = __LINE__; goto __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_3 = __pyx_t_8(__pyx_t_14); if (unlikely(!__pyx_t_3)) goto __pyx_L116_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_3);
      index = 1; __pyx_t_7 = __pyx_t_8(__pyx_t_14); if (unlikely(!__pyx_t_7)) goto __pyx_L116_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_7);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_14), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1731; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_8 = NULL;
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
      goto __pyx_L117_unpacking_done;
      __pyx_L116_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
      __pyx_t_8 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1731; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_L117_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":1732
 *             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_filename = __pyx_f[0]; __pyx_lineno = 1732; __pyx_clineno = __LINE__; goto __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 = PyDict_New(); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1732; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_inverse, Py_True) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1732; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_v_pj, __pyx_t_5, __pyx_t_7); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1732; __pyx_clineno = __LINE__; goto __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;
      #if CYTHON_COMPILING_IN_CPYTHON
      Py_ssize_t size = Py_SIZE(sequence);
      #else
      Py_ssize_t size = PySequence_Size(sequence);
      #endif
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1732; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      #if CYTHON_COMPILING_IN_CPYTHON
      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_filename = __pyx_f[0]; __pyx_lineno = 1732; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1732; __pyx_clineno = __LINE__; goto __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_14 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1732; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_14);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 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_L118_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_L118_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_5);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_14), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1732; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_8 = NULL;
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
      goto __pyx_L119_unpacking_done;
      __pyx_L118_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
      __pyx_t_8 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1732; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_L119_unpacking_done:;
    }
    __pyx_v_lons = __pyx_t_7;
    __pyx_t_7 = 0;
    __pyx_v_lats = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "pygrib.pyx":1734
 *             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_filename = __pyx_f[0]; __pyx_lineno = 1734; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1734; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && 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_3 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_v_lons); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1734; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
    } else {
      __pyx_t_14 = PyTuple_New(1+1); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1734; __pyx_clineno = __LINE__; goto __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_lons);
      __Pyx_GIVEREF(__pyx_v_lons);
      PyTuple_SET_ITEM(__pyx_t_14, 0+1, __pyx_v_lons);
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_14, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1734; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    }
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_v_abslons = __pyx_t_3;
    __pyx_t_3 = 0;
    __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1734; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_fabs); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1734; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_14);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && 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_3 = __Pyx_PyObject_CallOneArg(__pyx_t_14, __pyx_v_lats); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1734; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
    } else {
      __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1734; __pyx_clineno = __LINE__; goto __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_3 = __Pyx_PyObject_Call(__pyx_t_14, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1734; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    }
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    __pyx_v_abslats = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "pygrib.pyx":1735
 *             # 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_14 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1735; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_14);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_14, __pyx_n_s_where); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1735; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    __pyx_t_14 = PyObject_RichCompare(__pyx_v_abslons, __pyx_float_1_e20, Py_LT); __Pyx_XGOTREF(__pyx_t_14); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1735; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_7 = NULL;
    __pyx_t_6 = 0;
    if (CYTHON_COMPILING_IN_CPYTHON && 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;
      }
    }
    __pyx_t_15 = PyTuple_New(3+__pyx_t_6); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1735; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_15);
    if (__pyx_t_7) {
      __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_7); __pyx_t_7 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_14);
    PyTuple_SET_ITEM(__pyx_t_15, 0+__pyx_t_6, __pyx_t_14);
    __Pyx_INCREF(__pyx_v_lons);
    __Pyx_GIVEREF(__pyx_v_lons);
    PyTuple_SET_ITEM(__pyx_t_15, 1+__pyx_t_6, __pyx_v_lons);
    __Pyx_INCREF(__pyx_float_1_e30);
    __Pyx_GIVEREF(__pyx_float_1_e30);
    PyTuple_SET_ITEM(__pyx_t_15, 2+__pyx_t_6, __pyx_float_1_e30);
    __pyx_t_14 = 0;
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_15, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1735; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF_SET(__pyx_v_lons, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "pygrib.pyx":1736
 *             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_filename = __pyx_f[0]; __pyx_lineno = 1736; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_where); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1736; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_15);
    __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_filename = __pyx_f[0]; __pyx_lineno = 1736; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_14 = NULL;
    __pyx_t_6 = 0;
    if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_15))) {
      __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_15);
      if (likely(__pyx_t_14)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_15);
        __Pyx_INCREF(__pyx_t_14);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_15, function);
        __pyx_t_6 = 1;
      }
    }
    __pyx_t_7 = PyTuple_New(3+__pyx_t_6); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1736; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    if (__pyx_t_14) {
      __Pyx_GIVEREF(__pyx_t_14); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_14); __pyx_t_14 = 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_3 = __Pyx_PyObject_Call(__pyx_t_15, __pyx_t_7, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1736; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    __Pyx_DECREF_SET(__pyx_v_lats, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "pygrib.pyx":1700
 *             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":1737
 *             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_3 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_gridType); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1737; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_t_3, __pyx_n_s_equatorial_azimuthal_equidistant, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1737; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__pyx_t_1) {

    /* "pygrib.pyx":1738
 *             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_3 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_Dx); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1738; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_15 = __Pyx_PyFloat_DivideObjC(__pyx_t_3, __pyx_float_1_e3, 1.e3, 0); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1738; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_15);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_dx = __pyx_t_15;
    __pyx_t_15 = 0;

    /* "pygrib.pyx":1739
 *         elif self['gridType'] == "equatorial_azimuthal_equidistant":
 *             dx = self['Dx']/1.e3
 *             dy = self['Dy']/1.e3             # <<<<<<<<<<<<<<
 *             lat1 = self['latitudeOfFirstGridPointInDegrees']
 *             lon1 = self['longitudeOfFirstGridPointInDegrees']
 */
    __pyx_t_15 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_Dy); if (unlikely(__pyx_t_15 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1739; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_15);
    __pyx_t_3 = __Pyx_PyFloat_DivideObjC(__pyx_t_15, __pyx_float_1_e3, 1.e3, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1739; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    __pyx_v_dy = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "pygrib.pyx":1740
 *             dx = self['Dx']/1.e3
 *             dy = self['Dy']/1.e3
 *             lat1 = self['latitudeOfFirstGridPointInDegrees']             # <<<<<<<<<<<<<<
 *             lon1 = self['longitudeOfFirstGridPointInDegrees']
 *             pj = pyproj.Proj(self.projparams)
 */
    __pyx_t_3 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_latitudeOfFirstGridPointInDegree); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1740; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_v_lat1 = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "pygrib.pyx":1741
 *             dy = self['Dy']/1.e3
 *             lat1 = self['latitudeOfFirstGridPointInDegrees']
 *             lon1 = self['longitudeOfFirstGridPointInDegrees']             # <<<<<<<<<<<<<<
 *             pj = pyproj.Proj(self.projparams)
 *             llcrnrx, llcrnry = pj(lon1,lat1)
 */
    __pyx_t_3 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_longitudeOfFirstGridPointInDegre); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1741; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_v_lon1 = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "pygrib.pyx":1742
 *             lat1 = self['latitudeOfFirstGridPointInDegrees']
 *             lon1 = self['longitudeOfFirstGridPointInDegrees']
 *             pj = pyproj.Proj(self.projparams)             # <<<<<<<<<<<<<<
 *             llcrnrx, llcrnry = pj(lon1,lat1)
 *             try:
 */
    __pyx_t_15 = __Pyx_GetModuleGlobalName(__pyx_n_s_pyproj); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1742; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_15);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_15, __pyx_n_s_Proj); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1742; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    __pyx_t_15 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_15 = PyMethod_GET_SELF(__pyx_t_7);
      if (likely(__pyx_t_15)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_15);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_7, function);
      }
    }
    if (!__pyx_t_15) {
      __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_v_self->projparams); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1742; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
    } else {
      __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1742; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_15); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_15); __pyx_t_15 = 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_3 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1742; __pyx_clineno = __LINE__; goto __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;
    __pyx_v_pj = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "pygrib.pyx":1743
 *             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_COMPILING_IN_CPYTHON && 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;
      }
    }
    __pyx_t_15 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1743; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_15);
    if (__pyx_t_5) {
      __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_5); __pyx_t_5 = NULL;
    }
    __Pyx_INCREF(__pyx_v_lon1);
    __Pyx_GIVEREF(__pyx_v_lon1);
    PyTuple_SET_ITEM(__pyx_t_15, 0+__pyx_t_6, __pyx_v_lon1);
    __Pyx_INCREF(__pyx_v_lat1);
    __Pyx_GIVEREF(__pyx_v_lat1);
    PyTuple_SET_ITEM(__pyx_t_15, 1+__pyx_t_6, __pyx_v_lat1);
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_15, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1743; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 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;
      #if CYTHON_COMPILING_IN_CPYTHON
      Py_ssize_t size = Py_SIZE(sequence);
      #else
      Py_ssize_t size = PySequence_Size(sequence);
      #endif
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1743; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      #if CYTHON_COMPILING_IN_CPYTHON
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_7 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_15 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_7 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_15 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_15);
      #else
      __pyx_t_7 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1743; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_15 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1743; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_15);
      #endif
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_5 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1743; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 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_L120_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_7);
      index = 1; __pyx_t_15 = __pyx_t_8(__pyx_t_5); if (unlikely(!__pyx_t_15)) goto __pyx_L120_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_15);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_5), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1743; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1743; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_L121_unpacking_done:;
    }
    __pyx_v_llcrnrx = __pyx_t_7;
    __pyx_t_7 = 0;
    __pyx_v_llcrnry = __pyx_t_15;
    __pyx_t_15 = 0;

    /* "pygrib.pyx":1744
 *             pj = pyproj.Proj(self.projparams)
 *             llcrnrx, llcrnry = pj(lon1,lat1)
 *             try:             # <<<<<<<<<<<<<<
 *                 nx = self['Nx']
 *                 ny = self['Ny']
 */
    {
      __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":1745
 *             llcrnrx, llcrnry = pj(lon1,lat1)
 *             try:
 *                 nx = self['Nx']             # <<<<<<<<<<<<<<
 *                 ny = self['Ny']
 *             except:
 */
        __pyx_t_3 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_Nx); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1745; __pyx_clineno = __LINE__; goto __pyx_L122_error;};
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_v_nx = __pyx_t_3;
        __pyx_t_3 = 0;

        /* "pygrib.pyx":1746
 *             try:
 *                 nx = self['Nx']
 *                 ny = self['Ny']             # <<<<<<<<<<<<<<
 *             except:
 *                 nx = self['Ni']
 */
        __pyx_t_3 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_Ny); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1746; __pyx_clineno = __LINE__; goto __pyx_L122_error;};
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_v_ny = __pyx_t_3;
        __pyx_t_3 = 0;

        /* "pygrib.pyx":1744
 *             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_L129_try_end;
      __pyx_L122_error:;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
      __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "pygrib.pyx":1747
 *                 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_15, &__pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1747; __pyx_clineno = __LINE__; goto __pyx_L124_except_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_GOTREF(__pyx_t_15);
        __Pyx_GOTREF(__pyx_t_7);

        /* "pygrib.pyx":1748
 *                 ny = self['Ny']
 *             except:
 *                 nx = self['Ni']             # <<<<<<<<<<<<<<
 *                 ny = self['Nj']
 *             x = llcrnrx+dx*np.arange(nx)
 */
        __pyx_t_5 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_Ni); if (unlikely(__pyx_t_5 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1748; __pyx_clineno = __LINE__; goto __pyx_L124_except_error;};
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_XDECREF_SET(__pyx_v_nx, __pyx_t_5);
        __pyx_t_5 = 0;

        /* "pygrib.pyx":1749
 *             except:
 *                 nx = self['Ni']
 *                 ny = self['Nj']             # <<<<<<<<<<<<<<
 *             x = llcrnrx+dx*np.arange(nx)
 *             y = llcrnry+dy*np.arange(ny)
 */
        __pyx_t_5 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_Nj); if (unlikely(__pyx_t_5 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1749; __pyx_clineno = __LINE__; goto __pyx_L124_except_error;};
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_XDECREF_SET(__pyx_v_ny, __pyx_t_5);
        __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        goto __pyx_L123_exception_handled;
      }
      __pyx_L124_except_error:;

      /* "pygrib.pyx":1744
 *             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_L123_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_L129_try_end:;
    }

    /* "pygrib.pyx":1750
 *                 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_15 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1750; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_15);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_15, __pyx_n_s_arange); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1750; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    __pyx_t_15 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_15 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_15)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_15);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    if (!__pyx_t_15) {
      __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_nx); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1750; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
    } else {
      __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1750; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_15); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_15); __pyx_t_15 = 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_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1750; __pyx_clineno = __LINE__; goto __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;
    __pyx_t_3 = PyNumber_Multiply(__pyx_v_dx, __pyx_t_7); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1750; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = PyNumber_Add(__pyx_v_llcrnrx, __pyx_t_3); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1750; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_x = __pyx_t_7;
    __pyx_t_7 = 0;

    /* "pygrib.pyx":1751
 *                 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_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1751; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1751; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && 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_ny); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1751; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
    } else {
      __pyx_t_15 = PyTuple_New(1+1); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1751; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_15);
      __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_3); __pyx_t_3 = NULL;
      __Pyx_INCREF(__pyx_v_ny);
      __Pyx_GIVEREF(__pyx_v_ny);
      PyTuple_SET_ITEM(__pyx_t_15, 0+1, __pyx_v_ny);
      __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_15, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1751; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 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_filename = __pyx_f[0]; __pyx_lineno = 1751; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1751; __pyx_clineno = __LINE__; goto __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":1752
 *             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_filename = __pyx_f[0]; __pyx_lineno = 1752; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_meshgrid); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1752; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_15);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = NULL;
    __pyx_t_6 = 0;
    if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_15))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_15);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_15);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_15, function);
        __pyx_t_6 = 1;
      }
    }
    __pyx_t_3 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1752; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    if (__pyx_t_5) {
      __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5); __pyx_t_5 = 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_7 = __Pyx_PyObject_Call(__pyx_t_15, __pyx_t_3, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1752; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    if ((likely(PyTuple_CheckExact(__pyx_t_7))) || (PyList_CheckExact(__pyx_t_7))) {
      PyObject* sequence = __pyx_t_7;
      #if CYTHON_COMPILING_IN_CPYTHON
      Py_ssize_t size = Py_SIZE(sequence);
      #else
      Py_ssize_t size = PySequence_Size(sequence);
      #endif
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1752; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      #if CYTHON_COMPILING_IN_CPYTHON
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_15 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_15 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_3 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_15);
      __Pyx_INCREF(__pyx_t_3);
      #else
      __pyx_t_15 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1752; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_15);
      __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1752; __pyx_clineno = __LINE__; goto __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_5 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1752; __pyx_clineno = __LINE__; goto __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_15 = __pyx_t_8(__pyx_t_5); if (unlikely(!__pyx_t_15)) goto __pyx_L132_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_15);
      index = 1; __pyx_t_3 = __pyx_t_8(__pyx_t_5); if (unlikely(!__pyx_t_3)) goto __pyx_L132_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_3);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_5), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1752; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1752; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_L133_unpacking_done:;
    }
    __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_15);
    __pyx_t_15 = 0;
    __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "pygrib.pyx":1753
 *             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_filename = __pyx_f[0]; __pyx_lineno = 1753; __pyx_clineno = __LINE__; goto __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_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1753; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_inverse, Py_True) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1753; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_15 = __Pyx_PyObject_Call(__pyx_v_pj, __pyx_t_7, __pyx_t_3); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1753; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_15);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if ((likely(PyTuple_CheckExact(__pyx_t_15))) || (PyList_CheckExact(__pyx_t_15))) {
      PyObject* sequence = __pyx_t_15;
      #if CYTHON_COMPILING_IN_CPYTHON
      Py_ssize_t size = Py_SIZE(sequence);
      #else
      Py_ssize_t size = PySequence_Size(sequence);
      #endif
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1753; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      #if CYTHON_COMPILING_IN_CPYTHON
      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_filename = __pyx_f[0]; __pyx_lineno = 1753; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_7 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1753; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      #endif
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_5 = PyObject_GetIter(__pyx_t_15); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1753; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
      __pyx_t_8 = Py_TYPE(__pyx_t_5)->tp_iternext;
      index = 0; __pyx_t_3 = __pyx_t_8(__pyx_t_5); if (unlikely(!__pyx_t_3)) goto __pyx_L134_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_3);
      index = 1; __pyx_t_7 = __pyx_t_8(__pyx_t_5); if (unlikely(!__pyx_t_7)) goto __pyx_L134_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_7);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_5), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1753; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1753; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_L135_unpacking_done:;
    }
    __pyx_v_lons = __pyx_t_3;
    __pyx_t_3 = 0;
    __pyx_v_lats = __pyx_t_7;
    __pyx_t_7 = 0;

    /* "pygrib.pyx":1737
 *             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":1754
 *             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_15 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_gridType); if (unlikely(__pyx_t_15 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1754; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __Pyx_GOTREF(__pyx_t_15);
  __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_t_15, __pyx_n_s_lambert_azimuthal_equal_area, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1754; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
  if (__pyx_t_1) {

    /* "pygrib.pyx":1755
 *             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_15 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_Dx); if (unlikely(__pyx_t_15 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1755; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_15);
    __pyx_t_7 = __Pyx_PyFloat_DivideObjC(__pyx_t_15, __pyx_float_1_e3, 1.e3, 0); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1755; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    __pyx_v_dx = __pyx_t_7;
    __pyx_t_7 = 0;

    /* "pygrib.pyx":1756
 *         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 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_Dy); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1756; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_15 = __Pyx_PyFloat_DivideObjC(__pyx_t_7, __pyx_float_1_e3, 1.e3, 0); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1756; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_15);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_v_dy = __pyx_t_15;
    __pyx_t_15 = 0;

    /* "pygrib.pyx":1757
 *             dx = self['Dx']/1.e3
 *             dy = self['Dy']/1.e3
 *             lat1 = self['latitudeOfFirstGridPointInDegrees']             # <<<<<<<<<<<<<<
 *             lon1 = self['longitudeOfFirstGridPointInDegrees']
 *             pj = pyproj.Proj(self.projparams)
 */
    __pyx_t_15 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_latitudeOfFirstGridPointInDegree); if (unlikely(__pyx_t_15 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1757; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_15);
    __pyx_v_lat1 = __pyx_t_15;
    __pyx_t_15 = 0;

    /* "pygrib.pyx":1758
 *             dy = self['Dy']/1.e3
 *             lat1 = self['latitudeOfFirstGridPointInDegrees']
 *             lon1 = self['longitudeOfFirstGridPointInDegrees']             # <<<<<<<<<<<<<<
 *             pj = pyproj.Proj(self.projparams)
 *             llcrnrx, llcrnry = pj(lon1,lat1)
 */
    __pyx_t_15 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_longitudeOfFirstGridPointInDegre); if (unlikely(__pyx_t_15 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1758; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_15);
    __pyx_v_lon1 = __pyx_t_15;
    __pyx_t_15 = 0;

    /* "pygrib.pyx":1759
 *             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_filename = __pyx_f[0]; __pyx_lineno = 1759; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1759; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && 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_15 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_self->projparams); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1759; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_15);
    } else {
      __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1759; __pyx_clineno = __LINE__; goto __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_15 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1759; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_15);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_pj = __pyx_t_15;
    __pyx_t_15 = 0;

    /* "pygrib.pyx":1760
 *             lon1 = self['longitudeOfFirstGridPointInDegrees']
 *             pj = pyproj.Proj(self.projparams)
 *             llcrnrx, llcrnry = pj(lon1,lat1)             # <<<<<<<<<<<<<<
 *             try:
 *                 nx = self['Nx']
 */
    __Pyx_INCREF(__pyx_v_pj);
    __pyx_t_3 = __pyx_v_pj; __pyx_t_5 = NULL;
    __pyx_t_6 = 0;
    if (CYTHON_COMPILING_IN_CPYTHON && unlikely(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);
        __pyx_t_6 = 1;
      }
    }
    __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1760; __pyx_clineno = __LINE__; goto __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_15 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_7, NULL); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1760; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_15);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if ((likely(PyTuple_CheckExact(__pyx_t_15))) || (PyList_CheckExact(__pyx_t_15))) {
      PyObject* sequence = __pyx_t_15;
      #if CYTHON_COMPILING_IN_CPYTHON
      Py_ssize_t size = Py_SIZE(sequence);
      #else
      Py_ssize_t size = PySequence_Size(sequence);
      #endif
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1760; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      #if CYTHON_COMPILING_IN_CPYTHON
      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_filename = __pyx_f[0]; __pyx_lineno = 1760; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_7 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1760; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      #endif
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_5 = PyObject_GetIter(__pyx_t_15); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1760; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
      __pyx_t_8 = Py_TYPE(__pyx_t_5)->tp_iternext;
      index = 0; __pyx_t_3 = __pyx_t_8(__pyx_t_5); if (unlikely(!__pyx_t_3)) goto __pyx_L136_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_3);
      index = 1; __pyx_t_7 = __pyx_t_8(__pyx_t_5); if (unlikely(!__pyx_t_7)) goto __pyx_L136_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_7);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_5), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1760; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_8 = NULL;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      goto __pyx_L137_unpacking_done;
      __pyx_L136_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_8 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1760; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_L137_unpacking_done:;
    }
    __pyx_v_llcrnrx = __pyx_t_3;
    __pyx_t_3 = 0;
    __pyx_v_llcrnry = __pyx_t_7;
    __pyx_t_7 = 0;

    /* "pygrib.pyx":1761
 *             pj = pyproj.Proj(self.projparams)
 *             llcrnrx, llcrnry = pj(lon1,lat1)
 *             try:             # <<<<<<<<<<<<<<
 *                 nx = self['Nx']
 *                 ny = self['Ny']
 */
    {
      __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":1762
 *             llcrnrx, llcrnry = pj(lon1,lat1)
 *             try:
 *                 nx = self['Nx']             # <<<<<<<<<<<<<<
 *                 ny = self['Ny']
 *             except:
 */
        __pyx_t_15 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_Nx); if (unlikely(__pyx_t_15 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1762; __pyx_clineno = __LINE__; goto __pyx_L138_error;};
        __Pyx_GOTREF(__pyx_t_15);
        __pyx_v_nx = __pyx_t_15;
        __pyx_t_15 = 0;

        /* "pygrib.pyx":1763
 *             try:
 *                 nx = self['Nx']
 *                 ny = self['Ny']             # <<<<<<<<<<<<<<
 *             except:
 *                 nx = self['Ni']
 */
        __pyx_t_15 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_Ny); if (unlikely(__pyx_t_15 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1763; __pyx_clineno = __LINE__; goto __pyx_L138_error;};
        __Pyx_GOTREF(__pyx_t_15);
        __pyx_v_ny = __pyx_t_15;
        __pyx_t_15 = 0;

        /* "pygrib.pyx":1761
 *             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_L145_try_end;
      __pyx_L138_error:;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
      __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 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;
      __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;

      /* "pygrib.pyx":1764
 *                 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_15, &__pyx_t_7, &__pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1764; __pyx_clineno = __LINE__; goto __pyx_L140_except_error;}
        __Pyx_GOTREF(__pyx_t_15);
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_GOTREF(__pyx_t_3);

        /* "pygrib.pyx":1765
 *                 ny = self['Ny']
 *             except:
 *                 nx = self['Ni']             # <<<<<<<<<<<<<<
 *                 ny = self['Nj']
 *             x = llcrnrx+dx*np.arange(nx)
 */
        __pyx_t_5 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_Ni); if (unlikely(__pyx_t_5 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1765; __pyx_clineno = __LINE__; goto __pyx_L140_except_error;};
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_XDECREF_SET(__pyx_v_nx, __pyx_t_5);
        __pyx_t_5 = 0;

        /* "pygrib.pyx":1766
 *             except:
 *                 nx = self['Ni']
 *                 ny = self['Nj']             # <<<<<<<<<<<<<<
 *             x = llcrnrx+dx*np.arange(nx)
 *             y = llcrnry+dy*np.arange(ny)
 */
        __pyx_t_5 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_Nj); if (unlikely(__pyx_t_5 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1766; __pyx_clineno = __LINE__; goto __pyx_L140_except_error;};
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_XDECREF_SET(__pyx_v_ny, __pyx_t_5);
        __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        goto __pyx_L139_exception_handled;
      }
      __pyx_L140_except_error:;

      /* "pygrib.pyx":1761
 *             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_L139_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_L145_try_end:;
    }

    /* "pygrib.pyx":1767
 *                 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_filename = __pyx_f[0]; __pyx_lineno = 1767; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_arange); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1767; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_15);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_15))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_15);
      if (likely(__pyx_t_7)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_15);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_15, function);
      }
    }
    if (!__pyx_t_7) {
      __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_15, __pyx_v_nx); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1767; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
    } else {
      __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1767; __pyx_clineno = __LINE__; goto __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_3 = __Pyx_PyObject_Call(__pyx_t_15, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1767; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    }
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    __pyx_t_15 = PyNumber_Multiply(__pyx_v_dx, __pyx_t_3); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1767; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_15);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyNumber_Add(__pyx_v_llcrnrx, __pyx_t_15); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1767; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    __pyx_v_x = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "pygrib.pyx":1768
 *                 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_15 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1768; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_15);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_15, __pyx_n_s_arange); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1768; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    __pyx_t_15 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_15 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_15)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_15);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
      }
    }
    if (!__pyx_t_15) {
      __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_ny); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1768; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
    } else {
      __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1768; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_GIVEREF(__pyx_t_15); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_15); __pyx_t_15 = NULL;
      __Pyx_INCREF(__pyx_v_ny);
      __Pyx_GIVEREF(__pyx_v_ny);
      PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_v_ny);
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_7, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1768; __pyx_clineno = __LINE__; goto __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_t_5 = PyNumber_Multiply(__pyx_v_dy, __pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1768; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyNumber_Add(__pyx_v_llcrnry, __pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1768; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_v_y = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "pygrib.pyx":1769
 *             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_filename = __pyx_f[0]; __pyx_lineno = 1769; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1769; __pyx_clineno = __LINE__; goto __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_COMPILING_IN_CPYTHON && 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;
      }
    }
    __pyx_t_15 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1769; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_15);
    if (__pyx_t_5) {
      __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_5); __pyx_t_5 = NULL;
    }
    __Pyx_INCREF(__pyx_v_x);
    __Pyx_GIVEREF(__pyx_v_x);
    PyTuple_SET_ITEM(__pyx_t_15, 0+__pyx_t_6, __pyx_v_x);
    __Pyx_INCREF(__pyx_v_y);
    __Pyx_GIVEREF(__pyx_v_y);
    PyTuple_SET_ITEM(__pyx_t_15, 1+__pyx_t_6, __pyx_v_y);
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_15, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1769; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 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;
      #if CYTHON_COMPILING_IN_CPYTHON
      Py_ssize_t size = Py_SIZE(sequence);
      #else
      Py_ssize_t size = PySequence_Size(sequence);
      #endif
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1769; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      #if CYTHON_COMPILING_IN_CPYTHON
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_7 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_15 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_7 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_15 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_15);
      #else
      __pyx_t_7 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1769; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_15 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1769; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_15);
      #endif
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_5 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1769; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 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_L148_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_7);
      index = 1; __pyx_t_15 = __pyx_t_8(__pyx_t_5); if (unlikely(!__pyx_t_15)) goto __pyx_L148_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_15);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_5), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1769; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_8 = NULL;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      goto __pyx_L149_unpacking_done;
      __pyx_L148_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_8 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1769; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_L149_unpacking_done:;
    }
    __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_7);
    __pyx_t_7 = 0;
    __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_15);
    __pyx_t_15 = 0;

    /* "pygrib.pyx":1770
 *             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_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1770; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v_x);
    __Pyx_GIVEREF(__pyx_v_x);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_x);
    __Pyx_INCREF(__pyx_v_y);
    __Pyx_GIVEREF(__pyx_v_y);
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_y);
    __pyx_t_15 = PyDict_New(); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1770; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_15);
    if (PyDict_SetItem(__pyx_t_15, __pyx_n_s_inverse, Py_True) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1770; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_7 = __Pyx_PyObject_Call(__pyx_v_pj, __pyx_t_3, __pyx_t_15); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1770; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    if ((likely(PyTuple_CheckExact(__pyx_t_7))) || (PyList_CheckExact(__pyx_t_7))) {
      PyObject* sequence = __pyx_t_7;
      #if CYTHON_COMPILING_IN_CPYTHON
      Py_ssize_t size = Py_SIZE(sequence);
      #else
      Py_ssize_t size = PySequence_Size(sequence);
      #endif
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1770; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      #if CYTHON_COMPILING_IN_CPYTHON
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_15 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_15 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_3 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_15);
      __Pyx_INCREF(__pyx_t_3);
      #else
      __pyx_t_15 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1770; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_15);
      __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1770; __pyx_clineno = __LINE__; goto __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_5 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1770; __pyx_clineno = __LINE__; goto __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_15 = __pyx_t_8(__pyx_t_5); if (unlikely(!__pyx_t_15)) goto __pyx_L150_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_15);
      index = 1; __pyx_t_3 = __pyx_t_8(__pyx_t_5); if (unlikely(!__pyx_t_3)) goto __pyx_L150_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_3);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_5), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1770; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_8 = NULL;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      goto __pyx_L151_unpacking_done;
      __pyx_L150_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_8 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1770; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_L151_unpacking_done:;
    }
    __pyx_v_lons = __pyx_t_15;
    __pyx_t_15 = 0;
    __pyx_v_lats = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "pygrib.pyx":1754
 *             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":1771
 *             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 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_gridType); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1771; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1771; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (__pyx_t_1) {

    /* "pygrib.pyx":1772
 *             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_filename = __pyx_f[0]; __pyx_lineno = 1772; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_tuple__97, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1772; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_v_scale = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "pygrib.pyx":1773
 *         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_filename = __pyx_f[0]; __pyx_lineno = 1773; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (__pyx_t_1) {

      /* "pygrib.pyx":1774
 *             scale = self._get_key('grib2divider',False)
 *             if scale:
 *                 scale = float(scale)             # <<<<<<<<<<<<<<
 *             else:
 *                 scale = 1000.
 */
      __pyx_t_12 = __Pyx_PyObject_AsDouble(__pyx_v_scale); if (unlikely(__pyx_t_12 == ((double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1774; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_3 = PyFloat_FromDouble(__pyx_t_12); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1774; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF_SET(__pyx_v_scale, __pyx_t_3);
      __pyx_t_3 = 0;

      /* "pygrib.pyx":1773
 *         elif self['gridType'] == 'mercator':
 *             scale = self._get_key('grib2divider',False)
 *             if scale:             # <<<<<<<<<<<<<<
 *                 scale = float(scale)
 *             else:
 */
      goto __pyx_L152;
    }

    /* "pygrib.pyx":1776
 *                 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_L152:;

    /* "pygrib.pyx":1777
 *             else:
 *                 scale = 1000.
 *             lon1 = self['longitudeOfFirstGridPoint']/scale             # <<<<<<<<<<<<<<
 *             lon2 = self['longitudeOfLastGridPoint']/scale
 *             if self._get_key('truncateDegrees',False):
 */
    __pyx_t_3 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_longitudeOfFirstGridPoint); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1777; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_7 = __Pyx_PyNumber_Divide(__pyx_t_3, __pyx_v_scale); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1777; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_lon1 = __pyx_t_7;
    __pyx_t_7 = 0;

    /* "pygrib.pyx":1778
 *                 scale = 1000.
 *             lon1 = self['longitudeOfFirstGridPoint']/scale
 *             lon2 = self['longitudeOfLastGridPoint']/scale             # <<<<<<<<<<<<<<
 *             if self._get_key('truncateDegrees',False):
 *                 lon1 = int(lon1)
 */
    __pyx_t_7 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_longitudeOfLastGridPoint); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1778; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_3 = __Pyx_PyNumber_Divide(__pyx_t_7, __pyx_v_scale); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1778; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_v_lon2 = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "pygrib.pyx":1779
 *             lon1 = self['longitudeOfFirstGridPoint']/scale
 *             lon2 = self['longitudeOfLastGridPoint']/scale
 *             if self._get_key('truncateDegrees',False):             # <<<<<<<<<<<<<<
 *                 lon1 = int(lon1)
 *                 lon2 = int(lon2)
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_get_key); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1779; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__98, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1779; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1779; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (__pyx_t_1) {

      /* "pygrib.pyx":1780
 *             lon2 = self['longitudeOfLastGridPoint']/scale
 *             if self._get_key('truncateDegrees',False):
 *                 lon1 = int(lon1)             # <<<<<<<<<<<<<<
 *                 lon2 = int(lon2)
 *             lat1 = self['latitudeOfFirstGridPoint']/scale
 */
      __pyx_t_7 = PyNumber_Int(__pyx_v_lon1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1780; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF_SET(__pyx_v_lon1, __pyx_t_7);
      __pyx_t_7 = 0;

      /* "pygrib.pyx":1781
 *             if self._get_key('truncateDegrees',False):
 *                 lon1 = int(lon1)
 *                 lon2 = int(lon2)             # <<<<<<<<<<<<<<
 *             lat1 = self['latitudeOfFirstGridPoint']/scale
 *             lat2 = self['latitudeOfLastGridPoint']/scale
 */
      __pyx_t_7 = PyNumber_Int(__pyx_v_lon2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1781; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF_SET(__pyx_v_lon2, __pyx_t_7);
      __pyx_t_7 = 0;

      /* "pygrib.pyx":1779
 *             lon1 = self['longitudeOfFirstGridPoint']/scale
 *             lon2 = self['longitudeOfLastGridPoint']/scale
 *             if self._get_key('truncateDegrees',False):             # <<<<<<<<<<<<<<
 *                 lon1 = int(lon1)
 *                 lon2 = int(lon2)
 */
    }

    /* "pygrib.pyx":1782
 *                 lon1 = int(lon1)
 *                 lon2 = int(lon2)
 *             lat1 = self['latitudeOfFirstGridPoint']/scale             # <<<<<<<<<<<<<<
 *             lat2 = self['latitudeOfLastGridPoint']/scale
 *             if self._get_key('truncateDegrees',False):
 */
    __pyx_t_7 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_latitudeOfFirstGridPoint); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1782; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_3 = __Pyx_PyNumber_Divide(__pyx_t_7, __pyx_v_scale); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1782; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_v_lat1 = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "pygrib.pyx":1783
 *                 lon2 = int(lon2)
 *             lat1 = self['latitudeOfFirstGridPoint']/scale
 *             lat2 = self['latitudeOfLastGridPoint']/scale             # <<<<<<<<<<<<<<
 *             if self._get_key('truncateDegrees',False):
 *                 lat1 = int(lat1)
 */
    __pyx_t_3 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_latitudeOfLastGridPoint); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1783; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_7 = __Pyx_PyNumber_Divide(__pyx_t_3, __pyx_v_scale); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1783; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_lat2 = __pyx_t_7;
    __pyx_t_7 = 0;

    /* "pygrib.pyx":1784
 *             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_filename = __pyx_f[0]; __pyx_lineno = 1784; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_tuple__99, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1784; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1784; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (__pyx_t_1) {

      /* "pygrib.pyx":1785
 *             lat2 = self['latitudeOfLastGridPoint']/scale
 *             if self._get_key('truncateDegrees',False):
 *                 lat1 = int(lat1)             # <<<<<<<<<<<<<<
 *                 lat2 = int(lat2)
 *             pj = pyproj.Proj(self.projparams)
 */
      __pyx_t_3 = PyNumber_Int(__pyx_v_lat1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1785; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF_SET(__pyx_v_lat1, __pyx_t_3);
      __pyx_t_3 = 0;

      /* "pygrib.pyx":1786
 *             if self._get_key('truncateDegrees',False):
 *                 lat1 = int(lat1)
 *                 lat2 = int(lat2)             # <<<<<<<<<<<<<<
 *             pj = pyproj.Proj(self.projparams)
 *             llcrnrx, llcrnry = pj(lon1,lat1)
 */
      __pyx_t_3 = PyNumber_Int(__pyx_v_lat2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1786; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF_SET(__pyx_v_lat2, __pyx_t_3);
      __pyx_t_3 = 0;

      /* "pygrib.pyx":1784
 *             lat1 = self['latitudeOfFirstGridPoint']/scale
 *             lat2 = self['latitudeOfLastGridPoint']/scale
 *             if self._get_key('truncateDegrees',False):             # <<<<<<<<<<<<<<
 *                 lat1 = int(lat1)
 *                 lat2 = int(lat2)
 */
    }

    /* "pygrib.pyx":1787
 *                 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_filename = __pyx_f[0]; __pyx_lineno = 1787; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_Proj); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1787; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_15);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_15))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_15);
      if (likely(__pyx_t_7)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_15);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_15, function);
      }
    }
    if (!__pyx_t_7) {
      __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_15, __pyx_v_self->projparams); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1787; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
    } else {
      __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1787; __pyx_clineno = __LINE__; goto __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_3 = __Pyx_PyObject_Call(__pyx_t_15, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1787; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    }
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    __pyx_v_pj = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "pygrib.pyx":1788
 *                 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_15 = __pyx_v_pj; __pyx_t_5 = NULL;
    __pyx_t_6 = 0;
    if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_15))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_15);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_15);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_15, function);
        __pyx_t_6 = 1;
      }
    }
    __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1788; __pyx_clineno = __LINE__; goto __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_3 = __Pyx_PyObject_Call(__pyx_t_15, __pyx_t_7, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1788; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) {
      PyObject* sequence = __pyx_t_3;
      #if CYTHON_COMPILING_IN_CPYTHON
      Py_ssize_t size = Py_SIZE(sequence);
      #else
      Py_ssize_t size = PySequence_Size(sequence);
      #endif
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1788; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      #if CYTHON_COMPILING_IN_CPYTHON
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_15 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_7 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_15 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_7 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_15);
      __Pyx_INCREF(__pyx_t_7);
      #else
      __pyx_t_15 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1788; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_15);
      __pyx_t_7 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1788; __pyx_clineno = __LINE__; goto __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_5 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1788; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_8 = Py_TYPE(__pyx_t_5)->tp_iternext;
      index = 0; __pyx_t_15 = __pyx_t_8(__pyx_t_5); if (unlikely(!__pyx_t_15)) goto __pyx_L155_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_15);
      index = 1; __pyx_t_7 = __pyx_t_8(__pyx_t_5); if (unlikely(!__pyx_t_7)) goto __pyx_L155_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_7);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_5), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1788; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_8 = NULL;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      goto __pyx_L156_unpacking_done;
      __pyx_L155_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_8 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1788; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_L156_unpacking_done:;
    }
    __pyx_v_llcrnrx = __pyx_t_15;
    __pyx_t_15 = 0;
    __pyx_v_llcrnry = __pyx_t_7;
    __pyx_t_7 = 0;

    /* "pygrib.pyx":1789
 *             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_15 = NULL;
    __pyx_t_6 = 0;
    if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_15 = PyMethod_GET_SELF(__pyx_t_7);
      if (likely(__pyx_t_15)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_15);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_7, function);
        __pyx_t_6 = 1;
      }
    }
    __pyx_t_5 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1789; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    if (__pyx_t_15) {
      __Pyx_GIVEREF(__pyx_t_15); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_15); __pyx_t_15 = 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_3 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1789; __pyx_clineno = __LINE__; goto __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;
      #if CYTHON_COMPILING_IN_CPYTHON
      Py_ssize_t size = Py_SIZE(sequence);
      #else
      Py_ssize_t size = PySequence_Size(sequence);
      #endif
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1789; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      #if CYTHON_COMPILING_IN_CPYTHON
      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_filename = __pyx_f[0]; __pyx_lineno = 1789; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1789; __pyx_clineno = __LINE__; goto __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_15 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1789; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_15);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_8 = Py_TYPE(__pyx_t_15)->tp_iternext;
      index = 0; __pyx_t_7 = __pyx_t_8(__pyx_t_15); if (unlikely(!__pyx_t_7)) goto __pyx_L157_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_7);
      index = 1; __pyx_t_5 = __pyx_t_8(__pyx_t_15); if (unlikely(!__pyx_t_5)) goto __pyx_L157_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_5);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_15), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1789; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_8 = NULL;
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
      goto __pyx_L158_unpacking_done;
      __pyx_L157_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
      __pyx_t_8 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1789; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_L158_unpacking_done:;
    }
    __pyx_v_urcrnrx = __pyx_t_7;
    __pyx_t_7 = 0;
    __pyx_v_urcrnry = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "pygrib.pyx":1790
 *             llcrnrx, llcrnry = pj(lon1,lat1)
 *             urcrnrx, urcrnry = pj(lon2,lat2)
 *             try:             # <<<<<<<<<<<<<<
 *                 nx = self['Nx']
 *                 ny = self['Ny']
 */
    {
      __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":1791
 *             urcrnrx, urcrnry = pj(lon2,lat2)
 *             try:
 *                 nx = self['Nx']             # <<<<<<<<<<<<<<
 *                 ny = self['Ny']
 *             except:
 */
        __pyx_t_3 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_Nx); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1791; __pyx_clineno = __LINE__; goto __pyx_L159_error;};
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_v_nx = __pyx_t_3;
        __pyx_t_3 = 0;

        /* "pygrib.pyx":1792
 *             try:
 *                 nx = self['Nx']
 *                 ny = self['Ny']             # <<<<<<<<<<<<<<
 *             except:
 *                 nx = self['Ni']
 */
        __pyx_t_3 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_Ny); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1792; __pyx_clineno = __LINE__; goto __pyx_L159_error;};
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_v_ny = __pyx_t_3;
        __pyx_t_3 = 0;

        /* "pygrib.pyx":1790
 *             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_L166_try_end;
      __pyx_L159_error:;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
      __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
      __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 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":1793
 *                 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_filename = __pyx_f[0]; __pyx_lineno = 1793; __pyx_clineno = __LINE__; goto __pyx_L161_except_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_GOTREF(__pyx_t_7);

        /* "pygrib.pyx":1794
 *                 ny = self['Ny']
 *             except:
 *                 nx = self['Ni']             # <<<<<<<<<<<<<<
 *                 ny = self['Nj']
 *             dx = (urcrnrx-llcrnrx)/(nx-1)
 */
        __pyx_t_15 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_Ni); if (unlikely(__pyx_t_15 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1794; __pyx_clineno = __LINE__; goto __pyx_L161_except_error;};
        __Pyx_GOTREF(__pyx_t_15);
        __Pyx_XDECREF_SET(__pyx_v_nx, __pyx_t_15);
        __pyx_t_15 = 0;

        /* "pygrib.pyx":1795
 *             except:
 *                 nx = self['Ni']
 *                 ny = self['Nj']             # <<<<<<<<<<<<<<
 *             dx = (urcrnrx-llcrnrx)/(nx-1)
 *             dy = (urcrnry-llcrnry)/(ny-1)
 */
        __pyx_t_15 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_Nj); if (unlikely(__pyx_t_15 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1795; __pyx_clineno = __LINE__; goto __pyx_L161_except_error;};
        __Pyx_GOTREF(__pyx_t_15);
        __Pyx_XDECREF_SET(__pyx_v_ny, __pyx_t_15);
        __pyx_t_15 = 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_L160_exception_handled;
      }
      __pyx_L161_except_error:;

      /* "pygrib.pyx":1790
 *             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_L160_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_L166_try_end:;
    }

    /* "pygrib.pyx":1796
 *                 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_filename = __pyx_f[0]; __pyx_lineno = 1796; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1796; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_3 = __Pyx_PyNumber_Divide(__pyx_t_7, __pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1796; __pyx_clineno = __LINE__; goto __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_dx = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "pygrib.pyx":1797
 *                 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_3 = PyNumber_Subtract(__pyx_v_urcrnry, __pyx_v_llcrnry); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1797; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = __Pyx_PyInt_SubtractObjC(__pyx_v_ny, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1797; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_7 = __Pyx_PyNumber_Divide(__pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1797; __pyx_clineno = __LINE__; goto __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;
    __pyx_v_dy = __pyx_t_7;
    __pyx_t_7 = 0;

    /* "pygrib.pyx":1798
 *             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_filename = __pyx_f[0]; __pyx_lineno = 1798; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_arange); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1798; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && unlikely(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_7 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_nx); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1798; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
    } else {
      __pyx_t_15 = PyTuple_New(1+1); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1798; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_15);
      __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_5); __pyx_t_5 = NULL;
      __Pyx_INCREF(__pyx_v_nx);
      __Pyx_GIVEREF(__pyx_v_nx);
      PyTuple_SET_ITEM(__pyx_t_15, 0+1, __pyx_v_nx);
      __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_15, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1798; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyNumber_Multiply(__pyx_v_dx, __pyx_t_7); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1798; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = PyNumber_Add(__pyx_v_llcrnrx, __pyx_t_3); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1798; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_x = __pyx_t_7;
    __pyx_t_7 = 0;

    /* "pygrib.pyx":1799
 *             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_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_arange); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_15);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_15))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_15);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_15);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_15, function);
      }
    }
    if (!__pyx_t_3) {
      __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_t_15, __pyx_v_ny); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
    } else {
      __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1799; __pyx_clineno = __LINE__; goto __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_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_15, __pyx_t_5, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    }
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    __pyx_t_15 = PyNumber_Multiply(__pyx_v_dy, __pyx_t_7); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_15);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = PyNumber_Add(__pyx_v_llcrnry, __pyx_t_15); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    __pyx_v_y = __pyx_t_7;
    __pyx_t_7 = 0;

    /* "pygrib.pyx":1800
 *             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_15 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1800; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_15);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_15, __pyx_n_s_meshgrid); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1800; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    __pyx_t_15 = NULL;
    __pyx_t_6 = 0;
    if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_15 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_15)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_15);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
        __pyx_t_6 = 1;
      }
    }
    __pyx_t_3 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1800; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    if (__pyx_t_15) {
      __Pyx_GIVEREF(__pyx_t_15); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_15); __pyx_t_15 = 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_7 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_3, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1800; __pyx_clineno = __LINE__; goto __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;
      #if CYTHON_COMPILING_IN_CPYTHON
      Py_ssize_t size = Py_SIZE(sequence);
      #else
      Py_ssize_t size = PySequence_Size(sequence);
      #endif
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1800; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      #if CYTHON_COMPILING_IN_CPYTHON
      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_filename = __pyx_f[0]; __pyx_lineno = 1800; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1800; __pyx_clineno = __LINE__; goto __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_15 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1800; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_15);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_8 = Py_TYPE(__pyx_t_15)->tp_iternext;
      index = 0; __pyx_t_5 = __pyx_t_8(__pyx_t_15); if (unlikely(!__pyx_t_5)) goto __pyx_L169_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_5);
      index = 1; __pyx_t_3 = __pyx_t_8(__pyx_t_15); if (unlikely(!__pyx_t_3)) goto __pyx_L169_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_3);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_15), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1800; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_8 = NULL;
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
      goto __pyx_L170_unpacking_done;
      __pyx_L169_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
      __pyx_t_8 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1800; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_L170_unpacking_done:;
    }
    __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_5);
    __pyx_t_5 = 0;
    __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "pygrib.pyx":1801
 *             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_filename = __pyx_f[0]; __pyx_lineno = 1801; __pyx_clineno = __LINE__; goto __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_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1801; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_inverse, Py_True) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1801; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_5 = __Pyx_PyObject_Call(__pyx_v_pj, __pyx_t_7, __pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1801; __pyx_clineno = __LINE__; goto __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;
      #if CYTHON_COMPILING_IN_CPYTHON
      Py_ssize_t size = Py_SIZE(sequence);
      #else
      Py_ssize_t size = PySequence_Size(sequence);
      #endif
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1801; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      #if CYTHON_COMPILING_IN_CPYTHON
      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_filename = __pyx_f[0]; __pyx_lineno = 1801; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_7 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1801; __pyx_clineno = __LINE__; goto __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_15 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1801; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_15);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_8 = Py_TYPE(__pyx_t_15)->tp_iternext;
      index = 0; __pyx_t_3 = __pyx_t_8(__pyx_t_15); if (unlikely(!__pyx_t_3)) goto __pyx_L171_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_3);
      index = 1; __pyx_t_7 = __pyx_t_8(__pyx_t_15); if (unlikely(!__pyx_t_7)) goto __pyx_L171_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_7);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_15), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1801; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_8 = NULL;
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
      goto __pyx_L172_unpacking_done;
      __pyx_L171_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
      __pyx_t_8 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1801; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_L172_unpacking_done:;
    }
    __pyx_v_lons = __pyx_t_3;
    __pyx_t_3 = 0;
    __pyx_v_lats = __pyx_t_7;
    __pyx_t_7 = 0;

    /* "pygrib.pyx":1771
 *             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":1802
 *             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 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_gridType); if (unlikely(__pyx_t_5 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1802; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1802; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (!__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L173_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_filename = __pyx_f[0]; __pyx_lineno = 1802; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_1 = __pyx_t_2;
  __pyx_L173_bool_binop_done:;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "pygrib.pyx":1803
 *             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 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_distinctLatitudes); if (unlikely(__pyx_t_5 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1803; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_v_rotatedlats = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "pygrib.pyx":1804
 *         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 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_distinctLongitudes); if (unlikely(__pyx_t_5 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1804; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_v_rotatedlons = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "pygrib.pyx":1805
 *             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_filename = __pyx_f[0]; __pyx_lineno = 1805; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1805; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1805; __pyx_clineno = __LINE__; goto __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":1806
 *             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_filename = __pyx_f[0]; __pyx_lineno = 1806; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_meshgrid); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1806; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __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_filename = __pyx_f[0]; __pyx_lineno = 1806; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_15 = PyNumber_Multiply(__pyx_v_rotatedlats, __pyx_v_d2r); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1806; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_15);
    __pyx_t_14 = NULL;
    __pyx_t_6 = 0;
    if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_14)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_14);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
        __pyx_t_6 = 1;
      }
    }
    __pyx_t_13 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1806; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_13);
    if (__pyx_t_14) {
      __Pyx_GIVEREF(__pyx_t_14); PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_14); __pyx_t_14 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_7);
    PyTuple_SET_ITEM(__pyx_t_13, 0+__pyx_t_6, __pyx_t_7);
    __Pyx_GIVEREF(__pyx_t_15);
    PyTuple_SET_ITEM(__pyx_t_13, 1+__pyx_t_6, __pyx_t_15);
    __pyx_t_7 = 0;
    __pyx_t_15 = 0;
    __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_13, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1806; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 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;
      #if CYTHON_COMPILING_IN_CPYTHON
      Py_ssize_t size = Py_SIZE(sequence);
      #else
      Py_ssize_t size = PySequence_Size(sequence);
      #endif
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1806; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      #if CYTHON_COMPILING_IN_CPYTHON
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_13 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_3 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_13 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_13);
      #else
      __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1806; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_13 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1806; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_13);
      #endif
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_15 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1806; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_15);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_8 = Py_TYPE(__pyx_t_15)->tp_iternext;
      index = 0; __pyx_t_3 = __pyx_t_8(__pyx_t_15); if (unlikely(!__pyx_t_3)) goto __pyx_L175_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_3);
      index = 1; __pyx_t_13 = __pyx_t_8(__pyx_t_15); if (unlikely(!__pyx_t_13)) goto __pyx_L175_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_13);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_15), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1806; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_8 = NULL;
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
      goto __pyx_L176_unpacking_done;
      __pyx_L175_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
      __pyx_t_8 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1806; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_L176_unpacking_done:;
    }
    __pyx_v_lonsr = __pyx_t_3;
    __pyx_t_3 = 0;
    __pyx_v_latsr = __pyx_t_13;
    __pyx_t_13 = 0;

    /* "pygrib.pyx":1807
 *             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_13 = __Pyx_GetModuleGlobalName(__pyx_n_s_pyproj); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1807; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_13);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s_Proj); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1807; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    __pyx_t_13 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_13)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_13);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    if (!__pyx_t_13) {
      __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_self->projparams); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1807; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
    } else {
      __pyx_t_15 = PyTuple_New(1+1); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1807; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_15);
      __Pyx_GIVEREF(__pyx_t_13); PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_13); __pyx_t_13 = NULL;
      __Pyx_INCREF(__pyx_v_self->projparams);
      __Pyx_GIVEREF(__pyx_v_self->projparams);
      PyTuple_SET_ITEM(__pyx_t_15, 0+1, __pyx_v_self->projparams);
      __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_15, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1807; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_pj = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "pygrib.pyx":1808
 *             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_filename = __pyx_f[0]; __pyx_lineno = 1808; __pyx_clineno = __LINE__; goto __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_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1808; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_inverse, Py_True) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1808; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_15 = __Pyx_PyObject_Call(__pyx_v_pj, __pyx_t_5, __pyx_t_3); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1808; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_15);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if ((likely(PyTuple_CheckExact(__pyx_t_15))) || (PyList_CheckExact(__pyx_t_15))) {
      PyObject* sequence = __pyx_t_15;
      #if CYTHON_COMPILING_IN_CPYTHON
      Py_ssize_t size = Py_SIZE(sequence);
      #else
      Py_ssize_t size = PySequence_Size(sequence);
      #endif
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1808; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      #if CYTHON_COMPILING_IN_CPYTHON
      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_filename = __pyx_f[0]; __pyx_lineno = 1808; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1808; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      #endif
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_13 = PyObject_GetIter(__pyx_t_15); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1808; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_13);
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
      __pyx_t_8 = Py_TYPE(__pyx_t_13)->tp_iternext;
      index = 0; __pyx_t_3 = __pyx_t_8(__pyx_t_13); if (unlikely(!__pyx_t_3)) goto __pyx_L177_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_3);
      index = 1; __pyx_t_5 = __pyx_t_8(__pyx_t_13); if (unlikely(!__pyx_t_5)) goto __pyx_L177_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_5);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_13), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1808; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_8 = NULL;
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      goto __pyx_L178_unpacking_done;
      __pyx_L177_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      __pyx_t_8 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1808; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_L178_unpacking_done:;
    }
    __pyx_v_lons = __pyx_t_3;
    __pyx_t_3 = 0;
    __pyx_v_lats = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "pygrib.pyx":1802
 *             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":1810
 *             lons,lats = pj(lonsr,latsr,inverse=True)
 *         else:
 *             raise ValueError('unsupported grid %s' % self['gridType'])             # <<<<<<<<<<<<<<
 *         return lats, lons
 * 
 */
  /*else*/ {
    __pyx_t_15 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_n_s_gridType); if (unlikely(__pyx_t_15 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1810; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_15);
    __pyx_t_5 = __Pyx_PyString_Format(__pyx_kp_s_unsupported_grid_s, __pyx_t_15); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1810; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    __pyx_t_15 = PyTuple_New(1); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1810; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_15);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_5);
    __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_t_15, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1810; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    __Pyx_Raise(__pyx_t_5, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1810; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_L4:;

  /* "pygrib.pyx":1811
 *         else:
 *             raise ValueError('unsupported grid %s' % self['gridType'])
 *         return lats, lons             # <<<<<<<<<<<<<<
 * 
 * cdef class index(object):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1811; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(__pyx_v_lats);
  __Pyx_GIVEREF(__pyx_v_lats);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_lats);
  __Pyx_INCREF(__pyx_v_lons);
  __Pyx_GIVEREF(__pyx_v_lons);
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_lons);
  __pyx_r = __pyx_t_5;
  __pyx_t_5 = 0;
  goto __pyx_L0;

  /* "pygrib.pyx":1565
 *         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_13);
  __Pyx_XDECREF(__pyx_t_14);
  __Pyx_XDECREF(__pyx_t_15);
  __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":829
 *     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":830
 *     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;
}

/* "pygrib.pyx":1868
 *     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_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 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);
        case  0: break;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_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_filename = __pyx_f[0]; __pyx_lineno = 1868; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1868; __pyx_clineno = __LINE__; goto __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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "pygrib.pyx":1874
 *         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_filename = __pyx_f[0]; __pyx_lineno = 1874; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_bytestr = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pygrib.pyx":1875
 *         cdef char *keys
 *         bytestr = _strencode(filename)
 *         filenamec = bytestr             # <<<<<<<<<<<<<<
 *         if args == ():
 *             #raise ValueError('no keys specified for index')
 */
  __pyx_t_2 = __Pyx_PyObject_AsString(__pyx_v_bytestr); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1875; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_filenamec = __pyx_t_2;

  /* "pygrib.pyx":1876
 *         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_filename = __pyx_f[0]; __pyx_lineno = 1876; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1876; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_3) {

    /* "pygrib.pyx":1879
 *             #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":1880
 *             # 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 (__pyx_t_3) {

      /* "pygrib.pyx":1881
 *             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_filename = __pyx_f[0]; __pyx_lineno = 1881; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1881; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_1);
      PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
      __pyx_t_1 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1881; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_Raise(__pyx_t_1, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1881; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

      /* "pygrib.pyx":1880
 *             # 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":1876
 *         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":1883
 *                 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_1 = __Pyx_PyString_Join(__pyx_kp_s__100, __pyx_v_args); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1883; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = __pyx_f_6pygrib__strencode(__pyx_t_1, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1883; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF_SET(__pyx_v_bytestr, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "pygrib.pyx":1884
 *         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_AsString(__pyx_v_bytestr); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1884; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_keys = __pyx_t_2;

    /* "pygrib.pyx":1885
 *             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":1886
 *             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 (__pyx_t_3) {

      /* "pygrib.pyx":1887
 *             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_4 = __Pyx_PyBytes_FromString(grib_get_error_message(__pyx_v_err)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1887; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1887; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4);
      __pyx_t_4 = 0;
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_t_1, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1887; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_Raise(__pyx_t_4, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1887; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

      /* "pygrib.pyx":1886
 *             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":1888
 *             if err:
 *                 raise RuntimeError(grib_get_error_message(err))
 *             grbs = open(filename)             # <<<<<<<<<<<<<<
 *             if grbs.has_multi_field_msgs:
 *                 msg="""
 */
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1888; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_v_filename);
    __Pyx_GIVEREF(__pyx_v_filename);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_filename);
    __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_6pygrib_open), __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1888; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_v_grbs = ((struct __pyx_obj_6pygrib_open *)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "pygrib.pyx":1889
 *                 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_filename = __pyx_f[0]; __pyx_lineno = 1889; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (__pyx_t_3) {

      /* "pygrib.pyx":1892
 *                 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_1 = __Pyx_PyString_Format(__pyx_kp_s_file_s_has_multi_field_messages, __pyx_v_filename); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1892; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_v_msg = ((PyObject*)__pyx_t_1);
      __pyx_t_1 = 0;

      /* "pygrib.pyx":1893
 * 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_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_warnings); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_warn); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && 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_1 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_msg); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
      } else {
        __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
        __Pyx_INCREF(__pyx_v_msg);
        __Pyx_GIVEREF(__pyx_v_msg);
        PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_v_msg);
        __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      }
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "pygrib.pyx":1889
 *                 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":1894
 * 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_filename = __pyx_f[0]; __pyx_lineno = 1894; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && 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_1 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1894; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    } else {
      __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_5); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1894; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }
  __pyx_L3:;

  /* "pygrib.pyx":1868
 *     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":1895
 *                 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_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 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);
        case  0: break;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_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_filename = __pyx_f[0]; __pyx_lineno = 1895; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1895; __pyx_clineno = __LINE__; goto __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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "pygrib.pyx":1897
 *     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":1898
 *         # 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":1899
 *         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":1900
 *         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_filename = __pyx_f[0]; __pyx_lineno = 1900; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1900; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "pygrib.pyx":1902
 *         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_filename = __pyx_f[0]; __pyx_lineno = 1902; __pyx_clineno = __LINE__; goto __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_COMPILING_IN_CPYTHON
      __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_filename = __pyx_f[0]; __pyx_lineno = 1902; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #else
      __pyx_t_5 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1902; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1902; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_tuple__101, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1902; __pyx_clineno = __LINE__; goto __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 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1902; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1902; __pyx_clineno = __LINE__; goto __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":1904
 *             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_filename = __pyx_f[0]; __pyx_lineno = 1904; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_types = ((PyObject*)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "pygrib.pyx":1905
 *             # 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_COMPILING_IN_CPYTHON
      __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_filename = __pyx_f[0]; __pyx_lineno = 1905; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #else
      __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1905; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      #endif
      __Pyx_XDECREF_SET(__pyx_v_arg, __pyx_t_3);
      __pyx_t_3 = 0;

      /* "pygrib.pyx":1906
 *             types = []
 *             for arg in args:
 *                 try:             # <<<<<<<<<<<<<<
 *                     type = arg.split(':')[1]
 *                 except IndexError:
 */
      {
        __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":1907
 *             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_filename = __pyx_f[0]; __pyx_lineno = 1907; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
          __Pyx_GOTREF(__pyx_t_3);
          __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__102, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1907; __pyx_clineno = __LINE__; goto __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 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1907; __pyx_clineno = __LINE__; goto __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":1906
 *             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":1908
 *                 try:
 *                     type = arg.split(':')[1]
 *                 except IndexError:             # <<<<<<<<<<<<<<
 *                     type = None
 *                 types.append(type)
 */
        __pyx_t_10 = 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_filename = __pyx_f[0]; __pyx_lineno = 1908; __pyx_clineno = __LINE__; goto __pyx_L10_except_error;}
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_GOTREF(__pyx_t_6);

          /* "pygrib.pyx":1909
 *                     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":1906
 *             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":1910
 *                 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 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1910; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

      /* "pygrib.pyx":1905
 *             # 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":1911
 *                     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":1912
 *                 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":1900
 *         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":1895
 *                 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":1913
 *             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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__call__", 0);

  /* "pygrib.pyx":1915
 *     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_filename = __pyx_f[0]; __pyx_lineno = 1915; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1915; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "pygrib.pyx":1913
 *             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":1916
 *         """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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("select", 0);

  /* "pygrib.pyx":1950
 *         # 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":1951
 *         # 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_filename = __pyx_f[0]; __pyx_lineno = 1951; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1951; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1951; __pyx_clineno = __LINE__; goto __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_COMPILING_IN_CPYTHON
        __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_filename = __pyx_f[0]; __pyx_lineno = 1951; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1951; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      } else {
        if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __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_filename = __pyx_f[0]; __pyx_lineno = 1951; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1951; __pyx_clineno = __LINE__; goto __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(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1951; __pyx_clineno = __LINE__; goto __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;
      #if CYTHON_COMPILING_IN_CPYTHON
      Py_ssize_t size = Py_SIZE(sequence);
      #else
      Py_ssize_t size = PySequence_Size(sequence);
      #endif
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1951; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      #if CYTHON_COMPILING_IN_CPYTHON
      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_filename = __pyx_f[0]; __pyx_lineno = 1951; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1951; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1951; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1951; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1951; __pyx_clineno = __LINE__; goto __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":1952
 *         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_filename = __pyx_f[0]; __pyx_lineno = 1952; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_10 = (__pyx_t_11 != 0);
    __pyx_t_9 = __pyx_t_10;
    __pyx_L8_bool_binop_done:;
    if (__pyx_t_9) {

      /* "pygrib.pyx":1953
 *         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__103, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1953; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_Raise(__pyx_t_1, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1953; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

      /* "pygrib.pyx":1952
 *         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":1954
 *             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":1955
 *                 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_filename = __pyx_f[0]; __pyx_lineno = 1955; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_5 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && 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_filename = __pyx_f[0]; __pyx_lineno = 1955; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
      } else {
        __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1955; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1955; __pyx_clineno = __LINE__; goto __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 = PyObject_GetItem(__pyx_v_self->types, __pyx_t_1); if (unlikely(__pyx_t_6 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1955; __pyx_clineno = __LINE__; goto __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":1954
 *             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":1957
 *                 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":1958
 *             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_filename = __pyx_f[0]; __pyx_lineno = 1958; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_XDECREF_SET(__pyx_v_bytestr, __pyx_t_6);
    __pyx_t_6 = 0;

    /* "pygrib.pyx":1959
 *                 typ = None
 *             bytestr = _strencode(k)
 *             key = bytestr             # <<<<<<<<<<<<<<
 *             err = grib_index_get_size(self._gi, key, &size)
 *             if err:
 */
    __pyx_t_12 = __Pyx_PyObject_AsString(__pyx_v_bytestr); if (unlikely((!__pyx_t_12) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1959; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_key = __pyx_t_12;

    /* "pygrib.pyx":1960
 *             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":1961
 *             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 (__pyx_t_10) {

      /* "pygrib.pyx":1962
 *             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_filename = __pyx_f[0]; __pyx_lineno = 1962; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1962; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GIVEREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_6);
      __pyx_t_6 = 0;
      __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_t_1, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1962; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1962; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

      /* "pygrib.pyx":1961
 *             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":1963
 *             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_6 = __Pyx_PyInt_FromSize_t(__pyx_v_size); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1963; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_1 = PyNumber_Add(__pyx_v_sizetot, __pyx_t_6); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1963; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF_SET(__pyx_v_sizetot, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "pygrib.pyx":1965
 *             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":1966
 *             # 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":1965
 *             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":1967
 *             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_filename = __pyx_f[0]; __pyx_lineno = 1967; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (!__pyx_t_9) {
    } else {
      __pyx_t_10 = __pyx_t_9;
      goto __pyx_L14_bool_binop_done;
    }
    __pyx_t_1 = PyObject_RichCompare(((PyObject *)Py_TYPE(__pyx_v_v)), ((PyObject *)(&PyInt_Type)), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1967; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1967; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (!__pyx_t_9) {
    } else {
      __pyx_t_10 = __pyx_t_9;
      goto __pyx_L14_bool_binop_done;
    }
    __pyx_t_1 = PyObject_RichCompare(((PyObject *)Py_TYPE(__pyx_v_v)), ((PyObject *)(&PyLong_Type)), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1967; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1967; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_10 = __pyx_t_9;
    __pyx_L14_bool_binop_done:;
    if (__pyx_t_10) {

      /* "pygrib.pyx":1968
 *                 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_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1968; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_INCREF(__pyx_v_v);
      __Pyx_GIVEREF(__pyx_v_v);
      PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_v);
      __pyx_t_6 = __Pyx_PyObject_Call(((PyObject *)(&PyLong_Type)), __pyx_t_1, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1968; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_13 = __Pyx_PyInt_As_long(__pyx_t_6); if (unlikely((__pyx_t_13 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1968; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_v_longval = __pyx_t_13;

      /* "pygrib.pyx":1969
 *             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":1970
 *                 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 (__pyx_t_10) {

        /* "pygrib.pyx":1971
 *                 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_filename = __pyx_f[0]; __pyx_lineno = 1971; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1971; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_GIVEREF(__pyx_t_6);
        PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_6);
        __pyx_t_6 = 0;
        __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_t_1, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1971; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_6);
        __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_filename = __pyx_f[0]; __pyx_lineno = 1971; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

        /* "pygrib.pyx":1970
 *                 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":1967
 *             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":1972
 *                 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_filename = __pyx_f[0]; __pyx_lineno = 1972; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (!__pyx_t_9) {
    } else {
      __pyx_t_10 = __pyx_t_9;
      goto __pyx_L18_bool_binop_done;
    }
    __pyx_t_6 = PyObject_RichCompare(((PyObject *)Py_TYPE(__pyx_v_v)), ((PyObject *)(&PyFloat_Type)), Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1972; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1972; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_10 = __pyx_t_9;
    __pyx_L18_bool_binop_done:;
    if (__pyx_t_10) {

      /* "pygrib.pyx":1973
 *                     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)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1973; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_v_doubval = __pyx_t_14;

      /* "pygrib.pyx":1974
 *             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":1975
 *                 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 (__pyx_t_10) {

        /* "pygrib.pyx":1976
 *                 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_6 = __Pyx_PyBytes_FromString(grib_get_error_message(__pyx_v_err)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1976; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1976; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_GIVEREF(__pyx_t_6);
        PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_6);
        __pyx_t_6 = 0;
        __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_t_1, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1976; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1976; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

        /* "pygrib.pyx":1975
 *                 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":1972
 *                 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":1977
 *                 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_filename = __pyx_f[0]; __pyx_lineno = 1977; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1977; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_7 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && 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_filename = __pyx_f[0]; __pyx_lineno = 1977; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
    } else {
      __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1977; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1977; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1977; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_10 = __pyx_t_9;
    __pyx_L21_bool_binop_done:;
    if (__pyx_t_10) {

      /* "pygrib.pyx":1978
 *                     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_filename = __pyx_f[0]; __pyx_lineno = 1978; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF_SET(__pyx_v_bytestr, __pyx_t_6);
      __pyx_t_6 = 0;

      /* "pygrib.pyx":1979
 *             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_AsString(__pyx_v_bytestr); if (unlikely((!__pyx_t_12) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1979; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_v_strval = __pyx_t_12;

      /* "pygrib.pyx":1980
 *                 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":1981
 *                 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 (__pyx_t_10) {

        /* "pygrib.pyx":1982
 *                 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_filename = __pyx_f[0]; __pyx_lineno = 1982; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1982; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_GIVEREF(__pyx_t_6);
        PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_6);
        __pyx_t_6 = 0;
        __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_t_1, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1982; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1982; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

        /* "pygrib.pyx":1981
 *                 strval = bytestr
 *                 err = grib_index_select_string(self._gi, key, strval)
 *                 if err:             # <<<<<<<<<<<<<<
 *                     raise RuntimeError(grib_get_error_message(err))
 *             else:
 */
      }

      /* "pygrib.pyx":1977
 *                 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":1984
 *                     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_6 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__104, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1984; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_Raise(__pyx_t_6, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1984; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_L13:;

    /* "pygrib.pyx":1951
 *         # 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":1986
 *                 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_filename = __pyx_f[0]; __pyx_lineno = 1986; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1986; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_10) {

    /* "pygrib.pyx":1987
 *         # 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__105, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1987; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1987; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "pygrib.pyx":1986
 *                 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":1989
 *             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_filename = __pyx_f[0]; __pyx_lineno = 1989; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_grbs = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "pygrib.pyx":1990
 *         # 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":1991
 *         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":1992
 *         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":1993
 *             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":1992
 *         while 1:
 *             gh = grib_handle_new_from_index(self._gi, &err)
 *             if err or gh == NULL:             # <<<<<<<<<<<<<<
 *                 break
 *             else:
 */
    }

    /* "pygrib.pyx":1995
 *                 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_filename = __pyx_f[0]; __pyx_lineno = 1995; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF_SET(__pyx_v_messagenumber, __pyx_t_2);
      __pyx_t_2 = 0;
    }

    /* "pygrib.pyx":1996
 *             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_filename = __pyx_f[0]; __pyx_lineno = 1996; __pyx_clineno = __LINE__; goto __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 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1996; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "pygrib.pyx":1997
 *                 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":1998
 *             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 (__pyx_t_10) {

      /* "pygrib.pyx":1999
 *             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_filename = __pyx_f[0]; __pyx_lineno = 1999; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1999; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_2);
      __pyx_t_2 = 0;
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1999; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_Raise(__pyx_t_2, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1999; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

      /* "pygrib.pyx":1998
 *             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":2000
 *             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 = (__pyx_v_grbs != Py_None) && (PyList_GET_SIZE(__pyx_v_grbs) != 0);
  __pyx_t_9 = ((!__pyx_t_10) != 0);
  if (__pyx_t_9) {

    /* "pygrib.pyx":2001
 *                 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_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__106, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2001; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2001; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "pygrib.pyx":2000
 *             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":2003
 *             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":1916
 *         """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":2004
 *         # 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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("write", 0);

  /* "pygrib.pyx":2010
 *         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_filename = __pyx_f[0]; __pyx_lineno = 2010; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_bytestr = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pygrib.pyx":2011
 *         cdef char * filenamec
 *         bytestr = _strencode(filename)
 *         filenamec = bytestr             # <<<<<<<<<<<<<<
 *         err = grib_index_write(self._gi, filenamec);
 *         if err:
 */
  __pyx_t_2 = __Pyx_PyObject_AsString(__pyx_v_bytestr); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2011; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_filenamec = __pyx_t_2;

  /* "pygrib.pyx":2012
 *         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":2013
 *         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 (__pyx_t_3) {

    /* "pygrib.pyx":2014
 *         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_filename = __pyx_f[0]; __pyx_lineno = 2014; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2014; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
    __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2014; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2014; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "pygrib.pyx":2013
 *         filenamec = bytestr
 *         err = grib_index_write(self._gi, filenamec);
 *         if err:             # <<<<<<<<<<<<<<
 *             raise RuntimeError(grib_get_error_message(err))
 *     def close(self):
 */
  }

  /* "pygrib.pyx":2004
 *         # 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":2015
 *         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":2020
 * 
 *         deallocate C structures associated with class instance"""
 *         grib_index_delete(self._gi)             # <<<<<<<<<<<<<<
 *         self._gi = NULL
 * 
 */
  grib_index_delete(__pyx_v_self->_gi);

  /* "pygrib.pyx":2021
 *         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":2015
 *         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":2023
 *         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":2026
 *         # 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":2027
 *         # 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":2026
 *         # deallocate storage when there are no more references
 *         # to the object.
 *         if self._gi != NULL:             # <<<<<<<<<<<<<<
 *             grib_index_delete(self._gi)
 * 
 */
  }

  /* "pygrib.pyx":2023
 *         self._gi = NULL
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         # deallocate storage when there are no more references
 *         # to the object.
 */

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

/* "pygrib.pyx":1867
 * """
 *     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;
}

/* "pygrib.pyx":2029
 *             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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_is_stringlike", 0);

  /* "pygrib.pyx":2030
 * 
 * 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_filename = __pyx_f[0]; __pyx_lineno = 2030; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2030; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 2030; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2030; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 2030; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2030; __pyx_clineno = __LINE__; goto __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":2031
 * 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":2030
 * 
 * def _is_stringlike(a):
 *     if type(a) == str or type(a) == bytes or type(a) == unicode:             # <<<<<<<<<<<<<<
 *         return True
 *     else:
 */
  }

  /* "pygrib.pyx":2033
 *         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":2029
 *             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":2035
 *         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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_is_container", 0);

  /* "pygrib.pyx":2038
 *     # 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_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_filename = __pyx_f[0]; __pyx_lineno = 2038; __pyx_clineno = __LINE__; goto __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_L10_try_end;
    __pyx_L3_error:;

    /* "pygrib.pyx":2039
 *     # 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_filename = __pyx_f[0]; __pyx_lineno = 2039; __pyx_clineno = __LINE__; goto __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":2038
 *     # 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_L10_try_end:;
  }

  /* "pygrib.pyx":2040
 *     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_filename = __pyx_f[0]; __pyx_lineno = 2040; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_5 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && 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_filename = __pyx_f[0]; __pyx_lineno = 2040; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
  } else {
    __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2040; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 2040; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 2040; __pyx_clineno = __LINE__; goto __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":2041
 *     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":2035
 *         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":2043
 *     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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 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);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_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_filename = __pyx_f[0]; __pyx_lineno = 2043; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 2043; __pyx_clineno = __LINE__; goto __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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_find", 0);

  /* "pygrib.pyx":2048
 *     # 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_filename = __pyx_f[0]; __pyx_lineno = 2048; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 2048; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2048; __pyx_clineno = __LINE__; goto __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_COMPILING_IN_CPYTHON
        __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_filename = __pyx_f[0]; __pyx_lineno = 2048; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2048; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      } else {
        if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __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_filename = __pyx_f[0]; __pyx_lineno = 2048; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2048; __pyx_clineno = __LINE__; goto __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(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2048; __pyx_clineno = __LINE__; goto __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;
      #if CYTHON_COMPILING_IN_CPYTHON
      Py_ssize_t size = Py_SIZE(sequence);
      #else
      Py_ssize_t size = PySequence_Size(sequence);
      #endif
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2048; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      #if CYTHON_COMPILING_IN_CPYTHON
      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_filename = __pyx_f[0]; __pyx_lineno = 2048; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2048; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 2048; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 2048; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 2048; __pyx_clineno = __LINE__; goto __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":2049
 *     # 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_filename = __pyx_f[0]; __pyx_lineno = 2049; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_5 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && 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_filename = __pyx_f[0]; __pyx_lineno = 2049; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
    } else {
      __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2049; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 2049; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 2049; __pyx_clineno = __LINE__; goto __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":2051
 *         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_filename = __pyx_f[0]; __pyx_lineno = 2051; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && 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_filename = __pyx_f[0]; __pyx_lineno = 2051; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
    } else {
      __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2051; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 2051; __pyx_clineno = __LINE__; goto __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":2053
 *         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 = PyObject_HasAttr(__pyx_v_v, __pyx_n_s_call); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2053; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_iscallable = __pyx_t_10;

    /* "pygrib.pyx":2056
 *         # 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_filename = __pyx_f[0]; __pyx_lineno = 2056; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 2056; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 2056; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 2056; __pyx_clineno = __LINE__; goto __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":2057
 *         # 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":2056
 *         # 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":2058
 *         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_filename = __pyx_f[0]; __pyx_lineno = 2058; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 2058; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 2058; __pyx_clineno = __LINE__; goto __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":2059
 *             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":2058
 *         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":2060
 *         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_filename = __pyx_f[0]; __pyx_lineno = 2060; __pyx_clineno = __LINE__; goto __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_COMPILING_IN_CPYTHON && 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_filename = __pyx_f[0]; __pyx_lineno = 2060; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_GOTREF(__pyx_t_6);
    } else {
      __pyx_t_12 = PyTuple_New(1+1); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2060; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 2060; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 2060; __pyx_clineno = __LINE__; goto __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":2061
 *             continue
 *         elif iscallable and v(getattr(grb,k)): # v a function
 *             continue             # <<<<<<<<<<<<<<
 *         else:
 *             return False
 */
      goto __pyx_L3_continue;

      /* "pygrib.pyx":2060
 *         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":2063
 *             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":2048
 *     # 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":2064
 *         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":2043
 *     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":2066
 *     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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __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":2069
 *     # 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":2070
 *     # 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_filename = __pyx_f[0]; __pyx_lineno = 2070; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF_SET(__pyx_v_encoding, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "pygrib.pyx":2069
 *     # 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":2071
 *     if encoding is None:
 *         encoding = default_encoding
 *     try:             # <<<<<<<<<<<<<<
 *         return pystr.encode(encoding)
 *     except AttributeError:
 */
  {
    __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":2072
 *         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_filename = __pyx_f[0]; __pyx_lineno = 2072; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_8 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && 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_filename = __pyx_f[0]; __pyx_lineno = 2072; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
        __Pyx_GOTREF(__pyx_t_3);
      } else {
        __pyx_t_9 = PyTuple_New(1+1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2072; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 2072; __pyx_clineno = __LINE__; goto __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":2071
 *     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":2073
 *     try:
 *         return pystr.encode(encoding)
 *     except AttributeError:             # <<<<<<<<<<<<<<
 *         return pystr # already bytes?
 */
    __pyx_t_10 = 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_filename = __pyx_f[0]; __pyx_lineno = 2073; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_GOTREF(__pyx_t_9);

      /* "pygrib.pyx":2074
 *         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":2071
 *     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":2066
 *     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)) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_6pygrib_open(PyObject *o) {
  struct __pyx_obj_6pygrib_open *p = (struct __pyx_obj_6pygrib_open *)o;
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    ++Py_REFCNT(o);
    __pyx_pw_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},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_6pygrib_open[] = {
  {(char *)"name", __pyx_getprop_6pygrib_4open_name, __pyx_setprop_6pygrib_4open_name, 0, 0},
  {(char *)"messagenumber", __pyx_getprop_6pygrib_4open_messagenumber, __pyx_setprop_6pygrib_4open_messagenumber, 0, 0},
  {(char *)"messages", __pyx_getprop_6pygrib_4open_messages, __pyx_setprop_6pygrib_4open_messages, 0, 0},
  {(char *)"closed", __pyx_getprop_6pygrib_4open_closed, __pyx_setprop_6pygrib_4open_closed, 0, 0},
  {(char *)"has_multi_field_msgs", __pyx_getprop_6pygrib_4open_has_multi_field_msgs, __pyx_setprop_6pygrib_4open_has_multi_field_msgs, 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 PY_VERSION_HEX >= 0x030400a1
  if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    ++Py_REFCNT(o);
    __pyx_pw_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 = 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},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_6pygrib_gribmessage[] = {
  {(char *)"messagenumber", __pyx_getprop_6pygrib_11gribmessage_messagenumber, __pyx_setprop_6pygrib_11gribmessage_messagenumber, 0, 0},
  {(char *)"projparams", __pyx_getprop_6pygrib_11gribmessage_projparams, __pyx_setprop_6pygrib_11gribmessage_projparams, 0, 0},
  {(char *)"validDate", __pyx_getprop_6pygrib_11gribmessage_validDate, __pyx_setprop_6pygrib_11gribmessage_validDate, 0, 0},
  {(char *)"analDate", __pyx_getprop_6pygrib_11gribmessage_analDate, __pyx_setprop_6pygrib_11gribmessage_analDate, 0, 0},
  {(char *)"expand_reduced", __pyx_getprop_6pygrib_11gribmessage_expand_reduced, __pyx_setprop_6pygrib_11gribmessage_expand_reduced, 0, 0},
  {(char *)"_ro_keys", __pyx_getprop_6pygrib_11gribmessage__ro_keys, __pyx_setprop_6pygrib_11gribmessage__ro_keys, 0, 0},
  {(char *)"_all_keys", __pyx_getprop_6pygrib_11gribmessage__all_keys, __pyx_setprop_6pygrib_11gribmessage__all_keys, 0, 0},
  {(char *)"fcstimeunits", __pyx_getprop_6pygrib_11gribmessage_fcstimeunits, __pyx_setprop_6pygrib_11gribmessage_fcstimeunits, 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)) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_6pygrib_index(PyObject *o) {
  struct __pyx_obj_6pygrib_index *p = (struct __pyx_obj_6pygrib_index *)o;
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    ++Py_REFCNT(o);
    __pyx_pw_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},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_6pygrib_index[] = {
  {(char *)"keys", __pyx_getprop_6pygrib_5index_keys, __pyx_setprop_6pygrib_5index_keys, 0, 0},
  {(char *)"types", __pyx_getprop_6pygrib_5index_types, __pyx_setprop_6pygrib_5index_types, 0, 0},
  {(char *)"name", __pyx_getprop_6pygrib_5index_name, __pyx_setprop_6pygrib_5index_name, 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 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\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
static struct PyModuleDef __pyx_moduledef = {
  #if PY_VERSION_HEX < 0x03020000
    { PyObject_HEAD_INIT(NULL) NULL, 0, NULL },
  #else
    PyModuleDef_HEAD_INIT,
  #endif
    "pygrib",
    __pyx_k_Introduction_Python_module_for, /* m_doc */
    -1, /* m_size */
    __pyx_methods /* m_methods */,
    NULL, /* m_reload */
    NULL, /* m_traverse */
    NULL, /* m_clear */
    NULL /* m_free */
};
#endif

static __Pyx_StringTabEntry __pyx_string_tab[] = {
  {&__pyx_kp_s_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_2_0_2, __pyx_k_2_0_2, sizeof(__pyx_k_2_0_2), 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_Volumes_Drobo_python_pygrib_git, __pyx_k_Volumes_Drobo_python_pygrib_git, sizeof(__pyx_k_Volumes_Drobo_python_pygrib_git), 0, 0, 1, 0},
  {&__pyx_kp_s__100, __pyx_k__100, sizeof(__pyx_k__100), 0, 0, 1, 0},
  {&__pyx_kp_s__13, __pyx_k__13, sizeof(__pyx_k__13), 0, 0, 1, 0},
  {&__pyx_kp_s__18, __pyx_k__18, sizeof(__pyx_k__18), 0, 0, 1, 0},
  {&__pyx_kp_s__23, __pyx_k__23, sizeof(__pyx_k__23), 0, 0, 1, 0},
  {&__pyx_kp_s__24, __pyx_k__24, sizeof(__pyx_k__24), 0, 0, 1, 0},
  {&__pyx_kp_s__8, __pyx_k__8, sizeof(__pyx_k__8), 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_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_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_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_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_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_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_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_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_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_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_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_IOError = __Pyx_GetBuiltinName(__pyx_n_s_IOError); if (!__pyx_builtin_IOError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 394; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_StopIteration = __Pyx_GetBuiltinName(__pyx_n_s_StopIteration); if (!__pyx_builtin_StopIteration) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 426; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_n_s_RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #if PY_MAJOR_VERSION >= 3
  __pyx_builtin_xrange = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_xrange) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 445; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #else
  __pyx_builtin_xrange = __Pyx_GetBuiltinName(__pyx_n_s_xrange); if (!__pyx_builtin_xrange) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 445; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #endif
  __pyx_builtin_KeyError = __Pyx_GetBuiltinName(__pyx_n_s_KeyError); if (!__pyx_builtin_KeyError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 455; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 619; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_AttributeError = __Pyx_GetBuiltinName(__pyx_n_s_AttributeError); if (!__pyx_builtin_AttributeError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_IndexError = __Pyx_GetBuiltinName(__pyx_n_s_IndexError); if (!__pyx_builtin_IndexError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1908; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  return 0;
  __pyx_L1_error:;
  return -1;
}

static int __Pyx_InitCachedConstants(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);

  /* "pygrib.pyx":331
 *     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_filename = __pyx_f[0]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple_);
  __Pyx_GIVEREF(__pyx_tuple_);

  /* "pygrib.pyx":455
 *             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_filename = __pyx_f[0]; __pyx_lineno = 455; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__2);
  __Pyx_GIVEREF(__pyx_tuple__2);

  /* "pygrib.pyx":475
 *         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_filename = __pyx_f[0]; __pyx_lineno = 475; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__3);
  __Pyx_GIVEREF(__pyx_tuple__3);

  /* "pygrib.pyx":558
 *         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_filename = __pyx_f[0]; __pyx_lineno = 558; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__4);
  __Pyx_GIVEREF(__pyx_tuple__4);

  /* "pygrib.pyx":609
 *         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_filename = __pyx_f[0]; __pyx_lineno = 609; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__5);
  __Pyx_GIVEREF(__pyx_tuple__5);

  /* "pygrib.pyx":617
 *         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_filename = __pyx_f[0]; __pyx_lineno = 617; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__6);
  __Pyx_GIVEREF(__pyx_tuple__6);

  /* "pygrib.pyx":627
 *                 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_filename = __pyx_f[0]; __pyx_lineno = 627; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__7);
  __Pyx_GIVEREF(__pyx_tuple__7);

  /* "pygrib.pyx":712
 *     """
 *     grb.fcstimeunits = ""
 *     if grb.has_key('indicatorOfUnitOfTimeRange') and\             # <<<<<<<<<<<<<<
 *        grb.indicatorOfUnitOfTimeRange in _ftimedict:
 *         grb.fcstimeunits = _ftimedict[grb.indicatorOfUnitOfTimeRange]
 */
  __pyx_tuple__9 = PyTuple_Pack(1, __pyx_n_s_indicatorOfUnitOfTimeRange); if (unlikely(!__pyx_tuple__9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 712; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__9);
  __Pyx_GIVEREF(__pyx_tuple__9);

  /* "pygrib.pyx":715
 *        grb.indicatorOfUnitOfTimeRange in _ftimedict:
 *         grb.fcstimeunits = _ftimedict[grb.indicatorOfUnitOfTimeRange]
 *     if grb.has_key('forecastTime'):             # <<<<<<<<<<<<<<
 *         if grb.has_key('forecastTime'):
 *             ftime = grb.forecastTime
 */
  __pyx_tuple__10 = PyTuple_Pack(1, __pyx_n_s_forecastTime); if (unlikely(!__pyx_tuple__10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 715; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__10);
  __Pyx_GIVEREF(__pyx_tuple__10);

  /* "pygrib.pyx":716
 *         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__11 = PyTuple_Pack(1, __pyx_n_s_forecastTime); if (unlikely(!__pyx_tuple__11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 716; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__11);
  __Pyx_GIVEREF(__pyx_tuple__11);

  /* "pygrib.pyx":718
 *         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__12 = PyTuple_Pack(1, __pyx_n_s_stepRange); if (unlikely(!__pyx_tuple__12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 718; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__12);
  __Pyx_GIVEREF(__pyx_tuple__12);

  /* "pygrib.pyx":723
 *             # 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__14 = PyTuple_Pack(1, __pyx_kp_s__13); if (unlikely(!__pyx_tuple__14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__14);
  __Pyx_GIVEREF(__pyx_tuple__14);

  /* "pygrib.pyx":729
 *         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__15 = PyTuple_Pack(1, __pyx_n_s_julianDay); if (unlikely(!__pyx_tuple__15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 729; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__15);
  __Pyx_GIVEREF(__pyx_tuple__15);

  /* "pygrib.pyx":833
 *     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__16 = PyTuple_Pack(1, __pyx_kp_s_This_class_cannot_be_instantiate); if (unlikely(!__pyx_tuple__16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__16);
  __Pyx_GIVEREF(__pyx_tuple__16);

  /* "pygrib.pyx":856
 *         """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__17 = PyTuple_Pack(1, __pyx_n_s_name); if (unlikely(!__pyx_tuple__17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 856; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__17);
  __Pyx_GIVEREF(__pyx_tuple__17);

  /* "pygrib.pyx":859
 *             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__19 = PyTuple_Pack(1, __pyx_n_s_parameterName); if (unlikely(!__pyx_tuple__19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 859; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__19);
  __Pyx_GIVEREF(__pyx_tuple__19);

  /* "pygrib.pyx":861
 *             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__20 = PyTuple_Pack(1, __pyx_n_s_units); if (unlikely(!__pyx_tuple__20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 861; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__20);
  __Pyx_GIVEREF(__pyx_tuple__20);

  /* "pygrib.pyx":864
 *             if self['units'] != 'unknown':
 *                 inventory.append(':'+self['units'])
 *             elif self.valid_key('parameterUnits'):             # <<<<<<<<<<<<<<
 *                 inventory.append(':'+self['parameterUnits'])
 *         if self.valid_key('stepType'):
 */
  __pyx_tuple__21 = PyTuple_Pack(1, __pyx_n_s_parameterUnits); if (unlikely(!__pyx_tuple__21)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 864; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__21);
  __Pyx_GIVEREF(__pyx_tuple__21);

  /* "pygrib.pyx":866
 *             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__22 = PyTuple_Pack(1, __pyx_n_s_stepType); if (unlikely(!__pyx_tuple__22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 866; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__22);
  __Pyx_GIVEREF(__pyx_tuple__22);

  /* "pygrib.pyx":868
 *         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__25 = PyTuple_Pack(1, __pyx_n_s_typeOfGrid); if (unlikely(!__pyx_tuple__25)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 868; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__25);
  __Pyx_GIVEREF(__pyx_tuple__25);
  __pyx_tuple__26 = PyTuple_Pack(1, __pyx_n_s_gridType); if (unlikely(!__pyx_tuple__26)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 868; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__26);
  __Pyx_GIVEREF(__pyx_tuple__26);

  /* "pygrib.pyx":869
 *             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__27 = PyTuple_Pack(1, __pyx_n_s_typeOfGrid); if (unlikely(!__pyx_tuple__27)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 869; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__27);
  __Pyx_GIVEREF(__pyx_tuple__27);

  /* "pygrib.pyx":873
 *             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__28 = PyTuple_Pack(1, __pyx_n_s_typeOfLevel); if (unlikely(!__pyx_tuple__28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 873; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__28);
  __Pyx_GIVEREF(__pyx_tuple__28);

  /* "pygrib.pyx":875
 *         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__29 = PyTuple_Pack(1, __pyx_n_s_topLevel); if (unlikely(!__pyx_tuple__29)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 875; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__29);
  __Pyx_GIVEREF(__pyx_tuple__29);
  __pyx_tuple__30 = PyTuple_Pack(1, __pyx_n_s_bottomLevel); if (unlikely(!__pyx_tuple__30)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 875; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__30);
  __Pyx_GIVEREF(__pyx_tuple__30);

  /* "pygrib.pyx":878
 *             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__31 = PyTuple_Pack(1, __pyx_n_s_unitsOfFirstFixedSurface); if (unlikely(!__pyx_tuple__31)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 878; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__31);
  __Pyx_GIVEREF(__pyx_tuple__31);

  /* "pygrib.pyx":880
 *             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__32 = PyTuple_Pack(1, __pyx_n_s_typeOfFirstFixedSurface); if (unlikely(!__pyx_tuple__32)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 880; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__32);
  __Pyx_GIVEREF(__pyx_tuple__32);

  /* "pygrib.pyx":882
 *             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__33 = PyTuple_Pack(1, __pyx_n_s_scaledValueOfFirstFixedSurface); if (unlikely(!__pyx_tuple__33)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 882; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__33);
  __Pyx_GIVEREF(__pyx_tuple__33);

  /* "pygrib.pyx":883
 *                 toplev = self['topLevel']
 *                 if self.valid_key('scaledValueOfFirstFixedSurface') and\
 *                    self.valid_key('scaleFactorOfFirstFixedSurface'):             # <<<<<<<<<<<<<<
 *                    if self['scaleFactorOfFirstFixedSurface']:
 *                        toplev = self['scaledValueOfFirstFixedSurface']/\
 */
  __pyx_tuple__34 = PyTuple_Pack(1, __pyx_n_s_scaleFactorOfFirstFixedSurface); if (unlikely(!__pyx_tuple__34)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 883; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__34);
  __Pyx_GIVEREF(__pyx_tuple__34);

  /* "pygrib.pyx":889
 *                    else:
 *                        toplev = self['scaledValueOfFirstFixedSurface']
 *             if self.valid_key('typeOfSecondFixedSurface') and self['typeOfSecondFixedSurface'] != 255:             # <<<<<<<<<<<<<<
 *                 botlev = self['bottomLevel']
 *                 if self.valid_key('scaledValueOfSecondFixedSurface') and\
 */
  __pyx_tuple__35 = PyTuple_Pack(1, __pyx_n_s_typeOfSecondFixedSurface); if (unlikely(!__pyx_tuple__35)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 889; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__35);
  __Pyx_GIVEREF(__pyx_tuple__35);

  /* "pygrib.pyx":891
 *             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__36 = PyTuple_Pack(1, __pyx_n_s_scaledValueOfSecondFixedSurface); if (unlikely(!__pyx_tuple__36)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 891; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__36);
  __Pyx_GIVEREF(__pyx_tuple__36);

  /* "pygrib.pyx":892
 *                 botlev = self['bottomLevel']
 *                 if self.valid_key('scaledValueOfSecondFixedSurface') and\
 *                    self.valid_key('scaleFactorOfSecondFixedSurface'):             # <<<<<<<<<<<<<<
 *                    if self['scaleFactorOfSecondFixedSurface']:
 *                        botlev = self['scaledValueOfSecondFixedSurface']/\
 */
  __pyx_tuple__37 = PyTuple_Pack(1, __pyx_n_s_scaleFactorOfSecondFixedSurface); if (unlikely(!__pyx_tuple__37)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 892; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__37);
  __Pyx_GIVEREF(__pyx_tuple__37);

  /* "pygrib.pyx":907
 *             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__38 = PyTuple_Pack(1, __pyx_n_s_level); if (unlikely(!__pyx_tuple__38)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 907; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__38);
  __Pyx_GIVEREF(__pyx_tuple__38);

  /* "pygrib.pyx":909
 *         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__39 = PyTuple_Pack(1, __pyx_n_s_stepRange); if (unlikely(!__pyx_tuple__39)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 909; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__39);
  __Pyx_GIVEREF(__pyx_tuple__39);

  /* "pygrib.pyx":911
 *         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__40 = PyTuple_Pack(1, __pyx_n_s_stepType); if (unlikely(!__pyx_tuple__40)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 911; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__40);
  __Pyx_GIVEREF(__pyx_tuple__40);

  /* "pygrib.pyx":916
 *             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__41 = PyTuple_Pack(1, __pyx_n_s_forecastTime); if (unlikely(!__pyx_tuple__41)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 916; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__41);
  __Pyx_GIVEREF(__pyx_tuple__41);

  /* "pygrib.pyx":919
 *             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__42 = PyTuple_Pack(1, __pyx_n_s_dataDate); if (unlikely(!__pyx_tuple__42)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 919; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__42);
  __Pyx_GIVEREF(__pyx_tuple__42);
  __pyx_tuple__43 = PyTuple_Pack(1, __pyx_n_s_dataTime); if (unlikely(!__pyx_tuple__43)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 919; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__43);
  __Pyx_GIVEREF(__pyx_tuple__43);

  /* "pygrib.pyx":925
 *         #    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__44 = PyTuple_Pack(1, __pyx_n_s_perturbationNumber); if (unlikely(!__pyx_tuple__44)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 925; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__44);
  __Pyx_GIVEREF(__pyx_tuple__44);

  /* "pygrib.pyx":926
 *         #    ':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__45 = PyTuple_Pack(1, __pyx_n_s_typeOfEnsembleForecast); if (unlikely(!__pyx_tuple__45)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 926; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__45);
  __Pyx_GIVEREF(__pyx_tuple__45);

  /* "pygrib.pyx":937
 *             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__46 = PyTuple_Pack(1, __pyx_n_s_derivedForecast); if (unlikely(!__pyx_tuple__46)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 937; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__46);
  __Pyx_GIVEREF(__pyx_tuple__46);

  /* "pygrib.pyx":952
 *             elif self['derivedForecast'] == 6:
 *                 inventory.append(":ens mean of cluster")
 *         if self.valid_key('probabilityTypeName'):             # <<<<<<<<<<<<<<
 *             inventory.append(":"+self['probabilityTypeName'])
 *             lowerlim = None
 */
  __pyx_tuple__47 = PyTuple_Pack(1, __pyx_n_s_probabilityTypeName); if (unlikely(!__pyx_tuple__47)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 952; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__47);
  __Pyx_GIVEREF(__pyx_tuple__47);

  /* "pygrib.pyx":955
 *             inventory.append(":"+self['probabilityTypeName'])
 *             lowerlim = None
 *             if self.valid_key('scaledValueOfLowerLimit') and\             # <<<<<<<<<<<<<<
 *                self.valid_key('scaleFactorOfLowerLimit'):
 *                if self['scaledValueOfLowerLimit'] and\
 */
  __pyx_tuple__48 = PyTuple_Pack(1, __pyx_n_s_scaledValueOfLowerLimit); if (unlikely(!__pyx_tuple__48)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 955; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__48);
  __Pyx_GIVEREF(__pyx_tuple__48);

  /* "pygrib.pyx":956
 *             lowerlim = None
 *             if self.valid_key('scaledValueOfLowerLimit') and\
 *                self.valid_key('scaleFactorOfLowerLimit'):             # <<<<<<<<<<<<<<
 *                if self['scaledValueOfLowerLimit'] and\
 *                   self['scaleFactorOfLowerLimit']:
 */
  __pyx_tuple__49 = PyTuple_Pack(1, __pyx_n_s_scaleFactorOfLowerLimit); if (unlikely(!__pyx_tuple__49)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 956; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__49);
  __Pyx_GIVEREF(__pyx_tuple__49);

  /* "pygrib.pyx":962
 *                               np.power(10.0,self['scaleFactorOfLowerLimit'])
 *             upperlim = None
 *             if self.valid_key('scaledValueOfUpperLimit') and\             # <<<<<<<<<<<<<<
 *                self.valid_key('scaleFactorOfUpperLimit'):
 *                if self['scaledValueOfUpperLimit'] and\
 */
  __pyx_tuple__50 = PyTuple_Pack(1, __pyx_n_s_scaledValueOfUpperLimit); if (unlikely(!__pyx_tuple__50)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 962; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__50);
  __Pyx_GIVEREF(__pyx_tuple__50);

  /* "pygrib.pyx":963
 *             upperlim = None
 *             if self.valid_key('scaledValueOfUpperLimit') and\
 *                self.valid_key('scaleFactorOfUpperLimit'):             # <<<<<<<<<<<<<<
 *                if self['scaledValueOfUpperLimit'] and\
 *                   self['scaleFactorOfUpperLimit']:
 */
  __pyx_tuple__51 = PyTuple_Pack(1, __pyx_n_s_scaleFactorOfUpperLimit); if (unlikely(!__pyx_tuple__51)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 963; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__51);
  __Pyx_GIVEREF(__pyx_tuple__51);

  /* "pygrib.pyx":1096
 *             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__52 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__52)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1096; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_slice__52);
  __Pyx_GIVEREF(__pyx_slice__52);
  __pyx_tuple__53 = PyTuple_Pack(2, __pyx_slice__52, __pyx_int_0); if (unlikely(!__pyx_tuple__53)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1096; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__53);
  __Pyx_GIVEREF(__pyx_tuple__53);

  /* "pygrib.pyx":1097
 *             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__54 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__54)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1097; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_slice__54);
  __Pyx_GIVEREF(__pyx_slice__54);
  __pyx_tuple__55 = PyTuple_Pack(2, __pyx_int_0, __pyx_slice__54); if (unlikely(!__pyx_tuple__55)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1097; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__55);
  __Pyx_GIVEREF(__pyx_tuple__55);

  /* "pygrib.pyx":1194
 *         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__56 = PyTuple_Pack(1, __pyx_n_s_grid_complex); if (unlikely(!__pyx_tuple__56)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__56);
  __Pyx_GIVEREF(__pyx_tuple__56);

  /* "pygrib.pyx":1224
 *                 return longval
 *             else: # array
 *                 if self.has_key('jPointsAreConsecutive') and\             # <<<<<<<<<<<<<<
 *                    self['jPointsAreConsecutive']:
 *                     storageorder='F'
 */
  __pyx_tuple__57 = PyTuple_Pack(1, __pyx_n_s_jPointsAreConsecutive); if (unlikely(!__pyx_tuple__57)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1224; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__57);
  __Pyx_GIVEREF(__pyx_tuple__57);

  /* "pygrib.pyx":1244
 *                 return doubleval
 *             else: # array
 *                 if self.has_key('jPointsAreConsecutive') and\             # <<<<<<<<<<<<<<
 *                    self['jPointsAreConsecutive']:
 *                     storageorder='F'
 */
  __pyx_tuple__58 = PyTuple_Pack(1, __pyx_n_s_jPointsAreConsecutive); if (unlikely(!__pyx_tuple__58)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1244; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__58);
  __Pyx_GIVEREF(__pyx_tuple__58);

  /* "pygrib.pyx":1315
 *         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__59 = PyTuple_Pack(1, __pyx_n_s_grid_complex); if (unlikely(!__pyx_tuple__59)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1315; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__59);
  __Pyx_GIVEREF(__pyx_tuple__59);

  /* "pygrib.pyx":1331
 *         """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__60 = PyTuple_Pack(1, __pyx_kp_s_array_must_be_1d_or_2d); if (unlikely(!__pyx_tuple__60)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1331; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__60);
  __Pyx_GIVEREF(__pyx_tuple__60);

  /* "pygrib.pyx":1336
 *             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__61 = PyTuple_Pack(1, __pyx_n_s_reduced); if (unlikely(!__pyx_tuple__61)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1336; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__61);
  __Pyx_GIVEREF(__pyx_tuple__61);

  /* "pygrib.pyx":1338
 *         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__62 = PyTuple_Pack(1, __pyx_kp_s_reduced_grid_data_array_must_be); if (unlikely(!__pyx_tuple__62)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1338; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__62);
  __Pyx_GIVEREF(__pyx_tuple__62);

  /* "pygrib.pyx":1353
 *             if self['alternativeRowScanning']:
 *                 datsave = datarr.copy()
 *                 datarr[1::2,::-1] = datsave[1::2,:]             # <<<<<<<<<<<<<<
 *         return datarr
 *     def _reshape_mask(self, datarr):
 */
  __pyx_slice__63 = PySlice_New(__pyx_int_1, Py_None, __pyx_int_2); if (unlikely(!__pyx_slice__63)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1353; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_slice__63);
  __Pyx_GIVEREF(__pyx_slice__63);
  __pyx_slice__64 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__64)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1353; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_slice__64);
  __Pyx_GIVEREF(__pyx_slice__64);
  __pyx_tuple__65 = PyTuple_Pack(2, __pyx_slice__63, __pyx_slice__64); if (unlikely(!__pyx_tuple__65)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1353; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__65);
  __Pyx_GIVEREF(__pyx_tuple__65);
  __pyx_slice__66 = PySlice_New(__pyx_int_1, Py_None, __pyx_int_2); if (unlikely(!__pyx_slice__66)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1353; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_slice__66);
  __Pyx_GIVEREF(__pyx_slice__66);
  __pyx_slice__67 = PySlice_New(Py_None, Py_None, __pyx_int_neg_1); if (unlikely(!__pyx_slice__67)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1353; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_slice__67);
  __Pyx_GIVEREF(__pyx_slice__67);
  __pyx_tuple__68 = PyTuple_Pack(2, __pyx_slice__66, __pyx_slice__67); if (unlikely(!__pyx_tuple__68)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1353; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__68);
  __Pyx_GIVEREF(__pyx_tuple__68);

  /* "pygrib.pyx":1360
 *         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__69 = PyTuple_Pack(1, __pyx_kp_s_array_must_be_1d_or_2d); if (unlikely(!__pyx_tuple__69)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1360; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__69);
  __Pyx_GIVEREF(__pyx_tuple__69);

  /* "pygrib.pyx":1362
 *             raise ValueError('array must be 1d or 2d')
 *         # reduced grid.
 *         if self['gridType'].startswith('reduced'):             # <<<<<<<<<<<<<<
 *             try:
 *                 ny = self['Ny']
 */
  __pyx_tuple__70 = PyTuple_Pack(1, __pyx_n_s_reduced); if (unlikely(!__pyx_tuple__70)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1362; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__70);
  __Pyx_GIVEREF(__pyx_tuple__70);

  /* "pygrib.pyx":1367
 *             except:
 *                 ny = self['Nj']
 *             if self.has_key('missingValue'):             # <<<<<<<<<<<<<<
 *                 missval = self['missingValue']
 *             else:
 */
  __pyx_tuple__71 = PyTuple_Pack(1, __pyx_n_s_missingValue); if (unlikely(!__pyx_tuple__71)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1367; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__71);
  __Pyx_GIVEREF(__pyx_tuple__71);

  /* "pygrib.pyx":1376
 *             else:
 *                 nx = None
 *         elif self.has_key('Nx') and self.has_key('Ny'):             # <<<<<<<<<<<<<<
 *             nx = self['Nx']
 *             ny = self['Ny']
 */
  __pyx_tuple__72 = PyTuple_Pack(1, __pyx_n_s_Nx); if (unlikely(!__pyx_tuple__72)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1376; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__72);
  __Pyx_GIVEREF(__pyx_tuple__72);
  __pyx_tuple__73 = PyTuple_Pack(1, __pyx_n_s_Ny); if (unlikely(!__pyx_tuple__73)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1376; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__73);
  __Pyx_GIVEREF(__pyx_tuple__73);

  /* "pygrib.pyx":1380
 *             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__74 = PyTuple_Pack(1, __pyx_n_s_Ni); if (unlikely(!__pyx_tuple__74)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1380; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__74);
  __Pyx_GIVEREF(__pyx_tuple__74);
  __pyx_tuple__75 = PyTuple_Pack(1, __pyx_n_s_Nj); if (unlikely(!__pyx_tuple__75)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1380; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__75);
  __Pyx_GIVEREF(__pyx_tuple__75);

  /* "pygrib.pyx":1402
 *            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__76 = PySlice_New(__pyx_int_1, Py_None, __pyx_int_2); if (unlikely(!__pyx_slice__76)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1402; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_slice__76);
  __Pyx_GIVEREF(__pyx_slice__76);
  __pyx_slice__77 = PySlice_New(Py_None, Py_None, __pyx_int_neg_1); if (unlikely(!__pyx_slice__77)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1402; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_slice__77);
  __Pyx_GIVEREF(__pyx_slice__77);
  __pyx_tuple__78 = PyTuple_Pack(2, __pyx_slice__76, __pyx_slice__77); if (unlikely(!__pyx_tuple__78)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1402; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__78);
  __Pyx_GIVEREF(__pyx_tuple__78);
  __pyx_slice__79 = PySlice_New(__pyx_int_1, Py_None, __pyx_int_2); if (unlikely(!__pyx_slice__79)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1402; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_slice__79);
  __Pyx_GIVEREF(__pyx_slice__79);
  __pyx_slice__80 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__80)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1402; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_slice__80);
  __Pyx_GIVEREF(__pyx_slice__80);
  __pyx_tuple__81 = PyTuple_Pack(2, __pyx_slice__79, __pyx_slice__80); if (unlikely(!__pyx_tuple__81)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1402; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__81);
  __Pyx_GIVEREF(__pyx_tuple__81);

  /* "pygrib.pyx":1405
 *            # 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__82 = PyTuple_Pack(1, __pyx_n_s_missingValue); if (unlikely(!__pyx_tuple__82)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1405; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__82);
  __Pyx_GIVEREF(__pyx_tuple__82);

  /* "pygrib.pyx":1418
 *         # 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__83 = PyTuple_Pack(1, __pyx_n_s_radius); if (unlikely(!__pyx_tuple__83)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1418; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__83);
  __Pyx_GIVEREF(__pyx_tuple__83);

  /* "pygrib.pyx":1426
 *                 projparams['b']=6371229.0
 *             elif self['shapeOfTheEarth'] in [3,7]:
 *                 if self.has_key('scaleFactorOfMajorAxisOfOblateSpheroidEarth'):             # <<<<<<<<<<<<<<
 *                     scalea = self['scaleFactorOfMajorAxisOfOblateSpheroidEarth']
 *                     scaleb = self['scaleFactorOfMinorAxisOfOblateSpheroidEarth']
 */
  __pyx_tuple__84 = PyTuple_Pack(1, __pyx_n_s_scaleFactorOfMajorAxisOfOblateSp); if (unlikely(!__pyx_tuple__84)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1426; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__84);
  __Pyx_GIVEREF(__pyx_tuple__84);

  /* "pygrib.pyx":1454
 *                 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__85 = PyTuple_Pack(1, __pyx_n_s_scaleFactorOfRadiusOfSphericalEa); if (unlikely(!__pyx_tuple__85)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1454; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__85);
  __Pyx_GIVEREF(__pyx_tuple__85);

  /* "pygrib.pyx":1476
 *                 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__86 = PyTuple_Pack(1, __pyx_kp_s_unknown_shape_of_the_earth_flag); if (unlikely(!__pyx_tuple__86)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1476; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__86);
  __Pyx_GIVEREF(__pyx_tuple__86);

  /* "pygrib.pyx":1483
 *             projparams['proj']='stere'
 *             projparams['lat_ts']=self['latitudeWhereDxAndDyAreSpecifiedInDegrees']
 *             if self.has_key('projectionCentreFlag'):             # <<<<<<<<<<<<<<
 *                 projcenterflag = self['projectionCentreFlag']
 *             elif self.has_key('projectionCenterFlag'):
 */
  __pyx_tuple__87 = PyTuple_Pack(1, __pyx_n_s_projectionCentreFlag); if (unlikely(!__pyx_tuple__87)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1483; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__87);
  __Pyx_GIVEREF(__pyx_tuple__87);

  /* "pygrib.pyx":1485
 *             if self.has_key('projectionCentreFlag'):
 *                 projcenterflag = self['projectionCentreFlag']
 *             elif self.has_key('projectionCenterFlag'):             # <<<<<<<<<<<<<<
 *                 projcenterflag = self['projectionCenterFlag']
 *             else:
 */
  __pyx_tuple__88 = PyTuple_Pack(1, __pyx_n_s_projectionCenterFlag); if (unlikely(!__pyx_tuple__88)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1485; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__88);
  __Pyx_GIVEREF(__pyx_tuple__88);

  /* "pygrib.pyx":1488
 *                 projcenterflag = self['projectionCenterFlag']
 *             else:
 *                 if not tolerate_badgrib: raise KeyError('cannot find projection center flag')             # <<<<<<<<<<<<<<
 *             if projcenterflag == 0:
 *                 projparams['lat_0']=90.
 */
  __pyx_tuple__89 = PyTuple_Pack(1, __pyx_kp_s_cannot_find_projection_center_fl); if (unlikely(!__pyx_tuple__89)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1488; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__89);
  __Pyx_GIVEREF(__pyx_tuple__89);

  /* "pygrib.pyx":1536
 *             projparams['proj'] = 'laea'
 *         elif self['gridType'] == 'mercator':
 *             scale = self._get_key('grib2divider',False)             # <<<<<<<<<<<<<<
 *             if scale:
 *                 scale = float(scale)
 */
  __pyx_tuple__90 = PyTuple_Pack(2, __pyx_n_s_grib2divider, Py_False); if (unlikely(!__pyx_tuple__90)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1536; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__90);
  __Pyx_GIVEREF(__pyx_tuple__90);

  /* "pygrib.pyx":1543
 *             lon1 = self['longitudeOfFirstGridPoint']/scale
 *             lon2 = self['longitudeOfLastGridPoint']/scale
 *             if self._get_key('truncateDegrees',False):             # <<<<<<<<<<<<<<
 *                 lon1 = int(lon1)
 *                 lon2 = int(lon2)
 */
  __pyx_tuple__91 = PyTuple_Pack(2, __pyx_n_s_truncateDegrees, Py_False); if (unlikely(!__pyx_tuple__91)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1543; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__91);
  __Pyx_GIVEREF(__pyx_tuple__91);

  /* "pygrib.pyx":1546
 *                 lon1 = int(lon1)
 *                 lon2 = int(lon2)
 *             if self._get_key('LaD',False):             # <<<<<<<<<<<<<<
 *                 projparams['lat_ts'] = self['LaD']/scale
 *             else:
 */
  __pyx_tuple__92 = PyTuple_Pack(2, __pyx_n_s_LaD, Py_False); if (unlikely(!__pyx_tuple__92)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1546; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__92);
  __Pyx_GIVEREF(__pyx_tuple__92);

  /* "pygrib.pyx":1596
 *             # (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__93 = PyTuple_Pack(1, __pyx_n_s_grid_complex); if (unlikely(!__pyx_tuple__93)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1596; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__93);
  __Pyx_GIVEREF(__pyx_tuple__93);

  /* "pygrib.pyx":1603
 *             else:
 *                 lats = self['distinctLatitudes']
 *                 if lat2 < lat1 and lats[-1] > lats[0]: lats = lats[::-1]             # <<<<<<<<<<<<<<
 *                 lons = self['distinctLongitudes']
 *             # don't trust distinctLongitudes
 */
  __pyx_slice__94 = PySlice_New(Py_None, Py_None, __pyx_int_neg_1); if (unlikely(!__pyx_slice__94)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1603; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_slice__94);
  __Pyx_GIVEREF(__pyx_slice__94);

  /* "pygrib.pyx":1616
 *                 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__95 = PySlice_New(Py_None, Py_None, __pyx_int_neg_1); if (unlikely(!__pyx_slice__95)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1616; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_slice__95);
  __Pyx_GIVEREF(__pyx_slice__95);

  /* "pygrib.pyx":1710
 *             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__96 = PyTuple_Pack(1, __pyx_kp_s_unsupported_grid_earth_not_a_per); if (unlikely(!__pyx_tuple__96)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1710; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__96);
  __Pyx_GIVEREF(__pyx_tuple__96);

  /* "pygrib.pyx":1772
 *             lons, lats = pj(x, y, inverse=True)
 *         elif self['gridType'] == 'mercator':
 *             scale = self._get_key('grib2divider',False)             # <<<<<<<<<<<<<<
 *             if scale:
 *                 scale = float(scale)
 */
  __pyx_tuple__97 = PyTuple_Pack(2, __pyx_n_s_grib2divider, Py_False); if (unlikely(!__pyx_tuple__97)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1772; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__97);
  __Pyx_GIVEREF(__pyx_tuple__97);

  /* "pygrib.pyx":1779
 *             lon1 = self['longitudeOfFirstGridPoint']/scale
 *             lon2 = self['longitudeOfLastGridPoint']/scale
 *             if self._get_key('truncateDegrees',False):             # <<<<<<<<<<<<<<
 *                 lon1 = int(lon1)
 *                 lon2 = int(lon2)
 */
  __pyx_tuple__98 = PyTuple_Pack(2, __pyx_n_s_truncateDegrees, Py_False); if (unlikely(!__pyx_tuple__98)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1779; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__98);
  __Pyx_GIVEREF(__pyx_tuple__98);

  /* "pygrib.pyx":1784
 *             lat1 = self['latitudeOfFirstGridPoint']/scale
 *             lat2 = self['latitudeOfLastGridPoint']/scale
 *             if self._get_key('truncateDegrees',False):             # <<<<<<<<<<<<<<
 *                 lat1 = int(lat1)
 *                 lat2 = int(lat2)
 */
  __pyx_tuple__99 = PyTuple_Pack(2, __pyx_n_s_truncateDegrees, Py_False); if (unlikely(!__pyx_tuple__99)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1784; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__99);
  __Pyx_GIVEREF(__pyx_tuple__99);

  /* "pygrib.pyx":1902
 *         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__101 = PyTuple_Pack(1, __pyx_kp_s__18); if (unlikely(!__pyx_tuple__101)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1902; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__101);
  __Pyx_GIVEREF(__pyx_tuple__101);

  /* "pygrib.pyx":1907
 *             for arg in args:
 *                 try:
 *                     type = arg.split(':')[1]             # <<<<<<<<<<<<<<
 *                 except IndexError:
 *                     type = None
 */
  __pyx_tuple__102 = PyTuple_Pack(1, __pyx_kp_s__18); if (unlikely(!__pyx_tuple__102)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1907; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__102);
  __Pyx_GIVEREF(__pyx_tuple__102);

  /* "pygrib.pyx":1953
 *         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__103 = PyTuple_Pack(1, __pyx_kp_s_key_not_part_of_grib_index); if (unlikely(!__pyx_tuple__103)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1953; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__103);
  __Pyx_GIVEREF(__pyx_tuple__103);

  /* "pygrib.pyx":1984
 *                     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__104 = PyTuple_Pack(1, __pyx_kp_s_value_must_be_float_int_or_strin); if (unlikely(!__pyx_tuple__104)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1984; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__104);
  __Pyx_GIVEREF(__pyx_tuple__104);

  /* "pygrib.pyx":1987
 *         # 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__105 = PyTuple_Pack(1, __pyx_kp_s_no_matches_found); if (unlikely(!__pyx_tuple__105)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1987; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__105);
  __Pyx_GIVEREF(__pyx_tuple__105);

  /* "pygrib.pyx":2001
 *                 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__106 = PyTuple_Pack(1, __pyx_kp_s_no_matches_found); if (unlikely(!__pyx_tuple__106)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2001; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__106);
  __Pyx_GIVEREF(__pyx_tuple__106);

  /* "pygrib.pyx":184
 *         from mpl_toolkits.basemap import pyproj
 *     except:
 *         raise ImportError("either pyproj or basemap required")             # <<<<<<<<<<<<<<
 * from ncepgrib2 import Grib2Decode
 * import_array()
 */
  __pyx_tuple__107 = PyTuple_Pack(1, __pyx_kp_s_either_pyproj_or_basemap_require); if (unlikely(!__pyx_tuple__107)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__107);
  __Pyx_GIVEREF(__pyx_tuple__107);

  /* "pygrib.pyx":298
 * #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__108 = 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__108)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 298; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__108);
  __Pyx_GIVEREF(__pyx_tuple__108);
  __pyx_codeobj__109 = (PyObject*)__Pyx_PyCode_New(0, 0, 5, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__108, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Volumes_Drobo_python_pygrib_git, __pyx_n_s_get_grib_api_version, 298, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__109)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 298; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pygrib.pyx":308
 * tolerate_badgrib = False
 * 
 * def tolerate_badgrib_on():             # <<<<<<<<<<<<<<
 *     """
 *     don't raise an exception when a missing or malformed key is encountered.
 */
  __pyx_codeobj__110 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Volumes_Drobo_python_pygrib_git, __pyx_n_s_tolerate_badgrib_on, 308, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__110)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pygrib.pyx":315
 *     tolerate_badgrib = True
 * 
 * def tolerate_badgrib_off():             # <<<<<<<<<<<<<<
 *     """
 *     raise an exception when a missing or malformed key is encountered
 */
  __pyx_codeobj__111 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Volumes_Drobo_python_pygrib_git, __pyx_n_s_tolerate_badgrib_off, 315, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__111)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 315; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pygrib.pyx":323
 *     tolerate_badgrib = False
 * 
 * def gaulats(object nlats):             # <<<<<<<<<<<<<<
 *     """
 *     gaulats(nlats)
 */
  __pyx_tuple__112 = PyTuple_Pack(2, __pyx_n_s_nlats, __pyx_n_s_lats); if (unlikely(!__pyx_tuple__112)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 323; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__112);
  __Pyx_GIVEREF(__pyx_tuple__112);
  __pyx_codeobj__113 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__112, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Volumes_Drobo_python_pygrib_git, __pyx_n_s_gaulats, 323, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__113)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 323; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pygrib.pyx":354
 * 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__114 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Volumes_Drobo_python_pygrib_git, __pyx_n_s_multi_support_on, 354, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__114)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 354; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pygrib.pyx":358
 *     grib_multi_support_on(NULL)
 * 
 * def multi_support_off():             # <<<<<<<<<<<<<<
 *     """turn off support for multi-field grib messages"""
 *     grib_multi_support_off(NULL)
 */
  __pyx_codeobj__115 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Volumes_Drobo_python_pygrib_git, __pyx_n_s_multi_support_off, 358, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__115)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pygrib.pyx":637
 * ['_gh','fcstimeunits','expand_reduced','projparams','messagenumber','_all_keys','_ro_keys']
 * 
 * def julian_to_datetime(object jd):             # <<<<<<<<<<<<<<
 *     """
 *     julian_to_datetime(julday)
 */
  __pyx_tuple__116 = 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__116)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 637; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__116);
  __Pyx_GIVEREF(__pyx_tuple__116);
  __pyx_codeobj__117 = (PyObject*)__Pyx_PyCode_New(1, 0, 9, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__116, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Volumes_Drobo_python_pygrib_git, __pyx_n_s_julian_to_datetime, 637, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__117)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 637; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pygrib.pyx":654
 *     return datetime(year, month, day, hour, minute, second)
 * 
 * def datetime_to_julian(object d):             # <<<<<<<<<<<<<<
 *     """
 *     datetime_to_julian(date)
 */
  __pyx_tuple__118 = 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__118)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 654; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__118);
  __Pyx_GIVEREF(__pyx_tuple__118);
  __pyx_codeobj__119 = (PyObject*)__Pyx_PyCode_New(1, 0, 9, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__118, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Volumes_Drobo_python_pygrib_git, __pyx_n_s_datetime_to_julian, 654, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__119)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 654; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pygrib.pyx":680
 *     return setdates(grb)
 * 
 * def fromstring(gribstring):             # <<<<<<<<<<<<<<
 *     """
 *     fromstring(string)
 */
  __pyx_tuple__120 = PyTuple_Pack(4, __pyx_n_s_gribstring, __pyx_n_s_gribstr, __pyx_n_s_gh_2, __pyx_n_s_grb); if (unlikely(!__pyx_tuple__120)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 680; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__120);
  __Pyx_GIVEREF(__pyx_tuple__120);
  __pyx_codeobj__121 = (PyObject*)__Pyx_PyCode_New(1, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__120, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Volumes_Drobo_python_pygrib_git, __pyx_n_s_fromstring, 680, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__121)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 680; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pygrib.pyx":701
 *     return setdates(grb)
 * 
 * def setdates(gribmessage grb):             # <<<<<<<<<<<<<<
 *     """
 *     setdates(grb)
 */
  __pyx_tuple__122 = PyTuple_Pack(2, __pyx_n_s_grb, __pyx_n_s_ftime); if (unlikely(!__pyx_tuple__122)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 701; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__122);
  __Pyx_GIVEREF(__pyx_tuple__122);
  __pyx_codeobj__123 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__122, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Volumes_Drobo_python_pygrib_git, __pyx_n_s_setdates, 701, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__123)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 701; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pygrib.pyx":780
 *     return grb
 * 
 * def reload(gribmessage grb):             # <<<<<<<<<<<<<<
 *     """
 *     reload(grb)
 */
  __pyx_tuple__124 = PyTuple_Pack(1, __pyx_n_s_grb); if (unlikely(!__pyx_tuple__124)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 780; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__124);
  __Pyx_GIVEREF(__pyx_tuple__124);
  __pyx_codeobj__125 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__124, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Volumes_Drobo_python_pygrib_git, __pyx_n_s_reload, 780, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__125)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 780; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pygrib.pyx":2029
 *             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__126 = PyTuple_Pack(1, __pyx_n_s_a); if (unlikely(!__pyx_tuple__126)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2029; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__126);
  __Pyx_GIVEREF(__pyx_tuple__126);
  __pyx_codeobj__127 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__126, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Volumes_Drobo_python_pygrib_git, __pyx_n_s_is_stringlike, 2029, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__127)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2029; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pygrib.pyx":2035
 *         return False
 * 
 * def _is_container(a):             # <<<<<<<<<<<<<<
 *     # is object container-like?  (can test for
 *     # membership with "is in", but not a string)
 */
  __pyx_tuple__128 = PyTuple_Pack(1, __pyx_n_s_a); if (unlikely(!__pyx_tuple__128)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2035; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__128);
  __Pyx_GIVEREF(__pyx_tuple__128);
  __pyx_codeobj__129 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__128, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Volumes_Drobo_python_pygrib_git, __pyx_n_s_is_container, 2035, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__129)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2035; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pygrib.pyx":2043
 *     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__130 = 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__130)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2043; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__130);
  __Pyx_GIVEREF(__pyx_tuple__130);
  __pyx_codeobj__131 = (PyObject*)__Pyx_PyCode_New(1, 0, 6, 0, CO_VARKEYWORDS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__130, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Volumes_Drobo_python_pygrib_git, __pyx_n_s_find, 2043, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__131)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2043; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __pyx_float_0_ = PyFloat_FromDouble(0.); if (unlikely(!__pyx_float_0_)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_float_1_ = PyFloat_FromDouble(1.); if (unlikely(!__pyx_float_1_)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_float_2_ = PyFloat_FromDouble(2.); if (unlikely(!__pyx_float_2_)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_float_4_ = PyFloat_FromDouble(4.); if (unlikely(!__pyx_float_4_)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_float_8_ = PyFloat_FromDouble(8.); if (unlikely(!__pyx_float_8_)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_float_0_5 = PyFloat_FromDouble(0.5); if (unlikely(!__pyx_float_0_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_float_24_ = PyFloat_FromDouble(24.); if (unlikely(!__pyx_float_24_)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_float_90_ = PyFloat_FromDouble(90.); if (unlikely(!__pyx_float_90_)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_float_1_e3 = PyFloat_FromDouble(1.e3); if (unlikely(!__pyx_float_1_e3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_float_1_e6 = PyFloat_FromDouble(1.e6); if (unlikely(!__pyx_float_1_e6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_float_10_0 = PyFloat_FromDouble(10.0); if (unlikely(!__pyx_float_10_0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_float_180_ = PyFloat_FromDouble(180.); if (unlikely(!__pyx_float_180_)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_float_1_e20 = PyFloat_FromDouble(1.e20); if (unlikely(!__pyx_float_1_e20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_float_1_e30 = PyFloat_FromDouble(1.e30); if (unlikely(!__pyx_float_1_e30)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_float_1000_ = PyFloat_FromDouble(1000.); if (unlikely(!__pyx_float_1000_)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_float_1440_ = PyFloat_FromDouble(1440.); if (unlikely(!__pyx_float_1440_)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_float_86400_ = PyFloat_FromDouble(86400.); if (unlikely(!__pyx_float_86400_)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_float_6356775_0 = PyFloat_FromDouble(6356775.0); if (unlikely(!__pyx_float_6356775_0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_float_6367470_0 = PyFloat_FromDouble(6367470.0); if (unlikely(!__pyx_float_6367470_0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_float_6371200_0 = PyFloat_FromDouble(6371200.0); if (unlikely(!__pyx_float_6371200_0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_float_6371229_0 = PyFloat_FromDouble(6371229.0); if (unlikely(!__pyx_float_6371229_0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_float_6378137_0 = PyFloat_FromDouble(6378137.0); if (unlikely(!__pyx_float_6378137_0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_float_6378160_0 = PyFloat_FromDouble(6378160.0); if (unlikely(!__pyx_float_6378160_0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_float_6356752_3142 = PyFloat_FromDouble(6356752.3142); if (unlikely(!__pyx_float_6356752_3142)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_float_neg_0_5 = PyFloat_FromDouble(-0.5); if (unlikely(!__pyx_float_neg_0_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_float_neg_90_ = PyFloat_FromDouble(-90.); if (unlikely(!__pyx_float_neg_90_)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_float_neg_1_e100 = PyFloat_FromDouble(-1.e100); if (unlikely(!__pyx_float_neg_1_e100)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_int_2 = PyInt_FromLong(2); if (unlikely(!__pyx_int_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_int_3 = PyInt_FromLong(3); if (unlikely(!__pyx_int_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_int_4 = PyInt_FromLong(4); if (unlikely(!__pyx_int_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_int_5 = PyInt_FromLong(5); if (unlikely(!__pyx_int_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_int_6 = PyInt_FromLong(6); if (unlikely(!__pyx_int_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_int_7 = PyInt_FromLong(7); if (unlikely(!__pyx_int_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_int_8 = PyInt_FromLong(8); if (unlikely(!__pyx_int_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_int_100 = PyInt_FromLong(100); if (unlikely(!__pyx_int_100)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_int_255 = PyInt_FromLong(255); if (unlikely(!__pyx_int_255)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_int_360 = PyInt_FromLong(360); if (unlikely(!__pyx_int_360)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_int_1000 = PyInt_FromLong(1000); if (unlikely(!__pyx_int_1000)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_int_10900 = PyInt_FromLong(10900L); if (unlikely(!__pyx_int_10900)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_int_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_int_neg_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  return 0;
  __pyx_L1_error:;
  return -1;
}

#if PY_MAJOR_VERSION < 3
PyMODINIT_FUNC initpygrib(void); /*proto*/
PyMODINIT_FUNC initpygrib(void)
#else
PyMODINIT_FUNC PyInit_pygrib(void); /*proto*/
PyMODINIT_FUNC PyInit_pygrib(void)
#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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  #if CYTHON_REFNANNY
  __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
  if (!__Pyx_RefNanny) {
      PyErr_Clear();
      __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
      if (!__Pyx_RefNanny)
          Py_FatalError("failed to import 'refnanny' module");
  }
  #endif
  __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit_pygrib(void)", 0);
  if (__Pyx_check_binary_version() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #ifdef __Pyx_CyFunction_USED
  if (__pyx_CyFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #endif
  #ifdef __Pyx_FusedFunction_USED
  if (__pyx_FusedFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #endif
  #ifdef __Pyx_Coroutine_USED
  if (__pyx_Coroutine_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #endif
  #ifdef __Pyx_Generator_USED
  if (__pyx_Generator_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #endif
  #ifdef __Pyx_StopAsyncIteration_USED
  if (__pyx_StopAsyncIteration_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #endif
  /*--- Library function declarations ---*/
  /*--- Threads initialization code ---*/
  #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
  #ifdef WITH_THREAD /* Python build with threading support? */
  PyEval_InitThreads();
  #endif
  #endif
  /*--- Module creation code ---*/
  #if PY_MAJOR_VERSION < 3
  __pyx_m = Py_InitModule4("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_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  Py_INCREF(__pyx_d);
  __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #if CYTHON_COMPILING_IN_PYPY
  Py_INCREF(__pyx_b);
  #endif
  if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  /*--- Initialize various global constants etc. ---*/
  if (__Pyx_InitGlobals() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
  if (__Pyx_init_sys_getdefaultencoding_params() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #endif
  if (__pyx_module_is_main_pygrib) {
    if (PyObject_SetAttrString(__pyx_m, "__name__", __pyx_n_s_main) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  #if PY_MAJOR_VERSION >= 3
  {
    PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (!PyDict_GetItemString(modules, "pygrib")) {
      if (unlikely(PyDict_SetItemString(modules, "pygrib", __pyx_m) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
  }
  #endif
  /*--- Builtin init code ---*/
  if (__Pyx_InitCachedBuiltins() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  /*--- Constants init code ---*/
  if (__Pyx_InitCachedConstants() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  /*--- Global init code ---*/
  /*--- Variable export code ---*/
  /*--- Function export code ---*/
  /*--- Type init code ---*/
  __pyx_ptype_6pygrib_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject), 0); if (unlikely(!__pyx_ptype_6pygrib_ndarray)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyType_Ready(&__pyx_type_6pygrib_open) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 362; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_6pygrib_open.tp_print = 0;
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_6pygrib_open, "__call__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 362; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 362; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_6pygrib_open = &__pyx_type_6pygrib_open;
  if (PyType_Ready(&__pyx_type_6pygrib_gribmessage) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_6pygrib_gribmessage = &__pyx_type_6pygrib_gribmessage;
  if (PyType_Ready(&__pyx_type_6pygrib_index) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1813; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_6pygrib_index.tp_print = 0;
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_6pygrib_index, "__call__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1813; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1813; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_6pygrib_index = &__pyx_type_6pygrib_index;
  /*--- Type import code ---*/
  /*--- Variable import code ---*/
  /*--- Function import code ---*/
  /*--- Execution code ---*/
  #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
  if (__Pyx_patch_abc() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __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.2'
 */
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pygrib.pyx":171
 * PERFORMANCE OF THIS SOFTWARE."""
 * __test__ = None
 * del __test__ # hack so epydoc doesn't show __test__             # <<<<<<<<<<<<<<
 * __version__ = '2.0.2'
 * 
 */
  if (__Pyx_PyObject_DelAttrStr(__pyx_m, __pyx_n_s_test) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pygrib.pyx":172
 * __test__ = None
 * del __test__ # hack so epydoc doesn't show __test__
 * __version__ = '2.0.2'             # <<<<<<<<<<<<<<
 * 
 * import numpy as np
 */
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_version, __pyx_kp_s_2_0_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pygrib.pyx":174
 * __version__ = '2.0.2'
 * 
 * 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_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_np, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __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 numpy import ma
 */
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_warnings, 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_warnings, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __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 numpy import ma
 * try:
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_datetime); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_datetime, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pygrib.pyx":177
 * import warnings
 * from datetime import datetime
 * from numpy import ma             # <<<<<<<<<<<<<<
 * try:
 *     import pyproj
 */
  __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_n_s_ma);
  __Pyx_GIVEREF(__pyx_n_s_ma);
  PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_ma);
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_numpy, __pyx_t_2, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_ma); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_ma, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __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 numpy import ma
 * try:             # <<<<<<<<<<<<<<
 *     import pyproj
 * except ImportError:
 */
  {
    __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":179
 * from numpy import ma
 * try:
 *     import pyproj             # <<<<<<<<<<<<<<
 * except ImportError:
 *     try:
 */
      __pyx_t_1 = __Pyx_Import(__pyx_n_s_pyproj, 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L2_error;}
      __Pyx_GOTREF(__pyx_t_1);
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyproj, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L2_error;}
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "pygrib.pyx":178
 * from datetime import datetime
 * 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_L9_try_end;
    __pyx_L2_error:;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "pygrib.pyx":180
 * try:
 *     import pyproj
 * except ImportError:             # <<<<<<<<<<<<<<
 *     try:
 *         from mpl_toolkits.basemap import pyproj
 */
    __pyx_t_6 = PyErr_ExceptionMatches(__pyx_builtin_ImportError);
    if (__pyx_t_6) {
      __Pyx_AddTraceback("pygrib", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_2, &__pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L4_except_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_GOTREF(__pyx_t_7);

      /* "pygrib.pyx":181
 *     import pyproj
 * except ImportError:
 *     try:             # <<<<<<<<<<<<<<
 *         from mpl_toolkits.basemap import pyproj
 *     except:
 */
      {
        __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":182
 * 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_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L12_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_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L12_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_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L12_error;}
          __Pyx_GOTREF(__pyx_t_11);
          if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyproj, __pyx_t_11) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L12_error;}
          __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;

          /* "pygrib.pyx":181
 *     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_L19_try_end;
        __pyx_L12_error:;
        __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
        __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;

        /* "pygrib.pyx":183
 *     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_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L14_except_error;}
          __Pyx_GOTREF(__pyx_t_12);
          __Pyx_GOTREF(__pyx_t_11);
          __Pyx_GOTREF(__pyx_t_13);

          /* "pygrib.pyx":184
 *         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__107, NULL); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L14_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_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L14_except_error;}
        }
        __pyx_L14_except_error:;

        /* "pygrib.pyx":181
 *     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_L19_try_end:;
      }
      __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_L3_exception_handled;
    }
    goto __pyx_L4_except_error;
    __pyx_L4_except_error:;

    /* "pygrib.pyx":178
 * from datetime import datetime
 * 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_L9_try_end:;
  }

  /* "pygrib.pyx":185
 *     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_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __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_2 = __Pyx_Import(__pyx_n_s_ncepgrib2, __pyx_t_7, -1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_Grib2Decode); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_Grib2Decode, __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pygrib.pyx":186
 *         raise ImportError("either pyproj or basemap required")
 * from ncepgrib2 import Grib2Decode
 * import_array()             # <<<<<<<<<<<<<<
 * 
 * cdef extern from "stdlib.h":
 */
  import_array();

  /* "pygrib.pyx":202
 * 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_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pygrib.pyx":294
 * 
 * 
 * missingvalue_int = GRIB_MISSING_LONG             # <<<<<<<<<<<<<<
 * #this doesn't work, since defined constants are assumed to be integers
 * #missingvalue_float = GRIB_MISSING_DOUBLE
 */
  __pyx_t_2 = __Pyx_PyInt_From_int(GRIB_MISSING_LONG); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 294; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_missingvalue_int, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 294; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pygrib.pyx":297
 * #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_filename = __pyx_f[0]; __pyx_lineno = 297; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pygrib.pyx":298
 * #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_2 = PyCFunction_NewEx(&__pyx_mdef_6pygrib_1_get_grib_api_version, NULL, __pyx_n_s_pygrib); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 298; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_get_grib_api_version, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 298; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pygrib.pyx":305
 *     major = v
 *     return "%d.%d.%d" % (major,minor,revision)
 * grib_api_version = _get_grib_api_version()             # <<<<<<<<<<<<<<
 * tolerate_badgrib = False
 * 
 */
  __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_get_grib_api_version); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_1 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_7))) {
    __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_7);
    if (likely(__pyx_t_1)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_7, function);
    }
  }
  if (__pyx_t_1) {
    __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_7); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_grib_api_version, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pygrib.pyx":306
 *     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_filename = __pyx_f[0]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pygrib.pyx":308
 * tolerate_badgrib = False
 * 
 * def tolerate_badgrib_on():             # <<<<<<<<<<<<<<
 *     """
 *     don't raise an exception when a missing or malformed key is encountered.
 */
  __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_6pygrib_3tolerate_badgrib_on, NULL, __pyx_n_s_pygrib); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_tolerate_badgrib_on, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pygrib.pyx":315
 *     tolerate_badgrib = True
 * 
 * def tolerate_badgrib_off():             # <<<<<<<<<<<<<<
 *     """
 *     raise an exception when a missing or malformed key is encountered
 */
  __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_6pygrib_5tolerate_badgrib_off, NULL, __pyx_n_s_pygrib); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 315; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_tolerate_badgrib_off, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 315; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pygrib.pyx":323
 *     tolerate_badgrib = False
 * 
 * def gaulats(object nlats):             # <<<<<<<<<<<<<<
 *     """
 *     gaulats(nlats)
 */
  __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_6pygrib_7gaulats, NULL, __pyx_n_s_pygrib); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 323; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_gaulats, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 323; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pygrib.pyx":337
 * 
 * # dict for forecast time units (Code Table 4.4).
 * _ftimedict = {}             # <<<<<<<<<<<<<<
 * _ftimedict[0]='mins'
 * _ftimedict[1]='hrs'
 */
  __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_ftimedict, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pygrib.pyx":338
 * # dict for forecast time units (Code Table 4.4).
 * _ftimedict = {}
 * _ftimedict[0]='mins'             # <<<<<<<<<<<<<<
 * _ftimedict[1]='hrs'
 * _ftimedict[2]='days'
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_ftimedict); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (unlikely(__Pyx_SetItemInt(__pyx_t_2, 0, __pyx_n_s_mins, long, 1, __Pyx_PyInt_From_long, 0, 0, 1) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pygrib.pyx":339
 * _ftimedict = {}
 * _ftimedict[0]='mins'
 * _ftimedict[1]='hrs'             # <<<<<<<<<<<<<<
 * _ftimedict[2]='days'
 * _ftimedict[3]='months'
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_ftimedict); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 339; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (unlikely(__Pyx_SetItemInt(__pyx_t_2, 1, __pyx_n_s_hrs, long, 1, __Pyx_PyInt_From_long, 0, 0, 1) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 339; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pygrib.pyx":340
 * _ftimedict[0]='mins'
 * _ftimedict[1]='hrs'
 * _ftimedict[2]='days'             # <<<<<<<<<<<<<<
 * _ftimedict[3]='months'
 * _ftimedict[4]='yrs'
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_ftimedict); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 340; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (unlikely(__Pyx_SetItemInt(__pyx_t_2, 2, __pyx_n_s_days, long, 1, __Pyx_PyInt_From_long, 0, 0, 1) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 340; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pygrib.pyx":341
 * _ftimedict[1]='hrs'
 * _ftimedict[2]='days'
 * _ftimedict[3]='months'             # <<<<<<<<<<<<<<
 * _ftimedict[4]='yrs'
 * _ftimedict[5]='decades'
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_ftimedict); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (unlikely(__Pyx_SetItemInt(__pyx_t_2, 3, __pyx_n_s_months, long, 1, __Pyx_PyInt_From_long, 0, 0, 1) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pygrib.pyx":342
 * _ftimedict[2]='days'
 * _ftimedict[3]='months'
 * _ftimedict[4]='yrs'             # <<<<<<<<<<<<<<
 * _ftimedict[5]='decades'
 * _ftimedict[6]='30 yr periods'
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_ftimedict); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 342; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (unlikely(__Pyx_SetItemInt(__pyx_t_2, 4, __pyx_n_s_yrs, long, 1, __Pyx_PyInt_From_long, 0, 0, 1) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 342; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pygrib.pyx":343
 * _ftimedict[3]='months'
 * _ftimedict[4]='yrs'
 * _ftimedict[5]='decades'             # <<<<<<<<<<<<<<
 * _ftimedict[6]='30 yr periods'
 * _ftimedict[7]='centuries'
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_ftimedict); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 343; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (unlikely(__Pyx_SetItemInt(__pyx_t_2, 5, __pyx_n_s_decades, long, 1, __Pyx_PyInt_From_long, 0, 0, 1) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 343; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pygrib.pyx":344
 * _ftimedict[4]='yrs'
 * _ftimedict[5]='decades'
 * _ftimedict[6]='30 yr periods'             # <<<<<<<<<<<<<<
 * _ftimedict[7]='centuries'
 * _ftimedict[10]='3 hr periods'
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_ftimedict); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 344; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (unlikely(__Pyx_SetItemInt(__pyx_t_2, 6, __pyx_kp_s_30_yr_periods, long, 1, __Pyx_PyInt_From_long, 0, 0, 1) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 344; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pygrib.pyx":345
 * _ftimedict[5]='decades'
 * _ftimedict[6]='30 yr periods'
 * _ftimedict[7]='centuries'             # <<<<<<<<<<<<<<
 * _ftimedict[10]='3 hr periods'
 * _ftimedict[11]='6 hr periods'
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_ftimedict); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 345; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (unlikely(__Pyx_SetItemInt(__pyx_t_2, 7, __pyx_n_s_centuries, long, 1, __Pyx_PyInt_From_long, 0, 0, 1) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 345; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pygrib.pyx":346
 * _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_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_ftimedict); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 346; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (unlikely(__Pyx_SetItemInt(__pyx_t_2, 10, __pyx_kp_s_3_hr_periods, long, 1, __Pyx_PyInt_From_long, 0, 0, 1) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 346; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pygrib.pyx":347
 * _ftimedict[7]='centuries'
 * _ftimedict[10]='3 hr periods'
 * _ftimedict[11]='6 hr periods'             # <<<<<<<<<<<<<<
 * _ftimedict[12]='12 hr periods'
 * _ftimedict[13]='secs'
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_ftimedict); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 347; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (unlikely(__Pyx_SetItemInt(__pyx_t_2, 11, __pyx_kp_s_6_hr_periods, long, 1, __Pyx_PyInt_From_long, 0, 0, 1) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 347; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pygrib.pyx":348
 * _ftimedict[10]='3 hr periods'
 * _ftimedict[11]='6 hr periods'
 * _ftimedict[12]='12 hr periods'             # <<<<<<<<<<<<<<
 * _ftimedict[13]='secs'
 * 
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_ftimedict); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 348; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (unlikely(__Pyx_SetItemInt(__pyx_t_2, 12, __pyx_kp_s_12_hr_periods, long, 1, __Pyx_PyInt_From_long, 0, 0, 1) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 348; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pygrib.pyx":349
 * _ftimedict[11]='6 hr periods'
 * _ftimedict[12]='12 hr periods'
 * _ftimedict[13]='secs'             # <<<<<<<<<<<<<<
 * 
 * # turn on support for multi-field grib messages.
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_ftimedict); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (unlikely(__Pyx_SetItemInt(__pyx_t_2, 13, __pyx_n_s_secs, long, 1, __Pyx_PyInt_From_long, 0, 0, 1) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

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

  /* "pygrib.pyx":354
 * 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_2 = PyCFunction_NewEx(&__pyx_mdef_6pygrib_9multi_support_on, NULL, __pyx_n_s_pygrib); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 354; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_multi_support_on, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 354; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pygrib.pyx":358
 *     grib_multi_support_on(NULL)
 * 
 * def multi_support_off():             # <<<<<<<<<<<<<<
 *     """turn off support for multi-field grib messages"""
 *     grib_multi_support_off(NULL)
 */
  __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_6pygrib_11multi_support_off, NULL, __pyx_n_s_pygrib); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_multi_support_off, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pygrib.pyx":635
 * # distinguished from grib keys.
 * _private_atts =\
 * ['_gh','fcstimeunits','expand_reduced','projparams','messagenumber','_all_keys','_ro_keys']             # <<<<<<<<<<<<<<
 * 
 * def julian_to_datetime(object jd):
 */
  __pyx_t_2 = PyList_New(7); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 635; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_n_s_gh);
  __Pyx_GIVEREF(__pyx_n_s_gh);
  PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_gh);
  __Pyx_INCREF(__pyx_n_s_fcstimeunits);
  __Pyx_GIVEREF(__pyx_n_s_fcstimeunits);
  PyList_SET_ITEM(__pyx_t_2, 1, __pyx_n_s_fcstimeunits);
  __Pyx_INCREF(__pyx_n_s_expand_reduced);
  __Pyx_GIVEREF(__pyx_n_s_expand_reduced);
  PyList_SET_ITEM(__pyx_t_2, 2, __pyx_n_s_expand_reduced);
  __Pyx_INCREF(__pyx_n_s_projparams);
  __Pyx_GIVEREF(__pyx_n_s_projparams);
  PyList_SET_ITEM(__pyx_t_2, 3, __pyx_n_s_projparams);
  __Pyx_INCREF(__pyx_n_s_messagenumber);
  __Pyx_GIVEREF(__pyx_n_s_messagenumber);
  PyList_SET_ITEM(__pyx_t_2, 4, __pyx_n_s_messagenumber);
  __Pyx_INCREF(__pyx_n_s_all_keys);
  __Pyx_GIVEREF(__pyx_n_s_all_keys);
  PyList_SET_ITEM(__pyx_t_2, 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_2, 6, __pyx_n_s_ro_keys);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_private_atts, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 634; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pygrib.pyx":637
 * ['_gh','fcstimeunits','expand_reduced','projparams','messagenumber','_all_keys','_ro_keys']
 * 
 * def julian_to_datetime(object jd):             # <<<<<<<<<<<<<<
 *     """
 *     julian_to_datetime(julday)
 */
  __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_6pygrib_13julian_to_datetime, NULL, __pyx_n_s_pygrib); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 637; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_julian_to_datetime, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 637; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pygrib.pyx":654
 *     return datetime(year, month, day, hour, minute, second)
 * 
 * def datetime_to_julian(object d):             # <<<<<<<<<<<<<<
 *     """
 *     datetime_to_julian(date)
 */
  __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_6pygrib_15datetime_to_julian, NULL, __pyx_n_s_pygrib); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 654; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_datetime_to_julian, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 654; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pygrib.pyx":680
 *     return setdates(grb)
 * 
 * def fromstring(gribstring):             # <<<<<<<<<<<<<<
 *     """
 *     fromstring(string)
 */
  __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_6pygrib_17fromstring, NULL, __pyx_n_s_pygrib); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 680; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_fromstring, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 680; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pygrib.pyx":701
 *     return setdates(grb)
 * 
 * def setdates(gribmessage grb):             # <<<<<<<<<<<<<<
 *     """
 *     setdates(grb)
 */
  __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_6pygrib_19setdates, NULL, __pyx_n_s_pygrib); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 701; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_setdates, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 701; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pygrib.pyx":780
 *     return grb
 * 
 * def reload(gribmessage grb):             # <<<<<<<<<<<<<<
 *     """
 *     reload(grb)
 */
  __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_6pygrib_21reload, NULL, __pyx_n_s_pygrib); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 780; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_reload, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 780; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pygrib.pyx":2029
 *             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_2 = PyCFunction_NewEx(&__pyx_mdef_6pygrib_23_is_stringlike, NULL, __pyx_n_s_pygrib); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2029; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_is_stringlike, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2029; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pygrib.pyx":2035
 *         return False
 * 
 * def _is_container(a):             # <<<<<<<<<<<<<<
 *     # is object container-like?  (can test for
 *     # membership with "is in", but not a string)
 */
  __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_6pygrib_25_is_container, NULL, __pyx_n_s_pygrib); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2035; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_is_container, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2035; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pygrib.pyx":2043
 *     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_2 = PyCFunction_NewEx(&__pyx_mdef_6pygrib_27_find, NULL, __pyx_n_s_pygrib); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2043; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_find, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2043; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pygrib.pyx":2066
 *     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", __pyx_clineno, __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 PY_MAJOR_VERSION < 3
  return;
  #else
  return __pyx_m;
  #endif
}

/* --- Runtime support code --- */
#if CYTHON_REFNANNY
static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
    PyObject *m = NULL, *p = NULL;
    void *r = NULL;
    m = PyImport_ImportModule((char *)modname);
    if (!m) goto end;
    p = PyObject_GetAttrString(m, (char *)"RefNannyAPI");
    if (!p) goto end;
    r = PyLong_AsVoidPtr(p);
end:
    Py_XDECREF(p);
    Py_XDECREF(m);
    return (__Pyx_RefNannyAPIStruct *)r;
}
#endif

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;
}

static void __Pyx_RaiseArgtupleInvalid(
    const char* func_name,
    int exact,
    Py_ssize_t num_min,
    Py_ssize_t num_max,
    Py_ssize_t num_found)
{
    Py_ssize_t num_expected;
    const char *more_or_less;
    if (num_found < num_min) {
        num_expected = num_min;
        more_or_less = "at least";
    } else {
        num_expected = num_max;
        more_or_less = "at most";
    }
    if (exact) {
        more_or_less = "exactly";
    }
    PyErr_Format(PyExc_TypeError,
                 "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)",
                 func_name, more_or_less, num_expected,
                 (num_expected == 1) ? "" : "s", num_found);
}

static void __Pyx_RaiseDoubleKeywordsError(
    const char* func_name,
    PyObject* kw_name)
{
    PyErr_Format(PyExc_TypeError,
        #if PY_MAJOR_VERSION >= 3
        "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
        #else
        "%s() got multiple values for keyword argument '%s'", func_name,
        PyString_AsString(kw_name));
        #endif
}

static int __Pyx_ParseOptionalKeywords(
    PyObject *kwds,
    PyObject **argnames[],
    PyObject *kwds2,
    PyObject *values[],
    Py_ssize_t num_pos_args,
    const char* function_name)
{
    PyObject *key = 0, *value = 0;
    Py_ssize_t pos = 0;
    PyObject*** name;
    PyObject*** first_kw_arg = argnames + num_pos_args;
    while (PyDict_Next(kwds, &pos, &key, &value)) {
        name = first_kw_arg;
        while (*name && (**name != key)) name++;
        if (*name) {
            values[name-argnames] = value;
            continue;
        }
        name = first_kw_arg;
        #if PY_MAJOR_VERSION < 3
        if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) {
            while (*name) {
                if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
                        && _PyString_Eq(**name, key)) {
                    values[name-argnames] = value;
                    break;
                }
                name++;
            }
            if (*name) continue;
            else {
                PyObject*** argname = argnames;
                while (argname != first_kw_arg) {
                    if ((**argname == key) || (
                            (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
                             && _PyString_Eq(**argname, key))) {
                        goto arg_passed_twice;
                    }
                    argname++;
                }
            }
        } else
        #endif
        if (likely(PyUnicode_Check(key))) {
            while (*name) {
                int cmp = (**name == key) ? 0 :
                #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
                    (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 :
                #endif
                    PyUnicode_Compare(**name, key);
                if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
                if (cmp == 0) {
                    values[name-argnames] = value;
                    break;
                }
                name++;
            }
            if (*name) continue;
            else {
                PyObject*** argname = argnames;
                while (argname != first_kw_arg) {
                    int cmp = (**argname == key) ? 0 :
                    #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
                        (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
                    #endif
                        PyUnicode_Compare(**argname, key);
                    if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
                    if (cmp == 0) goto arg_passed_twice;
                    argname++;
                }
            }
        } else
            goto invalid_keyword_type;
        if (kwds2) {
            if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
        } else {
            goto invalid_keyword;
        }
    }
    return 0;
arg_passed_twice:
    __Pyx_RaiseDoubleKeywordsError(function_name, key);
    goto bad;
invalid_keyword_type:
    PyErr_Format(PyExc_TypeError,
        "%.200s() keywords must be strings", function_name);
    goto bad;
invalid_keyword:
    PyErr_Format(PyExc_TypeError,
    #if PY_MAJOR_VERSION < 3
        "%.200s() got an unexpected keyword argument '%.200s'",
        function_name, PyString_AsString(key));
    #else
        "%s() got an unexpected keyword argument '%U'",
        function_name, key);
    #endif
bad:
    return -1;
}

static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type) {
    PyObject* fake_module;
    PyTypeObject* cached_type = NULL;
    fake_module = PyImport_AddModule((char*) "_cython_" CYTHON_ABI);
    if (!fake_module) return NULL;
    Py_INCREF(fake_module);
    cached_type = (PyTypeObject*) PyObject_GetAttrString(fake_module, type->tp_name);
    if (cached_type) {
        if (!PyType_Check((PyObject*)cached_type)) {
            PyErr_Format(PyExc_TypeError,
                "Shared Cython type %.200s is not a type object",
                type->tp_name);
            goto bad;
        }
        if (cached_type->tp_basicsize != type->tp_basicsize) {
            PyErr_Format(PyExc_TypeError,
                "Shared Cython type %.200s has the wrong size, try recompiling",
                type->tp_name);
            goto bad;
        }
    } else {
        if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad;
        PyErr_Clear();
        if (PyType_Ready(type) < 0) goto bad;
        if (PyObject_SetAttrString(fake_module, type->tp_name, (PyObject*) type) < 0)
            goto bad;
        Py_INCREF(type);
        cached_type = type;
    }
done:
    Py_DECREF(fake_module);
    return cached_type;
bad:
    Py_XDECREF(cached_type);
    cached_type = NULL;
    goto done;
}

static PyObject *
__Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *closure)
{
    if (unlikely(op->func_doc == NULL)) {
        if (op->func.m_ml->ml_doc) {
#if PY_MAJOR_VERSION >= 3
            op->func_doc = PyUnicode_FromString(op->func.m_ml->ml_doc);
#else
            op->func_doc = PyString_FromString(op->func.m_ml->ml_doc);
#endif
            if (unlikely(op->func_doc == NULL))
                return NULL;
        } else {
            Py_INCREF(Py_None);
            return Py_None;
        }
    }
    Py_INCREF(op->func_doc);
    return op->func_doc;
}
static int
__Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value)
{
    PyObject *tmp = op->func_doc;
    if (value == NULL) {
        value = Py_None;
    }
    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_COMPILING_IN_CPYTHON
    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(__pyx_CyFunctionObject, func.m_module), PY_WRITE_RESTRICTED, 0},
    {0, 0, 0,  0, 0}
};
static PyObject *
__Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, CYTHON_UNUSED PyObject *args)
{
#if PY_MAJOR_VERSION >= 3
    return PyUnicode_FromString(m->func.m_ml->ml_name);
#else
    return PyString_FromString(m->func.m_ml->ml_name);
#endif
}
static PyMethodDef __pyx_CyFunction_methods[] = {
    {"__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]);
        PyMem_Free(m->defaults);
        m->defaults = NULL;
    }
    return 0;
}
static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m)
{
    PyObject_GC_UnTrack(m);
    if (__Pyx_CyFunction_weakreflist(m) != NULL)
        PyObject_ClearWeakRefs((PyObject *) m);
    __Pyx_CyFunction_clear(m);
    PyObject_GC_Del(m);
}
static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit, void *arg)
{
    Py_VISIT(m->func_closure);
    Py_VISIT(m->func.m_module);
    Py_VISIT(m->func_dict);
    Py_VISIT(m->func_name);
    Py_VISIT(m->func_qualname);
    Py_VISIT(m->func_doc);
    Py_VISIT(m->func_globals);
    Py_VISIT(m->func_code);
    Py_VISIT(m->func_classobj);
    Py_VISIT(m->defaults_tuple);
    Py_VISIT(m->defaults_kwdict);
    if (m->defaults) {
        PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
        int i;
        for (i = 0; i < m->defaults_pyobjects; i++)
            Py_VISIT(pydefaults[i]);
    }
    return 0;
}
static PyObject *__Pyx_CyFunction_descr_get(PyObject *func, PyObject *obj, PyObject *type)
{
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    if (m->flags & __Pyx_CYFUNCTION_STATICMETHOD) {
        Py_INCREF(func);
        return func;
    }
    if (m->flags & __Pyx_CYFUNCTION_CLASSMETHOD) {
        if (type == NULL)
            type = (PyObject *)(Py_TYPE(obj));
        return __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
}
#if CYTHON_COMPILING_IN_PYPY
static PyObject * __Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) {
    PyCFunctionObject* f = (PyCFunctionObject*)func;
    PyCFunction meth = f->m_ml->ml_meth;
    PyObject *self = f->m_self;
    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 = PySequence_ITEM(arg, 0);
                if (unlikely(!arg0)) return NULL;
                result = (*meth)(self, arg0);
                Py_DECREF(arg0);
                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;
}
#else
static PyObject * __Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) {
	return PyCFunction_Call(func, arg, kw);
}
#endif
static PyTypeObject __pyx_CyFunctionType_type = {
    PyVarObject_HEAD_INIT(0, 0)
    "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_Call,
    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) {
#if !CYTHON_COMPILING_IN_PYPY
    __pyx_CyFunctionType_type.tp_call = PyCFunction_Call;
#endif
    __pyx_CyFunctionType = __Pyx_FetchCommonType(&__pyx_CyFunctionType_type);
    if (__pyx_CyFunctionType == NULL) {
        return -1;
    }
    return 0;
}
static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *func, size_t size, int pyobjects) {
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    m->defaults = PyMem_Malloc(size);
    if (!m->defaults)
        return PyErr_NoMemory();
    memset(m->defaults, 0, size);
    m->defaults_pyobjects = pyobjects;
    return m->defaults;
}
static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) {
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    m->defaults_tuple = tuple;
    Py_INCREF(tuple);
}
static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *func, PyObject *dict) {
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    m->defaults_kwdict = dict;
    Py_INCREF(dict);
}
static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, PyObject *dict) {
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    m->func_annotations = dict;
    Py_INCREF(dict);
}

static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
    PyErr_Format(PyExc_ValueError,
                 "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected);
}

static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
    PyErr_Format(PyExc_ValueError,
                 "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack",
                 index, (index == 1) ? "" : "s");
}

static CYTHON_INLINE int __Pyx_IterFinish(void) {
#if CYTHON_COMPILING_IN_CPYTHON
    PyThreadState *tstate = PyThreadState_GET();
    PyObject* exc_type = tstate->curexc_type;
    if (unlikely(exc_type)) {
        if (likely(exc_type == PyExc_StopIteration) || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)) {
            PyObject *exc_value, *exc_tb;
            exc_value = tstate->curexc_value;
            exc_tb = tstate->curexc_traceback;
            tstate->curexc_type = 0;
            tstate->curexc_value = 0;
            tstate->curexc_traceback = 0;
            Py_DECREF(exc_type);
            Py_XDECREF(exc_value);
            Py_XDECREF(exc_tb);
            return 0;
        } else {
            return -1;
        }
    }
    return 0;
#else
    if (unlikely(PyErr_Occurred())) {
        if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) {
            PyErr_Clear();
            return 0;
        } else {
            return -1;
        }
    }
    return 0;
#endif
}

static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) {
    if (unlikely(retval)) {
        Py_DECREF(retval);
        __Pyx_RaiseTooManyValuesError(expected);
        return -1;
    } else {
        return __Pyx_IterFinish();
    }
    return 0;
}

#if CYTHON_USE_PYLONG_INTERNALS
  #include "longintrepr.h"
#endif

#if CYTHON_COMPILING_IN_CPYTHON
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 && PY_MAJOR_VERSION >= 3
    if (likely(PyLong_CheckExact(op1))) {
        const long b = intval;
        long a, x;
        const PY_LONG_LONG llb = intval;
        PY_LONG_LONG lla, llx;
        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) | digits[0]));
                        break;
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
                        lla = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | digits[0]));
                        goto long_long;
                    }
                case 2:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                        a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | digits[0]));
                        break;
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
                        lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | digits[0]));
                        goto long_long;
                    }
                case -3:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                        a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | digits[1]) << PyLong_SHIFT) | digits[0]));
                        break;
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
                        lla = -(PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | digits[1]) << PyLong_SHIFT) | digits[0]));
                        goto long_long;
                    }
                case 3:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                        a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | digits[1]) << PyLong_SHIFT) | digits[0]));
                        break;
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
                        lla = (PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | digits[1]) << PyLong_SHIFT) | digits[0]));
                        goto long_long;
                    }
                case -4:
                    if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                        a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | digits[2]) << PyLong_SHIFT) | digits[1]) << PyLong_SHIFT) | digits[0]));
                        break;
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
                        lla = -(PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | digits[2]) << PyLong_SHIFT) | digits[1]) << PyLong_SHIFT) | digits[0]));
                        goto long_long;
                    }
                case 4:
                    if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                        a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | digits[2]) << PyLong_SHIFT) | digits[1]) << PyLong_SHIFT) | digits[0]));
                        break;
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
                        lla = (PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | digits[2]) << PyLong_SHIFT) | digits[1]) << PyLong_SHIFT) | digits[0]));
                        goto long_long;
                    }
                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);
        long_long:
                llx = lla % llb;
                llx += ((llx != 0) & ((llx ^ llb) < 0)) * llb;
            return PyLong_FromLongLong(llx);
    }
    #endif
    return (inplace ? PyNumber_InPlaceRemainder : PyNumber_Remainder)(op1, op2);
}
#endif

#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

static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) {
#if CYTHON_COMPILING_IN_CPYTHON
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    PyThreadState *tstate = PyThreadState_GET();
    tmp_type = tstate->curexc_type;
    tmp_value = tstate->curexc_value;
    tmp_tb = tstate->curexc_traceback;
    tstate->curexc_type = type;
    tstate->curexc_value = value;
    tstate->curexc_traceback = tb;
    Py_XDECREF(tmp_type);
    Py_XDECREF(tmp_value);
    Py_XDECREF(tmp_tb);
#else
    PyErr_Restore(type, value, tb);
#endif
}
static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) {
#if CYTHON_COMPILING_IN_CPYTHON
    PyThreadState *tstate = PyThreadState_GET();
    *type = tstate->curexc_type;
    *value = tstate->curexc_value;
    *tb = tstate->curexc_traceback;
    tstate->curexc_type = 0;
    tstate->curexc_value = 0;
    tstate->curexc_traceback = 0;
#else
    PyErr_Fetch(type, value, tb);
#endif
}

#if PY_MAJOR_VERSION < 3
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
                        CYTHON_UNUSED PyObject *cause) {
    Py_XINCREF(type);
    if (!value || value == Py_None)
        value = NULL;
    else
        Py_INCREF(value);
    if (!tb || tb == Py_None)
        tb = NULL;
    else {
        Py_INCREF(tb);
        if (!PyTraceBack_Check(tb)) {
            PyErr_SetString(PyExc_TypeError,
                "raise: arg 3 must be a traceback or None");
            goto raise_error;
        }
    }
    if (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_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 PY_VERSION_HEX >= 0x03030000
    if (cause) {
#else
    if (cause && cause != Py_None) {
#endif
        PyObject *fixed_cause;
        if (cause == Py_None) {
            fixed_cause = NULL;
        } else if (PyExceptionClass_Check(cause)) {
            fixed_cause = PyObject_CallObject(cause, NULL);
            if (fixed_cause == NULL)
                goto bad;
        } else if (PyExceptionInstance_Check(cause)) {
            fixed_cause = cause;
            Py_INCREF(fixed_cause);
        } else {
            PyErr_SetString(PyExc_TypeError,
                            "exception causes must derive from "
                            "BaseException");
            goto bad;
        }
        PyException_SetCause(value, fixed_cause);
    }
    PyErr_SetObject(type, value);
    if (tb) {
#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 = PyThreadState_GET();
        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

static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name) {
    PyObject *result;
#if CYTHON_COMPILING_IN_CPYTHON
    result = PyDict_GetItem(__pyx_d, name);
    if (likely(result)) {
        Py_INCREF(result);
    } else {
#else
    result = PyObject_GetItem(__pyx_d, name);
    if (!result) {
        PyErr_Clear();
#endif
        result = __Pyx_GetBuiltinName(name);
    }
    return result;
}

static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
    if (unlikely(!type)) {
        PyErr_SetString(PyExc_SystemError, "Missing type object");
        return 0;
    }
    if (likely(PyObject_TypeCheck(obj, type)))
        return 1;
    PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s",
                 Py_TYPE(obj)->tp_name, type->tp_name);
    return 0;
}

static 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;
}

#if CYTHON_COMPILING_IN_CPYTHON
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 && PY_MAJOR_VERSION >= 3
    if (likely(PyLong_CheckExact(op1))) {
        const long b = intval;
        long a, x;
        const PY_LONG_LONG llb = intval;
        PY_LONG_LONG lla, llx;
        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) | digits[0]));
                        break;
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
                        lla = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | digits[0]));
                        goto long_long;
                    }
                case 2:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                        a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | digits[0]));
                        break;
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
                        lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | digits[0]));
                        goto long_long;
                    }
                case -3:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                        a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | digits[1]) << PyLong_SHIFT) | digits[0]));
                        break;
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
                        lla = -(PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | digits[1]) << PyLong_SHIFT) | digits[0]));
                        goto long_long;
                    }
                case 3:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                        a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | digits[1]) << PyLong_SHIFT) | digits[0]));
                        break;
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
                        lla = (PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | digits[1]) << PyLong_SHIFT) | digits[0]));
                        goto long_long;
                    }
                case -4:
                    if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                        a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | digits[2]) << PyLong_SHIFT) | digits[1]) << PyLong_SHIFT) | digits[0]));
                        break;
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
                        lla = -(PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | digits[2]) << PyLong_SHIFT) | digits[1]) << PyLong_SHIFT) | digits[0]));
                        goto long_long;
                    }
                case 4:
                    if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                        a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | digits[2]) << PyLong_SHIFT) | digits[1]) << PyLong_SHIFT) | digits[0]));
                        break;
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
                        lla = (PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | digits[2]) << PyLong_SHIFT) | digits[1]) << PyLong_SHIFT) | digits[0]));
                        goto long_long;
                    }
                default: return PyLong_Type.tp_as_number->nb_add(op1, op2);
            }
        }
                x = a + b;
            return PyLong_FromLong(x);
        long_long:
                llx = lla + llb;
            return PyLong_FromLongLong(llx);
    }
    #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

#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

#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) {
#ifdef __Pyx_CyFunction_USED
    if (likely(PyCFunction_Check(func) || PyObject_TypeCheck(func, __pyx_CyFunctionType))) {
#else
    if (likely(PyCFunction_Check(func))) {
#endif
        if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) {
            return __Pyx_PyObject_CallMethO(func, arg);
        }
    }
    return __Pyx__PyObject_CallOneArg(func, arg);
}
#else
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
    PyObject* args = PyTuple_Pack(1, arg);
    return (likely(args)) ? __Pyx_PyObject_Call(func, args, NULL) : NULL;
}
#endif

#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) {
#ifdef __Pyx_CyFunction_USED
    if (likely(PyCFunction_Check(func) || PyObject_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

static CYTHON_INLINE int __Pyx_CheckKeywordStrings(
    PyObject *kwdict,
    const char* function_name,
    int kw_allowed)
{
    PyObject* key = 0;
    Py_ssize_t pos = 0;
#if CYTHON_COMPILING_IN_PYPY
    if (!kw_allowed && PyDict_Next(kwdict, &pos, &key, 0))
        goto invalid_keyword;
    return 1;
#else
    while (PyDict_Next(kwdict, &pos, &key, 0)) {
        #if PY_MAJOR_VERSION < 3
        if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key)))
        #endif
            if (unlikely(!PyUnicode_Check(key)))
                goto invalid_keyword_type;
    }
    if ((!kw_allowed) && unlikely(key))
        goto invalid_keyword;
    return 1;
invalid_keyword_type:
    PyErr_Format(PyExc_TypeError,
        "%.200s() keywords must be strings", function_name);
    return 0;
#endif
invalid_keyword:
    PyErr_Format(PyExc_TypeError,
    #if PY_MAJOR_VERSION < 3
        "%.200s() got an unexpected keyword argument '%.200s'",
        function_name, PyString_AsString(key));
    #else
        "%s() got an unexpected keyword argument '%U'",
        function_name, key);
    #endif
    return 0;
}

#if CYTHON_COMPILING_IN_CPYTHON
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 && PY_MAJOR_VERSION >= 3
    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) | digits[0]));
                        break;
                    }
                case 2:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                        a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | digits[0]));
                        break;
                    }
                case -3:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                        a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | digits[1]) << PyLong_SHIFT) | digits[0]));
                        break;
                    }
                case 3:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                        a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | digits[1]) << PyLong_SHIFT) | digits[0]));
                        break;
                    }
                case -4:
                    if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                        a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | digits[2]) << PyLong_SHIFT) | digits[1]) << PyLong_SHIFT) | digits[0]));
                        break;
                    }
                case 4:
                    if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                        a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | digits[2]) << PyLong_SHIFT) | digits[1]) << PyLong_SHIFT) | digits[0]));
                        break;
                    }
                #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

static CYTHON_INLINE PyObject *__Pyx_PyIter_Next2(PyObject* iterator, PyObject* defval) {
    PyObject* next;
    iternextfunc iternext = Py_TYPE(iterator)->tp_iternext;
#if CYTHON_COMPILING_IN_CPYTHON
    if (unlikely(!iternext)) {
#else
    if (unlikely(!iternext) || unlikely(!PyIter_Check(iterator))) {
#endif
        PyErr_Format(PyExc_TypeError,
            "%.200s object is not an iterator", Py_TYPE(iterator)->tp_name);
        return NULL;
    }
    next = iternext(iterator);
    if (likely(next))
        return next;
#if CYTHON_COMPILING_IN_CPYTHON
#if PY_VERSION_HEX >= 0x02070000
    if (unlikely(iternext == &_PyObject_NextNotImplemented))
        return NULL;
#endif
#endif
    if (defval) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
            if (unlikely(exc_type != PyExc_StopIteration) &&
                    !PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))
                return NULL;
            PyErr_Clear();
        }
        Py_INCREF(defval);
        return defval;
    }
    if (!PyErr_Occurred())
        PyErr_SetNone(PyExc_StopIteration);
    return NULL;
}

static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb) {
#if CYTHON_COMPILING_IN_CPYTHON
    PyThreadState *tstate = PyThreadState_GET();
    *type = tstate->exc_type;
    *value = tstate->exc_value;
    *tb = tstate->exc_traceback;
    Py_XINCREF(*type);
    Py_XINCREF(*value);
    Py_XINCREF(*tb);
#else
    PyErr_GetExcInfo(type, value, tb);
#endif
}
static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb) {
#if CYTHON_COMPILING_IN_CPYTHON
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    PyThreadState *tstate = PyThreadState_GET();
    tmp_type = tstate->exc_type;
    tmp_value = tstate->exc_value;
    tmp_tb = tstate->exc_traceback;
    tstate->exc_type = type;
    tstate->exc_value = value;
    tstate->exc_traceback = tb;
    Py_XDECREF(tmp_type);
    Py_XDECREF(tmp_value);
    Py_XDECREF(tmp_tb);
#else
    PyErr_SetExcInfo(type, value, tb);
#endif
}

static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) {
    PyObject *local_type, *local_value, *local_tb;
#if CYTHON_COMPILING_IN_CPYTHON
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    PyThreadState *tstate = PyThreadState_GET();
    local_type = tstate->curexc_type;
    local_value = tstate->curexc_value;
    local_tb = tstate->curexc_traceback;
    tstate->curexc_type = 0;
    tstate->curexc_value = 0;
    tstate->curexc_traceback = 0;
#else
    PyErr_Fetch(&local_type, &local_value, &local_tb);
#endif
    PyErr_NormalizeException(&local_type, &local_value, &local_tb);
#if CYTHON_COMPILING_IN_CPYTHON
    if (unlikely(tstate->curexc_type))
#else
    if (unlikely(PyErr_Occurred()))
#endif
        goto bad;
    #if PY_MAJOR_VERSION >= 3
    if (local_tb) {
        if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
            goto bad;
    }
    #endif
    Py_XINCREF(local_tb);
    Py_XINCREF(local_type);
    Py_XINCREF(local_value);
    *type = local_type;
    *value = local_value;
    *tb = local_tb;
#if CYTHON_COMPILING_IN_CPYTHON
    tmp_type = tstate->exc_type;
    tmp_value = tstate->exc_value;
    tmp_tb = tstate->exc_traceback;
    tstate->exc_type = local_type;
    tstate->exc_value = local_value;
    tstate->exc_traceback = local_tb;
    Py_XDECREF(tmp_type);
    Py_XDECREF(tmp_value);
    Py_XDECREF(tmp_tb);
#else
    PyErr_SetExcInfo(local_type, local_value, local_tb);
#endif
    return 0;
bad:
    *type = 0;
    *value = 0;
    *tb = 0;
    Py_XDECREF(local_type);
    Py_XDECREF(local_value);
    Py_XDECREF(local_tb);
    return -1;
}

static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname) {
    PyErr_Format(PyExc_UnboundLocalError, "local variable '%s' referenced before assignment", varname);
}

static void __Pyx_RaiseArgumentTypeInvalid(const char* name, PyObject *obj, PyTypeObject *type) {
    PyErr_Format(PyExc_TypeError,
        "Argument '%.200s' has incorrect type (expected %.200s, got %.200s)",
        name, type->tp_name, Py_TYPE(obj)->tp_name);
}
static CYTHON_INLINE int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed,
    const char *name, int exact)
{
    if (unlikely(!type)) {
        PyErr_SetString(PyExc_SystemError, "Missing type object");
        return 0;
    }
    if (none_allowed && obj == Py_None) return 1;
    else if (exact) {
        if (likely(Py_TYPE(obj) == type)) return 1;
        #if PY_MAJOR_VERSION == 2
        else if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1;
        #endif
    }
    else {
        if (likely(PyObject_TypeCheck(obj, type))) return 1;
    }
    __Pyx_RaiseArgumentTypeInvalid(name, obj, type);
    return 0;
}

static double __Pyx__PyObject_AsDouble(PyObject* obj) {
    PyObject* float_value;
#if CYTHON_COMPILING_IN_PYPY
    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;
}

static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
    PyObject *r;
    if (!j) return NULL;
    r = PyObject_GetItem(o, j);
    Py_DECREF(j);
    return r;
}
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
                                                              CYTHON_NCP_UNUSED int wraparound,
                                                              CYTHON_NCP_UNUSED int boundscheck) {
#if CYTHON_COMPILING_IN_CPYTHON
    if (wraparound & unlikely(i < 0)) i += PyList_GET_SIZE(o);
    if ((!boundscheck) || likely((0 <= i) & (i < PyList_GET_SIZE(o)))) {
        PyObject *r = PyList_GET_ITEM(o, i);
        Py_INCREF(r);
        return r;
    }
    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
#else
    return PySequence_GetItem(o, i);
#endif
}
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
                                                              CYTHON_NCP_UNUSED int wraparound,
                                                              CYTHON_NCP_UNUSED int boundscheck) {
#if CYTHON_COMPILING_IN_CPYTHON
    if (wraparound & unlikely(i < 0)) i += PyTuple_GET_SIZE(o);
    if ((!boundscheck) || likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) {
        PyObject *r = PyTuple_GET_ITEM(o, i);
        Py_INCREF(r);
        return r;
    }
    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
#else
    return PySequence_GetItem(o, i);
#endif
}
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list,
                                                     CYTHON_NCP_UNUSED int wraparound,
                                                     CYTHON_NCP_UNUSED int boundscheck) {
#if CYTHON_COMPILING_IN_CPYTHON
    if (is_list || PyList_CheckExact(o)) {
        Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
        if ((!boundscheck) || (likely((n >= 0) & (n < PyList_GET_SIZE(o))))) {
            PyObject *r = PyList_GET_ITEM(o, n);
            Py_INCREF(r);
            return r;
        }
    }
    else if (PyTuple_CheckExact(o)) {
        Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
        if ((!boundscheck) || likely((n >= 0) & (n < PyTuple_GET_SIZE(o)))) {
            PyObject *r = PyTuple_GET_ITEM(o, n);
            Py_INCREF(r);
            return r;
        }
    } else {
        PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
        if (likely(m && m->sq_item)) {
            if (wraparound && unlikely(i < 0) && likely(m->sq_length)) {
                Py_ssize_t l = m->sq_length(o);
                if (likely(l >= 0)) {
                    i += l;
                } else {
                    if (PyErr_ExceptionMatches(PyExc_OverflowError))
                        PyErr_Clear();
                    else
                        return NULL;
                }
            }
            return m->sq_item(o, i);
        }
    }
#else
    if (is_list || PySequence_Check(o)) {
        return PySequence_GetItem(o, i);
    }
#endif
    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
}

static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) {
#if CYTHON_COMPILING_IN_PYPY
    return PyObject_RichCompareBool(s1, s2, equals);
#else
    if (s1 == s2) {
        return (equals == Py_EQ);
    } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) {
        const char *ps1, *ps2;
        Py_ssize_t length = PyBytes_GET_SIZE(s1);
        if (length != PyBytes_GET_SIZE(s2))
            return (equals == Py_NE);
        ps1 = PyBytes_AS_STRING(s1);
        ps2 = PyBytes_AS_STRING(s2);
        if (ps1[0] != ps2[0]) {
            return (equals == Py_NE);
        } else if (length == 1) {
            return (equals == Py_EQ);
        } else {
            int result = memcmp(ps1, ps2, (size_t)length);
            return (equals == Py_EQ) ? (result == 0) : (result != 0);
        }
    } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) {
        return (equals == Py_NE);
    } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) {
        return (equals == Py_NE);
    } else {
        int result;
        PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
        if (!py_result)
            return -1;
        result = __Pyx_PyObject_IsTrue(py_result);
        Py_DECREF(py_result);
        return result;
    }
#endif
}

static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) {
#if CYTHON_COMPILING_IN_PYPY
    return PyObject_RichCompareBool(s1, s2, equals);
#else
#if PY_MAJOR_VERSION < 3
    PyObject* owned_ref = NULL;
#endif
    int s1_is_unicode, s2_is_unicode;
    if (s1 == s2) {
        goto return_eq;
    }
    s1_is_unicode = PyUnicode_CheckExact(s1);
    s2_is_unicode = PyUnicode_CheckExact(s2);
#if PY_MAJOR_VERSION < 3
    if ((s1_is_unicode & (!s2_is_unicode)) && PyString_CheckExact(s2)) {
        owned_ref = PyUnicode_FromObject(s2);
        if (unlikely(!owned_ref))
            return -1;
        s2 = owned_ref;
        s2_is_unicode = 1;
    } else if ((s2_is_unicode & (!s1_is_unicode)) && PyString_CheckExact(s1)) {
        owned_ref = PyUnicode_FromObject(s1);
        if (unlikely(!owned_ref))
            return -1;
        s1 = owned_ref;
        s1_is_unicode = 1;
    } else if (((!s2_is_unicode) & (!s1_is_unicode))) {
        return __Pyx_PyBytes_Equals(s1, s2, equals);
    }
#endif
    if (s1_is_unicode & s2_is_unicode) {
        Py_ssize_t length;
        int kind;
        void *data1, *data2;
        if (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;
        }
        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
}

#if CYTHON_COMPILING_IN_CPYTHON
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 && PY_MAJOR_VERSION >= 3
        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) | digits[0]));
                    if ((8 * sizeof(unsigned long) < 53) || (2 * PyLong_SHIFT < 53) || (a < (double) (1L<<53))) {
                        if (size == -2)
                            a = -a;
                        break;
                    }
                }
            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) | digits[1]) << PyLong_SHIFT) | digits[0]));
                    if ((8 * sizeof(unsigned long) < 53) || (3 * PyLong_SHIFT < 53) || (a < (double) (1L<<53))) {
                        if (size == -3)
                            a = -a;
                        break;
                    }
                }
            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) | digits[2]) << PyLong_SHIFT) | digits[1]) << PyLong_SHIFT) | digits[0]));
                    if ((8 * sizeof(unsigned long) < 53) || (4 * PyLong_SHIFT < 53) || (a < (double) (1L<<53))) {
                        if (size == -4)
                            a = -a;
                        break;
                    }
                }
            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

#if !CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyBytes_Join(PyObject* sep, PyObject* values) {
    return PyObject_CallMethodObjArgs(sep, __pyx_n_s_join, values, NULL);
}
#endif

static CYTHON_INLINE 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))) {
        length = strlen(cstring);
        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);
    }
}

static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
    PyObject *empty_list = 0;
    PyObject *module = 0;
    PyObject *global_dict = 0;
    PyObject *empty_dict = 0;
    PyObject *list;
    #if PY_VERSION_HEX < 0x03030000
    PyObject *py_import;
    py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
    if (!py_import)
        goto bad;
    #endif
    if (from_list)
        list = from_list;
    else {
        empty_list = PyList_New(0);
        if (!empty_list)
            goto bad;
        list = empty_list;
    }
    global_dict = PyModule_GetDict(__pyx_m);
    if (!global_dict)
        goto bad;
    empty_dict = PyDict_New();
    if (!empty_dict)
        goto bad;
    {
        #if PY_MAJOR_VERSION >= 3
        if (level == -1) {
            if (strchr(__Pyx_MODULE_NAME, '.')) {
                #if PY_VERSION_HEX < 0x03030000
                PyObject *py_level = PyInt_FromLong(1);
                if (!py_level)
                    goto bad;
                module = PyObject_CallFunctionObjArgs(py_import,
                    name, global_dict, empty_dict, list, py_level, NULL);
                Py_DECREF(py_level);
                #else
                module = PyImport_ImportModuleLevelObject(
                    name, global_dict, empty_dict, list, 1);
                #endif
                if (!module) {
                    if (!PyErr_ExceptionMatches(PyExc_ImportError))
                        goto bad;
                    PyErr_Clear();
                }
            }
            level = 0;
        }
        #endif
        if (!module) {
            #if PY_VERSION_HEX < 0x03030000
            PyObject *py_level = PyInt_FromLong(level);
            if (!py_level)
                goto bad;
            module = PyObject_CallFunctionObjArgs(py_import,
                name, global_dict, empty_dict, list, py_level, NULL);
            Py_DECREF(py_level);
            #else
            module = PyImport_ImportModuleLevelObject(
                name, global_dict, empty_dict, list, level);
            #endif
        }
    }
bad:
    #if PY_VERSION_HEX < 0x03030000
    Py_XDECREF(py_import);
    #endif
    Py_XDECREF(empty_list);
    Py_XDECREF(empty_dict);
    return module;
}

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;
}

#if CYTHON_COMPILING_IN_CPYTHON
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 && PY_MAJOR_VERSION >= 3
        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) | digits[0]));
                    if ((8 * sizeof(unsigned long) < 53) || (2 * PyLong_SHIFT < 53) || (a < (double) (1L<<53))) {
                        if (size == -2)
                            a = -a;
                        break;
                    }
                }
            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) | digits[1]) << PyLong_SHIFT) | digits[0]));
                    if ((8 * sizeof(unsigned long) < 53) || (3 * PyLong_SHIFT < 53) || (a < (double) (1L<<53))) {
                        if (size == -3)
                            a = -a;
                        break;
                    }
                }
            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) | digits[2]) << PyLong_SHIFT) | digits[1]) << PyLong_SHIFT) | digits[0]));
                    if ((8 * sizeof(unsigned long) < 53) || (4 * PyLong_SHIFT < 53) || (a < (double) (1L<<53))) {
                        if (size == -4)
                            a = -a;
                        break;
                    }
                }
            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

#if CYTHON_COMPILING_IN_CPYTHON
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 && PY_MAJOR_VERSION >= 3
    if (likely(PyLong_CheckExact(op2))) {
        const long a = intval;
        long b, x;
        const PY_LONG_LONG lla = intval;
        PY_LONG_LONG llb, llx;
        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) | digits[0]));
                        break;
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
                        llb = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | digits[0]));
                        goto long_long;
                    }
                case 2:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                        b = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | digits[0]));
                        break;
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
                        llb = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | digits[0]));
                        goto long_long;
                    }
                case -3:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                        b = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | digits[1]) << PyLong_SHIFT) | digits[0]));
                        break;
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
                        llb = -(PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | digits[1]) << PyLong_SHIFT) | digits[0]));
                        goto long_long;
                    }
                case 3:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                        b = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | digits[1]) << PyLong_SHIFT) | digits[0]));
                        break;
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
                        llb = (PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | digits[1]) << PyLong_SHIFT) | digits[0]));
                        goto long_long;
                    }
                case -4:
                    if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                        b = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | digits[2]) << PyLong_SHIFT) | digits[1]) << PyLong_SHIFT) | digits[0]));
                        break;
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
                        llb = -(PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | digits[2]) << PyLong_SHIFT) | digits[1]) << PyLong_SHIFT) | digits[0]));
                        goto long_long;
                    }
                case 4:
                    if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                        b = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | digits[2]) << PyLong_SHIFT) | digits[1]) << PyLong_SHIFT) | digits[0]));
                        break;
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
                        llb = (PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | digits[2]) << PyLong_SHIFT) | digits[1]) << PyLong_SHIFT) | digits[0]));
                        goto long_long;
                    }
                default: return PyLong_Type.tp_as_number->nb_add(op1, op2);
            }
        }
                x = a + b;
            return PyLong_FromLong(x);
        long_long:
                llx = lla + llb;
            return PyLong_FromLongLong(llx);
    }
    #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

#if CYTHON_COMPILING_IN_CPYTHON
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 && PY_MAJOR_VERSION >= 3
    if (likely(PyLong_CheckExact(op1))) {
        const long b = intval;
        long a, x;
        const PY_LONG_LONG llb = intval;
        PY_LONG_LONG lla, llx;
        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) | digits[0]));
                        break;
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
                        lla = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | digits[0]));
                        goto long_long;
                    }
                case 2:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                        a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | digits[0]));
                        break;
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
                        lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | digits[0]));
                        goto long_long;
                    }
                case -3:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                        a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | digits[1]) << PyLong_SHIFT) | digits[0]));
                        break;
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
                        lla = -(PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | digits[1]) << PyLong_SHIFT) | digits[0]));
                        goto long_long;
                    }
                case 3:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                        a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | digits[1]) << PyLong_SHIFT) | digits[0]));
                        break;
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
                        lla = (PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | digits[1]) << PyLong_SHIFT) | digits[0]));
                        goto long_long;
                    }
                case -4:
                    if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                        a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | digits[2]) << PyLong_SHIFT) | digits[1]) << PyLong_SHIFT) | digits[0]));
                        break;
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
                        lla = -(PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | digits[2]) << PyLong_SHIFT) | digits[1]) << PyLong_SHIFT) | digits[0]));
                        goto long_long;
                    }
                case 4:
                    if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                        a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | digits[2]) << PyLong_SHIFT) | digits[1]) << PyLong_SHIFT) | digits[0]));
                        break;
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
                        lla = (PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | digits[2]) << PyLong_SHIFT) | digits[1]) << PyLong_SHIFT) | digits[0]));
                        goto long_long;
                    }
                default: return PyLong_Type.tp_as_number->nb_subtract(op1, op2);
            }
        }
                x = a - b;
            return PyLong_FromLong(x);
        long_long:
                llx = lla - llb;
            return PyLong_FromLongLong(llx);
    }
    #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

#if CYTHON_COMPILING_IN_CPYTHON
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 && PY_MAJOR_VERSION >= 3
        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) | digits[0]));
                    if ((8 * sizeof(unsigned long) < 53) || (2 * PyLong_SHIFT < 53) || (a < (double) (1L<<53))) {
                        if (size == -2)
                            a = -a;
                        break;
                    }
                }
            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) | digits[1]) << PyLong_SHIFT) | digits[0]));
                    if ((8 * sizeof(unsigned long) < 53) || (3 * PyLong_SHIFT < 53) || (a < (double) (1L<<53))) {
                        if (size == -3)
                            a = -a;
                        break;
                    }
                }
            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) | digits[2]) << PyLong_SHIFT) | digits[1]) << PyLong_SHIFT) | digits[0]));
                    if ((8 * sizeof(unsigned long) < 53) || (4 * PyLong_SHIFT < 53) || (a < (double) (1L<<53))) {
                        if (size == -4)
                            a = -a;
                        break;
                    }
                }
            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

#if CYTHON_COMPILING_IN_CPYTHON
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 && PY_MAJOR_VERSION >= 3
        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) | digits[0]));
                    if ((8 * sizeof(unsigned long) < 53) || (2 * PyLong_SHIFT < 53) || (b < (double) (1L<<53))) {
                        if (size == -2)
                            b = -b;
                        break;
                    }
                }
            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) | digits[1]) << PyLong_SHIFT) | digits[0]));
                    if ((8 * sizeof(unsigned long) < 53) || (3 * PyLong_SHIFT < 53) || (b < (double) (1L<<53))) {
                        if (size == -3)
                            b = -b;
                        break;
                    }
                }
            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) | digits[2]) << PyLong_SHIFT) | digits[1]) << PyLong_SHIFT) | digits[0]));
                    if ((8 * sizeof(unsigned long) < 53) || (4 * PyLong_SHIFT < 53) || (b < (double) (1L<<53))) {
                        if (size == -4)
                            b = -b;
                        break;
                    }
                }
            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

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(PyObject_TypeCheck(method, &PyMethodDescr_Type)))
    #endif
    {
        PyMethodDescrObject *descr = (PyMethodDescrObject*) method;
        target->func = descr->d_method->ml_meth;
        target->flag = descr->d_method->ml_flags & (METH_VARARGS | METH_KEYWORDS | METH_O | METH_NOARGS);
    }
#endif
    return 0;
}

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_COMPILING_IN_CPYTHON
    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;
}

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);
}

static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *o, PyObject *n) {
#if CYTHON_COMPILING_IN_CPYTHON
#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);
}

static CYTHON_INLINE 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_COMPILING_IN_CPYTHON
    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))
                        PyErr_Clear();
                    else
                        return -1;
                }
            }
            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);
}

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);
}

#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;
    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(
        PyThreadState_GET(), /*PyThreadState *tstate,*/
        py_code,             /*PyCodeObject *code,*/
        __pyx_d,      /*PyObject *globals,*/
        0                    /*PyObject *locals*/
    );
    if (!py_frame) goto bad;
    py_frame->f_lineno = py_line;
    PyTraceBack_Here(py_frame);
bad:
    Py_XDECREF(py_code);
    Py_XDECREF(py_frame);
}

static 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);
        } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
        }
    } else {
        if (sizeof(int) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(int),
                                     little, !is_unsigned);
    }
}

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);
        } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
        }
    } else {
        if (sizeof(long) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(long),
                                     little, !is_unsigned);
    }
}

#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;\
    }

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) | digits[0])))
                        } else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) {
                            return (long) (((((long)digits[1]) << PyLong_SHIFT) | 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) | digits[1]) << PyLong_SHIFT) | digits[0])))
                        } else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) {
                            return (long) (((((((long)digits[2]) << PyLong_SHIFT) | digits[1]) << PyLong_SHIFT) | 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) | digits[2]) << PyLong_SHIFT) | digits[1]) << PyLong_SHIFT) | digits[0])))
                        } else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) {
                            return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | digits[2]) << PyLong_SHIFT) | digits[1]) << PyLong_SHIFT) | 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))
            } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
            }
        } 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) 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) | digits[0])))
                        } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                            return (long) -(((((long)digits[1]) << PyLong_SHIFT) | 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) | digits[0])))
                        } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                            return (long) (((((long)digits[1]) << PyLong_SHIFT) | 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) | digits[1]) << PyLong_SHIFT) | digits[0])))
                        } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                            return (long) -(((((((long)digits[2]) << PyLong_SHIFT) | digits[1]) << PyLong_SHIFT) | 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) | digits[1]) << PyLong_SHIFT) | digits[0])))
                        } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                            return (long) (((((((long)digits[2]) << PyLong_SHIFT) | digits[1]) << PyLong_SHIFT) | 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) | digits[2]) << PyLong_SHIFT) | digits[1]) << PyLong_SHIFT) | digits[0])))
                        } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                            return (long) -(((((((((long)digits[3]) << PyLong_SHIFT) | digits[2]) << PyLong_SHIFT) | digits[1]) << PyLong_SHIFT) | 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) | digits[2]) << PyLong_SHIFT) | digits[1]) << PyLong_SHIFT) | digits[0])))
                        } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                            return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | digits[2]) << PyLong_SHIFT) | digits[1]) << PyLong_SHIFT) | digits[0]));
                        }
                    }
                    break;
            }
#endif
            if (sizeof(long) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x))
            } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x))
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            long val;
            PyObject *v = __Pyx_PyNumber_Int(x);
 #if PY_MAJOR_VERSION < 3
            if (likely(v) && !PyLong_Check(v)) {
                PyObject *tmp = v;
                v = PyNumber_Long(tmp);
                Py_DECREF(tmp);
            }
 #endif
            if (likely(v)) {
                int one = 1; int is_little = (int)*(unsigned char *)&one;
                unsigned char *bytes = (unsigned char *)&val;
                int ret = _PyLong_AsByteArray((PyLongObject *)v,
                                              bytes, sizeof(val),
                                              is_little, !is_unsigned);
                Py_DECREF(v);
                if (likely(!ret))
                    return val;
            }
#endif
            return (long) -1;
        }
    } else {
        long val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (long) -1;
        val = __Pyx_PyInt_As_long(tmp);
        Py_DECREF(tmp);
        return val;
    }
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;
}

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) | digits[0])))
                        } else if (8 * sizeof(size_t) >= 2 * PyLong_SHIFT) {
                            return (size_t) (((((size_t)digits[1]) << PyLong_SHIFT) | 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) | digits[1]) << PyLong_SHIFT) | digits[0])))
                        } else if (8 * sizeof(size_t) >= 3 * PyLong_SHIFT) {
                            return (size_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | digits[1]) << PyLong_SHIFT) | 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) | digits[2]) << PyLong_SHIFT) | digits[1]) << PyLong_SHIFT) | digits[0])))
                        } else if (8 * sizeof(size_t) >= 4 * PyLong_SHIFT) {
                            return (size_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | digits[2]) << PyLong_SHIFT) | digits[1]) << PyLong_SHIFT) | 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))
            } else if (sizeof(size_t) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(size_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
            }
        } 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) 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) | digits[0])))
                        } else if (8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT) {
                            return (size_t) -(((((size_t)digits[1]) << PyLong_SHIFT) | 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) | digits[0])))
                        } else if (8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT) {
                            return (size_t) (((((size_t)digits[1]) << PyLong_SHIFT) | 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) | digits[1]) << PyLong_SHIFT) | digits[0])))
                        } else if (8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT) {
                            return (size_t) -(((((((size_t)digits[2]) << PyLong_SHIFT) | digits[1]) << PyLong_SHIFT) | 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) | digits[1]) << PyLong_SHIFT) | digits[0])))
                        } else if (8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT) {
                            return (size_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | digits[1]) << PyLong_SHIFT) | 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) | digits[2]) << PyLong_SHIFT) | digits[1]) << PyLong_SHIFT) | digits[0])))
                        } else if (8 * sizeof(size_t) - 1 > 4 * PyLong_SHIFT) {
                            return (size_t) -(((((((((size_t)digits[3]) << PyLong_SHIFT) | digits[2]) << PyLong_SHIFT) | digits[1]) << PyLong_SHIFT) | 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) | digits[2]) << PyLong_SHIFT) | digits[1]) << PyLong_SHIFT) | digits[0])))
                        } else if (8 * sizeof(size_t) - 1 > 4 * PyLong_SHIFT) {
                            return (size_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | digits[2]) << PyLong_SHIFT) | digits[1]) << PyLong_SHIFT) | digits[0]));
                        }
                    }
                    break;
            }
#endif
            if (sizeof(size_t) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT_EXC(size_t, long, PyLong_AsLong(x))
            } else if (sizeof(size_t) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(size_t, PY_LONG_LONG, PyLong_AsLongLong(x))
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            size_t val;
            PyObject *v = __Pyx_PyNumber_Int(x);
 #if PY_MAJOR_VERSION < 3
            if (likely(v) && !PyLong_Check(v)) {
                PyObject *tmp = v;
                v = PyNumber_Long(tmp);
                Py_DECREF(tmp);
            }
 #endif
            if (likely(v)) {
                int one = 1; int is_little = (int)*(unsigned char *)&one;
                unsigned char *bytes = (unsigned char *)&val;
                int ret = _PyLong_AsByteArray((PyLongObject *)v,
                                              bytes, sizeof(val),
                                              is_little, !is_unsigned);
                Py_DECREF(v);
                if (likely(!ret))
                    return val;
            }
#endif
            return (size_t) -1;
        }
    } else {
        size_t val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (size_t) -1;
        val = __Pyx_PyInt_As_size_t(tmp);
        Py_DECREF(tmp);
        return val;
    }
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;
}

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) | digits[0])))
                        } else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) {
                            return (int) (((((int)digits[1]) << PyLong_SHIFT) | 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) | digits[1]) << PyLong_SHIFT) | digits[0])))
                        } else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) {
                            return (int) (((((((int)digits[2]) << PyLong_SHIFT) | digits[1]) << PyLong_SHIFT) | 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) | digits[2]) << PyLong_SHIFT) | digits[1]) << PyLong_SHIFT) | digits[0])))
                        } else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) {
                            return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | digits[2]) << PyLong_SHIFT) | digits[1]) << PyLong_SHIFT) | 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))
            } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
            }
        } 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) 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) | digits[0])))
                        } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
                            return (int) -(((((int)digits[1]) << PyLong_SHIFT) | 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) | digits[0])))
                        } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
                            return (int) (((((int)digits[1]) << PyLong_SHIFT) | 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) | digits[1]) << PyLong_SHIFT) | digits[0])))
                        } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
                            return (int) -(((((((int)digits[2]) << PyLong_SHIFT) | digits[1]) << PyLong_SHIFT) | 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) | digits[1]) << PyLong_SHIFT) | digits[0])))
                        } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
                            return (int) (((((((int)digits[2]) << PyLong_SHIFT) | digits[1]) << PyLong_SHIFT) | 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) | digits[2]) << PyLong_SHIFT) | digits[1]) << PyLong_SHIFT) | digits[0])))
                        } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
                            return (int) -(((((((((int)digits[3]) << PyLong_SHIFT) | digits[2]) << PyLong_SHIFT) | digits[1]) << PyLong_SHIFT) | 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) | digits[2]) << PyLong_SHIFT) | digits[1]) << PyLong_SHIFT) | digits[0])))
                        } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
                            return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | digits[2]) << PyLong_SHIFT) | digits[1]) << PyLong_SHIFT) | digits[0]));
                        }
                    }
                    break;
            }
#endif
            if (sizeof(int) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x))
            } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x))
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            int val;
            PyObject *v = __Pyx_PyNumber_Int(x);
 #if PY_MAJOR_VERSION < 3
            if (likely(v) && !PyLong_Check(v)) {
                PyObject *tmp = v;
                v = PyNumber_Long(tmp);
                Py_DECREF(tmp);
            }
 #endif
            if (likely(v)) {
                int one = 1; int is_little = (int)*(unsigned char *)&one;
                unsigned char *bytes = (unsigned char *)&val;
                int ret = _PyLong_AsByteArray((PyLongObject *)v,
                                              bytes, sizeof(val),
                                              is_little, !is_unsigned);
                Py_DECREF(v);
                if (likely(!ret))
                    return val;
            }
#endif
            return (int) -1;
        }
    } else {
        int val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (int) -1;
        val = __Pyx_PyInt_As_int(tmp);
        Py_DECREF(tmp);
        return val;
    }
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;
}

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;
}

#ifndef __PYX_HAVE_RT_ImportModule
#define __PYX_HAVE_RT_ImportModule
static PyObject *__Pyx_ImportModule(const char *name) {
    PyObject *py_name = 0;
    PyObject *py_module = 0;
    py_name = __Pyx_PyIdentifier_FromString(name);
    if (!py_name)
        goto bad;
    py_module = PyImport_Import(py_name);
    Py_DECREF(py_name);
    return py_module;
bad:
    Py_XDECREF(py_name);
    return 0;
}
#endif

#ifndef __PYX_HAVE_RT_ImportType
#define __PYX_HAVE_RT_ImportType
static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name,
    size_t size, int strict)
{
    PyObject *py_module = 0;
    PyObject *result = 0;
    PyObject *py_name = 0;
    char warning[200];
    Py_ssize_t basicsize;
#ifdef Py_LIMITED_API
    PyObject *py_basicsize;
#endif
    py_module = __Pyx_ImportModule(module_name);
    if (!py_module)
        goto bad;
    py_name = __Pyx_PyIdentifier_FromString(class_name);
    if (!py_name)
        goto bad;
    result = PyObject_GetAttr(py_module, py_name);
    Py_DECREF(py_name);
    py_name = 0;
    Py_DECREF(py_module);
    py_module = 0;
    if (!result)
        goto bad;
    if (!PyType_Check(result)) {
        PyErr_Format(PyExc_TypeError,
            "%.200s.%.200s is not a type object",
            module_name, class_name);
        goto bad;
    }
#ifndef Py_LIMITED_API
    basicsize = ((PyTypeObject *)result)->tp_basicsize;
#else
    py_basicsize = PyObject_GetAttrString(result, "__basicsize__");
    if (!py_basicsize)
        goto bad;
    basicsize = PyLong_AsSsize_t(py_basicsize);
    Py_DECREF(py_basicsize);
    py_basicsize = 0;
    if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred())
        goto bad;
#endif
    if (!strict && (size_t)basicsize > size) {
        PyOS_snprintf(warning, sizeof(warning),
            "%s.%s size changed, may indicate binary incompatibility",
            module_name, class_name);
        if (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",
            module_name, class_name);
        goto bad;
    }
    return (PyTypeObject *)result;
bad:
    Py_XDECREF(py_module);
    Py_XDECREF(result);
    return NULL;
}
#endif

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;
        ++t;
    }
    return 0;
}

static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
    return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str));
}
static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject* o) {
    Py_ssize_t ignore;
    return __Pyx_PyObject_AsStringAndSize(o, &ignore);
}
static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
#if CYTHON_COMPILING_IN_CPYTHON && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
    if (
#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
            __Pyx_sys_getdefaultencoding_not_ascii &&
#endif
            PyUnicode_Check(o)) {
#if PY_VERSION_HEX < 0x03030000
        char* defenc_c;
        PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
        if (!defenc) return NULL;
        defenc_c = PyBytes_AS_STRING(defenc);
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
        {
            char* end = defenc_c + PyBytes_GET_SIZE(defenc);
            char* c;
            for (c = defenc_c; c < end; c++) {
                if ((unsigned char) (*c) >= 128) {
                    PyUnicode_AsASCIIString(o);
                    return NULL;
                }
            }
        }
#endif
        *length = PyBytes_GET_SIZE(defenc);
        return defenc_c;
#else
        if (__Pyx_PyUnicode_READY(o) == -1) return NULL;
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
        if (PyUnicode_IS_ASCII(o)) {
            *length = PyUnicode_GET_LENGTH(o);
            return PyUnicode_AsUTF8(o);
        } else {
            PyUnicode_AsASCIIString(o);
            return NULL;
        }
#else
        return PyUnicode_AsUTF8AndSize(o, length);
#endif
#endif
    } 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 CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) {
  PyNumberMethods *m;
  const char *name = NULL;
  PyObject *res = NULL;
#if PY_MAJOR_VERSION < 3
  if (PyInt_Check(x) || PyLong_Check(x))
#else
  if (PyLong_Check(x))
#endif
    return __Pyx_NewRef(x);
  m = Py_TYPE(x)->tp_as_number;
#if PY_MAJOR_VERSION < 3
  if (m && m->nb_int) {
    name = "int";
    res = PyNumber_Int(x);
  }
  else if (m && m->nb_long) {
    name = "long";
    res = PyNumber_Long(x);
  }
#else
  if (m && m->nb_int) {
    name = "int";
    res = PyNumber_Long(x);
  }
#endif
  if (res) {
#if PY_MAJOR_VERSION < 3
    if (!PyInt_Check(res) && !PyLong_Check(res)) {
#else
    if (!PyLong_Check(res)) {
#endif
      PyErr_Format(PyExc_TypeError,
                   "__%.4s__ returned non-%.4s (type %.200s)",
                   name, name, Py_TYPE(res)->tp_name);
      Py_DECREF(res);
      return NULL;
    }
  }
  else if (!PyErr_Occurred()) {
    PyErr_SetString(PyExc_TypeError,
                    "an integer is required");
  }
  return res;
}
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) | digits[0]));
           }
           break;
         case -2:
           if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
             return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | digits[0]));
           }
           break;
         case 3:
           if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
             return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | digits[1]) << PyLong_SHIFT) | digits[0]));
           }
           break;
         case -3:
           if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
             return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | digits[1]) << PyLong_SHIFT) | digits[0]));
           }
           break;
         case 4:
           if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
             return (Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | digits[2]) << PyLong_SHIFT) | digits[1]) << PyLong_SHIFT) | digits[0]));
           }
           break;
         case -4:
           if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
             return -(Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | digits[2]) << PyLong_SHIFT) | digits[1]) << PyLong_SHIFT) | 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_PyInt_FromSize_t(size_t ival) {
    return PyInt_FromSize_t(ival);
}


#endif /* Py_PYTHON_H */
