/* Generated by Cython 0.19.2 on Mon Jan 27 16:12:05 2014 */

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


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

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

#if defined(WIN32) || defined(MS_WINDOWS)
#define _USE_MATH_DEFINES
#endif
#include <math.h>
#define __PYX_HAVE__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
typedef struct {PyObject **p; char *s; const Py_ssize_t n; const char* encoding;
                const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/

#define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
#define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT 0
#define __PYX_DEFAULT_STRING_ENCODING ""
#define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
#define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject*);
static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
#define __Pyx_PyBytes_FromString        PyBytes_FromString
#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(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_AsUString(s)    ((unsigned char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_FromUString(s)  __Pyx_PyObject_FromString((char*)s)
#define __Pyx_PyBytes_FromUString(s)   __Pyx_PyBytes_FromString((char*)s)
#define __Pyx_PyStr_FromUString(s)     __Pyx_PyStr_FromString((char*)s)
#define __Pyx_PyUnicode_FromUString(s) __Pyx_PyUnicode_FromString((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 u_end - u - 1;
}
#else
#define __Pyx_Py_UNICODE_strlen Py_UNICODE_strlen
#endif
#define __Pyx_PyUnicode_FromUnicode(u)       PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
#define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
#define __Pyx_PyUnicode_AsUnicode            PyUnicode_AsUnicode
#define __Pyx_Owned_Py_None(b) (Py_INCREF(Py_None), Py_None)
#define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False))
static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x);
static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*);
#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() {
    PyObject* sys = NULL;
    PyObject* default_encoding = NULL;
    PyObject* ascii_chars_u = NULL;
    PyObject* ascii_chars_b = NULL;
    sys = PyImport_ImportModule("sys");
    if (sys == NULL) goto bad;
    default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
    if (default_encoding == NULL) goto bad;
    if (strcmp(PyBytes_AsString(default_encoding), "ascii") == 0) {
        __Pyx_sys_getdefaultencoding_not_ascii = 0;
    } else {
        const char* default_encoding_c = PyBytes_AS_STRING(default_encoding);
        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 == NULL) goto bad;
        ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
        if (ascii_chars_b == NULL || strncmp(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 '%s' is not a superset of ascii.",
                default_encoding_c);
            goto bad;
        }
    }
    Py_XDECREF(sys);
    Py_XDECREF(default_encoding);
    Py_XDECREF(ascii_chars_u);
    Py_XDECREF(ascii_chars_b);
    return 0;
bad:
    Py_XDECREF(sys);
    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() {
    PyObject* sys = NULL;
    PyObject* default_encoding = NULL;
    char* default_encoding_c;
    sys = PyImport_ImportModule("sys");
    if (sys == NULL) goto bad;
    default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
    if (default_encoding == NULL) goto bad;
    default_encoding_c = PyBytes_AS_STRING(default_encoding);
    __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c));
    strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
    Py_DECREF(sys);
    Py_DECREF(default_encoding);
    return 0;
bad:
    Py_XDECREF(sys);
    Py_XDECREF(default_encoding);
    return -1;
}
#endif
#endif


#ifdef __GNUC__
  /* Test for GCC > 2.95 */
  #if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))
    #define likely(x)   __builtin_expect(!!(x), 1)
    #define unlikely(x) __builtin_expect(!!(x), 0)
  #else /* __GNUC__ > 2 ... */
    #define likely(x)   (x)
    #define unlikely(x) (x)
  #endif /* __GNUC__ > 2 ... */
#else /* __GNUC__ */
  #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_gribmessage;
struct __pyx_obj_6pygrib_open;
struct __pyx_obj_6pygrib_index;
struct __pyx_opt_args_6pygrib__strencode;

/* "pygrib.pyx":2061
 *     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":800
 *     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":368
 *     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":1816
 *         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;
};

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

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

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

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

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

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

#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;
    int flags;
    PyObject *func_dict;
    PyObject *func_weakreflist;
    PyObject *func_name;
    PyObject *func_qualname;
    PyObject *func_doc;
    PyObject *func_code;
    PyObject *func_closure;
    PyObject *func_classobj; /* No-args super() class cell */
    void *defaults;
    int defaults_pyobjects;
    PyObject *defaults_tuple;   /* Const defaults tuple */
    PyObject *defaults_kwdict;  /* Const kwonly defaults dict */
    PyObject *(*defaults_getter)(PyObject *);
    PyObject *func_annotations; /* function annotations dict */
} __pyx_CyFunctionObject;
static PyTypeObject *__pyx_CyFunctionType = 0;
#define __Pyx_CyFunction_NewEx(ml, flags, qualname, self, module, code) \
    __Pyx_CyFunction_New(__pyx_CyFunctionType, ml, flags, qualname, self, module, code)
static PyObject *__Pyx_CyFunction_New(PyTypeObject *, PyMethodDef *ml,
                                      int flags, PyObject* qualname,
                                      PyObject *self, PyObject *module,
                                      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); /*proto*/

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

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

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

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

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

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

#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); /*proto*/

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

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

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 int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed,
    const char *name, int exact); /*proto*/

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

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

static double __Pyx__PyObject_AsDouble(PyObject* obj); /* proto */
#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, size, to_py_func, is_list, wraparound, boundscheck) \
    (((size) <= sizeof(Py_ssize_t)) ? \
    __Pyx_GetItemInt_Fast(o, i, is_list, wraparound, boundscheck) : \
    __Pyx_GetItemInt_Generic(o, to_py_func(i)))
#define __Pyx_GetItemInt_List(o, i, size, to_py_func, is_list, wraparound, boundscheck) \
    (((size) <= sizeof(Py_ssize_t)) ? \
    __Pyx_GetItemInt_List_Fast(o, i, wraparound, boundscheck) : \
    __Pyx_GetItemInt_Generic(o, to_py_func(i)))
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
                                                              int wraparound, int boundscheck);
#define __Pyx_GetItemInt_Tuple(o, i, size, to_py_func, is_list, wraparound, boundscheck) \
    (((size) <= sizeof(Py_ssize_t)) ? \
    __Pyx_GetItemInt_Tuple_Fast(o, i, wraparound, boundscheck) : \
    __Pyx_GetItemInt_Generic(o, to_py_func(i)))
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
                                                              int wraparound, int boundscheck);
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j);
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
                                                     int is_list, int wraparound, int boundscheck);

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

#include <string.h>

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

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

#if PY_MAJOR_VERSION >= 3
static CYTHON_INLINE PyObject* __Pyx_PyDict_Items(PyObject* d); /*proto*/
#else
#define __Pyx_PyDict_Items(d) PyDict_Items(d)
#endif

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

#define __Pyx_SetItemInt(o, i, v, size, to_py_func, is_list, wraparound, boundscheck) \
    (((size) <= sizeof(Py_ssize_t)) ? \
    __Pyx_SetItemInt_Fast(o, i, v, is_list, wraparound, boundscheck) : \
    __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);

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

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

static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *);

static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *);

static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *);

static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject *);

static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject *);

static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject *);

static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *);

static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *);

static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *);

static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject *);

static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *);

static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *);

static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject *);

static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *);

static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *);

static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(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); /*proto*/

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

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

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

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


/* Module declarations from 'numpy' */

/* Module declarations from 'pygrib' */
static PyTypeObject *__pyx_ptype_6pygrib_ndarray = 0;
static PyTypeObject *__pyx_ptype_6pygrib_gribmessage = 0;
static PyTypeObject *__pyx_ptype_6pygrib_open = 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 PyObject *__pyx_lambda_funcdef_lambda1(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_gribmessage(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_6pygrib_open(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_6pygrib_index(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static char __pyx_k_1[] = "_get_grib_api_version.<locals>.<lambda>";
static char __pyx_k_2[] = "%d.%d.%d";
static char __pyx_k_3[] = "nlats must be even";
static char __pyx_k_5[] = "could not open %s";
static char __pyx_k_6[] = "key must be an integer message number or a slice";
static char __pyx_k_8[] = "from_what keyword arg to seek must be 0,1 or 2";
static char __pyx_k_10[] = "grb message numbers start at 1";
static char __pyx_k_12[] = "no matches found";
static char __pyx_k_15[] = "nmsgs must be >= 0 in _advance";
static char __pyx_k_17[] = "not that many messages in file";
static char __pyx_k_19[] = "";
static char __pyx_k_20[] = "indicatorOfUnitOfTimeRange";
static char __pyx_k_24[] = "-";
static char __pyx_k_27[] = "3 hr periods";
static char __pyx_k_28[] = "6 hr periods";
static char __pyx_k_29[] = "12 hr periods";
static char __pyx_k_30[] = "This class cannot be instantiated from Python";
static char __pyx_k_33[] = ":";
static char __pyx_k_38[] = " (";
static char __pyx_k_39[] = ")";
static char __pyx_k_46[] = "unitsOfFirstFixedSurface";
static char __pyx_k_48[] = "typeOfFirstFixedSurface";
static char __pyx_k_50[] = "scaledValueOfFirstFixedSurface";
static char __pyx_k_52[] = "scaleFactorOfFirstFixedSurface";
static char __pyx_k_54[] = "typeOfSecondFixedSurface";
static char __pyx_k_56[] = "scaledValueOfSecondFixedSurface";
static char __pyx_k_58[] = "scaleFactorOfSecondFixedSurface";
static char __pyx_k_60[] = ":level %s";
static char __pyx_k_61[] = ":levels %s-%s";
static char __pyx_k_62[] = " %s";
static char __pyx_k_66[] = ":fcst time %s %s (%s)";
static char __pyx_k_67[] = ":fcst time %s %s";
static char __pyx_k_71[] = ":from ";
static char __pyx_k_72[] = "%04i";
static char __pyx_k_74[] = "typeOfEnsembleForecast";
static char __pyx_k_76[] = ":lo res cntl fcst";
static char __pyx_k_77[] = ":hi res cntl fcst";
static char __pyx_k_78[] = ":neg ens pert %d";
static char __pyx_k_79[] = ":pos ens pert %d";
static char __pyx_k_81[] = ":ens mean";
static char __pyx_k_82[] = ":weighted ens mean";
static char __pyx_k_83[] = ":ens std dev";
static char __pyx_k_84[] = ":normalized ens std dev";
static char __pyx_k_85[] = ":ens spread";
static char __pyx_k_86[] = ":ens large anomaly index";
static char __pyx_k_87[] = ":ens mean of cluster";
static char __pyx_k_89[] = "scaledValueOfLowerLimit";
static char __pyx_k_91[] = "scaleFactorOfLowerLimit";
static char __pyx_k_93[] = "scaledValueOfUpperLimit";
static char __pyx_k_95[] = "scaleFactorOfUpperLimit";
static char __pyx_k_97[] = " (%s-%s)";
static char __pyx_k_98[] = " (> %s)";
static char __pyx_k_99[] = " (< %s)";
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_104[] = "key \"%s\" is read only";
static char __pyx_k_105[] = "can only modify existing grib keys (key \"%s\" not found)";
static char __pyx_k_106[] = "unrecognized grib type % d";
static char __pyx_k_108[] = "jPointsAreConsecutive";
static char __pyx_k_112[] = "array must be 1d or 2d";
static char __pyx_k_115[] = "reduced grid data array must be 1d";
static char __pyx_k_117[] = "alternativeRowScanning";
static char __pyx_k_139[] = "scaleFactorOfMajorAxisOfOblateSpheroidEarth";
static char __pyx_k_141[] = "scaleFactorOfMinorAxisOfOblateSpheroidEarth";
static char __pyx_k_142[] = "scaledValueOfMajorAxisOfOblateSpheroidEarth";
static char __pyx_k_143[] = "scaledValueOfMinorAxisOfOblateSpheroidEarth";
static char __pyx_k_144[] = "scaledValueOfEarthMajorAxis";
static char __pyx_k_145[] = "scaledValueOfEarthMinorAxis";
static char __pyx_k_146[] = "scaleFactorOfRadiusOfSphericalEarth";
static char __pyx_k_148[] = "scaledValueOfRadiusOfSphericalEarth";
static char __pyx_k_149[] = "unknown shape of the earth flag";
static char __pyx_k_151[] = "latitudeWhereDxAndDyAreSpecifiedInDegrees";
static char __pyx_k_152[] = "projectionCentreFlag";
static char __pyx_k_154[] = "projectionCenterFlag";
static char __pyx_k_156[] = "cannot find projection center flag";
static char __pyx_k_158[] = "orientationOfTheGridInDegrees";
static char __pyx_k_159[] = "longitudeOfSubSatellitePointInDegrees";
static char __pyx_k_160[] = "latitudeOfSubSatellitePointInDegrees";
static char __pyx_k_161[] = "equatorial_azimuthal_equidistant";
static char __pyx_k_162[] = "lambert_azimuthal_equal_area";
static char __pyx_k_163[] = "longitudeOfFirstGridPoint";
static char __pyx_k_164[] = "longitudeOfLastGridPoint";
static char __pyx_k_165[] = "angleOfRotationInDegrees";
static char __pyx_k_166[] = "latitudeOfSouthernPoleInDegrees";
static char __pyx_k_167[] = "longitudeOfSouthernPoleInDegrees";
static char __pyx_k_168[] = "unsupported grid %s";
static char __pyx_k_169[] = "longitudeOfFirstGridPointInDegrees";
static char __pyx_k_170[] = "longitudeOfLastGridPointInDegrees";
static char __pyx_k_171[] = "latitudeOfFirstGridPointInDegrees";
static char __pyx_k_172[] = "latitudeOfLastGridPointInDegrees";
static char __pyx_k_176[] = "xDirectionGridLengthInMetres";
static char __pyx_k_177[] = "yDirectionGridLengthInMetres";
static char __pyx_k_178[] = "unsupported grid - earth not a perfect sphere";
static char __pyx_k_180[] = "latitudeOfFirstGridPoint";
static char __pyx_k_181[] = "latitudeOfLastGridPoint";
static char __pyx_k_182[] = ",";
static char __pyx_k_183[] = "\nfile %s has multi-field messages, keys inside multi-field\nmessages will not be indexed correctly";
static char __pyx_k_186[] = "key not part of grib index";
static char __pyx_k_188[] = "value must be float, int or string";
static char __pyx_k_192[] = "\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\n U{README.macosx<http://pygrib.googlecode.com/svn/trunk/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 la""t/lon or gaussian grid\n    # data is automatically expanded 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  \nChangelog\n=========\n\n - see U{Changelog<http://pygrib.googlecode.com/svn/trunk/Changelog>} file.\n\n@author: Jeffrey Whitaker.\n\n@contact: U{Jeff Whitaker<mailto:jeffrey.s.whitaker@noaa.gov>}\n\n@version: 1.9.9\n\n@copyright: copyright 2010 by Jeffrey Whitaker.\n\n@lic""ense: Permission to use, copy, modify, and distribute this software and its\ndocumentation for any purpose and without fee is hereby granted,\nprovided that the above 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_193[] = "1.9.9";
static char __pyx_k_194[] = "mpl_toolkits.basemap";
static char __pyx_k_195[] = "either pyproj or basemap required";
static char __pyx_k_199[] = "_get_grib_api_version";
static char __pyx_k_200[] = "/Volumes/User/jwhitaker/python/pygrib/pygrib.pyx";
static char __pyx_k_203[] = "tolerate_badgrib_off";
static char __pyx_k_206[] = "30 yr periods";
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__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__LaD[] = "LaD";
static char __pyx_k__LoV[] = "LoV";
static char __pyx_k___gh[] = "_gh";
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__sum[] = "sum";
static char __pyx_k__yrs[] = "yrs";
static char __pyx_k__7777[] = "7777";
static char __pyx_k__Proj[] = "Proj";
static char __pyx_k__aeqd[] = "aeqd";
static char __pyx_k__copy[] = "copy";
static char __pyx_k__data[] = "data";
static char __pyx_k__days[] = "days";
static char __pyx_k__fabs[] = "fabs";
static char __pyx_k__file[] = "file";
static char __pyx_k__geos[] = "geos";
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__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__warn[] = "warn";
static char __pyx_k__year[] = "year";
static char __pyx_k__zero[] = "zero";
static char __pyx_k__Latin[] = "Latin";
static char __pyx_k___find[] = "_find";
static char __pyx_k__ascii[] = "ascii";
static char __pyx_k__atype[] = "atype";
static char __pyx_k__close[] = "close";
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__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__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__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__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__unknown[] = "unknown";
static char __pyx_k__KeyError[] = "KeyError";
static char __pyx_k____call__[] = "__call__";
static char __pyx_k____dict__[] = "__dict__";
static char __pyx_k____main__[] = "__main__";
static char __pyx_k____test__[] = "__test__";
static char __pyx_k___advance[] = "_advance";
static char __pyx_k___get_key[] = "_get_key";
static char __pyx_k___ro_keys[] = "_ro_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__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___all_keys[] = "_all_keys";
static char __pyx_k___redtoreg[] = "_redtoreg";
static char __pyx_k__centuries[] = "centuries";
static char __pyx_k__from_what[] = "from_what";
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__stepUnits[] = "stepUnits";
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____import__[] = "__import__";
static char __pyx_k___ftimedict[] = "_ftimedict";
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__longitudes[] = "longitudes";
static char __pyx_k__projparams[] = "projparams";
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____getitem__[] = "__getitem__";
static char __pyx_k____version__[] = "__version__";
static char __pyx_k__bottomLevel[] = "bottomLevel";
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__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__missingValue[] = "missingValue";
static char __pyx_k__StopIteration[] = "StopIteration";
static char __pyx_k___is_container[] = "_is_container";
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__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___is_stringlike[] = "_is_stringlike";
static char __pyx_k__expand_reduced[] = "expand_reduced";
static char __pyx_k__numberOfValues[] = "numberOfValues";
static char __pyx_k__parameterUnits[] = "parameterUnits";
static char __pyx_k__Latin1InDegrees[] = "Latin1InDegrees";
static char __pyx_k__Latin2InDegrees[] = "Latin2InDegrees";
static char __pyx_k___read_only_keys[] = "_read_only_keys";
static char __pyx_k___set_projparams[] = "_set_projparams";
static char __pyx_k__derivedForecast[] = "derivedForecast";
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__default_encoding[] = "default_encoding";
static char __pyx_k__grib_api_version[] = "grib_api_version";
static char __pyx_k__missingvalue_int[] = "missingvalue_int";
static char __pyx_k__multi_support_on[] = "multi_support_on";
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__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__missingvalue_float[] = "missingvalue_float";
static char __pyx_k__perturbationNumber[] = "perturbationNumber";
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 PyObject *__pyx_n_s_1;
static PyObject *__pyx_kp_s_10;
static PyObject *__pyx_kp_s_104;
static PyObject *__pyx_kp_s_105;
static PyObject *__pyx_kp_s_106;
static PyObject *__pyx_n_s_108;
static PyObject *__pyx_kp_s_112;
static PyObject *__pyx_kp_s_115;
static PyObject *__pyx_n_s_117;
static PyObject *__pyx_kp_s_12;
static PyObject *__pyx_n_s_139;
static PyObject *__pyx_n_s_141;
static PyObject *__pyx_n_s_142;
static PyObject *__pyx_n_s_143;
static PyObject *__pyx_n_s_144;
static PyObject *__pyx_n_s_145;
static PyObject *__pyx_n_s_146;
static PyObject *__pyx_n_s_148;
static PyObject *__pyx_kp_s_149;
static PyObject *__pyx_kp_s_15;
static PyObject *__pyx_n_s_151;
static PyObject *__pyx_n_s_152;
static PyObject *__pyx_n_s_154;
static PyObject *__pyx_kp_s_156;
static PyObject *__pyx_n_s_158;
static PyObject *__pyx_n_s_159;
static PyObject *__pyx_n_s_160;
static PyObject *__pyx_n_s_161;
static PyObject *__pyx_n_s_162;
static PyObject *__pyx_n_s_163;
static PyObject *__pyx_n_s_164;
static PyObject *__pyx_n_s_165;
static PyObject *__pyx_n_s_166;
static PyObject *__pyx_n_s_167;
static PyObject *__pyx_kp_s_168;
static PyObject *__pyx_n_s_169;
static PyObject *__pyx_kp_s_17;
static PyObject *__pyx_n_s_170;
static PyObject *__pyx_n_s_171;
static PyObject *__pyx_n_s_172;
static PyObject *__pyx_n_s_176;
static PyObject *__pyx_n_s_177;
static PyObject *__pyx_kp_s_178;
static PyObject *__pyx_n_s_180;
static PyObject *__pyx_n_s_181;
static PyObject *__pyx_kp_s_182;
static PyObject *__pyx_kp_s_183;
static PyObject *__pyx_kp_s_186;
static PyObject *__pyx_kp_s_188;
static PyObject *__pyx_kp_s_19;
static PyObject *__pyx_kp_s_193;
static PyObject *__pyx_n_s_194;
static PyObject *__pyx_kp_s_195;
static PyObject *__pyx_n_s_199;
static PyObject *__pyx_kp_s_2;
static PyObject *__pyx_n_s_20;
static PyObject *__pyx_kp_s_200;
static PyObject *__pyx_n_s_203;
static PyObject *__pyx_kp_s_206;
static PyObject *__pyx_kp_s_24;
static PyObject *__pyx_kp_s_27;
static PyObject *__pyx_kp_s_28;
static PyObject *__pyx_kp_s_29;
static PyObject *__pyx_kp_s_3;
static PyObject *__pyx_kp_s_30;
static PyObject *__pyx_kp_s_33;
static PyObject *__pyx_kp_s_38;
static PyObject *__pyx_kp_s_39;
static PyObject *__pyx_n_s_46;
static PyObject *__pyx_n_s_48;
static PyObject *__pyx_kp_s_5;
static PyObject *__pyx_n_s_50;
static PyObject *__pyx_n_s_52;
static PyObject *__pyx_n_s_54;
static PyObject *__pyx_n_s_56;
static PyObject *__pyx_n_s_58;
static PyObject *__pyx_kp_s_6;
static PyObject *__pyx_kp_s_60;
static PyObject *__pyx_kp_s_61;
static PyObject *__pyx_kp_s_62;
static PyObject *__pyx_kp_s_66;
static PyObject *__pyx_kp_s_67;
static PyObject *__pyx_kp_s_71;
static PyObject *__pyx_kp_s_72;
static PyObject *__pyx_n_s_74;
static PyObject *__pyx_kp_s_76;
static PyObject *__pyx_kp_s_77;
static PyObject *__pyx_kp_s_78;
static PyObject *__pyx_kp_s_79;
static PyObject *__pyx_kp_s_8;
static PyObject *__pyx_kp_s_81;
static PyObject *__pyx_kp_s_82;
static PyObject *__pyx_kp_s_83;
static PyObject *__pyx_kp_s_84;
static PyObject *__pyx_kp_s_85;
static PyObject *__pyx_kp_s_86;
static PyObject *__pyx_kp_s_87;
static PyObject *__pyx_n_s_89;
static PyObject *__pyx_n_s_91;
static PyObject *__pyx_n_s_93;
static PyObject *__pyx_n_s_95;
static PyObject *__pyx_kp_s_97;
static PyObject *__pyx_kp_s_98;
static PyObject *__pyx_kp_s_99;
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_n_s__TypeError;
static PyObject *__pyx_n_s__ValueError;
static PyObject *__pyx_n_s____call__;
static PyObject *__pyx_n_s____dict__;
static PyObject *__pyx_n_s____getitem__;
static PyObject *__pyx_n_s____import__;
static PyObject *__pyx_n_s____main__;
static PyObject *__pyx_n_s____test__;
static PyObject *__pyx_n_s____version__;
static PyObject *__pyx_n_s___advance;
static PyObject *__pyx_n_s___all_keys;
static PyObject *__pyx_n_s___find;
static PyObject *__pyx_n_s___ftimedict;
static PyObject *__pyx_n_s___get_key;
static PyObject *__pyx_n_s___gh;
static PyObject *__pyx_n_s___is_container;
static PyObject *__pyx_n_s___is_stringlike;
static PyObject *__pyx_n_s___private_atts;
static PyObject *__pyx_n_s___read_only_keys;
static PyObject *__pyx_n_s___redtoreg;
static PyObject *__pyx_n_s___reshape_mask;
static PyObject *__pyx_n_s___ro_keys;
static PyObject *__pyx_n_s___set_projparams;
static PyObject *__pyx_n_s___unshape_mask;
static PyObject *__pyx_n_s__a;
static PyObject *__pyx_n_s__aea;
static PyObject *__pyx_n_s__aeqd;
static PyObject *__pyx_n_s__albers;
static PyObject *__pyx_n_s__analDate;
static PyObject *__pyx_n_s__arange;
static PyObject *__pyx_n_s__arcsin;
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__centralLongitude;
static PyObject *__pyx_n_s__centuries;
static PyObject *__pyx_n_s__close;
static PyObject *__pyx_n_s__copy;
static PyObject *__pyx_n_s__cyl;
static PyObject *__pyx_n_s__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__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_n_s__eleven;
static PyObject *__pyx_n_s__empty;
static PyObject *__pyx_n_s__encode;
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_n_s__fcstimeunits;
static PyObject *__pyx_n_s__file;
static PyObject *__pyx_n_s__filename;
static PyObject *__pyx_n_s__filled;
static PyObject *__pyx_n_s__float;
static PyObject *__pyx_n_s__float64;
static PyObject *__pyx_n_s__forecastTime;
static PyObject *__pyx_n_s__from_what;
static PyObject *__pyx_n_s__fromstring;
static PyObject *__pyx_n_s__ftime;
static PyObject *__pyx_n_s__gaulats;
static PyObject *__pyx_n_s__geos;
static PyObject *__pyx_n_s__gh;
static PyObject *__pyx_n_s__grb;
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_n_s__hour;
static PyObject *__pyx_n_s__hrs;
static PyObject *__pyx_n_s__iDirectionIncrement;
static PyObject *__pyx_n_s__index;
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_missing;
static PyObject *__pyx_n_s__iscallable;
static PyObject *__pyx_n_s__iscontainer;
static PyObject *__pyx_n_s__items;
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_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__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__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_n_s__linspace;
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__longitudes;
static PyObject *__pyx_n_s__longlat;
static PyObject *__pyx_n_s__ma;
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__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_n_s__next;
static PyObject *__pyx_n_s__nlats;
static PyObject *__pyx_n_s__nmsgs;
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__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_n_s__power;
static PyObject *__pyx_n_s__probabilityTypeName;
static PyObject *__pyx_n_s__proj;
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__redtoreg;
static PyObject *__pyx_n_s__reduced;
static PyObject *__pyx_n_s__reduced_gg;
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__return_msgs;
static PyObject *__pyx_n_s__revision;
static PyObject *__pyx_n_s__rewind;
static PyObject *__pyx_n_s__rotated_gg;
static PyObject *__pyx_n_s__rotated_ll;
static PyObject *__pyx_n_s__rstrip;
static PyObject *__pyx_n_s__s;
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__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__stepUnits;
static PyObject *__pyx_n_s__stere;
static PyObject *__pyx_n_s__sum;
static PyObject *__pyx_n_s__tell;
static PyObject *__pyx_n_s__thousand;
static PyObject *__pyx_n_s__tolerate_badgrib;
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__typeOfGrid;
static PyObject *__pyx_n_s__typeOfLevel;
static PyObject *__pyx_n_s__units;
static PyObject *__pyx_n_s__unknown;
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_n_b__values;
static PyObject *__pyx_n_s__values;
static PyObject *__pyx_n_s__warn;
static PyObject *__pyx_n_s__warnings;
static PyObject *__pyx_n_s__where;
static PyObject *__pyx_n_s__xrange;
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_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_neg_1;
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_k_14;
static PyObject *__pyx_k_tuple_4;
static PyObject *__pyx_k_tuple_7;
static PyObject *__pyx_k_tuple_9;
static PyObject *__pyx_k_tuple_11;
static PyObject *__pyx_k_tuple_13;
static PyObject *__pyx_k_tuple_16;
static PyObject *__pyx_k_tuple_18;
static PyObject *__pyx_k_tuple_21;
static PyObject *__pyx_k_tuple_22;
static PyObject *__pyx_k_tuple_23;
static PyObject *__pyx_k_tuple_25;
static PyObject *__pyx_k_tuple_26;
static PyObject *__pyx_k_tuple_31;
static PyObject *__pyx_k_tuple_32;
static PyObject *__pyx_k_tuple_34;
static PyObject *__pyx_k_tuple_35;
static PyObject *__pyx_k_tuple_36;
static PyObject *__pyx_k_tuple_37;
static PyObject *__pyx_k_tuple_40;
static PyObject *__pyx_k_tuple_41;
static PyObject *__pyx_k_tuple_42;
static PyObject *__pyx_k_tuple_43;
static PyObject *__pyx_k_tuple_44;
static PyObject *__pyx_k_tuple_45;
static PyObject *__pyx_k_tuple_47;
static PyObject *__pyx_k_tuple_49;
static PyObject *__pyx_k_tuple_51;
static PyObject *__pyx_k_tuple_53;
static PyObject *__pyx_k_tuple_55;
static PyObject *__pyx_k_tuple_57;
static PyObject *__pyx_k_tuple_59;
static PyObject *__pyx_k_tuple_63;
static PyObject *__pyx_k_tuple_64;
static PyObject *__pyx_k_tuple_65;
static PyObject *__pyx_k_tuple_68;
static PyObject *__pyx_k_tuple_69;
static PyObject *__pyx_k_tuple_70;
static PyObject *__pyx_k_tuple_73;
static PyObject *__pyx_k_tuple_75;
static PyObject *__pyx_k_tuple_80;
static PyObject *__pyx_k_tuple_88;
static PyObject *__pyx_k_tuple_90;
static PyObject *__pyx_k_tuple_92;
static PyObject *__pyx_k_tuple_94;
static PyObject *__pyx_k_tuple_96;
static PyObject *__pyx_k_slice_100;
static PyObject *__pyx_k_slice_102;
static PyObject *__pyx_k_slice_118;
static PyObject *__pyx_k_slice_119;
static PyObject *__pyx_k_slice_121;
static PyObject *__pyx_k_slice_122;
static PyObject *__pyx_k_slice_131;
static PyObject *__pyx_k_slice_132;
static PyObject *__pyx_k_slice_134;
static PyObject *__pyx_k_slice_135;
static PyObject *__pyx_k_slice_174;
static PyObject *__pyx_k_slice_175;
static PyObject *__pyx_k_tuple_101;
static PyObject *__pyx_k_tuple_103;
static PyObject *__pyx_k_tuple_107;
static PyObject *__pyx_k_tuple_109;
static PyObject *__pyx_k_tuple_110;
static PyObject *__pyx_k_tuple_111;
static PyObject *__pyx_k_tuple_113;
static PyObject *__pyx_k_tuple_114;
static PyObject *__pyx_k_tuple_116;
static PyObject *__pyx_k_tuple_120;
static PyObject *__pyx_k_tuple_123;
static PyObject *__pyx_k_tuple_124;
static PyObject *__pyx_k_tuple_125;
static PyObject *__pyx_k_tuple_126;
static PyObject *__pyx_k_tuple_127;
static PyObject *__pyx_k_tuple_128;
static PyObject *__pyx_k_tuple_129;
static PyObject *__pyx_k_tuple_130;
static PyObject *__pyx_k_tuple_133;
static PyObject *__pyx_k_tuple_136;
static PyObject *__pyx_k_tuple_137;
static PyObject *__pyx_k_tuple_138;
static PyObject *__pyx_k_tuple_140;
static PyObject *__pyx_k_tuple_147;
static PyObject *__pyx_k_tuple_150;
static PyObject *__pyx_k_tuple_153;
static PyObject *__pyx_k_tuple_155;
static PyObject *__pyx_k_tuple_157;
static PyObject *__pyx_k_tuple_173;
static PyObject *__pyx_k_tuple_179;
static PyObject *__pyx_k_tuple_184;
static PyObject *__pyx_k_tuple_185;
static PyObject *__pyx_k_tuple_187;
static PyObject *__pyx_k_tuple_189;
static PyObject *__pyx_k_tuple_190;
static PyObject *__pyx_k_tuple_191;
static PyObject *__pyx_k_tuple_196;
static PyObject *__pyx_k_tuple_197;
static PyObject *__pyx_k_tuple_204;
static PyObject *__pyx_k_tuple_209;
static PyObject *__pyx_k_tuple_211;
static PyObject *__pyx_k_tuple_213;
static PyObject *__pyx_k_tuple_215;
static PyObject *__pyx_k_tuple_217;
static PyObject *__pyx_k_tuple_219;
static PyObject *__pyx_k_tuple_221;
static PyObject *__pyx_k_tuple_223;
static PyObject *__pyx_k_codeobj_198;
static PyObject *__pyx_k_codeobj_201;
static PyObject *__pyx_k_codeobj_202;
static PyObject *__pyx_k_codeobj_205;
static PyObject *__pyx_k_codeobj_207;
static PyObject *__pyx_k_codeobj_208;
static PyObject *__pyx_k_codeobj_210;
static PyObject *__pyx_k_codeobj_212;
static PyObject *__pyx_k_codeobj_214;
static PyObject *__pyx_k_codeobj_216;
static PyObject *__pyx_k_codeobj_218;
static PyObject *__pyx_k_codeobj_220;
static PyObject *__pyx_k_codeobj_222;
static PyObject *__pyx_k_codeobj_224;

/* 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 = {__Pyx_NAMESTR("_get_grib_api_version"), (PyCFunction)__pyx_pw_6pygrib_1_get_grib_api_version, METH_NOARGS, __Pyx_DOCSTR(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);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pygrib_21_get_grib_api_version_lambda1(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_6pygrib_21_get_grib_api_version_lambda1 = {__Pyx_NAMESTR("lambda1"), (PyCFunction)__pyx_pw_6pygrib_21_get_grib_api_version_lambda1, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_6pygrib_21_get_grib_api_version_lambda1(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("lambda1 (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("lambda1", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "lambda1") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __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("lambda1", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pygrib._get_grib_api_version.lambda1", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_lambda_funcdef_lambda1(__pyx_self, __pyx_v_v, __pyx_v_d);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pygrib.pyx":305
 * 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)
 */

static PyObject *__pyx_lambda_funcdef_lambda1(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("lambda1", 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 = 305; __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 = 305; __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 = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_r = ((PyObject *)__pyx_t_3);
  __pyx_t_3 = 0;
  goto __pyx_L0;

  __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._get_grib_api_version.lambda1", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pygrib.pyx":304
 * #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":305
 * 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_lambda1, 0, __pyx_n_s_1, NULL, __pyx_n_s__pygrib, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_div = __pyx_t_1;
  __pyx_t_1 = 0;

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

  /* "pygrib.pyx":307
 *     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_lambda1(__pyx_v_div, __pyx_v_v, __pyx_int_100); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 307; __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 = 307; __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 = 307; __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 = 307; __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 = 307; __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 = 307; __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 = 307; __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":308
 *     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_lambda1(__pyx_v_div, __pyx_v_v, __pyx_int_100); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; __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 = 308; __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 = 308; __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 = 308; __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 = 308; __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 = 308; __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 = 308; __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":309
 *     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":310
 *     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 = 310; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_major);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_major);
  __Pyx_GIVEREF(__pyx_v_major);
  __Pyx_INCREF(__pyx_v_minor);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_minor);
  __Pyx_GIVEREF(__pyx_v_minor);
  __Pyx_INCREF(__pyx_v_revision);
  PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_revision);
  __Pyx_GIVEREF(__pyx_v_revision);
  __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_2), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 310; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __pyx_r = ((PyObject *)__pyx_t_2);
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("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;
}

/* 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 = {__Pyx_NAMESTR("tolerate_badgrib_on"), (PyCFunction)__pyx_pw_6pygrib_3tolerate_badgrib_on, METH_NOARGS, __Pyx_DOCSTR(__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);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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

static PyObject *__pyx_pf_6pygrib_2tolerate_badgrib_on(CYTHON_UNUSED PyObject *__pyx_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("tolerate_badgrib_on", 0);

  /* "pygrib.pyx":319
 *     """
 *     global tolerate_badgrib
 *     tolerate_badgrib = True             # <<<<<<<<<<<<<<
 * 
 * def tolerate_badgrib_off():
 */
  __pyx_t_1 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 319; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s__tolerate_badgrib, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 319; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __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;
}

/* 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 = {__Pyx_NAMESTR("tolerate_badgrib_off"), (PyCFunction)__pyx_pw_6pygrib_5tolerate_badgrib_off, METH_NOARGS, __Pyx_DOCSTR(__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);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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

static PyObject *__pyx_pf_6pygrib_4tolerate_badgrib_off(CYTHON_UNUSED PyObject *__pyx_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("tolerate_badgrib_off", 0);

  /* "pygrib.pyx":327
 *     """
 *     global tolerate_badgrib
 *     tolerate_badgrib = False             # <<<<<<<<<<<<<<
 * 
 * def gaulats(object nlats):
 */
  __pyx_t_1 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s__tolerate_badgrib, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __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;
}

/* 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 = {__Pyx_NAMESTR("gaulats"), (PyCFunction)__pyx_pw_6pygrib_7gaulats, METH_O, __Pyx_DOCSTR(__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));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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

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;
  long __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("gaulats", 0);

  /* "pygrib.pyx":336
 *     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 = PyNumber_Remainder(__pyx_v_nlats, __pyx_int_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; __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 = 336; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "pygrib.pyx":337
 *     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 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_4), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; __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 = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "pygrib.pyx":338
 *     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_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__empty); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__float64); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_nlats);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_nlats);
  __Pyx_GIVEREF(__pyx_v_nlats);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  __pyx_t_4 = 0;
  __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_6pygrib_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_lats = ((PyArrayObject *)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "pygrib.pyx":339
 *         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_5 = __Pyx_PyInt_AsLong(__pyx_v_nlats); if (unlikely((__pyx_t_5 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 339; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  grib_get_gaussian_latitudes(__Pyx_div_long(((long)__pyx_t_5), 2), ((double *)__pyx_v_lats->data));

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

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

/* 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 = {__Pyx_NAMESTR("multi_support_on"), (PyCFunction)__pyx_pw_6pygrib_9multi_support_on, METH_NOARGS, __Pyx_DOCSTR(__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);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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

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":362
 * 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);

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* 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 = {__Pyx_NAMESTR("multi_support_off"), (PyCFunction)__pyx_pw_6pygrib_11multi_support_off, METH_NOARGS, __Pyx_DOCSTR(__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);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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

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":366
 * 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);

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* 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 = 393; __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 = 393; __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);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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

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":397
 *         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 = 397; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_bytestr = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pygrib.pyx":398
 *         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 = 398; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_self->_fd = fopen(__pyx_t_2, __pyx_k__rb);

  /* "pygrib.pyx":399
 *         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":400
 *         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 = 400; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(((PyObject *)__pyx_kp_s_5));
    PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_kp_s_5));
    __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_5));
    __Pyx_INCREF(__pyx_v_filename);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_filename);
    __Pyx_GIVEREF(__pyx_v_filename);
    __pyx_t_4 = PyObject_Call(__pyx_builtin_IOError, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 400; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(((PyObject *)__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 = 400; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L3;
  }
  __pyx_L3:;

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

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

/* 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 = 402; __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 = 402; __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);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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

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
  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("__init__", 0);

  /* "pygrib.pyx":406
 *         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":407
 *         # initalize Python level objects
 *         self.name = filename
 *         self.closed = False             # <<<<<<<<<<<<<<
 *         self.messagenumber = 0
 *         # count number of messages in file.
 */
  __pyx_t_1 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 407; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->closed);
  __Pyx_DECREF(__pyx_v_self->closed);
  __pyx_v_self->closed = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pygrib.pyx":408
 *         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":410
 *         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":411
 *         # 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) {
    if (!1) break;

    /* "pygrib.pyx":412
 *         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":413
 *         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":414
 *             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_2 = ((__pyx_v_gh == NULL) != 0);
    if (__pyx_t_2) {
      goto __pyx_L4_break;
      goto __pyx_L5;
    }
    __pyx_L5:;

    /* "pygrib.pyx":415
 *             err = grib_handle_delete(gh)
 *             if gh == NULL: break
 *             nmsgs = nmsgs + 1             # <<<<<<<<<<<<<<
 *         rewind(self._fd)
 *         self.messages = nmsgs
 */
    __pyx_t_1 = PyNumber_Add(__pyx_v_nmsgs, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_nmsgs, __pyx_t_1);
    __pyx_t_1 = 0;
  }
  __pyx_L4_break:;

  /* "pygrib.pyx":416
 *             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":417
 *             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":418
 *         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":422
 *         # 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_1 = PyInt_FromLong(__pyx_v_ncount); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 422; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_v_self->messages, Py_NE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 422; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 422; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__pyx_t_2) {

    /* "pygrib.pyx":423
 *         # 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_t_3 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 423; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    __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_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L6;
  }
  /*else*/ {

    /* "pygrib.pyx":425
 *             self.has_multi_field_msgs=True
 *         else:
 *             self.has_multi_field_msgs=False             # <<<<<<<<<<<<<<
 *     def __iter__(self):
 *         return self
 */
    __pyx_t_3 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 425; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    __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_t_3;
    __pyx_t_3 = 0;
  }
  __pyx_L6:;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __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;
}

/* 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));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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

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":427
 *             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;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* 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));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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

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":431
 *         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 = 431; __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 = 431; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "pygrib.pyx":432
 *         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 = 432; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "pygrib.pyx":433
 *         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":434
 *             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":435
 *         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":436
 *             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 = 436; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_1));
      __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 436; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_1));
      __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
      __pyx_t_1 = 0;
      __pyx_t_1 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 436; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(((PyObject *)__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 = 436; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L5;
    }
    __pyx_L5:;
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "pygrib.pyx":437
 *             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":438
 *                 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":439
 *         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 = 439; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
    __pyx_t_3 = PyTuple_New(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);
    PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_1));
    __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
    __pyx_t_1 = 0;
    __pyx_t_1 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 439; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(((PyObject *)__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 = 439; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "pygrib.pyx":440
 *         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":441
 *             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 = 441; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L7;
  }
  /*else*/ {

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

    /* "pygrib.pyx":444
 *         else:
 *             self._gh = gh
 *             self.messagenumber = self.messagenumber + 1             # <<<<<<<<<<<<<<
 *         return _create_gribmessage(self._gh, self.messagenumber)
 *     def __getitem__(self, key):
 */
    __pyx_t_1 = PyNumber_Add(__pyx_v_self->messagenumber, __pyx_int_1); 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_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;
  }
  __pyx_L7:;

  /* "pygrib.pyx":445
 *             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 = 445; __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;

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

/* 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));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pygrib.pyx":446
 *             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.
 */

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 *);
  int __pyx_t_10;
  int __pyx_t_11;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__getitem__", 0);

  /* "pygrib.pyx":447
 *         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 *)((PyObject*)(&PySlice_Type))), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 447; __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 = 447; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "pygrib.pyx":449
 *         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_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_key, __pyx_n_s__indices); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 449; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 449; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v_self->messages);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_self->messages);
    __Pyx_GIVEREF(__pyx_v_self->messages);
    __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 449; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 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 != 3)) {
        if (size > 3) __Pyx_RaiseTooManyValuesError(3);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 449; __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_1 = PyTuple_GET_ITEM(sequence, 1); 
        __pyx_t_5 = PyTuple_GET_ITEM(sequence, 2); 
      } else {
        __pyx_t_3 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_1 = PyList_GET_ITEM(sequence, 1); 
        __pyx_t_5 = PyList_GET_ITEM(sequence, 2); 
      }
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_1);
      __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 = 449; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_1 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 449; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_5 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 449; __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_6 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 449; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 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_1 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_1)) goto __pyx_L4_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_1);
      index = 2; __pyx_t_5 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_5)) goto __pyx_L4_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_5);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_6), 3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 449; __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 = 449; __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_1;
    __pyx_t_1 = 0;
    __pyx_v_inc = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "pygrib.pyx":450
 *             # 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 = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_v_msg = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "pygrib.pyx":451
 *             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_5 = PyList_New(0); 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_t_4 = PyTuple_New(3); 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_INCREF(__pyx_v_beg);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_beg);
    __Pyx_GIVEREF(__pyx_v_beg);
    __Pyx_INCREF(__pyx_v_end);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_end);
    __Pyx_GIVEREF(__pyx_v_end);
    __Pyx_INCREF(__pyx_v_inc);
    PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_inc);
    __Pyx_GIVEREF(__pyx_v_inc);
    __pyx_t_1 = PyObject_Call(__pyx_builtin_xrange, ((PyObject *)__pyx_t_4), 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(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
    if (PyList_CheckExact(__pyx_t_1) || PyTuple_CheckExact(__pyx_t_1)) {
      __pyx_t_4 = __pyx_t_1; __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_1); 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_9 = Py_TYPE(__pyx_t_4)->tp_iternext;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    for (;;) {
      if (!__pyx_t_9 && PyList_CheckExact(__pyx_t_4)) {
        if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_4)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_1 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_8); __Pyx_INCREF(__pyx_t_1); __pyx_t_8++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 451; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_4, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 451; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #endif
      } else if (!__pyx_t_9 && PyTuple_CheckExact(__pyx_t_4)) {
        if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_8); __Pyx_INCREF(__pyx_t_1); __pyx_t_8++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 451; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_4, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 451; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #endif
      } else {
        __pyx_t_1 = __pyx_t_9(__pyx_t_4);
        if (unlikely(!__pyx_t_1)) {
          if (PyErr_Occurred()) {
            if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
            else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 451; __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;
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__message); 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_t_3 = PyNumber_Add(__pyx_v_n, __pyx_int_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 451; __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 = 451; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_3);
      __pyx_t_3 = 0;
      __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 451; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_5, (PyObject*)__pyx_t_3))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 451; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_v_grbs = ((PyObject*)__pyx_t_5);
    __pyx_t_5 = 0;

    /* "pygrib.pyx":452
 *             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_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__seek); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_4 = PyTuple_New(1); 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_INCREF(__pyx_v_msg);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_msg);
    __Pyx_GIVEREF(__pyx_v_msg);
    __pyx_t_3 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_4), NULL); 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_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "pygrib.pyx":453
 *             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(((PyObject *)__pyx_v_grbs));
    __pyx_r = ((PyObject *)__pyx_v_grbs);
    goto __pyx_L0;
    goto __pyx_L3;
  }

  /* "pygrib.pyx":454
 *             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_3 = PyObject_RichCompare(((PyObject *)Py_TYPE(__pyx_v_key)), ((PyObject *)((PyObject*)(&PyInt_Type))), Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 454; __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 = 454; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (!__pyx_t_2) {
    __pyx_t_3 = PyObject_RichCompare(((PyObject *)Py_TYPE(__pyx_v_key)), ((PyObject *)((PyObject*)(&PyLong_Type))), Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_11 = __pyx_t_10;
  } else {
    __pyx_t_11 = __pyx_t_2;
  }
  if (__pyx_t_11) {

    /* "pygrib.pyx":456
 *         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_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__tell); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 456; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 456; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_msg = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "pygrib.pyx":457
 *             # 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 = 457; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 457; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v_key);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_key);
    __Pyx_GIVEREF(__pyx_v_key);
    __pyx_t_5 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 457; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
    __pyx_v_grb = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "pygrib.pyx":458
 *             msg = self.tell()
 *             grb = self.message(key)
 *             self.seek(msg) # put iterator back in original position             # <<<<<<<<<<<<<<
 *             return grb
 *         else:
 */
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__seek); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 458; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 458; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v_msg);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_msg);
    __Pyx_GIVEREF(__pyx_v_msg);
    __pyx_t_4 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 458; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "pygrib.pyx":459
 *             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;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "pygrib.pyx":461
 *             return grb
 *         else:
 *             raise KeyError('key must be an integer message number or a slice')             # <<<<<<<<<<<<<<
 *     def __call__(self, **kwargs):
 *         """same as L{select}"""
 */
    __pyx_t_4 = PyObject_Call(__pyx_builtin_KeyError, ((PyObject *)__pyx_k_tuple_7), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 461; __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 = 461; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_L3:;

  __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_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __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;
}

/* 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;
  __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_4open_10__call__(((struct __pyx_obj_6pygrib_open *)__pyx_v_self), __pyx_v_kwargs);
  __Pyx_XDECREF(__pyx_v_kwargs);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pygrib.pyx":462
 *         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)
 */

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;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__call__", 0);

  /* "pygrib.pyx":464
 *     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 = 464; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = ((PyObject *)__pyx_v_kwargs);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 464; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  __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.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* 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));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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

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":466
 *         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;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* 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 = 467; __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 = 467; __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 = 467; __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 = 467; __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);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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

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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__exit__", 0);

  /* "pygrib.pyx":468
 *         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_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__close); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 468; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 468; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("pygrib.open.__exit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* 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));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pygrib.pyx":469
 *     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)."""
 */

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":472
 *         """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;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* 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 = 473; __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 = 473; __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);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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

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;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("seek", 0);

  /* "pygrib.pyx":480
 *         (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_2 = PyObject_RichCompare(__pyx_t_1, __pyx_int_0, Py_NE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 480; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 480; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (((int)__pyx_t_3)) {
    __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_int_1, Py_NE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 480; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 480; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_5 = ((int)__pyx_t_4);
  } else {
    __pyx_t_5 = ((int)__pyx_t_3);
  }
  if (__pyx_t_5) {
    __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_int_2, Py_NE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 480; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 480; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_4 = ((int)__pyx_t_3);
  } else {
    __pyx_t_4 = __pyx_t_5;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_5 = (__pyx_t_4 != 0);
  if (__pyx_t_5) {

    /* "pygrib.pyx":481
 *         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 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_9), NULL); 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_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 481; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L3;
  }
  __pyx_L3:;

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

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

      /* "pygrib.pyx":484
 *         if msg == 0:
 *             if from_what == 0:
 *                 self.rewind()             # <<<<<<<<<<<<<<
 *             elif from_what == 1:
 *                 return
 */
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__rewind); 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_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 484; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      goto __pyx_L5;
    }

    /* "pygrib.pyx":485
 *             if from_what == 0:
 *                 self.rewind()
 *             elif from_what == 1:             # <<<<<<<<<<<<<<
 *                 return
 *             elif from_what == 2:
 */
    __pyx_t_2 = PyObject_RichCompare(__pyx_v_from_what, __pyx_int_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 485; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 485; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__pyx_t_5) {

      /* "pygrib.pyx":486
 *                 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;
      goto __pyx_L5;
    }

    /* "pygrib.pyx":487
 *             elif from_what == 1:
 *                 return
 *             elif from_what == 2:             # <<<<<<<<<<<<<<
 *                 self.message(self.messages)
 *         else:
 */
    __pyx_t_2 = PyObject_RichCompare(__pyx_v_from_what, __pyx_int_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 487; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 487; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__pyx_t_5) {

      /* "pygrib.pyx":488
 *                 return
 *             elif from_what == 2:
 *                 self.message(self.messages)             # <<<<<<<<<<<<<<
 *         else:
 *             if from_what == 0:
 */
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__message); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 488; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 488; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_INCREF(__pyx_v_self->messages);
      PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_self->messages);
      __Pyx_GIVEREF(__pyx_v_self->messages);
      __pyx_t_6 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 488; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      goto __pyx_L5;
    }
    __pyx_L5:;
    goto __pyx_L4;
  }
  /*else*/ {

    /* "pygrib.pyx":490
 *                 self.message(self.messages)
 *         else:
 *             if from_what == 0:             # <<<<<<<<<<<<<<
 *                 self.message(msg)
 *             elif from_what == 1:
 */
    __pyx_t_6 = PyObject_RichCompare(__pyx_v_from_what, __pyx_int_0, Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 490; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 490; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (__pyx_t_5) {

      /* "pygrib.pyx":491
 *         else:
 *             if from_what == 0:
 *                 self.message(msg)             # <<<<<<<<<<<<<<
 *             elif from_what == 1:
 *                 self.message(self.messagenumber+msg)
 */
      __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__message); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 491; __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 = 491; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_INCREF(__pyx_v_msg);
      PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_msg);
      __Pyx_GIVEREF(__pyx_v_msg);
      __pyx_t_2 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 491; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      goto __pyx_L6;
    }

    /* "pygrib.pyx":492
 *             if from_what == 0:
 *                 self.message(msg)
 *             elif from_what == 1:             # <<<<<<<<<<<<<<
 *                 self.message(self.messagenumber+msg)
 *             elif from_what == 2:
 */
    __pyx_t_2 = PyObject_RichCompare(__pyx_v_from_what, __pyx_int_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 492; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 492; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__pyx_t_5) {

      /* "pygrib.pyx":493
 *                 self.message(msg)
 *             elif from_what == 1:
 *                 self.message(self.messagenumber+msg)             # <<<<<<<<<<<<<<
 *             elif from_what == 2:
 *                 self.message(self.messages+msg)
 */
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__message); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_1 = PyNumber_Add(__pyx_v_self->messagenumber, __pyx_v_msg); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 493; __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 = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_1);
      __Pyx_GIVEREF(__pyx_t_1);
      __pyx_t_1 = 0;
      __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L6;
    }

    /* "pygrib.pyx":494
 *             elif from_what == 1:
 *                 self.message(self.messagenumber+msg)
 *             elif from_what == 2:             # <<<<<<<<<<<<<<
 *                 self.message(self.messages+msg)
 *     def readline(self):
 */
    __pyx_t_1 = PyObject_RichCompare(__pyx_v_from_what, __pyx_int_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 494; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 494; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (__pyx_t_5) {

      /* "pygrib.pyx":495
 *                 self.message(self.messagenumber+msg)
 *             elif from_what == 2:
 *                 self.message(self.messages+msg)             # <<<<<<<<<<<<<<
 *     def readline(self):
 *         """
 */
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__message); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 495; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_6 = PyNumber_Add(__pyx_v_self->messages, __pyx_v_msg); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 495; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 495; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_6);
      __pyx_t_6 = 0;
      __pyx_t_6 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 495; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      goto __pyx_L6;
    }
    __pyx_L6:;
  }
  __pyx_L4:;

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

/* 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));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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

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;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("readline", 0);

  /* "pygrib.pyx":502
 *         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":503
 *         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), ((PyObject *)__pyx_n_s__next)); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __pyx_t_5 = (__pyx_t_4 != 0);
      if (__pyx_t_5) {

        /* "pygrib.pyx":504
 *         try:
 *             if hasattr(self,'next'):
 *                 grb = self.next()             # <<<<<<<<<<<<<<
 *             else:
 *                 grb = next(self)
 */
        __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__next); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_7 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __pyx_v_grb = __pyx_t_7;
        __pyx_t_7 = 0;
        goto __pyx_L11;
      }
      /*else*/ {

        /* "pygrib.pyx":506
 *                 grb = self.next()
 *             else:
 *                 grb = next(self)             # <<<<<<<<<<<<<<
 *         except StopIteration:
 *             grb = None
 */
        __pyx_t_7 = __Pyx_PyIter_Next(((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 506; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_v_grb = __pyx_t_7;
        __pyx_t_7 = 0;
      }
      __pyx_L11:;
    }
    __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_6); __pyx_t_6 = 0;
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;

    /* "pygrib.pyx":507
 *             else:
 *                 grb = next(self)
 *         except StopIteration:             # <<<<<<<<<<<<<<
 *             grb = None
 *         return grb
 */
    __pyx_t_8 = PyErr_ExceptionMatches(__pyx_builtin_StopIteration);
    if (__pyx_t_8) {
      __Pyx_AddTraceback("pygrib.open.readline", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_6, &__pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GOTREF(__pyx_t_9);

      /* "pygrib.pyx":508
 *                 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_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      goto __pyx_L4_exception_handled;
    }
    __pyx_L5_except_error:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L1_error;
    __pyx_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":509
 *         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;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_9);
  __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;
}

/* 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};

    /* "pygrib.pyx":510
 *             grb = None
 *         return grb
 *     def read(self,msgs=None):             # <<<<<<<<<<<<<<
 *         """
 *         read(N=None)
 */
    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 = 510; __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 = 510; __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);
  __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":520
 *         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":521
 *         """
 *         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 = 521; __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 = 521; __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 = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    __pyx_t_4 = 0;
    __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
    __pyx_t_6 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__return_msgs), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_5), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
    __pyx_v_grbs = __pyx_t_6;
    __pyx_t_6 = 0;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "pygrib.pyx":523
 *             grbs = self._advance(self.messages-self.messagenumber,return_msgs=True)
 *         else:
 *             grbs = self._advance(msgs,return_msgs=True)             # <<<<<<<<<<<<<<
 *         return grbs
 *     def close(self):
 */
    __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 = 523; __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 = 523; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_v_msgs);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_msgs);
    __Pyx_GIVEREF(__pyx_v_msgs);
    __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 523; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_5));
    __pyx_t_3 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 523; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    if (PyDict_SetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__return_msgs), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 523; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 523; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
    __pyx_v_grbs = __pyx_t_3;
    __pyx_t_3 = 0;
  }
  __pyx_L3:;

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

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __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;
}

/* 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));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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

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":531
 *         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":532
 *         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":533
 *         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":534
 *         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":535
 *             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 = 535; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_2));
      __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 535; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_2));
      __Pyx_GIVEREF(((PyObject *)__pyx_t_2));
      __pyx_t_2 = 0;
      __pyx_t_2 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 535; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(((PyObject *)__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 = 535; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L4;
    }
    __pyx_L4:;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "pygrib.pyx":536
 *             if err:
 *                 raise RuntimeError(grib_get_error_message(err))
 *         self.closed = True             # <<<<<<<<<<<<<<
 *         self._fd = NULL
 * 
 */
  __pyx_t_2 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 536; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __Pyx_GOTREF(__pyx_v_self->closed);
  __Pyx_DECREF(__pyx_v_self->closed);
  __pyx_v_self->closed = __pyx_t_2;
  __pyx_t_2 = 0;

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

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

/* 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));
  __Pyx_RefNannyFinishContext();
}

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

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":543
 *         # 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":544
 *         cdef int err
 *         if self._fd:
 *             fclose(self._fd)             # <<<<<<<<<<<<<<
 * 
 *     def rewind(self):
 */
    fclose(__pyx_v_self->_fd);
    goto __pyx_L3;
  }
  __pyx_L3:;

  __Pyx_RefNannyFinishContext();
}

/* 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));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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

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":551
 *         # 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) {
    if (!1) break;

    /* "pygrib.pyx":552
 *         # (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":553
 *         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":554
 *             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;
      goto __pyx_L5;
    }
    __pyx_L5:;
  }
  __pyx_L4_break:;

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

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* 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));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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

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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("message", 0);

  /* "pygrib.pyx":563
 *         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 = 563; __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 = 563; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "pygrib.pyx":564
 *         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 = PyObject_Call(__pyx_builtin_IOError, ((PyObject *)__pyx_k_tuple_11), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __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 = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "pygrib.pyx":566
 *             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 = 566; __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 = 566; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "pygrib.pyx":567
 *         # 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_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__rewind); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 567; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 567; __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_3); __pyx_t_3 = 0;
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "pygrib.pyx":569
 *             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 = 569; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = PyNumber_Subtract(__pyx_v_N, __pyx_v_self->messagenumber); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 569; __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 = 569; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 569; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pygrib.pyx":570
 *         # 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_4 = __pyx_f_6pygrib__create_gribmessage(__pyx_v_self->_gh, __pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 570; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

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

/* 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;
  __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_4open_32select(((struct __pyx_obj_6pygrib_open *)__pyx_v_self), __pyx_v_kwargs);
  __Pyx_XDECREF(__pyx_v_kwargs);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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

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;
  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 = NULL;
  int __pyx_t_9;
  int __pyx_t_10;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("select", 0);

  /* "pygrib.pyx":610
 * 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_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__tell); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 610; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 610; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_msgnum = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "pygrib.pyx":611
 * """
 *         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 = 611; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 611; __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":612
 *         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 = 612; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (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_3 = 0;
    __pyx_t_4 = NULL;
  } else {
    __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 612; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext;
  }
  for (;;) {
    if (!__pyx_t_4 && PyList_CheckExact(__pyx_t_2)) {
      if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break;
      #if CYTHON_COMPILING_IN_CPYTHON
      __pyx_t_5 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 612; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #else
      __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 612; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #endif
    } else if (!__pyx_t_4 && PyTuple_CheckExact(__pyx_t_2)) {
      if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
      #if CYTHON_COMPILING_IN_CPYTHON
      __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 612; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #else
      __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 612; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #endif
    } else {
      __pyx_t_5 = __pyx_t_4(__pyx_t_2);
      if (unlikely(!__pyx_t_5)) {
        if (PyErr_Occurred()) {
          if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
          else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 612; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_5);
    }
    __Pyx_XDECREF_SET(__pyx_v_grb, __pyx_t_5);
    __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s___find); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 612; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 612; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_INCREF(__pyx_v_grb);
    PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_grb);
    __Pyx_GIVEREF(__pyx_v_grb);
    __pyx_t_7 = ((PyObject *)__pyx_v_kwargs);
    __Pyx_INCREF(__pyx_t_7);
    __pyx_t_8 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_6), ((PyObject *)__pyx_t_7)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 612; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
    __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 612; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    if (__pyx_t_9) {
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_v_grb))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 612; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L5;
    }
    __pyx_L5:;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_grbs = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pygrib.pyx":613
 *         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_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__seek); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 613; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 613; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_msgnum);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_msgnum);
  __Pyx_GIVEREF(__pyx_v_msgnum);
  __pyx_t_8 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 613; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "pygrib.pyx":614
 *         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_9 = (((PyObject *)__pyx_v_grbs) != Py_None) && (PyList_GET_SIZE(((PyObject *)__pyx_v_grbs)) != 0);
  __pyx_t_10 = ((!__pyx_t_9) != 0);
  if (__pyx_t_10) {

    /* "pygrib.pyx":615
 *         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_8 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_13), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_Raise(__pyx_t_8, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "pygrib.pyx":616
 *         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(((PyObject *)__pyx_v_grbs));
  __pyx_r = ((PyObject *)__pyx_v_grbs);
  goto __pyx_L0;

  __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_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __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;
}

/* 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] = __pyx_k_14;
    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 = 617; __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 = 617; __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);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pygrib.pyx":617
 *             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
 */

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":622
 *         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 = 622; __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 = 622; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "pygrib.pyx":623
 *         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 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_16), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 623; __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 = 623; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "pygrib.pyx":624
 *         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 = 624; __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 = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_grbs = ((PyObject*)__pyx_t_1);
    __pyx_t_1 = 0;
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "pygrib.pyx":625
 *             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 = 625; __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 = 625; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_v_self->messagenumber);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_self->messagenumber);
  __Pyx_GIVEREF(__pyx_v_self->messagenumber);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_Call(__pyx_builtin_range, ((PyObject *)__pyx_t_3), 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(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  if (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 = 625; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = Py_TYPE(__pyx_t_3)->tp_iternext;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  for (;;) {
    if (!__pyx_t_5 && 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 = 625; __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 = 625; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #endif
    } else if (!__pyx_t_5 && PyTuple_CheckExact(__pyx_t_3)) {
      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 = 625; __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 = 625; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #endif
    } else {
      __pyx_t_1 = __pyx_t_5(__pyx_t_3);
      if (unlikely(!__pyx_t_1)) {
        if (PyErr_Occurred()) {
          if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
          else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 625; __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":626
 *         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":627
 *         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":628
 *             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 = 628; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_1));
      __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 628; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_t_1));
      __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
      __pyx_t_1 = 0;
      __pyx_t_1 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_t_6), NULL); 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_DECREF(((PyObject *)__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 = 628; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L7;
    }
    __pyx_L7:;

    /* "pygrib.pyx":629
 *             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":630
 *                 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":631
 *             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 = 631; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_1));
      __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 631; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_t_1));
      __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
      __pyx_t_1 = 0;
      __pyx_t_1 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 631; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(((PyObject *)__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 = 631; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L8;
    }
    __pyx_L8:;

    /* "pygrib.pyx":632
 *             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":633
 *                 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 = PyObject_Call(__pyx_builtin_IOError, ((PyObject *)__pyx_k_tuple_18), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 633; __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 = 633; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L9;
    }
    __pyx_L9:;

    /* "pygrib.pyx":634
 *             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 = PyNumber_Add(__pyx_v_self->messagenumber, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 634; __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":635
 *                 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 = 635; __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 = 635; __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 = 635; __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 = 635; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      goto __pyx_L10;
    }
    __pyx_L10:;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pygrib.pyx":636
 *             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 = 636; __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 = 636; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
    __Pyx_INCREF(((PyObject *)__pyx_v_grbs));
    __pyx_r = ((PyObject *)__pyx_v_grbs);
    goto __pyx_L0;
    goto __pyx_L11;
  }
  __pyx_L11:;

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

/* 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));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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

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;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __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));
  __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;

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

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

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __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));
  __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;

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

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

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __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));
  __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;

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

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

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __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));
  __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;

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

  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* 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));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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

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;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __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));
  __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;

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

  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* 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 = {__Pyx_NAMESTR("julian_to_datetime"), (PyCFunction)__pyx_pw_6pygrib_13julian_to_datetime, METH_O, __Pyx_DOCSTR(__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));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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

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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("julian_to_datetime", 0);

  /* "pygrib.pyx":654
 *     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 = 654; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_julday = __pyx_t_1;

  /* "pygrib.pyx":655
 *     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":656
 *     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":657
 *     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 = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_3));
    __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
    __pyx_t_3 = 0;
    __pyx_t_3 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(((PyObject *)__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 = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "pygrib.pyx":658
 *     if err:
 *         raise RuntimeError(grib_get_error_message(err))
 *     return datetime(year, month, day, hour, minute, second)             # <<<<<<<<<<<<<<
 * 
 * def datetime_to_julian(object d):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__datetime); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 658; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyInt_FromLong(__pyx_v_year); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 658; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyInt_FromLong(__pyx_v_month); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 658; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = PyInt_FromLong(__pyx_v_day); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 658; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = PyInt_FromLong(__pyx_v_hour); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 658; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_8 = PyInt_FromLong(__pyx_v_minute); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 658; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_9 = PyInt_FromLong(__pyx_v_second); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 658; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_10 = PyTuple_New(6); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 658; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_10);
  PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_10, 2, __pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_10, 3, __pyx_t_7);
  __Pyx_GIVEREF(__pyx_t_7);
  PyTuple_SET_ITEM(__pyx_t_10, 4, __pyx_t_8);
  __Pyx_GIVEREF(__pyx_t_8);
  PyTuple_SET_ITEM(__pyx_t_10, 5, __pyx_t_9);
  __Pyx_GIVEREF(__pyx_t_9);
  __pyx_t_4 = 0;
  __pyx_t_5 = 0;
  __pyx_t_6 = 0;
  __pyx_t_7 = 0;
  __pyx_t_8 = 0;
  __pyx_t_9 = 0;
  __pyx_t_9 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 658; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
  __pyx_r = __pyx_t_9;
  __pyx_t_9 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __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_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;
}

/* 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 = {__Pyx_NAMESTR("datetime_to_julian"), (PyCFunction)__pyx_pw_6pygrib_15datetime_to_julian, METH_O, __Pyx_DOCSTR(__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));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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

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":668
 *     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 = 668; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_AsLong(__pyx_t_1); if (unlikely((__pyx_t_2 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 668; __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 = 668; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_AsLong(__pyx_t_1); if (unlikely((__pyx_t_2 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 668; __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 = 668; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_AsLong(__pyx_t_1); if (unlikely((__pyx_t_2 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 668; __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 = 668; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_AsLong(__pyx_t_1); if (unlikely((__pyx_t_2 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 668; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_hour = __pyx_t_2;

  /* "pygrib.pyx":669
 *     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 = 669; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_AsLong(__pyx_t_1); if (unlikely((__pyx_t_2 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 669; __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 = 669; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_AsLong(__pyx_t_1); if (unlikely((__pyx_t_2 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 669; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_second = __pyx_t_2;

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

  /* "pygrib.pyx":673
 *     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 = 673; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_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.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":675
 *     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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_create_gribmessage", 0);

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

  /* "pygrib.pyx":678
 *     """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":679
 *     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_t_1 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 679; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_grb->expand_reduced);
  __Pyx_DECREF(__pyx_v_grb->expand_reduced);
  __pyx_v_grb->expand_reduced = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pygrib.pyx":680
 *     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":681
 *     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_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_grb), __pyx_n_s__keys); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 681; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 681; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_GIVEREF(__pyx_t_2);
  __Pyx_GOTREF(__pyx_v_grb->_all_keys);
  __Pyx_DECREF(__pyx_v_grb->_all_keys);
  __pyx_v_grb->_all_keys = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "pygrib.pyx":682
 *     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 = 682; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 682; __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":683
 *     grb._all_keys = grb.keys()
 *     grb._ro_keys  = grb._read_only_keys()
 *     grb._set_projparams() # set projection parameter dict.             # <<<<<<<<<<<<<<
 *     return setdates(grb)
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_grb), __pyx_n_s___set_projparams); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 683; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 683; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pygrib.pyx":684
 *     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 = 684; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 684; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_v_grb));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_grb));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_grb));
  __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 684; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  __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._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;
}

/* 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 = {__Pyx_NAMESTR("fromstring"), (PyCFunction)__pyx_pw_6pygrib_17fromstring, METH_O, __Pyx_DOCSTR(__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));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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

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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("fromstring", 0);

  /* "pygrib.pyx":696
 *     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 = 696; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_gribstr = __pyx_t_1;

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

  /* "pygrib.pyx":699
 *     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":700
 *     grb  = gribmessage.__new__(gribmessage)
 *     grb.messagenumber = 1
 *     grb.expand_reduced = True             # <<<<<<<<<<<<<<
 *     grb._gh = gh
 *     grb._all_keys = grb.keys()
 */
  __pyx_t_3 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 700; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __Pyx_GOTREF(__pyx_v_grb->expand_reduced);
  __Pyx_DECREF(__pyx_v_grb->expand_reduced);
  __pyx_v_grb->expand_reduced = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "pygrib.pyx":701
 *     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":702
 *     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_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_grb), __pyx_n_s__keys); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 702; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 702; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_GIVEREF(__pyx_t_4);
  __Pyx_GOTREF(__pyx_v_grb->_all_keys);
  __Pyx_DECREF(__pyx_v_grb->_all_keys);
  __pyx_v_grb->_all_keys = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "pygrib.pyx":703
 *     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 = 703; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 703; __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":704
 *     grb._all_keys = grb.keys()
 *     grb._ro_keys  = grb._read_only_keys()
 *     grb._set_projparams() # set projection parameter dict.             # <<<<<<<<<<<<<<
 *     return setdates(grb)
 * 
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_grb), __pyx_n_s___set_projparams); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 704; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 704; __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_4); __pyx_t_4 = 0;

  /* "pygrib.pyx":705
 *     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 = 705; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 705; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(((PyObject *)__pyx_v_grb));
  PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_grb));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_grb));
  __pyx_t_5 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 705; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_5;
  __pyx_t_5 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __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;
}

/* 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 = {__Pyx_NAMESTR("setdates"), (PyCFunction)__pyx_pw_6pygrib_19setdates, METH_O, __Pyx_DOCSTR(__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 = 707; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_6pygrib_18setdates(__pyx_self, ((struct __pyx_obj_6pygrib_gribmessage *)__pyx_v_grb));
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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

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
  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;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  double __pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  int __pyx_t_12;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("setdates", 0);

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

  /* "pygrib.pyx":718
 *     """
 *     grb.fcstimeunits = ""
 *     if grb.has_key('indicatorOfUnitOfTimeRange') and\             # <<<<<<<<<<<<<<
 *        grb.indicatorOfUnitOfTimeRange in _ftimedict:
 *         grb.fcstimeunits = _ftimedict[grb.indicatorOfUnitOfTimeRange]
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_grb), __pyx_n_s__has_key); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 718; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_21), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 718; __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 = 718; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_3) {

    /* "pygrib.pyx":719
 *     grb.fcstimeunits = ""
 *     if grb.has_key('indicatorOfUnitOfTimeRange') and\
 *        grb.indicatorOfUnitOfTimeRange in _ftimedict:             # <<<<<<<<<<<<<<
 *         grb.fcstimeunits = _ftimedict[grb.indicatorOfUnitOfTimeRange]
 *     if grb.has_key('forecastTime'):
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_grb), __pyx_n_s_20); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 719; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s___ftimedict); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 719; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = (__Pyx_PySequence_Contains(__pyx_t_2, __pyx_t_1, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 719; __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;
    __pyx_t_5 = __pyx_t_4;
  } else {
    __pyx_t_5 = __pyx_t_3;
  }
  if (__pyx_t_5) {

    /* "pygrib.pyx":720
 *     if grb.has_key('indicatorOfUnitOfTimeRange') and\
 *        grb.indicatorOfUnitOfTimeRange in _ftimedict:
 *         grb.fcstimeunits = _ftimedict[grb.indicatorOfUnitOfTimeRange]             # <<<<<<<<<<<<<<
 *     if grb.has_key('forecastTime'):
 *         if grb.has_key('stepRange'):
 */
    __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s___ftimedict); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 720; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_grb), __pyx_n_s_20); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 720; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_6 = PyObject_GetItem(__pyx_t_1, __pyx_t_2); if (!__pyx_t_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 720; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 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;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "pygrib.pyx":721
 *        grb.indicatorOfUnitOfTimeRange in _ftimedict:
 *         grb.fcstimeunits = _ftimedict[grb.indicatorOfUnitOfTimeRange]
 *     if grb.has_key('forecastTime'):             # <<<<<<<<<<<<<<
 *         if grb.has_key('stepRange'):
 *             # this is a hack to work around grib_api bug
 */
  __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 = 721; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_2 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_k_tuple_22), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 721; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 721; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_5) {

    /* "pygrib.pyx":722
 *         grb.fcstimeunits = _ftimedict[grb.indicatorOfUnitOfTimeRange]
 *     if grb.has_key('forecastTime'):
 *         if grb.has_key('stepRange'):             # <<<<<<<<<<<<<<
 *             # this is a hack to work around grib_api bug
 *             # sometimes stepUnits and 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 = 722; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_6 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_23), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 722; __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 = 722; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (__pyx_t_5) {

      /* "pygrib.pyx":726
 *             # sometimes stepUnits and indicatorOfUnitOfTimeRange
 *             # are inconsistent.
 *             grb.stepUnits = grb.indicatorOfUnitOfTimeRange             # <<<<<<<<<<<<<<
 *             ftime = grb['stepRange'] # computed key, uses stepUnits
 *             # if it's a range, use the end of the range to define validDate
 */
      __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_grb), __pyx_n_s_20); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 726; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_grb), __pyx_n_s__stepUnits, __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 726; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

      /* "pygrib.pyx":727
 *             # are inconsistent.
 *             grb.stepUnits = grb.indicatorOfUnitOfTimeRange
 *             ftime = grb['stepRange'] # computed key, uses stepUnits             # <<<<<<<<<<<<<<
 *             # if it's a range, use the end of the range to define validDate
 *             try:
 */
      __pyx_t_6 = PyObject_GetItem(((PyObject *)__pyx_v_grb), ((PyObject *)__pyx_n_s__stepRange)); if (!__pyx_t_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 727; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_v_ftime = __pyx_t_6;
      __pyx_t_6 = 0;

      /* "pygrib.pyx":729
 *             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":730
 *             # if it's a range, use the end of the range to define validDate
 *             try:
 *                 ftime = float(ftime.split('-')[1])             # <<<<<<<<<<<<<<
 *             except:
 *                 ftime = grb.forecastTime
 */
          __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_ftime, __pyx_n_s__split); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 730; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
          __Pyx_GOTREF(__pyx_t_6);
          __pyx_t_2 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_k_tuple_25), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 730; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __pyx_t_6 = __Pyx_GetItemInt(__pyx_t_2, 1, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 730; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
          __Pyx_GOTREF(__pyx_t_6);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __pyx_t_10 = __Pyx_PyObject_AsDouble(__pyx_t_6); if (unlikely(__pyx_t_10 == ((double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 730; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __pyx_t_6 = PyFloat_FromDouble(__pyx_t_10); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 730; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
          __Pyx_GOTREF(__pyx_t_6);
          __Pyx_DECREF_SET(__pyx_v_ftime, __pyx_t_6);
          __pyx_t_6 = 0;
        }
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        goto __pyx_L13_try_end;
        __pyx_L6_error:;
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;

        /* "pygrib.pyx":731
 *             try:
 *                 ftime = float(ftime.split('-')[1])
 *             except:             # <<<<<<<<<<<<<<
 *                 ftime = grb.forecastTime
 *         else:
 */
        /*except:*/ {
          __Pyx_AddTraceback("pygrib.setdates", __pyx_clineno, __pyx_lineno, __pyx_filename);
          if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_2, &__pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 731; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
          __Pyx_GOTREF(__pyx_t_6);
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_GOTREF(__pyx_t_1);

          /* "pygrib.pyx":732
 *                 ftime = float(ftime.split('-')[1])
 *             except:
 *                 ftime = grb.forecastTime             # <<<<<<<<<<<<<<
 *         else:
 *             ftime = grb.forecastTime
 */
          __pyx_t_11 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_grb), __pyx_n_s__forecastTime); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 732; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
          __Pyx_GOTREF(__pyx_t_11);
          __Pyx_DECREF_SET(__pyx_v_ftime, __pyx_t_11);
          __pyx_t_11 = 0;
          __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;
          goto __pyx_L7_exception_handled;
        }
        __pyx_L8_except_error:;
        __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_L7_exception_handled:;
        __Pyx_XGIVEREF(__pyx_t_7);
        __Pyx_XGIVEREF(__pyx_t_8);
        __Pyx_XGIVEREF(__pyx_t_9);
        __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9);
        __pyx_L13_try_end:;
      }
      goto __pyx_L5;
    }
    /*else*/ {

      /* "pygrib.pyx":734
 *                 ftime = grb.forecastTime
 *         else:
 *             ftime = grb.forecastTime             # <<<<<<<<<<<<<<
 *     else:
 *         ftime = 0
 */
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_grb), __pyx_n_s__forecastTime); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 734; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_v_ftime = __pyx_t_1;
      __pyx_t_1 = 0;
    }
    __pyx_L5:;
    goto __pyx_L4;
  }
  /*else*/ {

    /* "pygrib.pyx":736
 *             ftime = grb.forecastTime
 *     else:
 *         ftime = 0             # <<<<<<<<<<<<<<
 *     if grb.has_key('julianDay'):
 *         # don't do anything if datetime fails (because of a miscoded julianDay)
 */
    __Pyx_INCREF(__pyx_int_0);
    __pyx_v_ftime = __pyx_int_0;
  }
  __pyx_L4:;

  /* "pygrib.pyx":737
 *     else:
 *         ftime = 0
 *     if grb.has_key('julianDay'):             # <<<<<<<<<<<<<<
 *         # don't do anything if datetime fails (because of a miscoded julianDay)
 *         try:
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_grb), __pyx_n_s__has_key); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 737; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_26), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 737; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 737; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_5) {

    /* "pygrib.pyx":739
 *     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":741
 *         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 = 741; __pyx_clineno = __LINE__; goto __pyx_L17_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_grb), __pyx_n_s__julianDay); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 741; __pyx_clineno = __LINE__; goto __pyx_L17_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 741; __pyx_clineno = __LINE__; goto __pyx_L17_error;}
        __Pyx_GOTREF(__pyx_t_6);
        PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_1);
        __Pyx_GIVEREF(__pyx_t_1);
        __pyx_t_1 = 0;
        __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 741; __pyx_clineno = __LINE__; goto __pyx_L17_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;

        /* "pygrib.pyx":740
 *         # 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_1);
        __Pyx_GOTREF(__pyx_v_grb->analDate);
        __Pyx_DECREF(__pyx_v_grb->analDate);
        __pyx_v_grb->analDate = __pyx_t_1;
        __pyx_t_1 = 0;
      }
      __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_L24_try_end;
      __pyx_L17_error:;
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;

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

        /* "pygrib.pyx":743
 *             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_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        goto __pyx_L20_except_return;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        goto __pyx_L18_exception_handled;
      }
      __pyx_L19_except_error:;
      __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_L20_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_L18_exception_handled:;
      __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);
      __pyx_L24_try_end:;
    }

    /* "pygrib.pyx":744
 *         except ValueError:
 *             return grb
 *         if grb.fcstimeunits == 'hrs':             # <<<<<<<<<<<<<<
 *             try:
 *                 grb.validDate =\
 */
    __pyx_t_2 = PyObject_RichCompare(__pyx_v_grb->fcstimeunits, ((PyObject *)__pyx_n_s__hrs), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 744; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 744; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__pyx_t_5) {

      /* "pygrib.pyx":745
 *             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":747
 *             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 = 747; __pyx_clineno = __LINE__; goto __pyx_L28_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 = 747; __pyx_clineno = __LINE__; goto __pyx_L28_error;}
          __Pyx_GOTREF(__pyx_t_6);
          __pyx_t_1 = PyFloat_FromDouble(24.); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 747; __pyx_clineno = __LINE__; goto __pyx_L28_error;}
          __Pyx_GOTREF(__pyx_t_1);
          __pyx_t_11 = __Pyx_PyNumber_Divide(__pyx_v_ftime, __pyx_t_1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 747; __pyx_clineno = __LINE__; goto __pyx_L28_error;}
          __Pyx_GOTREF(__pyx_t_11);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __pyx_t_1 = PyNumber_Add(__pyx_t_6, __pyx_t_11); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 747; __pyx_clineno = __LINE__; goto __pyx_L28_error;}
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
          __pyx_t_11 = PyTuple_New(1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 747; __pyx_clineno = __LINE__; goto __pyx_L28_error;}
          __Pyx_GOTREF(__pyx_t_11);
          PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_1);
          __Pyx_GIVEREF(__pyx_t_1);
          __pyx_t_1 = 0;
          __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_11), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 747; __pyx_clineno = __LINE__; goto __pyx_L28_error;}
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0;

          /* "pygrib.pyx":746
 *         if grb.fcstimeunits == 'hrs':
 *             try:
 *                 grb.validDate =\             # <<<<<<<<<<<<<<
 *                 julian_to_datetime(grb.julianDay+ftime/24.)
 *             except ValueError:
 */
          __Pyx_GIVEREF(__pyx_t_1);
          __Pyx_GOTREF(__pyx_v_grb->validDate);
          __Pyx_DECREF(__pyx_v_grb->validDate);
          __pyx_v_grb->validDate = __pyx_t_1;
          __pyx_t_1 = 0;
        }
        __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_L35_try_end;
        __pyx_L28_error:;
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;

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

          /* "pygrib.pyx":749
 *                 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_1); __pyx_t_1 = 0;
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
          goto __pyx_L31_except_return;
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          goto __pyx_L29_exception_handled;
        }
        __pyx_L30_except_error:;
        __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_L31_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_L29_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_L35_try_end:;
      }
      goto __pyx_L27;
    }

    /* "pygrib.pyx":750
 *             except ValueError:
 *                 return grb
 *         elif grb.fcstimeunits == 'mins':             # <<<<<<<<<<<<<<
 *             try:
 *                 grb.validDate =\
 */
    __pyx_t_2 = PyObject_RichCompare(__pyx_v_grb->fcstimeunits, ((PyObject *)__pyx_n_s__mins), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 750; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 750; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__pyx_t_5) {

      /* "pygrib.pyx":751
 *                 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":753
 *             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 = 753; __pyx_clineno = __LINE__; goto __pyx_L38_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 = 753; __pyx_clineno = __LINE__; goto __pyx_L38_error;}
          __Pyx_GOTREF(__pyx_t_11);
          __pyx_t_1 = PyFloat_FromDouble(1440.); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 753; __pyx_clineno = __LINE__; goto __pyx_L38_error;}
          __Pyx_GOTREF(__pyx_t_1);
          __pyx_t_6 = __Pyx_PyNumber_Divide(__pyx_v_ftime, __pyx_t_1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 753; __pyx_clineno = __LINE__; goto __pyx_L38_error;}
          __Pyx_GOTREF(__pyx_t_6);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __pyx_t_1 = PyNumber_Add(__pyx_t_11, __pyx_t_6); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 753; __pyx_clineno = __LINE__; goto __pyx_L38_error;}
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 753; __pyx_clineno = __LINE__; goto __pyx_L38_error;}
          __Pyx_GOTREF(__pyx_t_6);
          PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_1);
          __Pyx_GIVEREF(__pyx_t_1);
          __pyx_t_1 = 0;
          __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 753; __pyx_clineno = __LINE__; goto __pyx_L38_error;}
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;

          /* "pygrib.pyx":752
 *         elif grb.fcstimeunits == 'mins':
 *             try:
 *                 grb.validDate =\             # <<<<<<<<<<<<<<
 *                 julian_to_datetime(grb.julianDay+ftime/1440.)
 *             except ValueError:
 */
          __Pyx_GIVEREF(__pyx_t_1);
          __Pyx_GOTREF(__pyx_v_grb->validDate);
          __Pyx_DECREF(__pyx_v_grb->validDate);
          __pyx_v_grb->validDate = __pyx_t_1;
          __pyx_t_1 = 0;
        }
        __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_L45_try_end;
        __pyx_L38_error:;
        __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;

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

          /* "pygrib.pyx":755
 *                 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_1); __pyx_t_1 = 0;
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          goto __pyx_L41_except_return;
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          goto __pyx_L39_exception_handled;
        }
        __pyx_L40_except_error:;
        __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_L41_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_L39_exception_handled:;
        __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);
        __pyx_L45_try_end:;
      }
      goto __pyx_L27;
    }

    /* "pygrib.pyx":756
 *             except ValueError:
 *                 return grb
 *         elif grb.fcstimeunits == 'days':             # <<<<<<<<<<<<<<
 *             try:
 *                 grb.validDate =\
 */
    __pyx_t_2 = PyObject_RichCompare(__pyx_v_grb->fcstimeunits, ((PyObject *)__pyx_n_s__days), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 756; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 756; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__pyx_t_5) {

      /* "pygrib.pyx":757
 *                 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":759
 *             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 = 759; __pyx_clineno = __LINE__; goto __pyx_L48_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 = 759; __pyx_clineno = __LINE__; goto __pyx_L48_error;}
          __Pyx_GOTREF(__pyx_t_6);
          __pyx_t_1 = PyNumber_Add(__pyx_t_6, __pyx_v_ftime); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 759; __pyx_clineno = __LINE__; goto __pyx_L48_error;}
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 759; __pyx_clineno = __LINE__; goto __pyx_L48_error;}
          __Pyx_GOTREF(__pyx_t_6);
          PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_1);
          __Pyx_GIVEREF(__pyx_t_1);
          __pyx_t_1 = 0;
          __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 759; __pyx_clineno = __LINE__; goto __pyx_L48_error;}
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;

          /* "pygrib.pyx":758
 *         elif grb.fcstimeunits == 'days':
 *             try:
 *                 grb.validDate =\             # <<<<<<<<<<<<<<
 *                 julian_to_datetime(grb.julianDay+ftime)
 *             except ValueError:
 */
          __Pyx_GIVEREF(__pyx_t_1);
          __Pyx_GOTREF(__pyx_v_grb->validDate);
          __Pyx_DECREF(__pyx_v_grb->validDate);
          __pyx_v_grb->validDate = __pyx_t_1;
          __pyx_t_1 = 0;
        }
        __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_L55_try_end;
        __pyx_L48_error:;
        __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;

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

          /* "pygrib.pyx":761
 *                 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_1); __pyx_t_1 = 0;
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          goto __pyx_L51_except_return;
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          goto __pyx_L49_exception_handled;
        }
        __pyx_L50_except_error:;
        __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_L51_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_L49_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_L55_try_end:;
      }
      goto __pyx_L27;
    }

    /* "pygrib.pyx":762
 *             except ValueError:
 *                 return grb
 *         elif grb.fcstimeunits == 'secs':             # <<<<<<<<<<<<<<
 *             try:
 *                 grb.validDate =\
 */
    __pyx_t_2 = PyObject_RichCompare(__pyx_v_grb->fcstimeunits, ((PyObject *)__pyx_n_s__secs), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 762; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 762; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__pyx_t_5) {

      /* "pygrib.pyx":763
 *                 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":765
 *             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 = 765; __pyx_clineno = __LINE__; goto __pyx_L58_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 = 765; __pyx_clineno = __LINE__; goto __pyx_L58_error;}
          __Pyx_GOTREF(__pyx_t_6);
          __pyx_t_1 = PyFloat_FromDouble(86400.); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 765; __pyx_clineno = __LINE__; goto __pyx_L58_error;}
          __Pyx_GOTREF(__pyx_t_1);
          __pyx_t_11 = __Pyx_PyNumber_Divide(__pyx_v_ftime, __pyx_t_1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 765; __pyx_clineno = __LINE__; goto __pyx_L58_error;}
          __Pyx_GOTREF(__pyx_t_11);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __pyx_t_1 = PyNumber_Add(__pyx_t_6, __pyx_t_11); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 765; __pyx_clineno = __LINE__; goto __pyx_L58_error;}
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
          __pyx_t_11 = PyTuple_New(1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 765; __pyx_clineno = __LINE__; goto __pyx_L58_error;}
          __Pyx_GOTREF(__pyx_t_11);
          PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_1);
          __Pyx_GIVEREF(__pyx_t_1);
          __pyx_t_1 = 0;
          __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_11), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 765; __pyx_clineno = __LINE__; goto __pyx_L58_error;}
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0;

          /* "pygrib.pyx":764
 *         elif grb.fcstimeunits == 'secs':
 *             try:
 *                 grb.validDate =\             # <<<<<<<<<<<<<<
 *                 julian_to_datetime(grb.julianDay+ftime/86400.)
 *             except ValueError:
 */
          __Pyx_GIVEREF(__pyx_t_1);
          __Pyx_GOTREF(__pyx_v_grb->validDate);
          __Pyx_DECREF(__pyx_v_grb->validDate);
          __pyx_v_grb->validDate = __pyx_t_1;
          __pyx_t_1 = 0;
        }
        __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_L65_try_end;
        __pyx_L58_error:;
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;

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

          /* "pygrib.pyx":767
 *                 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_1); __pyx_t_1 = 0;
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
          goto __pyx_L61_except_return;
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          goto __pyx_L59_exception_handled;
        }
        __pyx_L60_except_error:;
        __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_L61_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_L59_exception_handled:;
        __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);
        __pyx_L65_try_end:;
      }
      goto __pyx_L27;
    }

    /* "pygrib.pyx":768
 *             except ValueError:
 *                 return grb
 *         elif grb.fcstimeunits == '3 hr periods':             # <<<<<<<<<<<<<<
 *             try:
 *                 grb.validDate =\
 */
    __pyx_t_2 = PyObject_RichCompare(__pyx_v_grb->fcstimeunits, ((PyObject *)__pyx_kp_s_27), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 768; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 768; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__pyx_t_5) {

      /* "pygrib.pyx":769
 *                 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":771
 *             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 = 771; __pyx_clineno = __LINE__; goto __pyx_L68_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 = 771; __pyx_clineno = __LINE__; goto __pyx_L68_error;}
          __Pyx_GOTREF(__pyx_t_11);
          __pyx_t_1 = PyFloat_FromDouble(8.); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L68_error;}
          __Pyx_GOTREF(__pyx_t_1);
          __pyx_t_6 = __Pyx_PyNumber_Divide(__pyx_v_ftime, __pyx_t_1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L68_error;}
          __Pyx_GOTREF(__pyx_t_6);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __pyx_t_1 = PyNumber_Add(__pyx_t_11, __pyx_t_6); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L68_error;}
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L68_error;}
          __Pyx_GOTREF(__pyx_t_6);
          PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_1);
          __Pyx_GIVEREF(__pyx_t_1);
          __pyx_t_1 = 0;
          __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L68_error;}
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;

          /* "pygrib.pyx":770
 *         elif grb.fcstimeunits == '3 hr periods':
 *             try:
 *                 grb.validDate =\             # <<<<<<<<<<<<<<
 *                 julian_to_datetime(grb.julianDay+ftime/8.)
 *             except ValueError:
 */
          __Pyx_GIVEREF(__pyx_t_1);
          __Pyx_GOTREF(__pyx_v_grb->validDate);
          __Pyx_DECREF(__pyx_v_grb->validDate);
          __pyx_v_grb->validDate = __pyx_t_1;
          __pyx_t_1 = 0;
        }
        __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_L75_try_end;
        __pyx_L68_error:;
        __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;

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

          /* "pygrib.pyx":773
 *                 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_1); __pyx_t_1 = 0;
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          goto __pyx_L71_except_return;
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          goto __pyx_L69_exception_handled;
        }
        __pyx_L70_except_error:;
        __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_L71_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_L69_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_L75_try_end:;
      }
      goto __pyx_L27;
    }

    /* "pygrib.pyx":774
 *             except ValueError:
 *                 return grb
 *         elif grb.fcstimeunits == '6 hr periods':             # <<<<<<<<<<<<<<
 *             try:
 *                 grb.validDate =\
 */
    __pyx_t_2 = PyObject_RichCompare(__pyx_v_grb->fcstimeunits, ((PyObject *)__pyx_kp_s_28), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 774; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 774; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__pyx_t_5) {

      /* "pygrib.pyx":775
 *                 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":777
 *             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 = 777; __pyx_clineno = __LINE__; goto __pyx_L78_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 = 777; __pyx_clineno = __LINE__; goto __pyx_L78_error;}
          __Pyx_GOTREF(__pyx_t_6);
          __pyx_t_1 = PyFloat_FromDouble(4.); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 777; __pyx_clineno = __LINE__; goto __pyx_L78_error;}
          __Pyx_GOTREF(__pyx_t_1);
          __pyx_t_11 = __Pyx_PyNumber_Divide(__pyx_v_ftime, __pyx_t_1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 777; __pyx_clineno = __LINE__; goto __pyx_L78_error;}
          __Pyx_GOTREF(__pyx_t_11);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __pyx_t_1 = PyNumber_Add(__pyx_t_6, __pyx_t_11); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 777; __pyx_clineno = __LINE__; goto __pyx_L78_error;}
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
          __pyx_t_11 = PyTuple_New(1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 777; __pyx_clineno = __LINE__; goto __pyx_L78_error;}
          __Pyx_GOTREF(__pyx_t_11);
          PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_1);
          __Pyx_GIVEREF(__pyx_t_1);
          __pyx_t_1 = 0;
          __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_11), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 777; __pyx_clineno = __LINE__; goto __pyx_L78_error;}
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0;

          /* "pygrib.pyx":776
 *         elif grb.fcstimeunits == '6 hr periods':
 *             try:
 *                 grb.validDate =\             # <<<<<<<<<<<<<<
 *                 julian_to_datetime(grb.julianDay+ftime/4.)
 *             except ValueError:
 */
          __Pyx_GIVEREF(__pyx_t_1);
          __Pyx_GOTREF(__pyx_v_grb->validDate);
          __Pyx_DECREF(__pyx_v_grb->validDate);
          __pyx_v_grb->validDate = __pyx_t_1;
          __pyx_t_1 = 0;
        }
        __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_L85_try_end;
        __pyx_L78_error:;
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;

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

          /* "pygrib.pyx":779
 *                 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_1); __pyx_t_1 = 0;
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
          goto __pyx_L81_except_return;
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          goto __pyx_L79_exception_handled;
        }
        __pyx_L80_except_error:;
        __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_L81_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_L79_exception_handled:;
        __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);
        __pyx_L85_try_end:;
      }
      goto __pyx_L27;
    }

    /* "pygrib.pyx":780
 *             except ValueError:
 *                 return grb
 *         elif grb.fcstimeunits == '12 hr periods':             # <<<<<<<<<<<<<<
 *             try:
 *                 grb.validDate =\
 */
    __pyx_t_2 = PyObject_RichCompare(__pyx_v_grb->fcstimeunits, ((PyObject *)__pyx_kp_s_29), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 780; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_5 < 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;
    if (__pyx_t_5) {

      /* "pygrib.pyx":781
 *                 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":783
 *             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 = 783; __pyx_clineno = __LINE__; goto __pyx_L88_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 = 783; __pyx_clineno = __LINE__; goto __pyx_L88_error;}
          __Pyx_GOTREF(__pyx_t_11);
          __pyx_t_1 = PyFloat_FromDouble(2.); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L88_error;}
          __Pyx_GOTREF(__pyx_t_1);
          __pyx_t_6 = __Pyx_PyNumber_Divide(__pyx_v_ftime, __pyx_t_1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L88_error;}
          __Pyx_GOTREF(__pyx_t_6);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __pyx_t_1 = PyNumber_Add(__pyx_t_11, __pyx_t_6); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L88_error;}
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L88_error;}
          __Pyx_GOTREF(__pyx_t_6);
          PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_1);
          __Pyx_GIVEREF(__pyx_t_1);
          __pyx_t_1 = 0;
          __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L88_error;}
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;

          /* "pygrib.pyx":782
 *         elif grb.fcstimeunits == '12 hr periods':
 *             try:
 *                 grb.validDate =\             # <<<<<<<<<<<<<<
 *                 julian_to_datetime(grb.julianDay+ftime/2.)
 *             except ValueError:
 */
          __Pyx_GIVEREF(__pyx_t_1);
          __Pyx_GOTREF(__pyx_v_grb->validDate);
          __Pyx_DECREF(__pyx_v_grb->validDate);
          __pyx_v_grb->validDate = __pyx_t_1;
          __pyx_t_1 = 0;
        }
        __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_L95_try_end;
        __pyx_L88_error:;
        __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;

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

          /* "pygrib.pyx":785
 *                 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_1); __pyx_t_1 = 0;
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          goto __pyx_L91_except_return;
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          goto __pyx_L89_exception_handled;
        }
        __pyx_L90_except_error:;
        __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_L91_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_L89_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_L95_try_end:;
      }
      goto __pyx_L27;
    }
    __pyx_L27:;
    goto __pyx_L16;
  }
  __pyx_L16:;

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

  __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_11);
  __Pyx_AddTraceback("pygrib.setdates", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_ftime);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* 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 = {__Pyx_NAMESTR("reload"), (PyCFunction)__pyx_pw_6pygrib_21reload, METH_O, __Pyx_DOCSTR(__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 = 788; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_6pygrib_20reload(__pyx_self, ((struct __pyx_obj_6pygrib_gribmessage *)__pyx_v_grb));
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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

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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("reload", 0);

  /* "pygrib.pyx":798
 * 
 *     Equivalent to fromstring(grb.tostring())"""
 *     return fromstring(grb.tostring())             # <<<<<<<<<<<<<<
 * 
 * cdef class gribmessage(object):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__fromstring); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_grb), __pyx_n_s__tostring); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_3 = 0;
  __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  __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.reload", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* 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));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pygrib.pyx":839
 *     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")
 */

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":841
 *     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 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_k_tuple_31), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 841; __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 = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pygrib.gribmessage.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* 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));
  __Pyx_RefNannyFinishContext();
}

/* "pygrib.pyx":842
 *         # 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
 */

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":845
 *         # 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);

  __Pyx_RefNannyFinishContext();
}

/* 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));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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

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;
  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("__getattr__", 0);

  /* "pygrib.pyx":849
 *         # 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":850
 *         # 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_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s____getitem__); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 850; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 850; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_INCREF(__pyx_v_item);
      PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_item);
      __Pyx_GIVEREF(__pyx_v_item);
      __pyx_t_6 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 850; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
      __pyx_r = __pyx_t_6;
      __pyx_t_6 = 0;
      goto __pyx_L7_try_return;
    }
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L10_try_end;
    __pyx_L7_try_return:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L0;
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "pygrib.pyx":851
 *         try:
 *             return self.__getitem__(item)
 *         except KeyError:             # <<<<<<<<<<<<<<
 *             raise AttributeError(item)
 *     def __setattr__(self, name, value):
 */
    __pyx_t_7 = PyErr_ExceptionMatches(__pyx_builtin_KeyError);
    if (__pyx_t_7) {
      __Pyx_AddTraceback("pygrib.gribmessage.__getattr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_5, &__pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 851; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GOTREF(__pyx_t_4);

      /* "pygrib.pyx":852
 *             return self.__getitem__(item)
 *         except KeyError:
 *             raise AttributeError(item)             # <<<<<<<<<<<<<<
 *     def __setattr__(self, name, value):
 *         # allow gribmessage keys to be set like attributes.
 */
      __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 852; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_INCREF(__pyx_v_item);
      PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_item);
      __Pyx_GIVEREF(__pyx_v_item);
      __pyx_t_9 = PyObject_Call(__pyx_builtin_AttributeError, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 852; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
      __Pyx_Raise(__pyx_t_9, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 852; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      goto __pyx_L4_exception_handled;
    }
    __pyx_L5_except_error:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L1_error;
    __pyx_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:;
  }

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("pygrib.gribmessage.__getattr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* 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));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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

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":855
 *     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 = 855; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = (__Pyx_PySequence_Contains(__pyx_v_name, __pyx_t_1, Py_NE)); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 855; __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":857
 *         if name not in _private_atts:
 *             # these are grib message keys
 *             self[name] = value             # <<<<<<<<<<<<<<
 *         else:
 *             # these are python attributes.
 */
    if (PyObject_SetItem(((PyObject *)__pyx_v_self), __pyx_v_name, __pyx_v_value) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 857; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L3;
  }
  /*else*/ {

    /* "pygrib.pyx":860
 *         else:
 *             # these are python attributes.
 *             self.__dict__[name]=value             # <<<<<<<<<<<<<<
 *     def __repr__(self):
 *         """prints a short inventory of the grib message"""
 */
    __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 = 860; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (PyObject_SetItem(__pyx_t_1, __pyx_v_name, __pyx_v_value) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 860; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }
  __pyx_L3:;

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

/* 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));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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

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;
  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("__repr__", 0);

  /* "pygrib.pyx":863
 *     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 = 863; __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":864
 *         """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 = 864; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_32), NULL); 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_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 = 864; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_3) {

    /* "pygrib.pyx":865
 *         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), ((PyObject *)__pyx_n_s__name)); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 865; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, ((PyObject *)__pyx_n_s__unknown), Py_NE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_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;
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 865; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (__pyx_t_3) {

      /* "pygrib.pyx":866
 *         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_1 = __pyx_v_self->messagenumber;
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_2 = PyObject_Repr(__pyx_t_1); 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_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = PyNumber_Add(__pyx_t_2, ((PyObject *)__pyx_kp_s_33)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 866; __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), ((PyObject *)__pyx_n_s__name)); if (!__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 = PyNumber_Add(__pyx_t_1, __pyx_t_2); 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_1); __pyx_t_1 = 0;
      __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 = 866; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      goto __pyx_L4;
    }

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

      /* "pygrib.pyx":868
 *                 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_2 = __pyx_v_self->messagenumber;
      __Pyx_INCREF(__pyx_t_2);
      __pyx_t_4 = PyObject_Repr(__pyx_t_2); 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_2 = PyNumber_Add(__pyx_t_4, ((PyObject *)__pyx_kp_s_33)); 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_4 = PyObject_GetItem(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_n_s__parameterName)); if (!__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_1 = PyNumber_Add(__pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 868; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_5 = __Pyx_PyList_Append(__pyx_v_inventory, __pyx_t_1); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 868; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L4;
    }
    __pyx_L4:;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "pygrib.pyx":869
 *             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_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 = 869; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_35), NULL); 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_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); 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_4); __pyx_t_4 = 0;
  if (__pyx_t_3) {

    /* "pygrib.pyx":870
 *                 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), ((PyObject *)__pyx_n_s__units)); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 870; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = PyObject_RichCompare(__pyx_t_4, ((PyObject *)__pyx_n_s__unknown), Py_NE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_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;
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 870; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (__pyx_t_3) {

      /* "pygrib.pyx":871
 *         if self.valid_key('units'):
 *             if self['units'] != 'unknown':
 *                 inventory.append(':'+self['units'])             # <<<<<<<<<<<<<<
 *             elif self.valid_key('parameterUnits'):
 *                 inventory.append(':'+self['parameterUnits'])
 */
      __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_n_s__units)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 871; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_4 = PyNumber_Add(((PyObject *)__pyx_kp_s_33), __pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 871; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_5 = __Pyx_PyList_Append(__pyx_v_inventory, __pyx_t_4); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 871; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      goto __pyx_L6;
    }

    /* "pygrib.pyx":872
 *             if self['units'] != 'unknown':
 *                 inventory.append(':'+self['units'])
 *             elif self.valid_key('parameterUnits'):             # <<<<<<<<<<<<<<
 *                 inventory.append(':'+self['parameterUnits'])
 *         if self.valid_key('stepType'):
 */
    __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 = 872; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_k_tuple_36), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 872; __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 = 872; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (__pyx_t_3) {

      /* "pygrib.pyx":873
 *                 inventory.append(':'+self['units'])
 *             elif self.valid_key('parameterUnits'):
 *                 inventory.append(':'+self['parameterUnits'])             # <<<<<<<<<<<<<<
 *         if self.valid_key('stepType'):
 *             inventory.append(' ('+self['stepType']+')')
 */
      __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_n_s__parameterUnits)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 873; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_4 = PyNumber_Add(((PyObject *)__pyx_kp_s_33), __pyx_t_1); 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_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 = 873; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      goto __pyx_L6;
    }
    __pyx_L6:;
    goto __pyx_L5;
  }
  __pyx_L5:;

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

    /* "pygrib.pyx":875
 *                 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_1 = PyObject_GetItem(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_n_s__stepType)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 875; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = PyNumber_Add(((PyObject *)__pyx_kp_s_38), __pyx_t_1); 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_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyNumber_Add(__pyx_t_4, ((PyObject *)__pyx_kp_s_39)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 875; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_5 = __Pyx_PyList_Append(__pyx_v_inventory, __pyx_t_1); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 875; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    goto __pyx_L7;
  }
  __pyx_L7:;

  /* "pygrib.pyx":876
 *         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_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 = 876; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_40), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 876; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 876; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (!__pyx_t_3) {
    __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 = 876; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_k_tuple_41), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 876; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 876; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_7 = __pyx_t_6;
  } else {
    __pyx_t_7 = __pyx_t_3;
  }
  if (__pyx_t_7) {

    /* "pygrib.pyx":877
 *             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_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 = 877; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_42), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 877; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 877; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (__pyx_t_7) {

      /* "pygrib.pyx":878
 *         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_4 = PyObject_GetItem(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_n_s__typeOfGrid)); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 878; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_1 = PyNumber_Add(((PyObject *)__pyx_kp_s_33), __pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 878; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_5 = __Pyx_PyList_Append(__pyx_v_inventory, __pyx_t_1); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 878; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L9;
    }
    /*else*/ {

      /* "pygrib.pyx":880
 *                inventory.append(':'+self['typeOfGrid'])
 *             else:
 *                inventory.append(':'+self['gridType'])             # <<<<<<<<<<<<<<
 *         if self.valid_key('typeOfLevel'):
 *             inventory.append(':'+self['typeOfLevel'])
 */
      __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_n_s__gridType)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 880; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_4 = PyNumber_Add(((PyObject *)__pyx_kp_s_33), __pyx_t_1); 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_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 = 880; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
    __pyx_L9:;
    goto __pyx_L8;
  }
  __pyx_L8:;

  /* "pygrib.pyx":881
 *             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_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 = 881; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_1 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_k_tuple_43), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 881; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 881; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_7) {

    /* "pygrib.pyx":882
 *                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_1 = PyObject_GetItem(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_n_s__typeOfLevel)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 882; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = PyNumber_Add(((PyObject *)__pyx_kp_s_33), __pyx_t_1); 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_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 = 882; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L10;
  }
  __pyx_L10:;

  /* "pygrib.pyx":883
 *         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_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 = 883; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_1 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_k_tuple_44), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 883; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 883; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_7) {
    __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 = 883; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_45), 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_1); __pyx_t_1 = 0;
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_3 < 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_6 = __pyx_t_3;
  } else {
    __pyx_t_6 = __pyx_t_7;
  }
  if (__pyx_t_6) {

    /* "pygrib.pyx":884
 *             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":885
 *         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(((PyObject *)__pyx_n_s__unknown));
    __pyx_v_levunits = ((PyObject *)__pyx_n_s__unknown);

    /* "pygrib.pyx":886
 *             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_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 = 886; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_k_tuple_47), NULL); 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_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 886; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (__pyx_t_6) {

      /* "pygrib.pyx":887
 *             levunits = 'unknown'
 *             if self.valid_key('unitsOfFirstFixedSurface'):
 *                 levunits = self['unitsOfFirstFixedSurface']             # <<<<<<<<<<<<<<
 *             if self.valid_key('typeOfFirstFixedSurface') and self['typeOfFirstFixedSurface'] != 255:
 *                 toplev = self['topLevel']
 */
      __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_n_s_46)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 887; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF_SET(__pyx_v_levunits, __pyx_t_1);
      __pyx_t_1 = 0;
      goto __pyx_L12;
    }
    __pyx_L12:;

    /* "pygrib.pyx":888
 *             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_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 = 888; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_49), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 888; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 888; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (__pyx_t_6) {
      __pyx_t_4 = PyObject_GetItem(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_n_s_48)); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 888; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_1 = PyObject_RichCompare(__pyx_t_4, __pyx_int_255, Py_NE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 888; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 888; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_3 = __pyx_t_7;
    } else {
      __pyx_t_3 = __pyx_t_6;
    }
    if (__pyx_t_3) {

      /* "pygrib.pyx":889
 *                 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_1 = PyObject_GetItem(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_n_s__topLevel)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 889; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF_SET(__pyx_v_toplev, __pyx_t_1);
      __pyx_t_1 = 0;

      /* "pygrib.pyx":890
 *             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_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 = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_51), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (__pyx_t_3) {

        /* "pygrib.pyx":891
 *                 toplev = self['topLevel']
 *                 if self.valid_key('scaledValueOfFirstFixedSurface') and\
 *                    self.valid_key('scaleFactorOfFirstFixedSurface'):             # <<<<<<<<<<<<<<
 *                    if self['scaleFactorOfFirstFixedSurface']:
 *                        toplev = self['scaledValueOfFirstFixedSurface']/\
 */
        __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 = 891; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_1 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_k_tuple_53), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 891; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); 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_1); __pyx_t_1 = 0;
        __pyx_t_7 = __pyx_t_6;
      } else {
        __pyx_t_7 = __pyx_t_3;
      }
      if (__pyx_t_7) {

        /* "pygrib.pyx":892
 *                 if self.valid_key('scaledValueOfFirstFixedSurface') and\
 *                    self.valid_key('scaleFactorOfFirstFixedSurface'):
 *                    if self['scaleFactorOfFirstFixedSurface']:             # <<<<<<<<<<<<<<
 *                        toplev = self['scaledValueOfFirstFixedSurface']/\
 *                                 np.power(10.0,self['scaleFactorOfFirstFixedSurface'])
 */
        __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_n_s_52)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 892; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 892; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        if (__pyx_t_7) {

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

          /* "pygrib.pyx":894
 *                    if self['scaleFactorOfFirstFixedSurface']:
 *                        toplev = self['scaledValueOfFirstFixedSurface']/\
 *                                 np.power(10.0,self['scaleFactorOfFirstFixedSurface'])             # <<<<<<<<<<<<<<
 *                    else:
 *                        toplev = self['scaledValueOfFirstFixedSurface']
 */
          __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 894; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_4);
          __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s__power); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 894; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __pyx_t_4 = PyFloat_FromDouble(10.0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 894; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_4);
          __pyx_t_8 = PyObject_GetItem(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_n_s_52)); if (!__pyx_t_8) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 894; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_8);
          __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 894; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_9);
          PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_4);
          __Pyx_GIVEREF(__pyx_t_4);
          PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_8);
          __Pyx_GIVEREF(__pyx_t_8);
          __pyx_t_4 = 0;
          __pyx_t_8 = 0;
          __pyx_t_8 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 894; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_8);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
          __pyx_t_9 = __Pyx_PyNumber_Divide(__pyx_t_1, __pyx_t_8); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 893; __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_8); __pyx_t_8 = 0;
          __Pyx_DECREF_SET(__pyx_v_toplev, __pyx_t_9);
          __pyx_t_9 = 0;
          goto __pyx_L15;
        }
        /*else*/ {

          /* "pygrib.pyx":896
 *                                 np.power(10.0,self['scaleFactorOfFirstFixedSurface'])
 *                    else:
 *                        toplev = self['scaledValueOfFirstFixedSurface']             # <<<<<<<<<<<<<<
 *             if self.valid_key('typeOfSecondFixedSurface') and self['typeOfSecondFixedSurface'] != 255:
 *                 botlev = self['bottomLevel']
 */
          __pyx_t_9 = PyObject_GetItem(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_n_s_50)); if (!__pyx_t_9) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 896; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_DECREF_SET(__pyx_v_toplev, __pyx_t_9);
          __pyx_t_9 = 0;
        }
        __pyx_L15:;
        goto __pyx_L14;
      }
      __pyx_L14:;
      goto __pyx_L13;
    }
    __pyx_L13:;

    /* "pygrib.pyx":897
 *                    else:
 *                        toplev = self['scaledValueOfFirstFixedSurface']
 *             if self.valid_key('typeOfSecondFixedSurface') and self['typeOfSecondFixedSurface'] != 255:             # <<<<<<<<<<<<<<
 *                 botlev = self['bottomLevel']
 *                 if self.valid_key('scaledValueOfSecondFixedSurface') and\
 */
    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__valid_key); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 897; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_8 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_k_tuple_55), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 897; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 897; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    if (__pyx_t_7) {
      __pyx_t_8 = PyObject_GetItem(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_n_s_54)); if (!__pyx_t_8) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 897; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_9 = PyObject_RichCompare(__pyx_t_8, __pyx_int_255, Py_NE); __Pyx_XGOTREF(__pyx_t_9); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 897; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 897; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_6 = __pyx_t_3;
    } else {
      __pyx_t_6 = __pyx_t_7;
    }
    if (__pyx_t_6) {

      /* "pygrib.pyx":898
 *                        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_9 = PyObject_GetItem(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_n_s__bottomLevel)); if (!__pyx_t_9) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 898; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF_SET(__pyx_v_botlev, __pyx_t_9);
      __pyx_t_9 = 0;

      /* "pygrib.pyx":899
 *             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_9 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__valid_key); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 899; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_8 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_k_tuple_57), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 899; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 899; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (__pyx_t_6) {

        /* "pygrib.pyx":900
 *                 botlev = self['bottomLevel']
 *                 if self.valid_key('scaledValueOfSecondFixedSurface') and\
 *                    self.valid_key('scaleFactorOfSecondFixedSurface'):             # <<<<<<<<<<<<<<
 *                    if self['scaleFactorOfSecondFixedSurface']:
 *                        botlev = self['scaledValueOfSecondFixedSurface']/\
 */
        __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 = 900; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_8);
        __pyx_t_9 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_k_tuple_59), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 900; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 900; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __pyx_t_3 = __pyx_t_7;
      } else {
        __pyx_t_3 = __pyx_t_6;
      }
      if (__pyx_t_3) {

        /* "pygrib.pyx":901
 *                 if self.valid_key('scaledValueOfSecondFixedSurface') and\
 *                    self.valid_key('scaleFactorOfSecondFixedSurface'):
 *                    if self['scaleFactorOfSecondFixedSurface']:             # <<<<<<<<<<<<<<
 *                        botlev = self['scaledValueOfSecondFixedSurface']/\
 *                                 np.power(10.0,self['scaleFactorOfSecondFixedSurface'])
 */
        __pyx_t_9 = PyObject_GetItem(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_n_s_58)); if (!__pyx_t_9) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 901; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_9);
        __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 901; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        if (__pyx_t_3) {

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

          /* "pygrib.pyx":903
 *                    if self['scaleFactorOfSecondFixedSurface']:
 *                        botlev = self['scaledValueOfSecondFixedSurface']/\
 *                                 np.power(10.0,self['scaleFactorOfSecondFixedSurface'])             # <<<<<<<<<<<<<<
 *                    else:
 *                        botlev = self['scaledValueOfSecondFixedSurface']
 */
          __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 903; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_8);
          __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s__power); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 903; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
          __pyx_t_8 = PyFloat_FromDouble(10.0); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 903; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_8);
          __pyx_t_2 = PyObject_GetItem(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_n_s_58)); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 903; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 903; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_4);
          PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_8);
          __Pyx_GIVEREF(__pyx_t_8);
          PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2);
          __Pyx_GIVEREF(__pyx_t_2);
          __pyx_t_8 = 0;
          __pyx_t_2 = 0;
          __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 903; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
          __pyx_t_4 = __Pyx_PyNumber_Divide(__pyx_t_9, __pyx_t_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 902; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_DECREF_SET(__pyx_v_botlev, __pyx_t_4);
          __pyx_t_4 = 0;
          goto __pyx_L18;
        }
        /*else*/ {

          /* "pygrib.pyx":905
 *                                 np.power(10.0,self['scaleFactorOfSecondFixedSurface'])
 *                    else:
 *                        botlev = self['scaledValueOfSecondFixedSurface']             # <<<<<<<<<<<<<<
 *             levstring = None
 *             if botlev is None or toplev == botlev:
 */
          __pyx_t_4 = PyObject_GetItem(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_n_s_56)); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 905; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF_SET(__pyx_v_botlev, __pyx_t_4);
          __pyx_t_4 = 0;
        }
        __pyx_L18:;
        goto __pyx_L17;
      }
      __pyx_L17:;
      goto __pyx_L16;
    }
    __pyx_L16:;

    /* "pygrib.pyx":906
 *                    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":907
 *                        botlev = self['scaledValueOfSecondFixedSurface']
 *             levstring = None
 *             if botlev is None or toplev == botlev:             # <<<<<<<<<<<<<<
 *                 levstring = ':level %s' % toplev
 *             else:
 */
    __pyx_t_3 = (__pyx_v_botlev == Py_None);
    if (!__pyx_t_3) {
      __pyx_t_4 = PyObject_RichCompare(__pyx_v_toplev, __pyx_v_botlev, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 907; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 907; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_7 = __pyx_t_6;
    } else {
      __pyx_t_7 = __pyx_t_3;
    }
    if (__pyx_t_7) {

      /* "pygrib.pyx":908
 *             levstring = None
 *             if botlev is None or toplev == botlev:
 *                 levstring = ':level %s' % toplev             # <<<<<<<<<<<<<<
 *             else:
 *                 levstring = ':levels %s-%s' % (toplev,botlev)
 */
      __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_60), __pyx_v_toplev); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 908; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_4));
      __Pyx_DECREF_SET(__pyx_v_levstring, ((PyObject *)__pyx_t_4));
      __pyx_t_4 = 0;
      goto __pyx_L19;
    }
    /*else*/ {

      /* "pygrib.pyx":910
 *                 levstring = ':level %s' % toplev
 *             else:
 *                 levstring = ':levels %s-%s' % (toplev,botlev)             # <<<<<<<<<<<<<<
 *             if levunits != 'unknown':
 *                 levstring = levstring+' %s' % levunits
 */
      __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 910; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_v_toplev);
      PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_toplev);
      __Pyx_GIVEREF(__pyx_v_toplev);
      __Pyx_INCREF(__pyx_v_botlev);
      PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_botlev);
      __Pyx_GIVEREF(__pyx_v_botlev);
      __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_61), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 910; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_2));
      __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
      __Pyx_DECREF_SET(__pyx_v_levstring, ((PyObject *)__pyx_t_2));
      __pyx_t_2 = 0;
    }
    __pyx_L19:;

    /* "pygrib.pyx":911
 *             else:
 *                 levstring = ':levels %s-%s' % (toplev,botlev)
 *             if levunits != 'unknown':             # <<<<<<<<<<<<<<
 *                 levstring = levstring+' %s' % levunits
 *             if levstring is not None:
 */
    __pyx_t_2 = PyObject_RichCompare(__pyx_v_levunits, ((PyObject *)__pyx_n_s__unknown), Py_NE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 911; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 911; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__pyx_t_7) {

      /* "pygrib.pyx":912
 *                 levstring = ':levels %s-%s' % (toplev,botlev)
 *             if levunits != 'unknown':
 *                 levstring = levstring+' %s' % levunits             # <<<<<<<<<<<<<<
 *             if levstring is not None:
 *                 inventory.append(levstring)
 */
      __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_62), __pyx_v_levunits); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 912; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_2));
      __pyx_t_4 = PyNumber_Add(__pyx_v_levstring, ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 912; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
      __Pyx_DECREF_SET(__pyx_v_levstring, __pyx_t_4);
      __pyx_t_4 = 0;
      goto __pyx_L20;
    }
    __pyx_L20:;

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

      /* "pygrib.pyx":914
 *                 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 = 914; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L21;
    }
    __pyx_L21:;
    goto __pyx_L11;
  }

  /* "pygrib.pyx":915
 *             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_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 = 915; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_2 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_k_tuple_63), NULL); 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_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 = 915; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_3) {

    /* "pygrib.pyx":916
 *                 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), ((PyObject *)__pyx_n_s__level)); if (!__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_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_60), __pyx_t_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 916; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_5 = __Pyx_PyList_Append(__pyx_v_inventory, ((PyObject *)__pyx_t_4)); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 916; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
    goto __pyx_L11;
  }
  __pyx_L11:;

  /* "pygrib.pyx":917
 *         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_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__has_key); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 917; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_2 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_k_tuple_64), NULL); 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_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 = 917; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_3) {

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

    /* "pygrib.pyx":919
 *         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 = 919; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_65), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 919; __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 = 919; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (__pyx_t_3) {
      __pyx_t_4 = PyObject_GetItem(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_n_s__stepType)); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 919; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_2 = PyObject_RichCompare(__pyx_t_4, ((PyObject *)__pyx_n_s__instant), Py_NE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 919; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_7 < 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;
      __pyx_t_6 = __pyx_t_7;
    } else {
      __pyx_t_6 = __pyx_t_3;
    }
    if (__pyx_t_6) {

      /* "pygrib.pyx":921
 *             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_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__stepType); 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_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 921; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_v_ftime);
      PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_ftime);
      __Pyx_GIVEREF(__pyx_v_ftime);
      __Pyx_INCREF(__pyx_v_self->fcstimeunits);
      PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_self->fcstimeunits);
      __Pyx_GIVEREF(__pyx_v_self->fcstimeunits);
      PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_2);
      __pyx_t_2 = 0;
      __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_66), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 920; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_2));
      __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
      __pyx_t_5 = __Pyx_PyList_Append(__pyx_v_inventory, ((PyObject *)__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(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
      goto __pyx_L23;
    }
    /*else*/ {

      /* "pygrib.pyx":923
 *                     (ftime,self.fcstimeunits,self.stepType))
 *             else:
 *                 inventory.append(':fcst time %s %s'% (ftime,self.fcstimeunits))             # <<<<<<<<<<<<<<
 *         elif self.valid_key('forecastTime'):
 *             ftime = repr(self['forecastTime'])
 */
      __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 923; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_INCREF(__pyx_v_ftime);
      PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_ftime);
      __Pyx_GIVEREF(__pyx_v_ftime);
      __Pyx_INCREF(__pyx_v_self->fcstimeunits);
      PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_self->fcstimeunits);
      __Pyx_GIVEREF(__pyx_v_self->fcstimeunits);
      __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_67), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 923; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_4));
      __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
      __pyx_t_5 = __Pyx_PyList_Append(__pyx_v_inventory, ((PyObject *)__pyx_t_4)); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 923; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
    }
    __pyx_L23:;
    goto __pyx_L22;
  }

  /* "pygrib.pyx":924
 *             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_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 = 924; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_2 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_k_tuple_68), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 924; __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 = 924; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_6) {

    /* "pygrib.pyx":925
 *                 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_2 = PyObject_GetItem(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_n_s__forecastTime)); if (!__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_4 = PyObject_Repr(__pyx_t_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 925; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_ftime = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "pygrib.pyx":926
 *         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_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 926; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_v_ftime);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_ftime);
    __Pyx_GIVEREF(__pyx_v_ftime);
    __Pyx_INCREF(__pyx_v_self->fcstimeunits);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_self->fcstimeunits);
    __Pyx_GIVEREF(__pyx_v_self->fcstimeunits);
    __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_67), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 926; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
    __pyx_t_5 = __Pyx_PyList_Append(__pyx_v_inventory, ((PyObject *)__pyx_t_2)); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 926; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
    goto __pyx_L22;
  }
  __pyx_L22:;

  /* "pygrib.pyx":927
 *             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_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 = 927; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_69), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 927; __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 = 927; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__pyx_t_6) {
    __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 = 927; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_2 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_k_tuple_70), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 927; __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 = 927; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_7 = __pyx_t_3;
  } else {
    __pyx_t_7 = __pyx_t_6;
  }
  if (__pyx_t_7) {

    /* "pygrib.pyx":929
 *         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_2 = PyObject_GetItem(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_n_s__dataDate)); if (!__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_4 = PyObject_Repr(__pyx_t_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 929; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyNumber_Add(((PyObject *)__pyx_kp_s_71), __pyx_t_4); 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_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyObject_GetItem(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_n_s__dataTime)); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 929; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_9 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_72), __pyx_t_4); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 929; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_9));
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyNumber_Add(__pyx_t_2, ((PyObject *)__pyx_t_9)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 929; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 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 = 928; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L24;
  }
  __pyx_L24:;

  /* "pygrib.pyx":933
 *         #    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_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 = 933; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_9 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_k_tuple_73), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 933; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 933; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  if (__pyx_t_7) {

    /* "pygrib.pyx":934
 *         #    ':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_9 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__valid_key); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 934; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_4 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_k_tuple_75), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 934; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 934; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_3 = __pyx_t_6;
  } else {
    __pyx_t_3 = __pyx_t_7;
  }
  if (__pyx_t_3) {

    /* "pygrib.pyx":935
 *         if self.valid_key('perturbationNumber') and\
 *            self.valid_key('typeOfEnsembleForecast'):
 *             ens_type = self['typeOfEnsembleForecast']             # <<<<<<<<<<<<<<
 *             pert_num = self['perturbationNumber']
 *             if ens_type == 0:
 */
    __pyx_t_4 = PyObject_GetItem(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_n_s_74)); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 935; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_v_ens_type = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "pygrib.pyx":936
 *            self.valid_key('typeOfEnsembleForecast'):
 *             ens_type = self['typeOfEnsembleForecast']
 *             pert_num = self['perturbationNumber']             # <<<<<<<<<<<<<<
 *             if ens_type == 0:
 *                inventory.append(":lo res cntl fcst")
 */
    __pyx_t_4 = PyObject_GetItem(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_n_s__perturbationNumber)); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 936; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_v_pert_num = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "pygrib.pyx":937
 *             ens_type = self['typeOfEnsembleForecast']
 *             pert_num = self['perturbationNumber']
 *             if ens_type == 0:             # <<<<<<<<<<<<<<
 *                inventory.append(":lo res cntl fcst")
 *             elif ens_type == 1:
 */
    __pyx_t_4 = PyObject_RichCompare(__pyx_v_ens_type, __pyx_int_0, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 937; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 937; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (__pyx_t_3) {

      /* "pygrib.pyx":938
 *             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, ((PyObject *)__pyx_kp_s_76)); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 938; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L26;
    }

    /* "pygrib.pyx":939
 *             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_4 = PyObject_RichCompare(__pyx_v_ens_type, __pyx_int_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 939; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 939; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (__pyx_t_3) {

      /* "pygrib.pyx":940
 *                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, ((PyObject *)__pyx_kp_s_77)); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 940; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L26;
    }

    /* "pygrib.pyx":941
 *             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_4 = PyObject_RichCompare(__pyx_v_ens_type, __pyx_int_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 941; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 941; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (__pyx_t_3) {

      /* "pygrib.pyx":942
 *                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_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_78), __pyx_v_pert_num); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 942; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_4));
      __pyx_t_5 = __Pyx_PyList_Append(__pyx_v_inventory, ((PyObject *)__pyx_t_4)); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 942; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
      goto __pyx_L26;
    }

    /* "pygrib.pyx":943
 *             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_4 = PyObject_RichCompare(__pyx_v_ens_type, __pyx_int_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 943; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 943; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (__pyx_t_3) {

      /* "pygrib.pyx":944
 *                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_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_79), __pyx_v_pert_num); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 944; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_4));
      __pyx_t_5 = __Pyx_PyList_Append(__pyx_v_inventory, ((PyObject *)__pyx_t_4)); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 944; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
      goto __pyx_L26;
    }
    __pyx_L26:;
    goto __pyx_L25;
  }
  __pyx_L25:;

  /* "pygrib.pyx":945
 *             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_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 = 945; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_9 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_k_tuple_80), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 945; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 945; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  if (__pyx_t_3) {

    /* "pygrib.pyx":946
 *                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_9 = PyObject_GetItem(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_n_s__derivedForecast)); if (!__pyx_t_9) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 946; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_4 = PyObject_RichCompare(__pyx_t_9, __pyx_int_0, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 946; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 946; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (__pyx_t_3) {

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

    /* "pygrib.pyx":948
 *             if self['derivedForecast'] == 0:
 *                 inventory.append(":ens mean")
 *             elif self['derivedForecast'] == 1:             # <<<<<<<<<<<<<<
 *                 inventory.append(":weighted ens mean")
 *             elif self['derivedForecast'] == 2:
 */
    __pyx_t_4 = PyObject_GetItem(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_n_s__derivedForecast)); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 948; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_9 = PyObject_RichCompare(__pyx_t_4, __pyx_int_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_9); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 948; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 948; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    if (__pyx_t_3) {

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

    /* "pygrib.pyx":950
 *             elif self['derivedForecast'] == 1:
 *                 inventory.append(":weighted ens mean")
 *             elif self['derivedForecast'] == 2:             # <<<<<<<<<<<<<<
 *                 inventory.append(":ens std dev")
 *             elif self['derivedForecast'] == 3:
 */
    __pyx_t_9 = PyObject_GetItem(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_n_s__derivedForecast)); if (!__pyx_t_9) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 950; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_4 = PyObject_RichCompare(__pyx_t_9, __pyx_int_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 950; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 950; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (__pyx_t_3) {

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

    /* "pygrib.pyx":952
 *             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_4 = PyObject_GetItem(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_n_s__derivedForecast)); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 952; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_9 = PyObject_RichCompare(__pyx_t_4, __pyx_int_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_9); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 952; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 952; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    if (__pyx_t_3) {

      /* "pygrib.pyx":953
 *                 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, ((PyObject *)__pyx_kp_s_84)); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 953; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L28;
    }

    /* "pygrib.pyx":954
 *             elif self['derivedForecast'] == 3:
 *                 inventory.append(":normalized ens std dev")
 *             elif self['derivedForecast'] == 4:             # <<<<<<<<<<<<<<
 *                 inventory.append(":ens spread")
 *             elif self['derivedForecast'] == 5:
 */
    __pyx_t_9 = PyObject_GetItem(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_n_s__derivedForecast)); if (!__pyx_t_9) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 954; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_4 = PyObject_RichCompare(__pyx_t_9, __pyx_int_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 954; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 954; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (__pyx_t_3) {

      /* "pygrib.pyx":955
 *                 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, ((PyObject *)__pyx_kp_s_85)); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 955; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L28;
    }

    /* "pygrib.pyx":956
 *             elif self['derivedForecast'] == 4:
 *                 inventory.append(":ens spread")
 *             elif self['derivedForecast'] == 5:             # <<<<<<<<<<<<<<
 *                 inventory.append(":ens large anomaly index")
 *             elif self['derivedForecast'] == 6:
 */
    __pyx_t_4 = PyObject_GetItem(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_n_s__derivedForecast)); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 956; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_9 = PyObject_RichCompare(__pyx_t_4, __pyx_int_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_9); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 956; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_9); 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_9); __pyx_t_9 = 0;
    if (__pyx_t_3) {

      /* "pygrib.pyx":957
 *                 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, ((PyObject *)__pyx_kp_s_86)); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 957; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L28;
    }

    /* "pygrib.pyx":958
 *             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_9 = PyObject_GetItem(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_n_s__derivedForecast)); if (!__pyx_t_9) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 958; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_4 = PyObject_RichCompare(__pyx_t_9, __pyx_int_6, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 958; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); 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_4); __pyx_t_4 = 0;
    if (__pyx_t_3) {

      /* "pygrib.pyx":959
 *                 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, ((PyObject *)__pyx_kp_s_87)); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 959; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L28;
    }
    __pyx_L28:;
    goto __pyx_L27;
  }
  __pyx_L27:;

  /* "pygrib.pyx":960
 *             elif self['derivedForecast'] == 6:
 *                 inventory.append(":ens mean of cluster")
 *         if self.valid_key('probabilityTypeName'):             # <<<<<<<<<<<<<<
 *             inventory.append(":"+self['probabilityTypeName'])
 *             lowerlim = None
 */
  __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 = 960; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_9 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_k_tuple_88), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 960; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 960; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  if (__pyx_t_3) {

    /* "pygrib.pyx":961
 *                 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_9 = PyObject_GetItem(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_n_s__probabilityTypeName)); if (!__pyx_t_9) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 961; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_4 = PyNumber_Add(((PyObject *)__pyx_kp_s_33), __pyx_t_9); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 961; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 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 = 961; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "pygrib.pyx":962
 *         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":963
 *             inventory.append(":"+self['probabilityTypeName'])
 *             lowerlim = None
 *             if self.valid_key('scaledValueOfLowerLimit') and\             # <<<<<<<<<<<<<<
 *                self.valid_key('scaleFactorOfLowerLimit'):
 *                if self['scaledValueOfLowerLimit'] 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 = 963; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_9 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_k_tuple_90), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 963; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_9); 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_9); __pyx_t_9 = 0;
    if (__pyx_t_3) {

      /* "pygrib.pyx":964
 *             lowerlim = None
 *             if self.valid_key('scaledValueOfLowerLimit') and\
 *                self.valid_key('scaleFactorOfLowerLimit'):             # <<<<<<<<<<<<<<
 *                if self['scaledValueOfLowerLimit'] and\
 *                   self['scaleFactorOfLowerLimit']:
 */
      __pyx_t_9 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__valid_key); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 964; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_4 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_k_tuple_92), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 964; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 964; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_6 = __pyx_t_7;
    } else {
      __pyx_t_6 = __pyx_t_3;
    }
    if (__pyx_t_6) {

      /* "pygrib.pyx":965
 *             if self.valid_key('scaledValueOfLowerLimit') and\
 *                self.valid_key('scaleFactorOfLowerLimit'):
 *                if self['scaledValueOfLowerLimit'] and\             # <<<<<<<<<<<<<<
 *                   self['scaleFactorOfLowerLimit']:
 *                    lowerlim = self['scaledValueOfLowerLimit']/\
 */
      __pyx_t_4 = PyObject_GetItem(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_n_s_89)); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 965; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 965; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (__pyx_t_6) {

        /* "pygrib.pyx":966
 *                self.valid_key('scaleFactorOfLowerLimit'):
 *                if self['scaledValueOfLowerLimit'] and\
 *                   self['scaleFactorOfLowerLimit']:             # <<<<<<<<<<<<<<
 *                    lowerlim = self['scaledValueOfLowerLimit']/\
 *                               np.power(10.0,self['scaleFactorOfLowerLimit'])
 */
        __pyx_t_4 = PyObject_GetItem(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_n_s_91)); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 966; __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 = 966; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __pyx_t_7 = __pyx_t_3;
      } else {
        __pyx_t_7 = __pyx_t_6;
      }
      if (__pyx_t_7) {

        /* "pygrib.pyx":967
 *                if self['scaledValueOfLowerLimit'] and\
 *                   self['scaleFactorOfLowerLimit']:
 *                    lowerlim = self['scaledValueOfLowerLimit']/\             # <<<<<<<<<<<<<<
 *                               np.power(10.0,self['scaleFactorOfLowerLimit'])
 *             upperlim = None
 */
        __pyx_t_4 = PyObject_GetItem(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_n_s_89)); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 967; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_4);

        /* "pygrib.pyx":968
 *                   self['scaleFactorOfLowerLimit']:
 *                    lowerlim = self['scaledValueOfLowerLimit']/\
 *                               np.power(10.0,self['scaleFactorOfLowerLimit'])             # <<<<<<<<<<<<<<
 *             upperlim = None
 *             if self.valid_key('scaledValueOfUpperLimit') and\
 */
        __pyx_t_9 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 968; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_9);
        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s__power); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 968; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __pyx_t_9 = PyFloat_FromDouble(10.0); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 968; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_9);
        __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_n_s_91)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 968; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 968; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_8);
        PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_9);
        __Pyx_GIVEREF(__pyx_t_9);
        PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_1);
        __Pyx_GIVEREF(__pyx_t_1);
        __pyx_t_9 = 0;
        __pyx_t_1 = 0;
        __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 968; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
        __pyx_t_8 = __Pyx_PyNumber_Divide(__pyx_t_4, __pyx_t_1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 967; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF_SET(__pyx_v_lowerlim, __pyx_t_8);
        __pyx_t_8 = 0;
        goto __pyx_L31;
      }
      __pyx_L31:;
      goto __pyx_L30;
    }
    __pyx_L30:;

    /* "pygrib.pyx":969
 *                    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":970
 *                               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 = 970; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_1 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_k_tuple_94), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 970; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 970; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (__pyx_t_7) {

      /* "pygrib.pyx":971
 *             upperlim = None
 *             if self.valid_key('scaledValueOfUpperLimit') and\
 *                self.valid_key('scaleFactorOfUpperLimit'):             # <<<<<<<<<<<<<<
 *                if self['scaledValueOfUpperLimit'] and\
 *                   self['scaleFactorOfUpperLimit']:
 */
      __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 = 971; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_8 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_96), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 971; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 971; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_3 = __pyx_t_6;
    } else {
      __pyx_t_3 = __pyx_t_7;
    }
    if (__pyx_t_3) {

      /* "pygrib.pyx":972
 *             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), ((PyObject *)__pyx_n_s_93)); if (!__pyx_t_8) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 972; __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 = 972; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (__pyx_t_3) {

        /* "pygrib.pyx":973
 *                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), ((PyObject *)__pyx_n_s_95)); if (!__pyx_t_8) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 973; __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 = 973; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __pyx_t_6 = __pyx_t_7;
      } else {
        __pyx_t_6 = __pyx_t_3;
      }
      if (__pyx_t_6) {

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

        /* "pygrib.pyx":975
 *                   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_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 975; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__power); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 975; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_1 = PyFloat_FromDouble(10.0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 975; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_2 = PyObject_GetItem(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_n_s_95)); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 975; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 975; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_9);
        PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_1);
        __Pyx_GIVEREF(__pyx_t_1);
        PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_2);
        __Pyx_GIVEREF(__pyx_t_2);
        __pyx_t_1 = 0;
        __pyx_t_2 = 0;
        __pyx_t_2 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 975; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
        __pyx_t_9 = __Pyx_PyNumber_Divide(__pyx_t_8, __pyx_t_2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 974; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF_SET(__pyx_v_upperlim, __pyx_t_9);
        __pyx_t_9 = 0;
        goto __pyx_L33;
      }
      __pyx_L33:;
      goto __pyx_L32;
    }
    __pyx_L32:;

    /* "pygrib.pyx":976
 *                    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_6 = (__pyx_v_upperlim != Py_None);
    if ((__pyx_t_6 != 0)) {
      __pyx_t_3 = (__pyx_v_lowerlim != Py_None);
      __pyx_t_7 = (__pyx_t_3 != 0);
    } else {
      __pyx_t_7 = (__pyx_t_6 != 0);
    }
    if (__pyx_t_7) {

      /* "pygrib.pyx":977
 *                               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_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 977; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_INCREF(__pyx_v_upperlim);
      PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_v_upperlim);
      __Pyx_GIVEREF(__pyx_v_upperlim);
      __Pyx_INCREF(__pyx_v_lowerlim);
      PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_v_lowerlim);
      __Pyx_GIVEREF(__pyx_v_lowerlim);
      __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_97), ((PyObject *)__pyx_t_9)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 977; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_2));
      __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
      __pyx_t_5 = __Pyx_PyList_Append(__pyx_v_inventory, ((PyObject *)__pyx_t_2)); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 977; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
      goto __pyx_L34;
    }

    /* "pygrib.pyx":978
 *             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_7 = (__pyx_v_upperlim != Py_None);
    __pyx_t_6 = (__pyx_t_7 != 0);
    if (__pyx_t_6) {

      /* "pygrib.pyx":979
 *                 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_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_98), __pyx_v_upperlim); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 979; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_2));
      __pyx_t_5 = __Pyx_PyList_Append(__pyx_v_inventory, ((PyObject *)__pyx_t_2)); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 979; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
      goto __pyx_L34;
    }

    /* "pygrib.pyx":980
 *             elif upperlim is not None:
 *                 inventory.append(" (> %s)" % upperlim)
 *             elif lowerlim is not None:             # <<<<<<<<<<<<<<
 *                 inventory.append(" (< %s)" % lowerlim)
 *         return ''.join(inventory)
 */
    __pyx_t_6 = (__pyx_v_lowerlim != Py_None);
    __pyx_t_7 = (__pyx_t_6 != 0);
    if (__pyx_t_7) {

      /* "pygrib.pyx":981
 *                 inventory.append(" (> %s)" % upperlim)
 *             elif lowerlim is not None:
 *                 inventory.append(" (< %s)" % lowerlim)             # <<<<<<<<<<<<<<
 *         return ''.join(inventory)
 * 
 */
      __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_99), __pyx_v_lowerlim); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 981; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_2));
      __pyx_t_5 = __Pyx_PyList_Append(__pyx_v_inventory, ((PyObject *)__pyx_t_2)); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 981; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
      goto __pyx_L34;
    }
    __pyx_L34:;
    goto __pyx_L29;
  }
  __pyx_L29:;

  /* "pygrib.pyx":982
 *             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_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_kp_s_19), __pyx_n_s__join); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 982; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 982; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_INCREF(((PyObject *)__pyx_v_inventory));
  PyTuple_SET_ITEM(__pyx_t_9, 0, ((PyObject *)__pyx_v_inventory));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_inventory));
  __pyx_t_8 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 982; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
  __pyx_r = __pyx_t_8;
  __pyx_t_8 = 0;
  goto __pyx_L0;

  __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_4);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __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;
}

/* 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};

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

  /* "pygrib.pyx":986
 *     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_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 = 986; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 986; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_key);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_key);
  __Pyx_GIVEREF(__pyx_v_key);
  __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 986; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__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 = 986; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__pyx_t_4) {

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

    /* "pygrib.pyx":989
 *             return self[key]
 *         else:
 *             return default             # <<<<<<<<<<<<<<
 * 
 *     def expand_grid(self,expand_reduced):
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_default);
    __pyx_r = __pyx_v_default;
    goto __pyx_L0;
  }
  __pyx_L3:;

  __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.gribmessage._get_key", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* 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));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pygrib.pyx":991
 *             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
 */

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":993
 *     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;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* 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 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));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pygrib.pyx":995
 *         self.expand_reduced = expand_reduced
 * 
 *     def is_missing(self,key):             # <<<<<<<<<<<<<<
 *         """
 *         is_missing(key)
 */

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;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("is_missing", 0);

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

  /* "pygrib.pyx":1004
 *         cdef char *name
 *         bytestr = _strencode(key)
 *         name = bytestr             # <<<<<<<<<<<<<<
 *         miss = grib_is_missing(self._gh, name, &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 = 1004; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_name = __pyx_t_2;

  /* "pygrib.pyx":1005
 *         bytestr = _strencode(key)
 *         name = bytestr
 *         miss = grib_is_missing(self._gh, name, &err)             # <<<<<<<<<<<<<<
 *         if err:
 *             raise RuntimeError(grib_get_error_message(err))
 */
  __pyx_v_miss = grib_is_missing(__pyx_v_self->_gh, __pyx_v_name, (&__pyx_v_err));

  /* "pygrib.pyx":1006
 *         name = bytestr
 *         miss = grib_is_missing(self._gh, name, &err)
 *         if err:             # <<<<<<<<<<<<<<
 *             raise RuntimeError(grib_get_error_message(err))
 *         if miss:
 */
  __pyx_t_3 = (__pyx_v_err != 0);
  if (__pyx_t_3) {

    /* "pygrib.pyx":1007
 *         miss = grib_is_missing(self._gh, name, &err)
 *         if err:
 *             raise RuntimeError(grib_get_error_message(err))             # <<<<<<<<<<<<<<
 *         if miss:
 *             return True
 */
    __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 = 1007; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1007; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_1));
    __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
    __pyx_t_1 = 0;
    __pyx_t_1 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1007; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(((PyObject *)__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 = 1007; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "pygrib.pyx":1008
 *         if err:
 *             raise RuntimeError(grib_get_error_message(err))
 *         if miss:             # <<<<<<<<<<<<<<
 *             return True
 *         else:
 */
  __pyx_t_3 = (__pyx_v_miss != 0);
  if (__pyx_t_3) {

    /* "pygrib.pyx":1009
 *             raise RuntimeError(grib_get_error_message(err))
 *         if miss:
 *             return True             # <<<<<<<<<<<<<<
 *         else:
 *             return False
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1009; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;
    goto __pyx_L4;
  }
  /*else*/ {

    /* "pygrib.pyx":1011
 *             return True
 *         else:
 *             return False             # <<<<<<<<<<<<<<
 *     def keys(self):
 *         """
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1011; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;
  }
  __pyx_L4:;

  __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.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;
}

/* 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));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pygrib.pyx":1012
 *         else:
 *             return False
 *     def keys(self):             # <<<<<<<<<<<<<<
 *         """
 *         keys()
 */

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;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("keys", 0);

  /* "pygrib.pyx":1022
 *         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;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "pygrib.pyx":1025
 *         # if not, get keys from grib file.
 *         gi = grib_keys_iterator_new(self._gh,\
 *                 GRIB_KEYS_ITERATOR_ALL_KEYS, NULL)             # <<<<<<<<<<<<<<
 *         keys = []
 *         while grib_keys_iterator_next(gi):
 */
  __pyx_v_gi = grib_keys_iterator_new(__pyx_v_self->_gh, GRIB_KEYS_ITERATOR_ALL_KEYS, NULL);

  /* "pygrib.pyx":1026
 *         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 = 1026; __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":1027
 *                 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":1028
 *         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":1029
 *         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 = ((PyObject *)__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 = 1029; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
    __Pyx_XDECREF_SET(__pyx_v_key, ((PyObject *)__pyx_t_3));
    __pyx_t_3 = 0;

    /* "pygrib.pyx":1031
 *             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_4 = PyObject_RichCompare(__pyx_t_3, ((PyObject *)__pyx_n_s__zero), Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1031; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1031; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (!((int)__pyx_t_2)) {
      __pyx_t_4 = PyObject_RichCompare(__pyx_t_3, ((PyObject *)__pyx_n_s__one), Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1031; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1031; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_5 = ((int)__pyx_t_1);
    } else {
      __pyx_t_5 = ((int)__pyx_t_2);
    }
    if (!__pyx_t_5) {
      __pyx_t_4 = PyObject_RichCompare(__pyx_t_3, ((PyObject *)__pyx_n_s__eight), Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1031; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1031; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_1 = ((int)__pyx_t_2);
    } else {
      __pyx_t_1 = __pyx_t_5;
    }
    if (!__pyx_t_1) {
      __pyx_t_4 = PyObject_RichCompare(__pyx_t_3, ((PyObject *)__pyx_n_s__eleven), Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1031; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1031; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_2 = ((int)__pyx_t_5);
    } else {
      __pyx_t_2 = __pyx_t_1;
    }
    if (!__pyx_t_2) {
      __pyx_t_4 = PyObject_RichCompare(__pyx_t_3, ((PyObject *)__pyx_n_s__false), Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1031; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1031; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_5 = ((int)__pyx_t_1);
    } else {
      __pyx_t_5 = __pyx_t_2;
    }
    if (!__pyx_t_5) {
      __pyx_t_4 = PyObject_RichCompare(__pyx_t_3, ((PyObject *)__pyx_n_s__thousand), Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1031; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1031; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_1 = ((int)__pyx_t_2);
    } else {
      __pyx_t_1 = __pyx_t_5;
    }
    if (!__pyx_t_1) {
      __pyx_t_4 = PyObject_RichCompare(__pyx_t_3, ((PyObject *)__pyx_n_s__file), Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1031; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1031; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_2 = ((int)__pyx_t_5);
    } else {
      __pyx_t_2 = __pyx_t_1;
    }
    if (!__pyx_t_2) {
      __pyx_t_4 = PyObject_RichCompare(__pyx_t_3, ((PyObject *)__pyx_n_s__localDir), Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1031; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1031; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_5 = ((int)__pyx_t_1);
    } else {
      __pyx_t_5 = __pyx_t_2;
    }
    if (!__pyx_t_5) {
      __pyx_t_4 = PyObject_RichCompare(__pyx_t_3, ((PyObject *)__pyx_kp_s__7777), Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1031; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1031; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_1 = ((int)__pyx_t_2);
    } else {
      __pyx_t_1 = __pyx_t_5;
    }
    if (!__pyx_t_1) {
      __pyx_t_4 = PyObject_RichCompare(__pyx_t_3, ((PyObject *)__pyx_n_s__oneThousand), Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1031; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1031; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_2 = ((int)__pyx_t_5);
    } else {
      __pyx_t_2 = __pyx_t_1;
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_1 = (__pyx_t_2 != 0);
    if (__pyx_t_1) {

      /* "pygrib.pyx":1033
 *             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;
      goto __pyx_L6;
    }
    __pyx_L6:;

    /* "pygrib.pyx":1034
 *                        "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":1035
 *                 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":1036
 *             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;
      goto __pyx_L7;
    }
    __pyx_L7:;

    /* "pygrib.pyx":1038
 *                 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":1039
 *             # 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":1038
 *                 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":1040
 *             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_6 = __Pyx_PyList_Append(__pyx_v_keys, __pyx_v_key); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1040; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L8;
    }
    __pyx_L8:;
    __pyx_L4_continue:;
  }

  /* "pygrib.pyx":1041
 *             [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":1042
 *                 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":1043
 *         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 = 1043; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1043; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_3));
    __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
    __pyx_t_3 = 0;
    __pyx_t_3 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1043; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(((PyObject *)__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 = 1043; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L9;
  }
  __pyx_L9:;

  /* "pygrib.pyx":1045
 *             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), ((PyObject *)__pyx_n_s__analDate)); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1045; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {
    __pyx_t_6 = __Pyx_PyList_Append(__pyx_v_keys, ((PyObject *)__pyx_n_s__analDate)); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1045; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L10;
  }
  __pyx_L10:;

  /* "pygrib.pyx":1046
 *         # 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), ((PyObject *)__pyx_n_s__validDate)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1046; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {
    __pyx_t_6 = __Pyx_PyList_Append(__pyx_v_keys, ((PyObject *)__pyx_n_s__validDate)); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1046; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L11;
  }
  __pyx_L11:;

  /* "pygrib.pyx":1047
 *         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(((PyObject *)__pyx_v_keys));
  __pyx_r = ((PyObject *)__pyx_v_keys);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __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;
}

/* 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));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pygrib.pyx":1048
 *         if hasattr(self,'validDate'): keys.append('validDate')
 *         return keys
 *     def _read_only_keys(self):             # <<<<<<<<<<<<<<
 *         """
 *         _read_only_keys()
 */

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;
  int __pyx_t_5;
  Py_ssize_t __pyx_t_6;
  PyObject *(*__pyx_t_7)(PyObject *);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_read_only_keys", 0);

  /* "pygrib.pyx":1057
 *         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":1058
 *         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_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__keys); 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 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); 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_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GIVEREF(__pyx_t_4);
    __Pyx_GOTREF(__pyx_v_self->_all_keys);
    __Pyx_DECREF(__pyx_v_self->_all_keys);
    __pyx_v_self->_all_keys = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "pygrib.pyx":1060
 *             self._all_keys = self.keys()
 *         gi = grib_keys_iterator_new(self._gh,\
 *                 GRIB_KEYS_ITERATOR_SKIP_READ_ONLY, NULL)             # <<<<<<<<<<<<<<
 *         keys_noro = []
 *         while grib_keys_iterator_next(gi):
 */
  __pyx_v_gi = grib_keys_iterator_new(__pyx_v_self->_gh, GRIB_KEYS_ITERATOR_SKIP_READ_ONLY, NULL);

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

  /* "pygrib.pyx":1062
 *                 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":1063
 *         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":1064
 *         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_4 = ((PyObject *)__Pyx_decode_c_string(__pyx_v_name, 0, strlen(__pyx_v_name), NULL, NULL, PyUnicode_DecodeASCII)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1064; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
    __Pyx_XDECREF_SET(__pyx_v_key, ((PyObject *)__pyx_t_4));
    __pyx_t_4 = 0;

    /* "pygrib.pyx":1065
 *             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_5 = __Pyx_PyList_Append(__pyx_v_keys_noro, __pyx_v_key); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1065; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "pygrib.pyx":1066
 *             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":1067
 *             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":1068
 *         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_4 = __Pyx_PyBytes_FromString(grib_get_error_message(__pyx_v_err)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1068; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1068; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_4));
    __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
    __pyx_t_4 = 0;
    __pyx_t_4 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1068; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(((PyObject *)__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 = 1068; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "pygrib.pyx":1069
 *         if err:
 *             raise RuntimeError(grib_get_error_message(err))
 *         keys_ro = []             # <<<<<<<<<<<<<<
 *         for key in self._all_keys:
 *             if key not in keys_noro:
 */
  __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1069; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_v_keys_ro = ((PyObject*)__pyx_t_4);
  __pyx_t_4 = 0;

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

    /* "pygrib.pyx":1071
 *         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_Contains(__pyx_v_key, ((PyObject *)__pyx_v_keys_noro), Py_NE)); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1071; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_1 = (__pyx_t_2 != 0);
    if (__pyx_t_1) {

      /* "pygrib.pyx":1072
 *         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_5 = __Pyx_PyList_Append(__pyx_v_keys_ro, __pyx_v_key); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1072; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L9;
    }
    __pyx_L9:;
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pygrib.pyx":1073
 *             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(((PyObject *)__pyx_v_keys_ro));
  __pyx_r = ((PyObject *)__pyx_v_keys_ro);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __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;
}

/* 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};

    /* "pygrib.pyx":1074
 *                 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)
 */
    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 = 1074; __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 = 1074; __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);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pygrib_11gribmessage_20data(struct __pyx_obj_6pygrib_gribmessage *__pyx_v_self, PyObject *__pyx_v_lat1, PyObject *__pyx_v_lat2, PyObject *__pyx_v_lon1, PyObject *__pyx_v_lon2) {
  PyObject *__pyx_v_data = NULL;
  PyObject *__pyx_v_lats = NULL;
  PyObject *__pyx_v_lons = NULL;
  PyObject *__pyx_v_datsubset = NULL;
  PyObject *__pyx_v_lonsubset = NULL;
  PyObject *__pyx_v_latsubset = NULL;
  PyObject *__pyx_v_masklat = NULL;
  PyObject *__pyx_v_masklon = NULL;
  PyObject *__pyx_v_mask = NULL;
  PyObject *__pyx_v_reduced_expand = NULL;
  PyObject *__pyx_v_nlats = NULL;
  PyObject *__pyx_v_nlons = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *(*__pyx_t_5)(PyObject *);
  int __pyx_t_6;
  int __pyx_t_7;
  int __pyx_t_8;
  int __pyx_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":1088
 *         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 = 1088; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_data = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pygrib.pyx":1089
 * 	"""
 *         data = self.values
 *         lats, lons = self.latlons()             # <<<<<<<<<<<<<<
 *         if lon1==lon2==lat1==lat2==None:
 *             datsubset = data; lonsubset = lons; latsubset = lats
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__latlons); 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_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1089; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
    PyObject* sequence = __pyx_t_2;
    #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 = 1089; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_1 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_t_3);
    #else
    __pyx_t_1 = PySequence_ITEM(sequence, 0); 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_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1089; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    #endif
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else
  {
    Py_ssize_t index = -1;
    __pyx_t_4 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1089; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_5 = Py_TYPE(__pyx_t_4)->tp_iternext;
    index = 0; __pyx_t_1 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_1)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_1);
    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 = 1089; __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 = 1089; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_L4_unpacking_done:;
  }
  __pyx_v_lats = __pyx_t_1;
  __pyx_t_1 = 0;
  __pyx_v_lons = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "pygrib.pyx":1090
 *         data = self.values
 *         lats, lons = self.latlons()
 *         if lon1==lon2==lat1==lat2==None:             # <<<<<<<<<<<<<<
 *             datsubset = data; lonsubset = lons; latsubset = lats
 *         else:
 */
  __pyx_t_2 = PyObject_RichCompare(__pyx_v_lon1, __pyx_v_lon2, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1090; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_PyObject_IsTrue(__pyx_t_2)) {
    __Pyx_DECREF(__pyx_t_2);
    __pyx_t_2 = PyObject_RichCompare(__pyx_v_lon2, __pyx_v_lat1, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1090; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (__Pyx_PyObject_IsTrue(__pyx_t_2)) {
      __Pyx_DECREF(__pyx_t_2);
      __pyx_t_2 = PyObject_RichCompare(__pyx_v_lat1, __pyx_v_lat2, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1090; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      if (__Pyx_PyObject_IsTrue(__pyx_t_2)) {
        __Pyx_DECREF(__pyx_t_2);
        __pyx_t_2 = PyObject_RichCompare(__pyx_v_lat2, Py_None, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1090; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
    }
  }
  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1090; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_6) {

    /* "pygrib.pyx":1091
 *         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;
    goto __pyx_L5;
  }
  /*else*/ {

    /* "pygrib.pyx":1093
 *             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()
 */
    __pyx_t_6 = (__pyx_v_lat1 == Py_None);
    __pyx_t_7 = (__pyx_t_6 != 0);
    if (__pyx_t_7) {
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_lats, __pyx_n_s__min); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1093; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1093; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF_SET(__pyx_v_lat1, __pyx_t_3);
      __pyx_t_3 = 0;
      goto __pyx_L6;
    }
    __pyx_L6:;

    /* "pygrib.pyx":1094
 *         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 = 1094; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1094; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF_SET(__pyx_v_lat2, __pyx_t_2);
      __pyx_t_2 = 0;
      goto __pyx_L7;
    }
    __pyx_L7:;

    /* "pygrib.pyx":1095
 *             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_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_lons, __pyx_n_s__min); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1095; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1095; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF_SET(__pyx_v_lon1, __pyx_t_3);
      __pyx_t_3 = 0;
      goto __pyx_L8;
    }
    __pyx_L8:;

    /* "pygrib.pyx":1096
 *             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 = 1096; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1096; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF_SET(__pyx_v_lon2, __pyx_t_2);
      __pyx_t_2 = 0;
      goto __pyx_L9;
    }
    __pyx_L9:;

    /* "pygrib.pyx":1097
 *             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_2 = PyObject_RichCompare(__pyx_v_lats, __pyx_v_lat1, Py_GE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1097; __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 = 1097; __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 = 1097; __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_masklat = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "pygrib.pyx":1098
 *             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_1 = PyObject_RichCompare(__pyx_v_lons, __pyx_v_lon1, Py_GE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1098; __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 = 1098; __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 = 1098; __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_masklon = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "pygrib.pyx":1099
 *             masklat = (lats >= lat1) & (lats <= lat2)
 *             masklon = (lons >= lon1) & (lons <= lon2)
 *             mask = masklat & masklon             # <<<<<<<<<<<<<<
 *             datsubset = data[mask]
 *             latsubset = lats[mask]
 */
    __pyx_t_2 = PyNumber_And(__pyx_v_masklat, __pyx_v_masklon); 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_v_mask = __pyx_t_2;
    __pyx_t_2 = 0;

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

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

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

    /* "pygrib.pyx":1104
 *             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_2 = PyObject_GetItem(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_n_s__gridType)); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, ((PyObject *)__pyx_n_s__reduced_ll), Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (!((int)__pyx_t_6)) {
      __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, ((PyObject *)__pyx_n_s__reduced_gg), Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_8 = ((int)__pyx_t_7);
    } else {
      __pyx_t_8 = ((int)__pyx_t_6);
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_8); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (__pyx_t_8) {
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_INCREF(__pyx_v_self->expand_reduced);
      __pyx_t_3 = __pyx_v_self->expand_reduced;
    } else {
      __pyx_t_3 = __pyx_t_2;
      __pyx_t_2 = 0;
    }
    __pyx_v_reduced_expand = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "pygrib.pyx":1105
 *             # 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_3 = PyObject_GetItem(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_n_s__gridType)); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = PyObject_RichCompare(__pyx_t_3, ((PyObject *)__pyx_n_s__regular_gg), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (!((int)__pyx_t_8)) {
      __pyx_t_2 = PyObject_RichCompare(__pyx_t_3, ((PyObject *)__pyx_n_s__regular_ll), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_7 = ((int)__pyx_t_6);
    } else {
      __pyx_t_7 = ((int)__pyx_t_8);
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_8 = __pyx_t_7;
    if (!__pyx_t_8) {
      __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_v_reduced_expand); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_6 = __pyx_t_7;
    } else {
      __pyx_t_6 = __pyx_t_8;
    }
    if (__pyx_t_6) {

      /* "pygrib.pyx":1106
 *             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, ((PyObject *)__pyx_k_tuple_101)); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1106; __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 = 1106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_v_nlats = __pyx_t_3;
      __pyx_t_3 = 0;

      /* "pygrib.pyx":1107
 *             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_3 = PyObject_GetItem(__pyx_v_masklon, ((PyObject *)__pyx_k_tuple_103)); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1107; __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 = 1107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_v_nlons = __pyx_t_3;
      __pyx_t_3 = 0;

      /* "pygrib.pyx":1108
 *                 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 = 1108; __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 = 1108; __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(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_v_datsubset);
      PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_datsubset);
      __Pyx_GIVEREF(__pyx_v_datsubset);
      __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (__pyx_t_6) {

        /* "pygrib.pyx":1109
 *                 nlons = masklon[0,:].sum()
 *                 if ma.isMA(datsubset):
 *                     datsubset = ma.reshape(datsubset,(nlats,nlons))             # <<<<<<<<<<<<<<
 *                 else:
 *                     datsubset = np.reshape(datsubset,(nlats,nlons))
 */
        __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__ma); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__reshape); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_INCREF(__pyx_v_nlats);
        PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_nlats);
        __Pyx_GIVEREF(__pyx_v_nlats);
        __Pyx_INCREF(__pyx_v_nlons);
        PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_nlons);
        __Pyx_GIVEREF(__pyx_v_nlons);
        __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_INCREF(__pyx_v_datsubset);
        PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_datsubset);
        __Pyx_GIVEREF(__pyx_v_datsubset);
        PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_t_1));
        __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
        __pyx_t_1 = 0;
        __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
        __Pyx_DECREF_SET(__pyx_v_datsubset, __pyx_t_1);
        __pyx_t_1 = 0;
        goto __pyx_L11;
      }
      /*else*/ {

        /* "pygrib.pyx":1111
 *                     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))
 */
        __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__reshape); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_INCREF(__pyx_v_nlats);
        PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_nlats);
        __Pyx_GIVEREF(__pyx_v_nlats);
        __Pyx_INCREF(__pyx_v_nlons);
        PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_nlons);
        __Pyx_GIVEREF(__pyx_v_nlons);
        __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_INCREF(__pyx_v_datsubset);
        PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_datsubset);
        __Pyx_GIVEREF(__pyx_v_datsubset);
        PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_t_1));
        __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
        __pyx_t_1 = 0;
        __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
        __Pyx_DECREF_SET(__pyx_v_datsubset, __pyx_t_1);
        __pyx_t_1 = 0;
      }
      __pyx_L11:;

      /* "pygrib.pyx":1112
 *                 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_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__reshape); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_INCREF(__pyx_v_nlats);
      PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_nlats);
      __Pyx_GIVEREF(__pyx_v_nlats);
      __Pyx_INCREF(__pyx_v_nlons);
      PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_nlons);
      __Pyx_GIVEREF(__pyx_v_nlons);
      __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_INCREF(__pyx_v_latsubset);
      PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_latsubset);
      __Pyx_GIVEREF(__pyx_v_latsubset);
      PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_t_1));
      __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
      __pyx_t_1 = 0;
      __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
      __Pyx_DECREF_SET(__pyx_v_latsubset, __pyx_t_1);
      __pyx_t_1 = 0;

      /* "pygrib.pyx":1113
 *                     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_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__reshape); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_INCREF(__pyx_v_nlats);
      PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_nlats);
      __Pyx_GIVEREF(__pyx_v_nlats);
      __Pyx_INCREF(__pyx_v_nlons);
      PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_nlons);
      __Pyx_GIVEREF(__pyx_v_nlons);
      __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_v_lonsubset);
      PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_lonsubset);
      __Pyx_GIVEREF(__pyx_v_lonsubset);
      PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_t_1));
      __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
      __pyx_t_1 = 0;
      __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
      __Pyx_DECREF_SET(__pyx_v_lonsubset, __pyx_t_1);
      __pyx_t_1 = 0;
      goto __pyx_L10;
    }
    __pyx_L10:;
  }
  __pyx_L5:;

  /* "pygrib.pyx":1114
 *                 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 = 1114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_datsubset);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_datsubset);
  __Pyx_GIVEREF(__pyx_v_datsubset);
  __Pyx_INCREF(__pyx_v_latsubset);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_latsubset);
  __Pyx_GIVEREF(__pyx_v_latsubset);
  __Pyx_INCREF(__pyx_v_lonsubset);
  PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_lonsubset);
  __Pyx_GIVEREF(__pyx_v_lonsubset);
  __pyx_r = ((PyObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("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;
}

/* 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));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pygrib.pyx":1115
 *                 lonsubset = np.reshape(lonsubset,(nlats,nlons))
 *         return datsubset,latsubset, lonsubset
 *     def __setitem__(self, key, value):             # <<<<<<<<<<<<<<
 *         """
 *         change values associated with existing grib keys.
 */

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;
  long __pyx_t_7;
  size_t __pyx_t_8;
  double __pyx_t_9;
  Py_ssize_t __pyx_t_10;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__setitem__", 0);

  /* "pygrib.pyx":1126
 *         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_Contains(__pyx_v_key, __pyx_v_self->_ro_keys, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1126; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "pygrib.pyx":1127
 *         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 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_104), __pyx_v_key); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_3));
    __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
    __pyx_t_3 = 0;
    __pyx_t_3 = PyObject_Call(__pyx_builtin_KeyError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(((PyObject *)__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 = 1127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "pygrib.pyx":1128
 *         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_Contains(__pyx_v_key, __pyx_v_self->_all_keys, Py_NE)); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "pygrib.pyx":1130
 *         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 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_105), __pyx_v_key); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_3));
    __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
    __pyx_t_3 = 0;
    __pyx_t_3 = PyObject_Call(__pyx_builtin_KeyError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(((PyObject *)__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 = 1129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "pygrib.pyx":1131
 *             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 = 1131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_bytestr = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "pygrib.pyx":1132
 *                     % 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 = 1132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_name = __pyx_t_5;

  /* "pygrib.pyx":1133
 *         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":1134
 *         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":1135
 *         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 = 1135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_3));
    __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
    __pyx_t_3 = 0;
    __pyx_t_3 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(((PyObject *)__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 = 1135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L5;
  }

  /* "pygrib.pyx":1136
 *         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":1138
 *         elif typ == GRIB_TYPE_LONG:
 *             # is value an array or a scalar?
 *             datarr = np.asarray(value, np.int)             # <<<<<<<<<<<<<<
 *             is_array = False
 *             if datarr.shape:
 */
    __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__asarray); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1138; __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 = 1138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__int); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __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 = 1138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v_value);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_value);
    __Pyx_GIVEREF(__pyx_v_value);
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_6);
    __pyx_t_6 = 0;
    __pyx_t_6 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
    if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_6pygrib_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_datarr = ((PyArrayObject *)__pyx_t_6);
    __pyx_t_6 = 0;

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

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

    /* "pygrib.pyx":1142
 *             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":1143
 *                 is_array = True
 *             if not is_array: # scalar
 *                 longval = value             # <<<<<<<<<<<<<<
 *                 err = grib_set_long(self._gh, name, longval)
 *                 if err:
 */
      __pyx_t_7 = __Pyx_PyInt_AsLong(__pyx_v_value); if (unlikely((__pyx_t_7 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_v_longval = __pyx_t_7;

      /* "pygrib.pyx":1144
 *             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":1145
 *                 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":1146
 *                 err = grib_set_long(self._gh, name, longval)
 *                 if err:
 *                     raise RuntimeError(grib_get_error_message(err))             # <<<<<<<<<<<<<<
 *             else:
 *                 if key == 'values':
 */
        __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 = 1146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(((PyObject *)__pyx_t_6));
        __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_3);
        PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_6));
        __Pyx_GIVEREF(((PyObject *)__pyx_t_6));
        __pyx_t_6 = 0;
        __pyx_t_6 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 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 = 1146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        goto __pyx_L8;
      }
      __pyx_L8:;
      goto __pyx_L7;
    }
    /*else*/ {

      /* "pygrib.pyx":1148
 *                     raise RuntimeError(grib_get_error_message(err))
 *             else:
 *                 if key == 'values':             # <<<<<<<<<<<<<<
 *                     datarr = self._unshape_mask(datarr)
 *                 if not PyArray_ISCONTIGUOUS(datarr):
 */
      __pyx_t_6 = PyObject_RichCompare(__pyx_v_key, ((PyObject *)__pyx_n_s__values), Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (__pyx_t_1) {

        /* "pygrib.pyx":1149
 *             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 = 1149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_INCREF(((PyObject *)__pyx_v_datarr));
        PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_datarr));
        __Pyx_GIVEREF(((PyObject *)__pyx_v_datarr));
        __pyx_t_4 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
        if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_6pygrib_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF_SET(__pyx_v_datarr, ((PyArrayObject *)__pyx_t_4));
        __pyx_t_4 = 0;
        goto __pyx_L9;
      }
      __pyx_L9:;

      /* "pygrib.pyx":1150
 *                 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":1151
 *                     datarr = self._unshape_mask(datarr)
 *                 if not PyArray_ISCONTIGUOUS(datarr):
 *                     datarr = datarr.copy()             # <<<<<<<<<<<<<<
 *                 size = datarr.size
 *                 err = grib_set_long_array(self._gh, name, <long *>datarr.data, size)
 */
        __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_datarr), __pyx_n_s__copy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 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 = 1151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF_SET(__pyx_v_datarr, ((PyArrayObject *)__pyx_t_3));
        __pyx_t_3 = 0;
        goto __pyx_L10;
      }
      __pyx_L10:;

      /* "pygrib.pyx":1152
 *                 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 = 1152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_8 = __Pyx_PyInt_AsSize_t(__pyx_t_3); if (unlikely((__pyx_t_8 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_v_size = __pyx_t_8;

      /* "pygrib.pyx":1153
 *                     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":1154
 *                 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":1155
 *                 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 = 1155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(((PyObject *)__pyx_t_3));
        __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_4);
        PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_3));
        __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
        __pyx_t_3 = 0;
        __pyx_t_3 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(((PyObject *)__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 = 1155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        goto __pyx_L11;
      }
      __pyx_L11:;
    }
    __pyx_L7:;
    goto __pyx_L5;
  }

  /* "pygrib.pyx":1156
 *                 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":1158
 *         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_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1158; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__asarray); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1158; __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 = 1158; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__float); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1158; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __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 = 1158; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v_value);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_value);
    __Pyx_GIVEREF(__pyx_v_value);
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_6);
    __pyx_t_6 = 0;
    __pyx_t_6 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1158; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
    if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_6pygrib_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1158; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_datarr = ((PyArrayObject *)__pyx_t_6);
    __pyx_t_6 = 0;

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

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

    /* "pygrib.pyx":1162
 *             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":1163
 *                 is_array = True
 *             if not is_array: # scalar
 *                 doubleval = value             # <<<<<<<<<<<<<<
 *                 err = grib_set_double(self._gh, name, doubleval)
 *                 if err:
 */
      __pyx_t_9 = __pyx_PyFloat_AsDouble(__pyx_v_value); if (unlikely((__pyx_t_9 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_v_doubleval = __pyx_t_9;

      /* "pygrib.pyx":1164
 *             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":1165
 *                 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":1166
 *                 err = grib_set_double(self._gh, name, doubleval)
 *                 if err:
 *                     raise RuntimeError(grib_get_error_message(err))             # <<<<<<<<<<<<<<
 *             else:
 *                 if key == 'values':
 */
        __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 = 1166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(((PyObject *)__pyx_t_6));
        __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_3);
        PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_6));
        __Pyx_GIVEREF(((PyObject *)__pyx_t_6));
        __pyx_t_6 = 0;
        __pyx_t_6 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 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 = 1166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        goto __pyx_L14;
      }
      __pyx_L14:;
      goto __pyx_L13;
    }
    /*else*/ {

      /* "pygrib.pyx":1168
 *                     raise RuntimeError(grib_get_error_message(err))
 *             else:
 *                 if key == 'values':             # <<<<<<<<<<<<<<
 *                     datarr = self._unshape_mask(datarr)
 *                 if not PyArray_ISCONTIGUOUS(datarr):
 */
      __pyx_t_6 = PyObject_RichCompare(__pyx_v_key, ((PyObject *)__pyx_n_s__values), Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (__pyx_t_1) {

        /* "pygrib.pyx":1169
 *             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 = 1169; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1169; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_INCREF(((PyObject *)__pyx_v_datarr));
        PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_datarr));
        __Pyx_GIVEREF(((PyObject *)__pyx_v_datarr));
        __pyx_t_4 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1169; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
        if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_6pygrib_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1169; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF_SET(__pyx_v_datarr, ((PyArrayObject *)__pyx_t_4));
        __pyx_t_4 = 0;
        goto __pyx_L15;
      }
      __pyx_L15:;

      /* "pygrib.pyx":1170
 *                 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":1171
 *                     datarr = self._unshape_mask(datarr)
 *                 if not PyArray_ISCONTIGUOUS(datarr):
 *                     datarr = datarr.copy()             # <<<<<<<<<<<<<<
 *                 size = datarr.size
 *                 err = grib_set_double_array(self._gh, name, <double *>datarr.data, size)
 */
        __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_datarr), __pyx_n_s__copy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 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 = 1171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF_SET(__pyx_v_datarr, ((PyArrayObject *)__pyx_t_3));
        __pyx_t_3 = 0;
        goto __pyx_L16;
      }
      __pyx_L16:;

      /* "pygrib.pyx":1172
 *                 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 = 1172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_8 = __Pyx_PyInt_AsSize_t(__pyx_t_3); if (unlikely((__pyx_t_8 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_v_size = __pyx_t_8;

      /* "pygrib.pyx":1173
 *                     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":1174
 *                 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":1175
 *                 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 = 1175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(((PyObject *)__pyx_t_3));
        __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_4);
        PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_3));
        __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
        __pyx_t_3 = 0;
        __pyx_t_3 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(((PyObject *)__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 = 1175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        goto __pyx_L17;
      }
      __pyx_L17:;
    }
    __pyx_L13:;
    goto __pyx_L5;
  }

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

    /* "pygrib.pyx":1178
 *         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 = 1178; __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":1179
 *             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 = 1179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_strdata = __pyx_t_5;

    /* "pygrib.pyx":1180
 *             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":1181
 *             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":1182
 *             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 = 1182; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_3));
      __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1182; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_3));
      __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
      __pyx_t_3 = 0;
      __pyx_t_3 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1182; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(((PyObject *)__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 = 1182; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L18;
    }
    __pyx_L18:;
    goto __pyx_L5;
  }
  /*else*/ {

    /* "pygrib.pyx":1184
 *                 raise RuntimeError(grib_get_error_message(err))
 *         else:
 *             raise ValueError("unrecognized grib type % d" % typ)             # <<<<<<<<<<<<<<
 *     def __getitem__(self, key):
 *         """
 */
    __pyx_t_3 = PyInt_FromLong(__pyx_v_typ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_106), __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__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 = 1184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_4));
    __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
    __pyx_t_4 = 0;
    __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(((PyObject *)__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 = 1184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_L5:;

  __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_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;
}

/* 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));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pygrib.pyx":1185
 *         else:
 *             raise ValueError("unrecognized grib type % d" % typ)
 *     def __getitem__(self, key):             # <<<<<<<<<<<<<<
 *         """
 *         access values associated with grib keys.
 */

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[1024];
  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;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  size_t __pyx_t_6;
  int __pyx_t_7;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__getitem__", 0);

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

  /* "pygrib.pyx":1203
 *         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 = 1203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_name = __pyx_t_2;

  /* "pygrib.pyx":1204
 *         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_1 = PyObject_RichCompare(__pyx_v_key, ((PyObject *)__pyx_n_s__values), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1204; __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 = 1204; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_3) {
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __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 = 1204; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s__startswith); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1204; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_k_tuple_107), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1204; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = __pyx_t_4;
    __pyx_t_4 = 0;
  } else {
    __pyx_t_5 = __pyx_t_1;
    __pyx_t_1 = 0;
  }
  __pyx_v_usenceplib = __pyx_t_5;
  __pyx_t_5 = 0;

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

    /* "pygrib.pyx":1207
 *         # 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_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__numberOfValues); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1207; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = __Pyx_PyInt_AsSize_t(__pyx_t_5); if (unlikely((__pyx_t_6 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1207; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_v_size = __pyx_t_6;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "pygrib.pyx":1209
 *             size = self.numberOfValues
 *         else:
 *             err = grib_get_size(self._gh, name, &size)             # <<<<<<<<<<<<<<
 *             if err:
 *                 if tolerate_badgrib:
 */
    __pyx_v_err = grib_get_size(__pyx_v_self->_gh, __pyx_v_name, (&__pyx_v_size));

    /* "pygrib.pyx":1210
 *         else:
 *             err = grib_get_size(self._gh, name, &size)
 *             if err:             # <<<<<<<<<<<<<<
 *                 if tolerate_badgrib:
 *                     return None
 */
    __pyx_t_3 = (__pyx_v_err != 0);
    if (__pyx_t_3) {

      /* "pygrib.pyx":1211
 *             err = grib_get_size(self._gh, name, &size)
 *             if err:
 *                 if tolerate_badgrib:             # <<<<<<<<<<<<<<
 *                     return None
 *                 else:
 */
      __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s__tolerate_badgrib); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (__pyx_t_3) {

        /* "pygrib.pyx":1212
 *             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;
        goto __pyx_L5;
      }
      /*else*/ {

        /* "pygrib.pyx":1214
 *                     return None
 *                 else:
 *                     raise RuntimeError(grib_get_error_message(err))             # <<<<<<<<<<<<<<
 *         # this workaround only needed for grib_api < 1.9.16.
 *         if usenceplib:
 */
        __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 = 1214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(((PyObject *)__pyx_t_5));
        __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_5));
        __Pyx_GIVEREF(((PyObject *)__pyx_t_5));
        __pyx_t_5 = 0;
        __pyx_t_5 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
        __Pyx_Raise(__pyx_t_5, 0, 0, 0);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_L5:;
      goto __pyx_L4;
    }
    __pyx_L4:;
  }
  __pyx_L3:;

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

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

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

    /* "pygrib.pyx":1220
 *             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
 */
    __pyx_v_err = grib_get_native_type(__pyx_v_self->_gh, __pyx_v_name, (&__pyx_v_typ));
  }
  __pyx_L6:;

  /* "pygrib.pyx":1224
 *         # 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_5 = PyObject_RichCompare(__pyx_v_key, ((PyObject *)__pyx_n_s__paramId), Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1224; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1224; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (__pyx_t_3) {
    __pyx_t_7 = (__pyx_v_typ == GRIB_TYPE_LONG);
    __pyx_t_8 = __pyx_t_7;
  } else {
    __pyx_t_8 = __pyx_t_3;
  }
  if (__pyx_t_8) {
    __pyx_v_size = 1;
    goto __pyx_L7;
  }
  __pyx_L7:;

  /* "pygrib.pyx":1225
 *         # 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_8 = (__pyx_v_err != 0);
  if (__pyx_t_8) {

    /* "pygrib.pyx":1226
 *         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_5 = __Pyx_PyBytes_FromString(grib_get_error_message(__pyx_v_err)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1226; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_5));
    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1226; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_5));
    __Pyx_GIVEREF(((PyObject *)__pyx_t_5));
    __pyx_t_5 = 0;
    __pyx_t_5 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1226; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
    __Pyx_Raise(__pyx_t_5, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1226; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L8;
  }

  /* "pygrib.pyx":1227
 *         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_8 = ((__pyx_v_typ == GRIB_TYPE_LONG) != 0);
  if (__pyx_t_8) {

    /* "pygrib.pyx":1228
 *             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_8 = ((__pyx_v_size == 1) != 0);
    if (__pyx_t_8) {

      /* "pygrib.pyx":1229
 *         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":1230
 *             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_8 = (__pyx_v_err != 0);
      if (__pyx_t_8) {

        /* "pygrib.pyx":1231
 *                 err = grib_get_long(self._gh, name, &longval)
 *                 if err:
 *                     raise RuntimeError(grib_get_error_message(err))             # <<<<<<<<<<<<<<
 *                 return longval
 *             else: # array
 */
        __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 = 1231; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(((PyObject *)__pyx_t_5));
        __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1231; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_5));
        __Pyx_GIVEREF(((PyObject *)__pyx_t_5));
        __pyx_t_5 = 0;
        __pyx_t_5 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1231; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
        __Pyx_Raise(__pyx_t_5, 0, 0, 0);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1231; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        goto __pyx_L10;
      }
      __pyx_L10:;

      /* "pygrib.pyx":1232
 *                 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_5 = PyInt_FromLong(__pyx_v_longval); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1232; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_r = __pyx_t_5;
      __pyx_t_5 = 0;
      goto __pyx_L0;
      goto __pyx_L9;
    }
    /*else*/ {

      /* "pygrib.pyx":1234
 *                 return longval
 *             else: # array
 *                 if self.has_key('jPointsAreConsecutive') and\             # <<<<<<<<<<<<<<
 *                    self['jPointsAreConsecutive']:
 *                     storageorder='F'
 */
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__has_key); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1234; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_1 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_k_tuple_109), NULL); 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_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1234; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (__pyx_t_8) {

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

        /* "pygrib.pyx":1236
 *                 if self.has_key('jPointsAreConsecutive') and\
 *                    self['jPointsAreConsecutive']:
 *                     storageorder='F'             # <<<<<<<<<<<<<<
 *                 else:
 *                     storageorder='C'
 */
        __Pyx_INCREF(((PyObject *)__pyx_n_s__F));
        __pyx_v_storageorder = ((PyObject *)__pyx_n_s__F);
        goto __pyx_L11;
      }
      /*else*/ {

        /* "pygrib.pyx":1238
 *                     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)
 */
        __Pyx_INCREF(((PyObject *)__pyx_n_s__C));
        __pyx_v_storageorder = ((PyObject *)__pyx_n_s__C);
      }
      __pyx_L11:;

      /* "pygrib.pyx":1239
 *                 else:
 *                     storageorder='C'
 *                 datarr = np.zeros(size, np.int, order=storageorder)             # <<<<<<<<<<<<<<
 *                 err = grib_get_long_array(self._gh, name, <long *>datarr.data, &size)
 *                 if err:
 */
      __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1239; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__zeros); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1239; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = __Pyx_PyInt_FromSize_t(__pyx_v_size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1239; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1239; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s__int); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1239; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_9);
      __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 = 1239; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
      __Pyx_GIVEREF(__pyx_t_1);
      PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_9);
      __Pyx_GIVEREF(__pyx_t_9);
      __pyx_t_1 = 0;
      __pyx_t_9 = 0;
      __pyx_t_9 = PyDict_New(); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1239; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_9));
      if (PyDict_SetItem(__pyx_t_9, ((PyObject *)__pyx_n_s__order), __pyx_v_storageorder) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1239; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_1 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_9)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1239; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 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 = 1239; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_v_datarr = ((PyArrayObject *)__pyx_t_1);
      __pyx_t_1 = 0;

      /* "pygrib.pyx":1240
 *                     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":1241
 *                 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_7 = (__pyx_v_err != 0);
      if (__pyx_t_7) {

        /* "pygrib.pyx":1242
 *                 err = grib_get_long_array(self._gh, name, <long *>datarr.data, &size)
 *                 if err:
 *                     raise RuntimeError(grib_get_error_message(err))             # <<<<<<<<<<<<<<
 *                 if key == 'values':
 *                     return self._reshape_mask(datarr)
 */
        __pyx_t_1 = __Pyx_PyBytes_FromString(grib_get_error_message(__pyx_v_err)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(((PyObject *)__pyx_t_1));
        __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_9);
        PyTuple_SET_ITEM(__pyx_t_9, 0, ((PyObject *)__pyx_t_1));
        __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
        __pyx_t_1 = 0;
        __pyx_t_1 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 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 = 1242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        goto __pyx_L12;
      }
      __pyx_L12:;

      /* "pygrib.pyx":1243
 *                 if err:
 *                     raise RuntimeError(grib_get_error_message(err))
 *                 if key == 'values':             # <<<<<<<<<<<<<<
 *                     return self._reshape_mask(datarr)
 *                 else:
 */
      __pyx_t_1 = PyObject_RichCompare(__pyx_v_key, ((PyObject *)__pyx_n_s__values), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1243; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1243; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (__pyx_t_7) {

        /* "pygrib.pyx":1244
 *                     raise RuntimeError(grib_get_error_message(err))
 *                 if key == 'values':
 *                     return self._reshape_mask(datarr)             # <<<<<<<<<<<<<<
 *                 else:
 *                     return datarr
 */
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s___reshape_mask); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1244; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1244; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_INCREF(((PyObject *)__pyx_v_datarr));
        PyTuple_SET_ITEM(__pyx_t_9, 0, ((PyObject *)__pyx_v_datarr));
        __Pyx_GIVEREF(((PyObject *)__pyx_v_datarr));
        __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1244; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
        __pyx_r = __pyx_t_4;
        __pyx_t_4 = 0;
        goto __pyx_L0;
        goto __pyx_L13;
      }
      /*else*/ {

        /* "pygrib.pyx":1246
 *                     return self._reshape_mask(datarr)
 *                 else:
 *                     return datarr             # <<<<<<<<<<<<<<
 *         elif typ == GRIB_TYPE_DOUBLE:
 *             if size == 1: # scalar
 */
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(((PyObject *)__pyx_v_datarr));
        __pyx_r = ((PyObject *)__pyx_v_datarr);
        goto __pyx_L0;
      }
      __pyx_L13:;
    }
    __pyx_L9:;
    goto __pyx_L8;
  }

  /* "pygrib.pyx":1247
 *                 else:
 *                     return datarr
 *         elif typ == GRIB_TYPE_DOUBLE:             # <<<<<<<<<<<<<<
 *             if size == 1: # scalar
 *                 err = grib_get_double(self._gh, name, &doubleval)
 */
  __pyx_t_7 = ((__pyx_v_typ == GRIB_TYPE_DOUBLE) != 0);
  if (__pyx_t_7) {

    /* "pygrib.pyx":1248
 *                     return datarr
 *         elif typ == GRIB_TYPE_DOUBLE:
 *             if size == 1: # scalar             # <<<<<<<<<<<<<<
 *                 err = grib_get_double(self._gh, name, &doubleval)
 *                 if err:
 */
    __pyx_t_7 = ((__pyx_v_size == 1) != 0);
    if (__pyx_t_7) {

      /* "pygrib.pyx":1249
 *         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":1250
 *             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_7 = (__pyx_v_err != 0);
      if (__pyx_t_7) {

        /* "pygrib.pyx":1251
 *                 err = grib_get_double(self._gh, name, &doubleval)
 *                 if err:
 *                     raise RuntimeError(grib_get_error_message(err))             # <<<<<<<<<<<<<<
 *                 return doubleval
 *             else: # array
 */
        __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 = 1251; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(((PyObject *)__pyx_t_4));
        __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1251; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_9);
        PyTuple_SET_ITEM(__pyx_t_9, 0, ((PyObject *)__pyx_t_4));
        __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
        __pyx_t_4 = 0;
        __pyx_t_4 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1251; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 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 = 1251; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        goto __pyx_L15;
      }
      __pyx_L15:;

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

      /* "pygrib.pyx":1254
 *                 return doubleval
 *             else: # array
 *                 if self.has_key('jPointsAreConsecutive') and\             # <<<<<<<<<<<<<<
 *                    self['jPointsAreConsecutive']:
 *                     storageorder='F'
 */
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__has_key); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1254; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_9 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_k_tuple_110), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1254; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1254; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      if (__pyx_t_7) {

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

        /* "pygrib.pyx":1256
 *                 if self.has_key('jPointsAreConsecutive') and\
 *                    self['jPointsAreConsecutive']:
 *                     storageorder='F'             # <<<<<<<<<<<<<<
 *                 else:
 *                     storageorder='C'
 */
        __Pyx_INCREF(((PyObject *)__pyx_n_s__F));
        __pyx_v_storageorder = ((PyObject *)__pyx_n_s__F);
        goto __pyx_L16;
      }
      /*else*/ {

        /* "pygrib.pyx":1258
 *                     storageorder='F'
 *                 else:
 *                     storageorder='C'             # <<<<<<<<<<<<<<
 *                 if usenceplib:
 *                     # use ncep lib to decode data (workaround for grib_api
 */
        __Pyx_INCREF(((PyObject *)__pyx_n_s__C));
        __pyx_v_storageorder = ((PyObject *)__pyx_n_s__C);
      }
      __pyx_L16:;

      /* "pygrib.pyx":1259
 *                 else:
 *                     storageorder='C'
 *                 if usenceplib:             # <<<<<<<<<<<<<<
 *                     # use ncep lib to decode data (workaround for grib_api
 *                     # bug with second-order complex packing).
 */
      __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_usenceplib); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1259; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      if (__pyx_t_3) {

        /* "pygrib.pyx":1262
 *                     # 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_9 = __Pyx_GetModuleGlobalName(__pyx_n_s__Grib2Decode); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1262; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_9);
        __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__tostring); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1262; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_1 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1262; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1262; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_4);
        PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
        __Pyx_GIVEREF(__pyx_t_1);
        __pyx_t_1 = 0;
        __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1262; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(((PyObject *)__pyx_t_1));
        __pyx_t_5 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1262; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_5);
        if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__gribmsg), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1262; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_t_5 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1262; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
        __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
        __pyx_v_grb = __pyx_t_5;
        __pyx_t_5 = 0;

        /* "pygrib.pyx":1263
 *                     # 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_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_grb, __pyx_n_s__data); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1263; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_1 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1263; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_r = __pyx_t_1;
        __pyx_t_1 = 0;
        goto __pyx_L0;
        goto __pyx_L17;
      }
      /*else*/ {

        /* "pygrib.pyx":1265
 *                     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:
 */
        __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1265; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__zeros); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1265; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_1 = __Pyx_PyInt_FromSize_t(__pyx_v_size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1265; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1265; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s__double); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1265; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_9);
        __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 = 1265; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_4);
        PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
        __Pyx_GIVEREF(__pyx_t_1);
        PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_9);
        __Pyx_GIVEREF(__pyx_t_9);
        __pyx_t_1 = 0;
        __pyx_t_9 = 0;
        __pyx_t_9 = PyDict_New(); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1265; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(((PyObject *)__pyx_t_9));
        if (PyDict_SetItem(__pyx_t_9, ((PyObject *)__pyx_n_s__order), __pyx_v_storageorder) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1265; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __pyx_t_1 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_9)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1265; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
        __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 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 = 1265; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __pyx_v_datarr = ((PyArrayObject *)__pyx_t_1);
        __pyx_t_1 = 0;

        /* "pygrib.pyx":1266
 *                 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":1267
 *                     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_3 = (__pyx_v_err != 0);
        if (__pyx_t_3) {

          /* "pygrib.pyx":1268
 *                     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_1 = __Pyx_PyBytes_FromString(grib_get_error_message(__pyx_v_err)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1268; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(((PyObject *)__pyx_t_1));
          __pyx_t_9 = PyTuple_New(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);
          PyTuple_SET_ITEM(__pyx_t_9, 0, ((PyObject *)__pyx_t_1));
          __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
          __pyx_t_1 = 0;
          __pyx_t_1 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1268; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 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 = 1268; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          goto __pyx_L18;
        }
        __pyx_L18:;

        /* "pygrib.pyx":1269
 *                     if err:
 *                         raise RuntimeError(grib_get_error_message(err))
 *                     if key == 'values':             # <<<<<<<<<<<<<<
 *                         return self._reshape_mask(datarr)
 *                     else:
 */
        __pyx_t_1 = PyObject_RichCompare(__pyx_v_key, ((PyObject *)__pyx_n_s__values), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1269; __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 = 1269; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        if (__pyx_t_3) {

          /* "pygrib.pyx":1270
 *                         raise RuntimeError(grib_get_error_message(err))
 *                     if key == 'values':
 *                         return self._reshape_mask(datarr)             # <<<<<<<<<<<<<<
 *                     else:
 *                         return datarr
 */
          __Pyx_XDECREF(__pyx_r);
          __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s___reshape_mask); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1270; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_1);
          __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1270; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_INCREF(((PyObject *)__pyx_v_datarr));
          PyTuple_SET_ITEM(__pyx_t_9, 0, ((PyObject *)__pyx_v_datarr));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_datarr));
          __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1270; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
          __pyx_r = __pyx_t_4;
          __pyx_t_4 = 0;
          goto __pyx_L0;
          goto __pyx_L19;
        }
        /*else*/ {

          /* "pygrib.pyx":1272
 *                         return self._reshape_mask(datarr)
 *                     else:
 *                         return datarr             # <<<<<<<<<<<<<<
 *         elif typ == GRIB_TYPE_STRING:
 *             size=1024 # grib_get_size returns 1 ?
 */
          __Pyx_XDECREF(__pyx_r);
          __Pyx_INCREF(((PyObject *)__pyx_v_datarr));
          __pyx_r = ((PyObject *)__pyx_v_datarr);
          goto __pyx_L0;
        }
        __pyx_L19:;
      }
      __pyx_L17:;
    }
    __pyx_L14:;
    goto __pyx_L8;
  }

  /* "pygrib.pyx":1273
 *                     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_3 = ((__pyx_v_typ == GRIB_TYPE_STRING) != 0);
  if (__pyx_t_3) {

    /* "pygrib.pyx":1274
 *                         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 = 1024;

    /* "pygrib.pyx":1275
 *         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":1276
 *             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_3 = (__pyx_v_err != 0);
    if (__pyx_t_3) {

      /* "pygrib.pyx":1277
 *             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_4 = __Pyx_PyBytes_FromString(grib_get_error_message(__pyx_v_err)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1277; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_4));
      __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1277; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_9);
      PyTuple_SET_ITEM(__pyx_t_9, 0, ((PyObject *)__pyx_t_4));
      __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
      __pyx_t_4 = 0;
      __pyx_t_4 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1277; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 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 = 1277; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L20;
    }
    __pyx_L20:;

    /* "pygrib.pyx":1278
 *             if err:
 *                 raise RuntimeError(grib_get_error_message(err))
 *             msg = strdata.decode(default_encoding)             # <<<<<<<<<<<<<<
 *             return msg.rstrip()
 *         else:
 */
    __pyx_t_4 = __Pyx_PyBytes_FromString(__pyx_v_strdata); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1278; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_t_4), __pyx_n_s__decode); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1278; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s__default_encoding); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1278; __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 = 1278; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    __pyx_t_4 = 0;
    __pyx_t_4 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1278; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
    __pyx_v_msg = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "pygrib.pyx":1279
 *                 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_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_msg, __pyx_n_s__rstrip); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1279; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1279; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;
    goto __pyx_L8;
  }
  /*else*/ {

    /* "pygrib.pyx":1281
 *             return msg.rstrip()
 *         else:
 *             raise ValueError("unrecognized grib type % d" % typ)             # <<<<<<<<<<<<<<
 *     def has_key(self,key):
 *         """
 */
    __pyx_t_1 = PyInt_FromLong(__pyx_v_typ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1281; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_106), __pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1281; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1281; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_4));
    __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
    __pyx_t_4 = 0;
    __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1281; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(((PyObject *)__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 = 1281; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_L8:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_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;
}

/* 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));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pygrib.pyx":1282
 *         else:
 *             raise ValueError("unrecognized grib type % d" % typ)
 *     def has_key(self,key):             # <<<<<<<<<<<<<<
 *         """
 *         has_key(key)
 */

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;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("has_key", 0);

  /* "pygrib.pyx":1288
 *         tests whether a grib message object has a specified key.
 *         """
 *         return key in self._all_keys             # <<<<<<<<<<<<<<
 *     def valid_key(self,key):
 *         """
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = (__Pyx_PySequence_Contains(__pyx_v_key, __pyx_v_self->_all_keys, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1288; __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 = 1288; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __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;
}

/* 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));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pygrib.pyx":1289
 *         """
 *         return key in self._all_keys
 *     def valid_key(self,key):             # <<<<<<<<<<<<<<
 *         """
 *         valid_key(key)
 */

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;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("valid_key", 0);

  /* "pygrib.pyx":1296
 *         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_Contains(__pyx_v_key, __pyx_v_self->_all_keys, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1296; __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 = 1296; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_ret = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "pygrib.pyx":1298
 *         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_1 = __Pyx_PyObject_IsTrue(__pyx_v_ret); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1298; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_1) {
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__is_missing); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1298; __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 = 1298; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v_key);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_key);
    __Pyx_GIVEREF(__pyx_v_key);
    __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1298; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1298; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_6 = __pyx_t_5;
  } else {
    __pyx_t_6 = __pyx_t_1;
  }
  if (__pyx_t_6) {
    __pyx_t_4 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1298; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF_SET(__pyx_v_ret, __pyx_t_4);
    __pyx_t_4 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "pygrib.pyx":1299
 *         # 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_6 = __Pyx_PyObject_IsTrue(__pyx_v_ret); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1299; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_6) {

    /* "pygrib.pyx":1300
 *         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":1301
 *         if ret:
 *             try:
 *                 self[key]             # <<<<<<<<<<<<<<
 *             except:
 *                 ret = False
 */
        __pyx_t_4 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_key); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1301; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      }
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      goto __pyx_L12_try_end;
      __pyx_L5_error:;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;

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

        /* "pygrib.pyx":1303
 *                 self[key]
 *             except:
 *                 ret = False             # <<<<<<<<<<<<<<
 *         return ret
 *     def tostring(self):
 */
        __pyx_t_10 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1303; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
        __Pyx_GOTREF(__pyx_t_10);
        __Pyx_DECREF_SET(__pyx_v_ret, __pyx_t_10);
        __pyx_t_10 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        goto __pyx_L6_exception_handled;
      }
      __pyx_L7_except_error:;
      __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_L6_exception_handled:;
      __Pyx_XGIVEREF(__pyx_t_7);
      __Pyx_XGIVEREF(__pyx_t_8);
      __Pyx_XGIVEREF(__pyx_t_9);
      __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9);
      __pyx_L12_try_end:;
    }
    goto __pyx_L4;
  }
  __pyx_L4:;

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

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_10);
  __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;
}

/* 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));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pygrib.pyx":1305
 *                 ret = False
 *         return ret
 *     def tostring(self):             # <<<<<<<<<<<<<<
 *         """
 *         tostring()
 */

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":1316
 *         cdef char *name
 *         cdef FILE *out
 *         bytestr = b'values'             # <<<<<<<<<<<<<<
 *         name = bytestr
 *         usenceplib = self.packingType.startswith('grid_complex')
 */
  __Pyx_INCREF(((PyObject *)__pyx_n_b__values));
  __pyx_v_bytestr = __pyx_n_b__values;

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

  /* "pygrib.pyx":1318
 *         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 = 1318; __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 = 1318; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_k_tuple_111), NULL); 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_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_usenceplib = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "pygrib.pyx":1320
 *         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 = 1320; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_4) {

    /* "pygrib.pyx":1321
 *         # 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 = 1321; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = __Pyx_PyInt_AsSize_t(__pyx_t_2); if (unlikely((__pyx_t_5 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1321; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_size = __pyx_t_5;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "pygrib.pyx":1323
 *             size = self.numberOfValues
 *         else:
 *             err = grib_get_size(self._gh, name, &size)             # <<<<<<<<<<<<<<
 *             if err:
 *                 raise RuntimeError(grib_get_error_message(err))
 */
    __pyx_v_err = grib_get_size(__pyx_v_self->_gh, __pyx_v_name, (&__pyx_v_size));

    /* "pygrib.pyx":1324
 *         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":1325
 *             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 = 1325; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__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);
      PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_2));
      __Pyx_GIVEREF(((PyObject *)__pyx_t_2));
      __pyx_t_2 = 0;
      __pyx_t_2 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__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(((PyObject *)__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;}
      goto __pyx_L4;
    }
    __pyx_L4:;
  }
  __pyx_L3:;

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

  /* "pygrib.pyx":1329
 *         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 = 1329; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_msg = __pyx_t_2;
  __pyx_t_2 = 0;

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

  __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.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;
}

/* 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));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pygrib.pyx":1331
 *         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:
 */

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;
  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":1333
 *     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 = 1333; __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 = 1333; __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 = 1333; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_3) {

    /* "pygrib.pyx":1334
 *         """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 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_113), NULL); 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_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1334; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "pygrib.pyx":1336
 *             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_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__ma); 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_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__isMA); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1336; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1336; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_datarr);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_datarr);
  __Pyx_GIVEREF(__pyx_v_datarr);
  __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); 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_1); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__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 = 1336; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__pyx_t_3) {

    /* "pygrib.pyx":1337
 *         # 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 = 1337; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_2 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); 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_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF_SET(__pyx_v_datarr, __pyx_t_2);
    __pyx_t_2 = 0;
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "pygrib.pyx":1339
 *             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), ((PyObject *)__pyx_n_s__gridType)); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1339; __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 = 1339; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_k_tuple_114), NULL); 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":1340
 *         # 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 = 1340; __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 = 1340; __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 = 1340; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (__pyx_t_3) {

      /* "pygrib.pyx":1341
 *         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 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_116), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1341; __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 = 1341; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L6;
    }
    __pyx_L6:;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "pygrib.pyx":1342
 *             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 = 1342; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_2 = PyObject_RichCompare(__pyx_t_4, __pyx_int_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1342; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __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 = 1342; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_3) {

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

      /* "pygrib.pyx":1355
 *             # (flip every other row)
 *             if self['alternativeRowScanning']:
 *                 datsave = datarr.copy()             # <<<<<<<<<<<<<<
 *                 datarr[1::2,::-1] = datsave[1::2,:]
 *         return datarr
 */
      __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 = 1355; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1355; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_v_datsave = __pyx_t_4;
      __pyx_t_4 = 0;

      /* "pygrib.pyx":1356
 *             if self['alternativeRowScanning']:
 *                 datsave = datarr.copy()
 *                 datarr[1::2,::-1] = datsave[1::2,:]             # <<<<<<<<<<<<<<
 *         return datarr
 *     def _reshape_mask(self, datarr):
 */
      __pyx_t_4 = PyObject_GetItem(__pyx_v_datsave, ((PyObject *)__pyx_k_tuple_120)); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      if (PyObject_SetItem(__pyx_v_datarr, ((PyObject *)__pyx_k_tuple_123), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      goto __pyx_L8;
    }
    __pyx_L8:;
    goto __pyx_L7;
  }
  __pyx_L7:;

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

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

/* 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));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pygrib.pyx":1358
 *                 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
 */

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;
  int __pyx_t_10;
  int __pyx_t_11;
  int __pyx_t_12;
  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":1361
 *         """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 = 1361; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_n_s___redtoreg));
  PyList_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_n_s___redtoreg));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s___redtoreg));
  __pyx_t_2 = __Pyx_Import(((PyObject *)__pyx_n_s__redtoreg), ((PyObject *)__pyx_t_1), -1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1361; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s___redtoreg); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1361; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_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":1362
 *         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 = 1362; __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 = 1362; __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 = 1362; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_3) {

    /* "pygrib.pyx":1363
 *         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 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_124), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1363; __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 = 1363; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L3;
  }
  __pyx_L3:;

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

    /* "pygrib.pyx":1366
 *         # 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":1367
 *         if self['gridType'].startswith('reduced'):
 *             try:
 *                 ny = self['Ny']             # <<<<<<<<<<<<<<
 *             except:
 *                 ny = self['Nj']
 */
        __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_n_s__Ny)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1367; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_v_ny = __pyx_t_1;
        __pyx_t_1 = 0;
      }
      __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":1368
 *             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 = 1368; __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":1369
 *                 ny = self['Ny']
 *             except:
 *                 ny = self['Nj']             # <<<<<<<<<<<<<<
 *             if self.has_key('missingValue'):
 *                 missval = self['missingValue']
 */
        __pyx_t_8 = PyObject_GetItem(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_n_s__Nj)); if (!__pyx_t_8) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1369; __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:;
      __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":1370
 *             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 = 1370; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_2 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_k_tuple_126), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1370; __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 = 1370; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__pyx_t_3) {

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

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

    /* "pygrib.pyx":1374
 *             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 = 1374; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (__pyx_t_3) {

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

      /* "pygrib.pyx":1376
 *             if self.expand_reduced:
 *                 nx = 2*ny
 *                 datarr = _redtoreg(2*ny, self['pl'], datarr, missval)             # <<<<<<<<<<<<<<
 *             else:
 *                 nx = None
 */
      __pyx_t_2 = PyNumber_Multiply(__pyx_int_2, __pyx_v_ny); 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_7 = PyObject_GetItem(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_n_s__pl)); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1376; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_1 = PyFloat_FromDouble(__pyx_v_missval); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1376; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_8 = PyTuple_New(4); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1376; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_7);
      __Pyx_GIVEREF(__pyx_t_7);
      __Pyx_INCREF(__pyx_v_datarr);
      PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_v_datarr);
      __Pyx_GIVEREF(__pyx_v_datarr);
      PyTuple_SET_ITEM(__pyx_t_8, 3, __pyx_t_1);
      __Pyx_GIVEREF(__pyx_t_1);
      __pyx_t_2 = 0;
      __pyx_t_7 = 0;
      __pyx_t_1 = 0;
      __pyx_t_1 = PyObject_Call(__pyx_v__redtoreg, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1376; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
      __Pyx_DECREF_SET(__pyx_v_datarr, __pyx_t_1);
      __pyx_t_1 = 0;
      goto __pyx_L16;
    }
    /*else*/ {

      /* "pygrib.pyx":1378
 *                 datarr = _redtoreg(2*ny, self['pl'], datarr, missval)
 *             else:
 *                 nx = None             # <<<<<<<<<<<<<<
 *         elif self.has_key('Nx') and self.has_key('Ny'):
 *             nx = self['Nx']
 */
      __Pyx_INCREF(Py_None);
      __pyx_v_nx = Py_None;
    }
    __pyx_L16:;
    goto __pyx_L4;
  }

  /* "pygrib.pyx":1379
 *             else:
 *                 nx = None
 *         elif self.has_key('Nx') and self.has_key('Ny'):             # <<<<<<<<<<<<<<
 *             nx = self['Nx']
 *             ny = self['Ny']
 */
  __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 = 1379; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_8 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_127), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1379; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1379; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  if (__pyx_t_3) {
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__has_key); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1379; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_1 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_k_tuple_128), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1379; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1379; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_11 = __pyx_t_10;
  } else {
    __pyx_t_11 = __pyx_t_3;
  }
  if (__pyx_t_11) {

    /* "pygrib.pyx":1380
 *                 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_1 = PyObject_GetItem(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_n_s__Nx)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1380; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_nx = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "pygrib.pyx":1381
 *         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_1 = PyObject_GetItem(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_n_s__Ny)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1381; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_ny = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L4;
  }

  /* "pygrib.pyx":1383
 *             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_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 = 1383; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_8 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_129), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1383; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1383; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  if (__pyx_t_11) {
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__has_key); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1383; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_1 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_k_tuple_130), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1383; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1383; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_10 = __pyx_t_3;
  } else {
    __pyx_t_10 = __pyx_t_11;
  }
  if (__pyx_t_10) {

    /* "pygrib.pyx":1384
 *         # 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_1 = PyObject_GetItem(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_n_s__Ni)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1384; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_nx = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "pygrib.pyx":1385
 *         elif self.has_key('Ni') and self.has_key('Nj'):
 *             nx = self['Ni']
 *             ny = self['Nj']             # <<<<<<<<<<<<<<
 *         else: # probably spectral data.
 *             return datarr
 */
    __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_n_s__Nj)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1385; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_ny = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L4;
  }
  /*else*/ {

    /* "pygrib.pyx":1387
 *             ny = self['Nj']
 *         else: # probably spectral data.
 *             return datarr             # <<<<<<<<<<<<<<
 *         if ny != GRIB_MISSING_LONG and nx != GRIB_MISSING_LONG and\
 *            self.expand_reduced:
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_datarr);
    __pyx_r = __pyx_v_datarr;
    goto __pyx_L0;
  }
  __pyx_L4:;

  /* "pygrib.pyx":1388
 *         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_1 = PyInt_FromLong(GRIB_MISSING_LONG); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1388; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_8 = PyObject_RichCompare(__pyx_v_ny, __pyx_t_1, Py_NE); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1388; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1388; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  if (__pyx_t_10) {
    __pyx_t_8 = PyInt_FromLong(GRIB_MISSING_LONG); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1388; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_1 = PyObject_RichCompare(__pyx_v_nx, __pyx_t_8, Py_NE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1388; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1388; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (__pyx_t_11) {

      /* "pygrib.pyx":1389
 *             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_3 = __Pyx_PyObject_IsTrue(__pyx_v_self->expand_reduced); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1389; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_12 = __pyx_t_3;
    } else {
      __pyx_t_12 = __pyx_t_11;
    }
    __pyx_t_11 = __pyx_t_12;
  } else {
    __pyx_t_11 = __pyx_t_10;
  }
  if (__pyx_t_11) {

    /* "pygrib.pyx":1390
 *         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_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1390; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_v_ny);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_ny);
    __Pyx_GIVEREF(__pyx_v_ny);
    __Pyx_INCREF(__pyx_v_nx);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_nx);
    __Pyx_GIVEREF(__pyx_v_nx);
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_datarr, __pyx_n_s__shape, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1390; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
    goto __pyx_L17;
  }
  __pyx_L17:;

  /* "pygrib.pyx":1392
 *             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_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_datarr, __pyx_n_s__ndim); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1392; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_8 = PyObject_RichCompare(__pyx_t_1, __pyx_int_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1392; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1392; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  if (__pyx_t_11) {

    /* "pygrib.pyx":1403
 *            # 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_8 = PyObject_GetItem(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_n_s_117)); if (!__pyx_t_8) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1403; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1403; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    if (__pyx_t_11) {

      /* "pygrib.pyx":1404
 *            # (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_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_datarr, __pyx_n_s__copy); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1404; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_1 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1404; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_v_datsave = __pyx_t_1;
      __pyx_t_1 = 0;

      /* "pygrib.pyx":1405
 *            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_1 = PyObject_GetItem(__pyx_v_datsave, ((PyObject *)__pyx_k_tuple_133)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1405; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      if (PyObject_SetItem(__pyx_v_datarr, ((PyObject *)__pyx_k_tuple_136), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1405; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L19;
    }
    __pyx_L19:;

    /* "pygrib.pyx":1408
 *            # 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_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 = 1408; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_8 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_137), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1408; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1408; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    if (__pyx_t_11) {
      __pyx_t_8 = PyObject_GetItem(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_n_s__numberOfMissing)); if (!__pyx_t_8) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1408; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1408; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_12 = __pyx_t_10;
    } else {
      __pyx_t_12 = __pyx_t_11;
    }
    if (__pyx_t_12) {

      /* "pygrib.pyx":1409
 *            # create a masked array.
 *            if self.has_key('missingValue') and self['numberOfMissing']:
 *                datarr = ma.masked_values(datarr, self['missingValue'])             # <<<<<<<<<<<<<<
 *         return datarr
 * 
 */
      __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s__ma); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1409; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s__masked_values); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1409; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_8 = PyObject_GetItem(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_n_s__missingValue)); if (!__pyx_t_8) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1409; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1409; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_INCREF(__pyx_v_datarr);
      PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_datarr);
      __Pyx_GIVEREF(__pyx_v_datarr);
      PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_8);
      __Pyx_GIVEREF(__pyx_t_8);
      __pyx_t_8 = 0;
      __pyx_t_8 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1409; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
      __Pyx_DECREF_SET(__pyx_v_datarr, __pyx_t_8);
      __pyx_t_8 = 0;
      goto __pyx_L20;
    }
    __pyx_L20:;
    goto __pyx_L18;
  }
  __pyx_L18:;

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

  __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_7);
  __Pyx_XDECREF(__pyx_t_8);
  __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;
}

/* 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));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pygrib.pyx":1412
 *         return datarr
 * 
 *     def _set_projparams(self):             # <<<<<<<<<<<<<<
 *         """
 *         sets the C{projparams} instance variable to a dictionary containing
 */

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;
  double __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_set_projparams", 0);

  /* "pygrib.pyx":1417
 *         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 = 1417; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __pyx_v_projparams = ((PyObject *)__pyx_t_1);
  __pyx_t_1 = 0;

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

    /* "pygrib.pyx":1422
 *         # 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), ((PyObject *)__pyx_n_s__radius)); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1422; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    if (PyObject_SetItem(__pyx_v_projparams, ((PyObject *)__pyx_n_s__a), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1422; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "pygrib.pyx":1423
 *         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), ((PyObject *)__pyx_n_s__radius)); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1423; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    if (PyObject_SetItem(__pyx_v_projparams, ((PyObject *)__pyx_n_s__b), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1423; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "pygrib.pyx":1425
 *             projparams['b'] = self['radius']
 *         else:
 *             if self['shapeOfTheEarth'] == 6:             # <<<<<<<<<<<<<<
 *                 projparams['a']=6371229.0
 *                 projparams['b']=6371229.0
 */
    __pyx_t_2 = PyObject_GetItem(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_n_s__shapeOfTheEarth)); if (!__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_1 = PyObject_RichCompare(__pyx_t_2, __pyx_int_6, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__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_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1425; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (__pyx_t_3) {

      /* "pygrib.pyx":1426
 *         else:
 *             if self['shapeOfTheEarth'] == 6:
 *                 projparams['a']=6371229.0             # <<<<<<<<<<<<<<
 *                 projparams['b']=6371229.0
 *             elif self['shapeOfTheEarth'] in [3,7]:
 */
      __pyx_t_1 = PyFloat_FromDouble(6371229.0); 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);
      if (PyObject_SetItem(__pyx_v_projparams, ((PyObject *)__pyx_n_s__a), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1426; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "pygrib.pyx":1427
 *             if self['shapeOfTheEarth'] == 6:
 *                 projparams['a']=6371229.0
 *                 projparams['b']=6371229.0             # <<<<<<<<<<<<<<
 *             elif self['shapeOfTheEarth'] in [3,7]:
 *                 if self.has_key('scaleFactorOfMajorAxisOfOblateSpheroidEarth'):
 */
      __pyx_t_1 = PyFloat_FromDouble(6371229.0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1427; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      if (PyObject_SetItem(__pyx_v_projparams, ((PyObject *)__pyx_n_s__b), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1427; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L4;
    }

    /* "pygrib.pyx":1428
 *                 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), ((PyObject *)__pyx_n_s__shapeOfTheEarth)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1428; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_int_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1428; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1428; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (!((int)__pyx_t_3)) {
      __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_int_7, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1428; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1428; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_5 = ((int)__pyx_t_4);
    } else {
      __pyx_t_5 = ((int)__pyx_t_3);
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_3 = (__pyx_t_5 != 0);
    if (__pyx_t_3) {

      /* "pygrib.pyx":1429
 *                 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 = 1429; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_140), NULL); 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_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 = 1429; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (__pyx_t_3) {

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

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

        /* "pygrib.pyx":1432
 *                     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 = 1432; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        if (__pyx_t_3) {
          __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__missingvalue_int); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1432; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_5 = (__pyx_v_scalea != __pyx_t_2);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __pyx_t_4 = __pyx_t_5;
        } else {
          __pyx_t_4 = __pyx_t_3;
        }
        if (__pyx_t_4) {

          /* "pygrib.pyx":1433
 *                     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_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1433; __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 = 1433; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __pyx_t_2 = PyFloat_FromDouble(10.0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1433; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_6 = PyNumber_Negative(__pyx_v_scalea); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1433; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_6);
          __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1433; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_7);
          PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_2);
          __Pyx_GIVEREF(__pyx_t_2);
          PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_6);
          __Pyx_GIVEREF(__pyx_t_6);
          __pyx_t_2 = 0;
          __pyx_t_6 = 0;
          __pyx_t_6 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1433; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_6);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
          __Pyx_DECREF_SET(__pyx_v_scalea, __pyx_t_6);
          __pyx_t_6 = 0;

          /* "pygrib.pyx":1434
 *                     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_6 = PyObject_GetItem(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_n_s__shapeOfTheEarth)); if (!__pyx_t_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1434; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_6);
          __pyx_t_7 = PyObject_RichCompare(__pyx_t_6, __pyx_int_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1434; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __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 = 1434; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          if (__pyx_t_4) {

            /* "pygrib.pyx":1435
 *                         scalea = np.power(10.0,-scalea)
 *                         if self['shapeOfTheEarth'] == 3: # radius in km
 *                             scalea = 1000.*scalea             # <<<<<<<<<<<<<<
 *                     else:
 *                         scalea = 1
 */
            __pyx_t_7 = PyFloat_FromDouble(1000.); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1435; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            __Pyx_GOTREF(__pyx_t_7);
            __pyx_t_6 = PyNumber_Multiply(__pyx_t_7, __pyx_v_scalea); 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_DECREF(__pyx_t_7); __pyx_t_7 = 0;
            __Pyx_DECREF_SET(__pyx_v_scalea, __pyx_t_6);
            __pyx_t_6 = 0;
            goto __pyx_L7;
          }
          __pyx_L7:;
          goto __pyx_L6;
        }
        /*else*/ {

          /* "pygrib.pyx":1437
 *                             scalea = 1000.*scalea
 *                     else:
 *                         scalea = 1             # <<<<<<<<<<<<<<
 *                     if scaleb and scaleb is not missingvalue_int:
 *                         scaleb = np.power(10.0,-scaleb)
 */
          __Pyx_INCREF(__pyx_int_1);
          __Pyx_DECREF_SET(__pyx_v_scalea, __pyx_int_1);
        }
        __pyx_L6:;

        /* "pygrib.pyx":1438
 *                     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_4 = __Pyx_PyObject_IsTrue(__pyx_v_scaleb); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1438; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        if (__pyx_t_4) {
          __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s__missingvalue_int); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1438; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_6);
          __pyx_t_3 = (__pyx_v_scaleb != __pyx_t_6);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __pyx_t_5 = __pyx_t_3;
        } else {
          __pyx_t_5 = __pyx_t_4;
        }
        if (__pyx_t_5) {

          /* "pygrib.pyx":1439
 *                         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_6 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1439; __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 = 1439; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __pyx_t_6 = PyFloat_FromDouble(10.0); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1439; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_6);
          __pyx_t_1 = PyNumber_Negative(__pyx_v_scaleb); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1439; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_1);
          __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1439; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_2);
          PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_6);
          __Pyx_GIVEREF(__pyx_t_6);
          PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1);
          __Pyx_GIVEREF(__pyx_t_1);
          __pyx_t_6 = 0;
          __pyx_t_1 = 0;
          __pyx_t_1 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1439; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
          __Pyx_DECREF_SET(__pyx_v_scaleb, __pyx_t_1);
          __pyx_t_1 = 0;

          /* "pygrib.pyx":1440
 *                     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_1 = PyObject_GetItem(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_n_s__shapeOfTheEarth)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1440; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_1);
          __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_int_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1440; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1440; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          if (__pyx_t_5) {

            /* "pygrib.pyx":1441
 *                         scaleb = np.power(10.0,-scaleb)
 *                         if self['shapeOfTheEarth'] == 3: # radius in km
 *                             scaleb = 1000.*scaleb             # <<<<<<<<<<<<<<
 *                     else:
 *                         scaleb = 1.
 */
            __pyx_t_2 = PyFloat_FromDouble(1000.); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1441; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            __Pyx_GOTREF(__pyx_t_2);
            __pyx_t_1 = PyNumber_Multiply(__pyx_t_2, __pyx_v_scaleb); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1441; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            __Pyx_GOTREF(__pyx_t_1);
            __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
            __Pyx_DECREF_SET(__pyx_v_scaleb, __pyx_t_1);
            __pyx_t_1 = 0;
            goto __pyx_L9;
          }
          __pyx_L9:;
          goto __pyx_L8;
        }
        /*else*/ {

          /* "pygrib.pyx":1443
 *                             scaleb = 1000.*scaleb
 *                     else:
 *                         scaleb = 1.             # <<<<<<<<<<<<<<
 *                 else:
 *                     scalea = 1.
 */
          __pyx_t_1 = PyFloat_FromDouble(1.); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1443; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF_SET(__pyx_v_scaleb, __pyx_t_1);
          __pyx_t_1 = 0;
        }
        __pyx_L8:;
        goto __pyx_L5;
      }
      /*else*/ {

        /* "pygrib.pyx":1445
 *                         scaleb = 1.
 *                 else:
 *                     scalea = 1.             # <<<<<<<<<<<<<<
 *                     scaleb = 1.
 *                 if grib_api_version < 10900:
 */
        __pyx_t_1 = PyFloat_FromDouble(1.); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1445; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_v_scalea = __pyx_t_1;
        __pyx_t_1 = 0;

        /* "pygrib.pyx":1446
 *                 else:
 *                     scalea = 1.
 *                     scaleb = 1.             # <<<<<<<<<<<<<<
 *                 if grib_api_version < 10900:
 *                     projparams['a']=self['scaledValueOfMajorAxisOfOblateSpheroidEarth']*scalea
 */
        __pyx_t_1 = PyFloat_FromDouble(1.); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1446; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_v_scaleb = __pyx_t_1;
        __pyx_t_1 = 0;
      }
      __pyx_L5:;

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

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

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

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

        /* "pygrib.pyx":1452
 *                 else:
 *                     projparams['a']=self['scaledValueOfEarthMajorAxis']*scalea
 *                     projparams['b']=self['scaledValueOfEarthMinorAxis']*scaleb             # <<<<<<<<<<<<<<
 *             elif self['shapeOfTheEarth'] == 2:
 *                 projparams['a']=6378160.0
 */
        __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_n_s_145)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1452; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_2 = PyNumber_Multiply(__pyx_t_1, __pyx_v_scaleb); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1452; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        if (PyObject_SetItem(__pyx_v_projparams, ((PyObject *)__pyx_n_s__b), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1452; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      }
      __pyx_L10:;
      goto __pyx_L4;
    }

    /* "pygrib.pyx":1453
 *                     projparams['a']=self['scaledValueOfEarthMajorAxis']*scalea
 *                     projparams['b']=self['scaledValueOfEarthMinorAxis']*scaleb
 *             elif self['shapeOfTheEarth'] == 2:             # <<<<<<<<<<<<<<
 *                 projparams['a']=6378160.0
 *                 projparams['b']=6356775.0
 */
    __pyx_t_2 = PyObject_GetItem(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_n_s__shapeOfTheEarth)); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1453; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, __pyx_int_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1453; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __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 = 1453; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (__pyx_t_5) {

      /* "pygrib.pyx":1454
 *                     projparams['b']=self['scaledValueOfEarthMinorAxis']*scaleb
 *             elif self['shapeOfTheEarth'] == 2:
 *                 projparams['a']=6378160.0             # <<<<<<<<<<<<<<
 *                 projparams['b']=6356775.0
 *             elif self['shapeOfTheEarth'] == 1:
 */
      __pyx_t_1 = PyFloat_FromDouble(6378160.0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1454; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      if (PyObject_SetItem(__pyx_v_projparams, ((PyObject *)__pyx_n_s__a), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1454; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "pygrib.pyx":1455
 *             elif self['shapeOfTheEarth'] == 2:
 *                 projparams['a']=6378160.0
 *                 projparams['b']=6356775.0             # <<<<<<<<<<<<<<
 *             elif self['shapeOfTheEarth'] == 1:
 *                 if self.has_key('scaleFactorOfRadiusOfSphericalEarth'):
 */
      __pyx_t_1 = PyFloat_FromDouble(6356775.0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1455; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      if (PyObject_SetItem(__pyx_v_projparams, ((PyObject *)__pyx_n_s__b), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1455; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L4;
    }

    /* "pygrib.pyx":1456
 *                 projparams['a']=6378160.0
 *                 projparams['b']=6356775.0
 *             elif self['shapeOfTheEarth'] == 1:             # <<<<<<<<<<<<<<
 *                 if self.has_key('scaleFactorOfRadiusOfSphericalEarth'):
 *                     scalea = self['scaleFactorOfRadiusOfSphericalEarth']
 */
    __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_n_s__shapeOfTheEarth)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1456; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_int_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1456; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1456; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__pyx_t_5) {

      /* "pygrib.pyx":1457
 *                 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_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 = 1457; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_147), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1457; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_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 = 1457; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (__pyx_t_5) {

        /* "pygrib.pyx":1458
 *             elif self['shapeOfTheEarth'] == 1:
 *                 if self.has_key('scaleFactorOfRadiusOfSphericalEarth'):
 *                     scalea = self['scaleFactorOfRadiusOfSphericalEarth']             # <<<<<<<<<<<<<<
 *                     if scalea and scalea is not missingvalue_int:
 *                         scalea = np.power(10.0,-scalea)
 */
        __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_n_s_146)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1458; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_v_scalea = __pyx_t_1;
        __pyx_t_1 = 0;

        /* "pygrib.pyx":1459
 *                 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_5 = __Pyx_PyObject_IsTrue(__pyx_v_scalea); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1459; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        if (__pyx_t_5) {
          __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__missingvalue_int); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1459; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_1);
          __pyx_t_4 = (__pyx_v_scalea != __pyx_t_1);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __pyx_t_3 = __pyx_t_4;
        } else {
          __pyx_t_3 = __pyx_t_5;
        }
        if (__pyx_t_3) {

          /* "pygrib.pyx":1460
 *                     scalea = self['scaleFactorOfRadiusOfSphericalEarth']
 *                     if scalea and scalea is not missingvalue_int:
 *                         scalea = np.power(10.0,-scalea)             # <<<<<<<<<<<<<<
 *                     else:
 *                         scalea = 1
 */
          __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1460; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_1);
          __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__power); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1460; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __pyx_t_1 = PyFloat_FromDouble(10.0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1460; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_1);
          __pyx_t_7 = PyNumber_Negative(__pyx_v_scalea); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1460; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_7);
          __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1460; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_6);
          PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_1);
          __Pyx_GIVEREF(__pyx_t_1);
          PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_7);
          __Pyx_GIVEREF(__pyx_t_7);
          __pyx_t_1 = 0;
          __pyx_t_7 = 0;
          __pyx_t_7 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1460; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
          __Pyx_DECREF_SET(__pyx_v_scalea, __pyx_t_7);
          __pyx_t_7 = 0;
          goto __pyx_L12;
        }
        /*else*/ {

          /* "pygrib.pyx":1462
 *                         scalea = np.power(10.0,-scalea)
 *                     else:
 *                         scalea = 1             # <<<<<<<<<<<<<<
 *                     scaleb = scalea
 *                 else:
 */
          __Pyx_INCREF(__pyx_int_1);
          __Pyx_DECREF_SET(__pyx_v_scalea, __pyx_int_1);
        }
        __pyx_L12:;

        /* "pygrib.pyx":1463
 *                     else:
 *                         scalea = 1
 *                     scaleb = scalea             # <<<<<<<<<<<<<<
 *                 else:
 *                     scalea = 1.
 */
        __Pyx_INCREF(__pyx_v_scalea);
        __pyx_v_scaleb = __pyx_v_scalea;
        goto __pyx_L11;
      }
      /*else*/ {

        /* "pygrib.pyx":1465
 *                     scaleb = scalea
 *                 else:
 *                     scalea = 1.             # <<<<<<<<<<<<<<
 *                     scaleb = 1.
 *                 projparams['a']=self['scaledValueOfRadiusOfSphericalEarth']*scalea
 */
        __pyx_t_7 = PyFloat_FromDouble(1.); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1465; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_v_scalea = __pyx_t_7;
        __pyx_t_7 = 0;

        /* "pygrib.pyx":1466
 *                 else:
 *                     scalea = 1.
 *                     scaleb = 1.             # <<<<<<<<<<<<<<
 *                 projparams['a']=self['scaledValueOfRadiusOfSphericalEarth']*scalea
 *                 projparams['b']=self['scaledValueOfRadiusOfSphericalEarth']*scaleb
 */
        __pyx_t_7 = PyFloat_FromDouble(1.); 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_v_scaleb = __pyx_t_7;
        __pyx_t_7 = 0;
      }
      __pyx_L11:;

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

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

    /* "pygrib.pyx":1469
 *                 projparams['a']=self['scaledValueOfRadiusOfSphericalEarth']*scalea
 *                 projparams['b']=self['scaledValueOfRadiusOfSphericalEarth']*scaleb
 *             elif self['shapeOfTheEarth'] == 0:             # <<<<<<<<<<<<<<
 *                 projparams['a']=6367470.0
 *                 projparams['b']=6367470.0
 */
    __pyx_t_7 = PyObject_GetItem(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_n_s__shapeOfTheEarth)); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_6 = PyObject_RichCompare(__pyx_t_7, __pyx_int_0, Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (__pyx_t_3) {

      /* "pygrib.pyx":1470
 *                 projparams['b']=self['scaledValueOfRadiusOfSphericalEarth']*scaleb
 *             elif self['shapeOfTheEarth'] == 0:
 *                 projparams['a']=6367470.0             # <<<<<<<<<<<<<<
 *                 projparams['b']=6367470.0
 *             elif self['shapeOfTheEarth'] == 5: # WGS84
 */
      __pyx_t_6 = PyFloat_FromDouble(6367470.0); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1470; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      if (PyObject_SetItem(__pyx_v_projparams, ((PyObject *)__pyx_n_s__a), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1470; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

      /* "pygrib.pyx":1471
 *             elif self['shapeOfTheEarth'] == 0:
 *                 projparams['a']=6367470.0
 *                 projparams['b']=6367470.0             # <<<<<<<<<<<<<<
 *             elif self['shapeOfTheEarth'] == 5: # WGS84
 *                 projparams['a']=6378137.0
 */
      __pyx_t_6 = PyFloat_FromDouble(6367470.0); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1471; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      if (PyObject_SetItem(__pyx_v_projparams, ((PyObject *)__pyx_n_s__b), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1471; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      goto __pyx_L4;
    }

    /* "pygrib.pyx":1472
 *                 projparams['a']=6367470.0
 *                 projparams['b']=6367470.0
 *             elif self['shapeOfTheEarth'] == 5: # WGS84             # <<<<<<<<<<<<<<
 *                 projparams['a']=6378137.0
 *                 projparams['b']=6356752.3142
 */
    __pyx_t_6 = PyObject_GetItem(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_n_s__shapeOfTheEarth)); if (!__pyx_t_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1472; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = PyObject_RichCompare(__pyx_t_6, __pyx_int_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1472; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_3 < 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_3) {

      /* "pygrib.pyx":1473
 *                 projparams['b']=6367470.0
 *             elif self['shapeOfTheEarth'] == 5: # WGS84
 *                 projparams['a']=6378137.0             # <<<<<<<<<<<<<<
 *                 projparams['b']=6356752.3142
 *             elif self['shapeOfTheEarth'] == 8:
 */
      __pyx_t_7 = PyFloat_FromDouble(6378137.0); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1473; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      if (PyObject_SetItem(__pyx_v_projparams, ((PyObject *)__pyx_n_s__a), __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1473; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

      /* "pygrib.pyx":1474
 *             elif self['shapeOfTheEarth'] == 5: # WGS84
 *                 projparams['a']=6378137.0
 *                 projparams['b']=6356752.3142             # <<<<<<<<<<<<<<
 *             elif self['shapeOfTheEarth'] == 8:
 *                 projparams['a']=6371200.0
 */
      __pyx_t_7 = PyFloat_FromDouble(6356752.3142); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1474; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      if (PyObject_SetItem(__pyx_v_projparams, ((PyObject *)__pyx_n_s__b), __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1474; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L4;
    }

    /* "pygrib.pyx":1475
 *                 projparams['a']=6378137.0
 *                 projparams['b']=6356752.3142
 *             elif self['shapeOfTheEarth'] == 8:             # <<<<<<<<<<<<<<
 *                 projparams['a']=6371200.0
 *                 projparams['b']=6371200.0
 */
    __pyx_t_7 = PyObject_GetItem(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_n_s__shapeOfTheEarth)); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1475; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_6 = PyObject_RichCompare(__pyx_t_7, __pyx_int_8, Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1475; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1475; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (__pyx_t_3) {

      /* "pygrib.pyx":1476
 *                 projparams['b']=6356752.3142
 *             elif self['shapeOfTheEarth'] == 8:
 *                 projparams['a']=6371200.0             # <<<<<<<<<<<<<<
 *                 projparams['b']=6371200.0
 *             else:
 */
      __pyx_t_6 = PyFloat_FromDouble(6371200.0); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1476; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      if (PyObject_SetItem(__pyx_v_projparams, ((PyObject *)__pyx_n_s__a), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1476; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

      /* "pygrib.pyx":1477
 *             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')
 */
      __pyx_t_6 = PyFloat_FromDouble(6371200.0); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1477; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      if (PyObject_SetItem(__pyx_v_projparams, ((PyObject *)__pyx_n_s__b), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1477; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      goto __pyx_L4;
    }
    /*else*/ {

      /* "pygrib.pyx":1479
 *                 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_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s__tolerate_badgrib); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1479; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1479; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_5 = ((!__pyx_t_3) != 0);
      if (__pyx_t_5) {
        __pyx_t_6 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_150), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1479; __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 = 1479; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        goto __pyx_L13;
      }
      __pyx_L13:;
    }
    __pyx_L4:;
  }
  __pyx_L3:;

  /* "pygrib.pyx":1481
 *                 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_6 = PyObject_GetItem(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_n_s__gridType)); if (!__pyx_t_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1481; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = PyObject_RichCompare(__pyx_t_6, ((PyObject *)__pyx_n_s__reduced_gg), Py_EQ); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1481; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1481; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (!((int)__pyx_t_5)) {
    __pyx_t_7 = PyObject_RichCompare(__pyx_t_6, ((PyObject *)__pyx_n_s__reduced_ll), Py_EQ); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1481; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1481; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_4 = ((int)__pyx_t_3);
  } else {
    __pyx_t_4 = ((int)__pyx_t_5);
  }
  if (!__pyx_t_4) {
    __pyx_t_7 = PyObject_RichCompare(__pyx_t_6, ((PyObject *)__pyx_n_s__regular_gg), Py_EQ); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1481; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1481; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_3 = ((int)__pyx_t_5);
  } else {
    __pyx_t_3 = __pyx_t_4;
  }
  if (!__pyx_t_3) {
    __pyx_t_7 = PyObject_RichCompare(__pyx_t_6, ((PyObject *)__pyx_n_s__regular_ll), Py_EQ); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1481; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1481; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_5 = ((int)__pyx_t_4);
  } else {
    __pyx_t_5 = __pyx_t_3;
  }
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_3 = (__pyx_t_5 != 0);
  if (__pyx_t_3) {

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

  /* "pygrib.pyx":1483
 *         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_6 = PyObject_GetItem(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_n_s__gridType)); if (!__pyx_t_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1483; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = PyObject_RichCompare(__pyx_t_6, ((PyObject *)__pyx_n_s__polar_stereographic), Py_EQ); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1483; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1483; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (__pyx_t_3) {

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

    /* "pygrib.pyx":1485
 *         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), ((PyObject *)__pyx_n_s_151)); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1485; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    if (PyObject_SetItem(__pyx_v_projparams, ((PyObject *)__pyx_n_s__lat_ts), __pyx_t_7) < 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;

    /* "pygrib.pyx":1486
 *             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 = 1486; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_6 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_k_tuple_153), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1486; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1486; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (__pyx_t_3) {

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

    /* "pygrib.pyx":1488
 *             if self.has_key('projectionCentreFlag'):
 *                 projcenterflag = self['projectionCentreFlag']
 *             elif self.has_key('projectionCenterFlag'):             # <<<<<<<<<<<<<<
 *                 projcenterflag = self['projectionCenterFlag']
 *             else:
 */
    __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 = 1488; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_k_tuple_155), 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_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_3 < 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;
    if (__pyx_t_3) {

      /* "pygrib.pyx":1489
 *                 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), ((PyObject *)__pyx_n_s_154)); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1489; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_v_projcenterflag = __pyx_t_7;
      __pyx_t_7 = 0;
      goto __pyx_L15;
    }
    /*else*/ {

      /* "pygrib.pyx":1491
 *                 projcenterflag = self['projectionCenterFlag']
 *             else:
 *                 if not tolerate_badgrib: raise KeyError('cannot find projection center flag')             # <<<<<<<<<<<<<<
 *             if projcenterflag == 0:
 *                 projparams['lat_0']=90.
 */
      __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s__tolerate_badgrib); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1491; __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 = 1491; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_5 = ((!__pyx_t_3) != 0);
      if (__pyx_t_5) {
        __pyx_t_7 = PyObject_Call(__pyx_builtin_KeyError, ((PyObject *)__pyx_k_tuple_157), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1491; __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 = 1491; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        goto __pyx_L16;
      }
      __pyx_L16:;
    }
    __pyx_L15:;

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

      /* "pygrib.pyx":1493
 *                 if not tolerate_badgrib: raise KeyError('cannot find projection center flag')
 *             if projcenterflag == 0:
 *                 projparams['lat_0']=90.             # <<<<<<<<<<<<<<
 *             else:
 *                 projparams['lat_0']=-90.
 */
      __pyx_t_7 = PyFloat_FromDouble(90.); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1493; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      if (PyObject_SetItem(__pyx_v_projparams, ((PyObject *)__pyx_n_s__lat_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;
      goto __pyx_L17;
    }
    /*else*/ {

      /* "pygrib.pyx":1495
 *                 projparams['lat_0']=90.
 *             else:
 *                 projparams['lat_0']=-90.             # <<<<<<<<<<<<<<
 *             projparams['lon_0']=self['orientationOfTheGridInDegrees']
 *         elif self['gridType'] == 'lambert':
 */
      __pyx_t_7 = PyFloat_FromDouble(-90.); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1495; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      if (PyObject_SetItem(__pyx_v_projparams, ((PyObject *)__pyx_n_s__lat_0), __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1495; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    }
    __pyx_L17:;

    /* "pygrib.pyx":1496
 *             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), ((PyObject *)__pyx_n_s_158)); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1496; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    if (PyObject_SetItem(__pyx_v_projparams, ((PyObject *)__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;
    goto __pyx_L14;
  }

  /* "pygrib.pyx":1497
 *                 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), ((PyObject *)__pyx_n_s__gridType)); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1497; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_6 = PyObject_RichCompare(__pyx_t_7, ((PyObject *)__pyx_n_s__lambert), Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1497; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1497; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (__pyx_t_5) {

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

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

    /* "pygrib.pyx":1500
 *             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_6 = PyObject_GetItem(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_n_s__LaDInDegrees)); if (!__pyx_t_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1500; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    if (PyObject_SetItem(__pyx_v_projparams, ((PyObject *)__pyx_n_s__lat_0), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1500; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "pygrib.pyx":1501
 *             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_6 = PyObject_GetItem(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_n_s__Latin1InDegrees)); if (!__pyx_t_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1501; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    if (PyObject_SetItem(__pyx_v_projparams, ((PyObject *)__pyx_n_s__lat_1), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1501; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

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

  /* "pygrib.pyx":1503
 *             projparams['lat_1']=self['Latin1InDegrees']
 *             projparams['lat_2']=self['Latin2InDegrees']
 *         elif self['gridType'] =='albers':             # <<<<<<<<<<<<<<
 *             projparams['proj']='aea'
 *             scale = float(self['grib2divider'])
 */
  __pyx_t_6 = PyObject_GetItem(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_n_s__gridType)); if (!__pyx_t_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1503; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = PyObject_RichCompare(__pyx_t_6, ((PyObject *)__pyx_n_s__albers), Py_EQ); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1503; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1503; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (__pyx_t_5) {

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

    /* "pygrib.pyx":1505
 *         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), ((PyObject *)__pyx_n_s__grib2divider)); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1505; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = __Pyx_PyObject_AsDouble(__pyx_t_7); if (unlikely(__pyx_t_8 == ((double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1505; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = PyFloat_FromDouble(__pyx_t_8); 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_v_scale = __pyx_t_7;
    __pyx_t_7 = 0;

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

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

      /* "pygrib.pyx":1508
 *             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_6 = PyObject_GetItem(__pyx_v_projparams, ((PyObject *)__pyx_n_s__lon_0)); if (!__pyx_t_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1508; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7 = PyTuple_New(1); 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);
      PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_6);
      __pyx_t_6 = 0;
      __pyx_t_6 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1508; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
      if (PyObject_SetItem(__pyx_v_projparams, ((PyObject *)__pyx_n_s__lon_0), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1508; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      goto __pyx_L18;
    }
    __pyx_L18:;

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

    /* "pygrib.pyx":1510
 *                 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_7 = PyObject_GetItem(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_n_s__truncateDegrees)); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1510; __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 = 1510; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (__pyx_t_5) {

      /* "pygrib.pyx":1511
 *             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_7 = PyObject_GetItem(__pyx_v_projparams, ((PyObject *)__pyx_n_s__lat_0)); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1511; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1511; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_7);
      __Pyx_GIVEREF(__pyx_t_7);
      __pyx_t_7 = 0;
      __pyx_t_7 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_6), NULL); 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(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
      if (PyObject_SetItem(__pyx_v_projparams, ((PyObject *)__pyx_n_s__lat_0), __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;
      goto __pyx_L19;
    }
    __pyx_L19:;

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

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

      /* "pygrib.pyx":1514
 *             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_6 = PyObject_GetItem(__pyx_v_projparams, ((PyObject *)__pyx_n_s__lat_1)); if (!__pyx_t_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1514; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7 = PyTuple_New(1); 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);
      PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_6);
      __pyx_t_6 = 0;
      __pyx_t_6 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1514; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
      if (PyObject_SetItem(__pyx_v_projparams, ((PyObject *)__pyx_n_s__lat_1), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1514; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      goto __pyx_L20;
    }
    __pyx_L20:;

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

    /* "pygrib.pyx":1516
 *                 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_7 = PyObject_GetItem(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_n_s__truncateDegrees)); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1516; __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 = 1516; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (__pyx_t_5) {

      /* "pygrib.pyx":1517
 *             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_7 = PyObject_GetItem(__pyx_v_projparams, ((PyObject *)__pyx_n_s__lat_2)); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1517; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1517; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_7);
      __Pyx_GIVEREF(__pyx_t_7);
      __pyx_t_7 = 0;
      __pyx_t_7 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1517; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
      if (PyObject_SetItem(__pyx_v_projparams, ((PyObject *)__pyx_n_s__lat_2), __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;
      goto __pyx_L21;
    }
    __pyx_L21:;
    goto __pyx_L14;
  }

  /* "pygrib.pyx":1518
 *             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), ((PyObject *)__pyx_n_s__gridType)); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1518; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_6 = PyObject_RichCompare(__pyx_t_7, ((PyObject *)__pyx_n_s__space_view), Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1518; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_6); 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_6); __pyx_t_6 = 0;
  if (__pyx_t_5) {

    /* "pygrib.pyx":1519
 *                 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_6 = PyObject_GetItem(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_n_s_159)); if (!__pyx_t_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1519; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    if (PyObject_SetItem(__pyx_v_projparams, ((PyObject *)__pyx_n_s__lon_0), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1519; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "pygrib.pyx":1520
 *         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_6 = PyObject_GetItem(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_n_s_160)); if (!__pyx_t_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1520; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    if (PyObject_SetItem(__pyx_v_projparams, ((PyObject *)__pyx_n_s__lat_0), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1520; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "pygrib.pyx":1521
 *             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_6 = PyObject_GetItem(__pyx_v_projparams, ((PyObject *)__pyx_n_s__lat_0)); if (!__pyx_t_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = PyFloat_FromDouble(0.); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_2 = PyObject_RichCompare(__pyx_t_6, __pyx_t_7, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__pyx_t_5) {

      /* "pygrib.pyx":1522
 *             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 (PyObject_SetItem(__pyx_v_projparams, ((PyObject *)__pyx_n_s__proj), ((PyObject *)__pyx_n_s__geos)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1522; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L22;
    }
    /*else*/ {

      /* "pygrib.pyx":1525
 *             # general case of 'near-side perspective projection' (untested)
 *             else:
 *                 projparams['proj'] = 'nsper'             # <<<<<<<<<<<<<<
 *             scale = float(self['grib2divider'])
 *             projparams['h'] = projparams['a'] * self['Nr']/scale
 */
      if (PyObject_SetItem(__pyx_v_projparams, ((PyObject *)__pyx_n_s__proj), ((PyObject *)__pyx_n_s__nsper)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1525; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_L22:;

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

    /* "pygrib.pyx":1527
 *                 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_2 = PyObject_GetItem(__pyx_v_projparams, ((PyObject *)__pyx_n_s__a)); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1527; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_7 = PyObject_GetItem(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_n_s__Nr)); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1527; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_6 = PyNumber_Multiply(__pyx_t_2, __pyx_t_7); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1527; __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_7); __pyx_t_7 = 0;
    __pyx_t_7 = __Pyx_PyNumber_Divide(__pyx_t_6, __pyx_v_scale); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1527; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (PyObject_SetItem(__pyx_v_projparams, ((PyObject *)__pyx_n_s__h), __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1527; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

    /* "pygrib.pyx":1529
 *             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, ((PyObject *)__pyx_n_s__h)); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1529; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_6 = PyObject_GetItem(__pyx_v_projparams, ((PyObject *)__pyx_n_s__a)); if (!__pyx_t_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1529; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_2 = PyNumber_Subtract(__pyx_t_7, __pyx_t_6); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1529; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (PyObject_SetItem(__pyx_v_projparams, ((PyObject *)__pyx_n_s__h), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1529; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    goto __pyx_L14;
  }

  /* "pygrib.pyx":1530
 *             # 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_2 = PyObject_GetItem(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_n_s__gridType)); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_6 = PyObject_RichCompare(__pyx_t_2, ((PyObject *)__pyx_n_s_161), Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __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 = 1530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (__pyx_t_5) {

    /* "pygrib.pyx":1531
 *             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_6 = PyObject_GetItem(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_n_s__standardParallel)); if (!__pyx_t_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1531; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_2 = PyFloat_FromDouble(1.e6); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1531; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_7 = __Pyx_PyNumber_Divide(__pyx_t_6, __pyx_t_2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1531; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (PyObject_SetItem(__pyx_v_projparams, ((PyObject *)__pyx_n_s__lat_0), __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1531; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

    /* "pygrib.pyx":1532
 *         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_7 = PyObject_GetItem(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_n_s__centralLongitude)); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1532; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_2 = PyFloat_FromDouble(1.e6); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1532; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_6 = __Pyx_PyNumber_Divide(__pyx_t_7, __pyx_t_2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1532; __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_2); __pyx_t_2 = 0;
    if (PyObject_SetItem(__pyx_v_projparams, ((PyObject *)__pyx_n_s__lon_0), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1532; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

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

  /* "pygrib.pyx":1534
 *             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_6 = PyObject_GetItem(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_n_s__gridType)); if (!__pyx_t_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1534; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_2 = PyObject_RichCompare(__pyx_t_6, ((PyObject *)__pyx_n_s_162), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1534; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1534; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_5) {

    /* "pygrib.pyx":1535
 *             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_2 = PyObject_GetItem(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_n_s__standardParallel)); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1535; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_6 = PyFloat_FromDouble(1.e6); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1535; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = __Pyx_PyNumber_Divide(__pyx_t_2, __pyx_t_6); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1535; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (PyObject_SetItem(__pyx_v_projparams, ((PyObject *)__pyx_n_s__lat_0), __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1535; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

    /* "pygrib.pyx":1536
 *         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_7 = PyObject_GetItem(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_n_s__centralLongitude)); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1536; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_6 = PyFloat_FromDouble(1.e6); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1536; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_2 = __Pyx_PyNumber_Divide(__pyx_t_7, __pyx_t_6); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1536; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (PyObject_SetItem(__pyx_v_projparams, ((PyObject *)__pyx_n_s__lon_0), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1536; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

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

  /* "pygrib.pyx":1538
 *             projparams['lon_0'] = self['centralLongitude']/1.e6
 *             projparams['proj'] = 'laea'
 *         elif self['gridType'] == 'mercator':             # <<<<<<<<<<<<<<
 *             scale = self._get_key('grib2divider',False)
 *             if scale:
 */
  __pyx_t_2 = PyObject_GetItem(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_n_s__gridType)); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1538; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_6 = PyObject_RichCompare(__pyx_t_2, ((PyObject *)__pyx_n_s__mercator), Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1538; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __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 = 1538; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (__pyx_t_5) {

    /* "pygrib.pyx":1539
 *             projparams['proj'] = 'laea'
 *         elif self['gridType'] == 'mercator':
 *             scale = self._get_key('grib2divider',False)             # <<<<<<<<<<<<<<
 *             if scale:
 *                 scale = float(scale)
 */
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s___get_key); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1539; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_2 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1539; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1539; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_INCREF(((PyObject *)__pyx_n_s__grib2divider));
    PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_n_s__grib2divider));
    __Pyx_GIVEREF(((PyObject *)__pyx_n_s__grib2divider));
    PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_2);
    __pyx_t_2 = 0;
    __pyx_t_2 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1539; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
    __pyx_v_scale = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "pygrib.pyx":1540
 *         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 = 1540; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (__pyx_t_5) {

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

      /* "pygrib.pyx":1543
 *                 scale = float(scale)
 *             else:
 *                 scale = 1000.             # <<<<<<<<<<<<<<
 *             lon1 = self['longitudeOfFirstGridPoint']/scale
 *             lon2 = self['longitudeOfLastGridPoint']/scale
 */
      __pyx_t_2 = PyFloat_FromDouble(1000.); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1543; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF_SET(__pyx_v_scale, __pyx_t_2);
      __pyx_t_2 = 0;
    }
    __pyx_L23:;

    /* "pygrib.pyx":1544
 *             else:
 *                 scale = 1000.
 *             lon1 = self['longitudeOfFirstGridPoint']/scale             # <<<<<<<<<<<<<<
 *             lon2 = self['longitudeOfLastGridPoint']/scale
 *             if self._get_key('truncateDegrees',False):
 */
    __pyx_t_2 = PyObject_GetItem(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_n_s_163)); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1544; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_7 = __Pyx_PyNumber_Divide(__pyx_t_2, __pyx_v_scale); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1544; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_lon1 = __pyx_t_7;
    __pyx_t_7 = 0;

    /* "pygrib.pyx":1545
 *                 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), ((PyObject *)__pyx_n_s_164)); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1545; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_2 = __Pyx_PyNumber_Divide(__pyx_t_7, __pyx_v_scale); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1545; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_v_lon2 = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "pygrib.pyx":1546
 *             lon1 = self['longitudeOfFirstGridPoint']/scale
 *             lon2 = self['longitudeOfLastGridPoint']/scale
 *             if self._get_key('truncateDegrees',False):             # <<<<<<<<<<<<<<
 *                 lon1 = int(lon1)
 *                 lon2 = int(lon2)
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s___get_key); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1546; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_7 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1546; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1546; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_INCREF(((PyObject *)__pyx_n_s__truncateDegrees));
    PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_n_s__truncateDegrees));
    __Pyx_GIVEREF(((PyObject *)__pyx_n_s__truncateDegrees));
    PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_7);
    __Pyx_GIVEREF(__pyx_t_7);
    __pyx_t_7 = 0;
    __pyx_t_7 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1546; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_7); 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_7); __pyx_t_7 = 0;
    if (__pyx_t_5) {

      /* "pygrib.pyx":1547
 *             lon2 = self['longitudeOfLastGridPoint']/scale
 *             if self._get_key('truncateDegrees',False):
 *                 lon1 = int(lon1)             # <<<<<<<<<<<<<<
 *                 lon2 = int(lon2)
 *             if self._get_key('LaD',False):
 */
      __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1547; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_INCREF(__pyx_v_lon1);
      PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_lon1);
      __Pyx_GIVEREF(__pyx_v_lon1);
      __pyx_t_6 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1547; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
      __Pyx_DECREF_SET(__pyx_v_lon1, __pyx_t_6);
      __pyx_t_6 = 0;

      /* "pygrib.pyx":1548
 *             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_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1548; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_INCREF(__pyx_v_lon2);
      PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_lon2);
      __Pyx_GIVEREF(__pyx_v_lon2);
      __pyx_t_7 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1548; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
      __Pyx_DECREF_SET(__pyx_v_lon2, __pyx_t_7);
      __pyx_t_7 = 0;
      goto __pyx_L24;
    }
    __pyx_L24:;

    /* "pygrib.pyx":1549
 *                 lon1 = int(lon1)
 *                 lon2 = int(lon2)
 *             if self._get_key('LaD',False):             # <<<<<<<<<<<<<<
 *                 projparams['lat_ts'] = self['LaD']/scale
 *             else:
 */
    __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 = 1549; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_6 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1549; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1549; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(((PyObject *)__pyx_n_s__LaD));
    PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_n_s__LaD));
    __Pyx_GIVEREF(((PyObject *)__pyx_n_s__LaD));
    PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_6);
    __pyx_t_6 = 0;
    __pyx_t_6 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1549; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(((PyObject *)__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 = 1549; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (__pyx_t_5) {

      /* "pygrib.pyx":1550
 *                 lon2 = int(lon2)
 *             if self._get_key('LaD',False):
 *                 projparams['lat_ts'] = self['LaD']/scale             # <<<<<<<<<<<<<<
 *             else:
 *                 projparams['lat_ts'] = self['Latin']/scale
 */
      __pyx_t_6 = PyObject_GetItem(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_n_s__LaD)); if (!__pyx_t_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1550; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_2 = __Pyx_PyNumber_Divide(__pyx_t_6, __pyx_v_scale); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1550; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (PyObject_SetItem(__pyx_v_projparams, ((PyObject *)__pyx_n_s__lat_ts), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1550; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      goto __pyx_L25;
    }
    /*else*/ {

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

    /* "pygrib.pyx":1553
 *             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_6 = PyFloat_FromDouble(0.5); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1553; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_2 = PyNumber_Add(__pyx_v_lon1, __pyx_v_lon2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1553; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_7 = PyNumber_Multiply(__pyx_t_6, __pyx_t_2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1553; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (PyObject_SetItem(__pyx_v_projparams, ((PyObject *)__pyx_n_s__lon_0), __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1553; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

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

  /* "pygrib.pyx":1555
 *             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_7 = PyObject_GetItem(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_n_s__gridType)); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1555; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_2 = PyObject_RichCompare(__pyx_t_7, ((PyObject *)__pyx_n_s__rotated_ll), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1555; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1555; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!((int)__pyx_t_5)) {
    __pyx_t_2 = PyObject_RichCompare(__pyx_t_7, ((PyObject *)__pyx_n_s__rotated_gg), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1555; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1555; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_4 = ((int)__pyx_t_3);
  } else {
    __pyx_t_4 = ((int)__pyx_t_5);
  }
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_5 = (__pyx_t_4 != 0);
  if (__pyx_t_5) {

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

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

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

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

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

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

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

    /* "pygrib.pyx":1563
 *             projparams['o_lat_p']=-pole_lat
 *             projparams['o_lon_p']=rot_angle
 *             projparams['lon_0']=pole_lon             # <<<<<<<<<<<<<<
 *         else: # unsupported grid type.
 *             projparams = None
 */
    if (PyObject_SetItem(__pyx_v_projparams, ((PyObject *)__pyx_n_s__lon_0), __pyx_v_pole_lon) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1563; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L14;
  }
  /*else*/ {

    /* "pygrib.pyx":1565
 *             projparams['lon_0']=pole_lon
 *         else: # unsupported grid type.
 *             projparams = None             # <<<<<<<<<<<<<<
 *         self.projparams = projparams
 * 
 */
    __Pyx_INCREF(Py_None);
    __Pyx_DECREF_SET(__pyx_v_projparams, Py_None);
  }
  __pyx_L14:;

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

  __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_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;
}

/* 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));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pygrib.pyx":1568
 *         self.projparams = projparams
 * 
 *     def latlons(self):             # <<<<<<<<<<<<<<
 *         """
 *         latlons()
 */

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;
  int __pyx_t_5;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *(*__pyx_t_9)(PyObject *);
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  double __pyx_t_13;
  PyObject *__pyx_t_14 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("latlons", 0);

  /* "pygrib.pyx":1582
 *         """
 * 
 *         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":1583
 * 
 *         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), ((PyObject *)__pyx_n_s__gridType)); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1583; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_168), __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1583; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__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 = 1583; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_4));
    __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
    __pyx_t_4 = 0;
    __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1583; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(((PyObject *)__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 = 1583; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "pygrib.pyx":1585
 *             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), ((PyObject *)__pyx_n_s__gridType)); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1585; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = PyObject_RichCompare(__pyx_t_4, ((PyObject *)__pyx_n_s__regular_gg), Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1585; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1585; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (!((int)__pyx_t_2)) {
    __pyx_t_3 = PyObject_RichCompare(__pyx_t_4, ((PyObject *)__pyx_n_s__regular_ll), Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1585; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1585; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_5 = ((int)__pyx_t_1);
  } else {
    __pyx_t_5 = ((int)__pyx_t_2);
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_2 = (__pyx_t_5 != 0);
  if (__pyx_t_2) {

    /* "pygrib.pyx":1586
 * 
 *         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), ((PyObject *)__pyx_n_s__Ni)); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1586; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_v_nx = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "pygrib.pyx":1587
 *         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), ((PyObject *)__pyx_n_s__Nj)); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1587; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_v_ny = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "pygrib.pyx":1588
 *             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), ((PyObject *)__pyx_n_s_169)); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1588; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_v_lon1 = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "pygrib.pyx":1589
 *             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), ((PyObject *)__pyx_n_s_170)); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1589; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_v_lon2 = __pyx_t_4;
    __pyx_t_4 = 0;

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

      /* "pygrib.pyx":1591
 *             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 = PyNumber_Add(__pyx_int_360, __pyx_v_lon2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1591; __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;
      goto __pyx_L5;
    }
    __pyx_L5:;

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

      /* "pygrib.pyx":1593
 *                 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 = PyNumber_Subtract(__pyx_v_lon1, __pyx_int_360); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1593; __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;
      goto __pyx_L6;
    }
    __pyx_L6:;

    /* "pygrib.pyx":1594
 *             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), ((PyObject *)__pyx_n_s_171)); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1594; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_v_lat1 = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "pygrib.pyx":1595
 *                 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), ((PyObject *)__pyx_n_s_172)); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1595; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_v_lat2 = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "pygrib.pyx":1599
 *             # (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 = 1599; __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 = 1599; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_k_tuple_173), 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_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 = 1599; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (__pyx_t_2) {

      /* "pygrib.pyx":1602
 *                 # this is not strictly correct for gaussian grids,
 *                 # but the error is very small.
 *                 lats = np.linspace(lat1,lat2,ny)             # <<<<<<<<<<<<<<
 *                 lons = np.linspace(lon1,lon2,nx)
 *             else:
 */
      __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1602; __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 = 1602; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1602; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_v_lat1);
      PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_lat1);
      __Pyx_GIVEREF(__pyx_v_lat1);
      __Pyx_INCREF(__pyx_v_lat2);
      PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_lat2);
      __Pyx_GIVEREF(__pyx_v_lat2);
      __Pyx_INCREF(__pyx_v_ny);
      PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_ny);
      __Pyx_GIVEREF(__pyx_v_ny);
      __pyx_t_7 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1602; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
      __pyx_v_lats = __pyx_t_7;
      __pyx_t_7 = 0;

      /* "pygrib.pyx":1603
 *                 # but the error is very small.
 *                 lats = np.linspace(lat1,lat2,ny)
 *                 lons = np.linspace(lon1,lon2,nx)             # <<<<<<<<<<<<<<
 *             else:
 *                 lats = self['distinctLatitudes']
 */
      __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1603; __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 = 1603; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_7 = PyTuple_New(3); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1603; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_INCREF(__pyx_v_lon1);
      PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_lon1);
      __Pyx_GIVEREF(__pyx_v_lon1);
      __Pyx_INCREF(__pyx_v_lon2);
      PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_v_lon2);
      __Pyx_GIVEREF(__pyx_v_lon2);
      __Pyx_INCREF(__pyx_v_nx);
      PyTuple_SET_ITEM(__pyx_t_7, 2, __pyx_v_nx);
      __Pyx_GIVEREF(__pyx_v_nx);
      __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1603; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
      __pyx_v_lons = __pyx_t_3;
      __pyx_t_3 = 0;
      goto __pyx_L7;
    }
    /*else*/ {

      /* "pygrib.pyx":1605
 *                 lons = np.linspace(lon1,lon2,nx)
 *             else:
 *                 lats = self['distinctLatitudes']             # <<<<<<<<<<<<<<
 *                 if lat2 < lat1 and lats[-1] > lats[0]: lats = lats[::-1]
 *                 lons = self['distinctLongitudes']
 */
      __pyx_t_3 = PyObject_GetItem(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_n_s__distinctLatitudes)); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1605; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_v_lats = __pyx_t_3;
      __pyx_t_3 = 0;

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

      /* "pygrib.pyx":1607
 *                 lats = self['distinctLatitudes']
 *                 if lat2 < lat1 and lats[-1] > lats[0]: lats = lats[::-1]
 *                 lons = self['distinctLongitudes']             # <<<<<<<<<<<<<<
 *             # don't trust distinctLongitudes
 *             # when longitudeOfLastGridPointInDegrees < 0
 */
      __pyx_t_4 = PyObject_GetItem(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_n_s__distinctLongitudes)); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1607; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_v_lons = __pyx_t_4;
      __pyx_t_4 = 0;
    }
    __pyx_L7:;

    /* "pygrib.pyx":1611
 *             # when longitudeOfLastGridPointInDegrees < 0
 *             # (bug in grib_api 1.9.16)
 *             if lon2 < 0:             # <<<<<<<<<<<<<<
 *                 lons = np.linspace(lon1,lon2,nx)
 *             lons,lats = np.meshgrid(lons,lats)
 */
    __pyx_t_4 = PyObject_RichCompare(__pyx_v_lon2, __pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1611; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_4); 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_4); __pyx_t_4 = 0;
    if (__pyx_t_1) {

      /* "pygrib.pyx":1612
 *             # (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_4 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1612; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s__linspace); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1612; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1612; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_v_lon1);
      PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_lon1);
      __Pyx_GIVEREF(__pyx_v_lon1);
      __Pyx_INCREF(__pyx_v_lon2);
      PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_lon2);
      __Pyx_GIVEREF(__pyx_v_lon2);
      __Pyx_INCREF(__pyx_v_nx);
      PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_nx);
      __Pyx_GIVEREF(__pyx_v_nx);
      __pyx_t_3 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1612; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
      __Pyx_DECREF_SET(__pyx_v_lons, __pyx_t_3);
      __pyx_t_3 = 0;
      goto __pyx_L9;
    }
    __pyx_L9:;

    /* "pygrib.pyx":1613
 *             if lon2 < 0:
 *                 lons = np.linspace(lon1,lon2,nx)
 *             lons,lats = np.meshgrid(lons,lats)             # <<<<<<<<<<<<<<
 *         elif self['gridType'] == 'reduced_gg': # reduced global gaussian grid
 *             if self.expand_reduced:
 */
    __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1613; __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 = 1613; __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(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1613; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v_lons);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_lons);
    __Pyx_GIVEREF(__pyx_v_lons);
    __Pyx_INCREF(__pyx_v_lats);
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_lats);
    __Pyx_GIVEREF(__pyx_v_lats);
    __pyx_t_7 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1613; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 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 = 1613; __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_4 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_3 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_4 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      #else
      __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1613; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1613; __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_8 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1613; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_9 = Py_TYPE(__pyx_t_8)->tp_iternext;
      index = 0; __pyx_t_3 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_3)) goto __pyx_L10_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_3);
      index = 1; __pyx_t_4 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_4)) goto __pyx_L10_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_4);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_8), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1613; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_9 = NULL;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      goto __pyx_L11_unpacking_done;
      __pyx_L10_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_9 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1613; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_L11_unpacking_done:;
    }
    __Pyx_DECREF_SET(__pyx_v_lons, __pyx_t_3);
    __pyx_t_3 = 0;
    __Pyx_DECREF_SET(__pyx_v_lats, __pyx_t_4);
    __pyx_t_4 = 0;
    goto __pyx_L4;
  }

  /* "pygrib.pyx":1614
 *                 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_7 = PyObject_GetItem(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_n_s__gridType)); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1614; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_4 = PyObject_RichCompare(__pyx_t_7, ((PyObject *)__pyx_n_s__reduced_gg), Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1614; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1614; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__pyx_t_1) {

    /* "pygrib.pyx":1615
 *             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 = 1615; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (__pyx_t_1) {

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

      /* "pygrib.pyx":1617
 *             if self.expand_reduced:
 *                 lat1 = self['latitudeOfFirstGridPointInDegrees']
 *                 lat2 = self['latitudeOfLastGridPointInDegrees']             # <<<<<<<<<<<<<<
 *                 lats = self['distinctLatitudes']
 *                 if lat2 < lat1 and lats[-1] > lats[0]: lats = lats[::-1]
 */
      __pyx_t_4 = PyObject_GetItem(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_n_s_172)); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1617; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_v_lat2 = __pyx_t_4;
      __pyx_t_4 = 0;

      /* "pygrib.pyx":1618
 *                 lat1 = self['latitudeOfFirstGridPointInDegrees']
 *                 lat2 = self['latitudeOfLastGridPointInDegrees']
 *                 lats = self['distinctLatitudes']             # <<<<<<<<<<<<<<
 *                 if lat2 < lat1 and lats[-1] > lats[0]: lats = lats[::-1]
 *                 ny = self['Nj']
 */
      __pyx_t_4 = PyObject_GetItem(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_n_s__distinctLatitudes)); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1618; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_v_lats = __pyx_t_4;
      __pyx_t_4 = 0;

      /* "pygrib.pyx":1619
 *                 lat2 = self['latitudeOfLastGridPointInDegrees']
 *                 lats = self['distinctLatitudes']
 *                 if lat2 < lat1 and lats[-1] > lats[0]: lats = lats[::-1]             # <<<<<<<<<<<<<<
 *                 ny = self['Nj']
 *                 nx = 2*ny
 */
      __pyx_t_4 = PyObject_RichCompare(__pyx_v_lat2, __pyx_v_lat1, Py_LT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1619; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1619; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (__pyx_t_1) {
        __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_lats, -1, sizeof(long), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1619; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_lats, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1619; __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 = 1619; __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 = 1619; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_t_5 = __pyx_t_2;
      } else {
        __pyx_t_5 = __pyx_t_1;
      }
      if (__pyx_t_5) {
        __pyx_t_3 = PyObject_GetItem(__pyx_v_lats, __pyx_k_slice_175); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1619; __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;
        goto __pyx_L13;
      }
      __pyx_L13:;

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

      /* "pygrib.pyx":1621
 *                 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_3 = PyNumber_Multiply(__pyx_int_2, __pyx_v_ny); 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_v_nx = __pyx_t_3;
      __pyx_t_3 = 0;

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

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

      /* "pygrib.pyx":1624
 *                 lon1 = self['longitudeOfFirstGridPointInDegrees']
 *                 lon2 = self['longitudeOfLastGridPointInDegrees']
 *                 lons = np.linspace(lon1,lon2,nx)             # <<<<<<<<<<<<<<
 *                 lons,lats = np.meshgrid(lons,lats)
 *             else:
 */
      __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1624; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__linspace); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1624; __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(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1624; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_v_lon1);
      PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_lon1);
      __Pyx_GIVEREF(__pyx_v_lon1);
      __Pyx_INCREF(__pyx_v_lon2);
      PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_lon2);
      __Pyx_GIVEREF(__pyx_v_lon2);
      __Pyx_INCREF(__pyx_v_nx);
      PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_nx);
      __Pyx_GIVEREF(__pyx_v_nx);
      __pyx_t_4 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1624; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
      __pyx_v_lons = __pyx_t_4;
      __pyx_t_4 = 0;

      /* "pygrib.pyx":1625
 *                 lon2 = self['longitudeOfLastGridPointInDegrees']
 *                 lons = np.linspace(lon1,lon2,nx)
 *                 lons,lats = np.meshgrid(lons,lats)             # <<<<<<<<<<<<<<
 *             else:
 *                 lats = self['latitudes']
 */
      __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1625; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s__meshgrid); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1625; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __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 = 1625; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_v_lons);
      PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_lons);
      __Pyx_GIVEREF(__pyx_v_lons);
      __Pyx_INCREF(__pyx_v_lats);
      PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_lats);
      __Pyx_GIVEREF(__pyx_v_lats);
      __pyx_t_7 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1625; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(((PyObject *)__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 = 1625; __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_3 = PyTuple_GET_ITEM(sequence, 1); 
        } else {
          __pyx_t_4 = PyList_GET_ITEM(sequence, 0); 
          __pyx_t_3 = PyList_GET_ITEM(sequence, 1); 
        }
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_3);
        #else
        __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1625; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1625; __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_8 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1625; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_t_9 = Py_TYPE(__pyx_t_8)->tp_iternext;
        index = 0; __pyx_t_4 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_4)) goto __pyx_L14_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_4);
        index = 1; __pyx_t_3 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_3)) goto __pyx_L14_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_3);
        if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_8), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1625; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __pyx_t_9 = NULL;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        goto __pyx_L15_unpacking_done;
        __pyx_L14_unpacking_failed:;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __pyx_t_9 = NULL;
        if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1625; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __pyx_L15_unpacking_done:;
      }
      __Pyx_DECREF_SET(__pyx_v_lons, __pyx_t_4);
      __pyx_t_4 = 0;
      __Pyx_DECREF_SET(__pyx_v_lats, __pyx_t_3);
      __pyx_t_3 = 0;
      goto __pyx_L12;
    }
    /*else*/ {

      /* "pygrib.pyx":1627
 *                 lons,lats = np.meshgrid(lons,lats)
 *             else:
 *                 lats = self['latitudes']             # <<<<<<<<<<<<<<
 *                 lons = self['longitudes']
 *         elif self['gridType'] == 'reduced_ll': # reduced lat/lon grid
 */
      __pyx_t_7 = PyObject_GetItem(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_n_s__latitudes)); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1627; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_v_lats = __pyx_t_7;
      __pyx_t_7 = 0;

      /* "pygrib.pyx":1628
 *             else:
 *                 lats = self['latitudes']
 *                 lons = self['longitudes']             # <<<<<<<<<<<<<<
 *         elif self['gridType'] == 'reduced_ll': # reduced lat/lon grid
 *             if self.expand_reduced:
 */
      __pyx_t_7 = PyObject_GetItem(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_n_s__longitudes)); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1628; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_v_lons = __pyx_t_7;
      __pyx_t_7 = 0;
    }
    __pyx_L12:;
    goto __pyx_L4;
  }

  /* "pygrib.pyx":1629
 *                 lats = self['latitudes']
 *                 lons = self['longitudes']
 *         elif self['gridType'] == 'reduced_ll': # reduced lat/lon grid             # <<<<<<<<<<<<<<
 *             if self.expand_reduced:
 *                 ny = self['Nj']
 */
  __pyx_t_7 = PyObject_GetItem(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_n_s__gridType)); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1629; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_3 = PyObject_RichCompare(__pyx_t_7, ((PyObject *)__pyx_n_s__reduced_ll), Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1629; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1629; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__pyx_t_5) {

    /* "pygrib.pyx":1630
 *                 lons = self['longitudes']
 *         elif self['gridType'] == 'reduced_ll': # reduced lat/lon grid
 *             if self.expand_reduced:             # <<<<<<<<<<<<<<
 *                 ny = self['Nj']
 *                 nx = 2*ny
 */
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_self->expand_reduced); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1630; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (__pyx_t_5) {

      /* "pygrib.pyx":1631
 *         elif self['gridType'] == 'reduced_ll': # reduced lat/lon grid
 *             if self.expand_reduced:
 *                 ny = self['Nj']             # <<<<<<<<<<<<<<
 *                 nx = 2*ny
 *                 lat1 = self['latitudeOfFirstGridPointInDegrees']
 */
      __pyx_t_3 = PyObject_GetItem(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_n_s__Nj)); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1631; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_v_ny = __pyx_t_3;
      __pyx_t_3 = 0;

      /* "pygrib.pyx":1632
 *             if self.expand_reduced:
 *                 ny = self['Nj']
 *                 nx = 2*ny             # <<<<<<<<<<<<<<
 *                 lat1 = self['latitudeOfFirstGridPointInDegrees']
 *                 lat2 = self['latitudeOfLastGridPointInDegrees']
 */
      __pyx_t_3 = PyNumber_Multiply(__pyx_int_2, __pyx_v_ny); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1632; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_v_nx = __pyx_t_3;
      __pyx_t_3 = 0;

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

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

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

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

      /* "pygrib.pyx":1637
 *                 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_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1637; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__linspace); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1637; __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(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1637; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_v_lon1);
      PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_lon1);
      __Pyx_GIVEREF(__pyx_v_lon1);
      __Pyx_INCREF(__pyx_v_lon2);
      PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_lon2);
      __Pyx_GIVEREF(__pyx_v_lon2);
      __Pyx_INCREF(__pyx_v_nx);
      PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_nx);
      __Pyx_GIVEREF(__pyx_v_nx);
      __pyx_t_4 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1637; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
      __pyx_v_lons = __pyx_t_4;
      __pyx_t_4 = 0;

      /* "pygrib.pyx":1638
 *                 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 = 1638; __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 = 1638; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1638; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_v_lat1);
      PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_lat1);
      __Pyx_GIVEREF(__pyx_v_lat1);
      __Pyx_INCREF(__pyx_v_lat2);
      PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_lat2);
      __Pyx_GIVEREF(__pyx_v_lat2);
      __Pyx_INCREF(__pyx_v_ny);
      PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_ny);
      __Pyx_GIVEREF(__pyx_v_ny);
      __pyx_t_7 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1638; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
      __pyx_v_lats = __pyx_t_7;
      __pyx_t_7 = 0;

      /* "pygrib.pyx":1639
 *                 lons = np.linspace(lon1,lon2,nx)
 *                 lats = np.linspace(lat1,lat2,ny)
 *                 lons,lats = np.meshgrid(lons,lats)             # <<<<<<<<<<<<<<
 *             else:
 *                 lats = self['latitudes']
 */
      __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1639; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s__meshgrid); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1639; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1639; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_INCREF(__pyx_v_lons);
      PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_lons);
      __Pyx_GIVEREF(__pyx_v_lons);
      __Pyx_INCREF(__pyx_v_lats);
      PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_v_lats);
      __Pyx_GIVEREF(__pyx_v_lats);
      __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1639; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(((PyObject *)__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 = 1639; __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 = 1639; __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 = 1639; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_4);
        #endif
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      } else
      {
        Py_ssize_t index = -1;
        __pyx_t_8 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1639; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_t_9 = Py_TYPE(__pyx_t_8)->tp_iternext;
        index = 0; __pyx_t_7 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_7)) goto __pyx_L17_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_7);
        index = 1; __pyx_t_4 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_4)) goto __pyx_L17_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_4);
        if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_8), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1639; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __pyx_t_9 = NULL;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        goto __pyx_L18_unpacking_done;
        __pyx_L17_unpacking_failed:;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __pyx_t_9 = NULL;
        if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1639; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __pyx_L18_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;
      goto __pyx_L16;
    }
    /*else*/ {

      /* "pygrib.pyx":1641
 *                 lons,lats = np.meshgrid(lons,lats)
 *             else:
 *                 lats = self['latitudes']             # <<<<<<<<<<<<<<
 *                 lons = self['longitudes']
 *         elif self['gridType'] == 'polar_stereographic':
 */
      __pyx_t_3 = PyObject_GetItem(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_n_s__latitudes)); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1641; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_v_lats = __pyx_t_3;
      __pyx_t_3 = 0;

      /* "pygrib.pyx":1642
 *             else:
 *                 lats = self['latitudes']
 *                 lons = self['longitudes']             # <<<<<<<<<<<<<<
 *         elif self['gridType'] == 'polar_stereographic':
 *             lat1 = self['latitudeOfFirstGridPointInDegrees']
 */
      __pyx_t_3 = PyObject_GetItem(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_n_s__longitudes)); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1642; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_v_lons = __pyx_t_3;
      __pyx_t_3 = 0;
    }
    __pyx_L16:;
    goto __pyx_L4;
  }

  /* "pygrib.pyx":1643
 *                 lats = self['latitudes']
 *                 lons = self['longitudes']
 *         elif self['gridType'] == 'polar_stereographic':             # <<<<<<<<<<<<<<
 *             lat1 = self['latitudeOfFirstGridPointInDegrees']
 *             lon1 = self['longitudeOfFirstGridPointInDegrees']
 */
  __pyx_t_3 = PyObject_GetItem(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_n_s__gridType)); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1643; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyObject_RichCompare(__pyx_t_3, ((PyObject *)__pyx_n_s__polar_stereographic), Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1643; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1643; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__pyx_t_5) {

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

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

    /* "pygrib.pyx":1646
 *             lat1 = self['latitudeOfFirstGridPointInDegrees']
 *             lon1 = self['longitudeOfFirstGridPointInDegrees']
 *             try:             # <<<<<<<<<<<<<<
 *                 nx = self['Nx']
 *                 ny = self['Ny']
 */
    {
      __Pyx_ExceptionSave(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
      __Pyx_XGOTREF(__pyx_t_10);
      __Pyx_XGOTREF(__pyx_t_11);
      __Pyx_XGOTREF(__pyx_t_12);
      /*try:*/ {

        /* "pygrib.pyx":1647
 *             lon1 = self['longitudeOfFirstGridPointInDegrees']
 *             try:
 *                 nx = self['Nx']             # <<<<<<<<<<<<<<
 *                 ny = self['Ny']
 *             except:
 */
        __pyx_t_4 = PyObject_GetItem(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_n_s__Nx)); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1647; __pyx_clineno = __LINE__; goto __pyx_L19_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_v_nx = __pyx_t_4;
        __pyx_t_4 = 0;

        /* "pygrib.pyx":1648
 *             try:
 *                 nx = self['Nx']
 *                 ny = self['Ny']             # <<<<<<<<<<<<<<
 *             except:
 *                 nx = self['Ni']
 */
        __pyx_t_4 = PyObject_GetItem(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_n_s__Ny)); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1648; __pyx_clineno = __LINE__; goto __pyx_L19_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_v_ny = __pyx_t_4;
        __pyx_t_4 = 0;
      }
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
      goto __pyx_L26_try_end;
      __pyx_L19_error:;
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;

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

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

        /* "pygrib.pyx":1651
 *             except:
 *                 nx = self['Ni']
 *                 ny = self['Nj']             # <<<<<<<<<<<<<<
 *             # key renamed from xDirectionGridLengthInMetres to
 *             # DxInMetres grib_api 1.8.0.1.
 */
        __pyx_t_8 = PyObject_GetItem(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_n_s__Nj)); if (!__pyx_t_8) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1651; __pyx_clineno = __LINE__; goto __pyx_L21_except_error;}
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_XDECREF_SET(__pyx_v_ny, __pyx_t_8);
        __pyx_t_8 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        goto __pyx_L20_exception_handled;
      }
      __pyx_L21_except_error:;
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_XGIVEREF(__pyx_t_12);
      __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
      goto __pyx_L1_error;
      __pyx_L20_exception_handled:;
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_XGIVEREF(__pyx_t_12);
      __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
      __pyx_L26_try_end:;
    }

    /* "pygrib.pyx":1654
 *             # key renamed from xDirectionGridLengthInMetres to
 *             # DxInMetres grib_api 1.8.0.1.
 *             try:             # <<<<<<<<<<<<<<
 *                 dx = self['DxInMetres']
 *             except:
 */
    {
      __Pyx_ExceptionSave(&__pyx_t_12, &__pyx_t_11, &__pyx_t_10);
      __Pyx_XGOTREF(__pyx_t_12);
      __Pyx_XGOTREF(__pyx_t_11);
      __Pyx_XGOTREF(__pyx_t_10);
      /*try:*/ {

        /* "pygrib.pyx":1655
 *             # DxInMetres grib_api 1.8.0.1.
 *             try:
 *                 dx = self['DxInMetres']             # <<<<<<<<<<<<<<
 *             except:
 *                 dx = self['xDirectionGridLengthInMetres']
 */
        __pyx_t_7 = PyObject_GetItem(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_n_s__DxInMetres)); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1655; __pyx_clineno = __LINE__; goto __pyx_L29_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_v_dx = __pyx_t_7;
        __pyx_t_7 = 0;
      }
      __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      goto __pyx_L36_try_end;
      __pyx_L29_error:;
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;

      /* "pygrib.pyx":1656
 *             try:
 *                 dx = self['DxInMetres']
 *             except:             # <<<<<<<<<<<<<<
 *                 dx = self['xDirectionGridLengthInMetres']
 *             try:
 */
      /*except:*/ {
        __Pyx_AddTraceback("pygrib.gribmessage.latlons", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_3, &__pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1656; __pyx_clineno = __LINE__; goto __pyx_L31_except_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_GOTREF(__pyx_t_4);

        /* "pygrib.pyx":1657
 *                 dx = self['DxInMetres']
 *             except:
 *                 dx = self['xDirectionGridLengthInMetres']             # <<<<<<<<<<<<<<
 *             try:
 *                 dy = self['DyInMetres']
 */
        __pyx_t_8 = PyObject_GetItem(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_n_s_176)); if (!__pyx_t_8) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1657; __pyx_clineno = __LINE__; goto __pyx_L31_except_error;}
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_XDECREF_SET(__pyx_v_dx, __pyx_t_8);
        __pyx_t_8 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        goto __pyx_L30_exception_handled;
      }
      __pyx_L31_except_error:;
      __Pyx_XGIVEREF(__pyx_t_12);
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_ExceptionReset(__pyx_t_12, __pyx_t_11, __pyx_t_10);
      goto __pyx_L1_error;
      __pyx_L30_exception_handled:;
      __Pyx_XGIVEREF(__pyx_t_12);
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_ExceptionReset(__pyx_t_12, __pyx_t_11, __pyx_t_10);
      __pyx_L36_try_end:;
    }

    /* "pygrib.pyx":1658
 *             except:
 *                 dx = self['xDirectionGridLengthInMetres']
 *             try:             # <<<<<<<<<<<<<<
 *                 dy = self['DyInMetres']
 *             except:
 */
    {
      __Pyx_ExceptionSave(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
      __Pyx_XGOTREF(__pyx_t_10);
      __Pyx_XGOTREF(__pyx_t_11);
      __Pyx_XGOTREF(__pyx_t_12);
      /*try:*/ {

        /* "pygrib.pyx":1659
 *                 dx = self['xDirectionGridLengthInMetres']
 *             try:
 *                 dy = self['DyInMetres']             # <<<<<<<<<<<<<<
 *             except:
 *                 dy = self['yDirectionGridLengthInMetres']
 */
        __pyx_t_4 = PyObject_GetItem(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_n_s__DyInMetres)); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1659; __pyx_clineno = __LINE__; goto __pyx_L39_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_v_dy = __pyx_t_4;
        __pyx_t_4 = 0;
      }
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
      goto __pyx_L46_try_end;
      __pyx_L39_error:;
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;

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

        /* "pygrib.pyx":1661
 *                 dy = self['DyInMetres']
 *             except:
 *                 dy = self['yDirectionGridLengthInMetres']             # <<<<<<<<<<<<<<
 *             pj = pyproj.Proj(self.projparams)
 *             llcrnrx, llcrnry = pj(lon1,lat1)
 */
        __pyx_t_8 = PyObject_GetItem(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_n_s_177)); if (!__pyx_t_8) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1661; __pyx_clineno = __LINE__; goto __pyx_L41_except_error;}
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_XDECREF_SET(__pyx_v_dy, __pyx_t_8);
        __pyx_t_8 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        goto __pyx_L40_exception_handled;
      }
      __pyx_L41_except_error:;
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_XGIVEREF(__pyx_t_12);
      __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
      goto __pyx_L1_error;
      __pyx_L40_exception_handled:;
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_XGIVEREF(__pyx_t_12);
      __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
      __pyx_L46_try_end:;
    }

    /* "pygrib.pyx":1662
 *             except:
 *                 dy = self['yDirectionGridLengthInMetres']
 *             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 = 1662; __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 = 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 = PyTuple_New(1); 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_INCREF(__pyx_v_self->projparams);
    PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_self->projparams);
    __Pyx_GIVEREF(__pyx_v_self->projparams);
    __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_7), NULL); 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_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
    __pyx_v_pj = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "pygrib.pyx":1663
 *                 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_t_4 = PyTuple_New(2); 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_INCREF(__pyx_v_lon1);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_lon1);
    __Pyx_GIVEREF(__pyx_v_lon1);
    __Pyx_INCREF(__pyx_v_lat1);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_lat1);
    __Pyx_GIVEREF(__pyx_v_lat1);
    __pyx_t_7 = PyObject_Call(__pyx_v_pj, ((PyObject *)__pyx_t_4), 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(((PyObject *)__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_3 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_4 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_3 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_3);
      #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_3 = PySequence_ITEM(sequence, 1); 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);
      #endif
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    } else
    {
      Py_ssize_t index = -1;
      __pyx_t_8 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1663; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_9 = Py_TYPE(__pyx_t_8)->tp_iternext;
      index = 0; __pyx_t_4 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_4)) goto __pyx_L49_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_4);
      index = 1; __pyx_t_3 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_3)) goto __pyx_L49_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_3);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_8), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1663; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_9 = NULL;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      goto __pyx_L50_unpacking_done;
      __pyx_L49_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_9 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1663; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_L50_unpacking_done:;
    }
    __pyx_v_llcrnrx = __pyx_t_4;
    __pyx_t_4 = 0;
    __pyx_v_llcrnry = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "pygrib.pyx":1664
 *             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 = 1664; __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 = 1664; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1664; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_INCREF(__pyx_v_nx);
    PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_nx);
    __Pyx_GIVEREF(__pyx_v_nx);
    __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_7), NULL); 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_3); __pyx_t_3 = 0;
    __Pyx_DECREF(((PyObject *)__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 = 1664; __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 = 1664; __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":1665
 *             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 = 1665; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s__arange); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1665; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1665; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_v_ny);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_ny);
    __Pyx_GIVEREF(__pyx_v_ny);
    __pyx_t_3 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1665; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
    __pyx_t_4 = PyNumber_Multiply(__pyx_v_dy, __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1665; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyNumber_Add(__pyx_v_llcrnry, __pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1665; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_v_y = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "pygrib.pyx":1666
 *             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 = 1666; __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 = 1666; __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(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1666; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v_x);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_x);
    __Pyx_GIVEREF(__pyx_v_x);
    __Pyx_INCREF(__pyx_v_y);
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_y);
    __Pyx_GIVEREF(__pyx_v_y);
    __pyx_t_7 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1666; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 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 = 1666; __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_4 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_3 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_4 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      #else
      __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1666; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1666; __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_8 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1666; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_9 = Py_TYPE(__pyx_t_8)->tp_iternext;
      index = 0; __pyx_t_3 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_3)) goto __pyx_L51_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_3);
      index = 1; __pyx_t_4 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_4)) goto __pyx_L51_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_4);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_8), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1666; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_9 = NULL;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      goto __pyx_L52_unpacking_done;
      __pyx_L51_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_9 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1666; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_L52_unpacking_done:;
    }
    __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_3);
    __pyx_t_3 = 0;
    __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "pygrib.pyx":1667
 *             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 = 1667; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_INCREF(__pyx_v_x);
    PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_x);
    __Pyx_GIVEREF(__pyx_v_x);
    __Pyx_INCREF(__pyx_v_y);
    PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_v_y);
    __Pyx_GIVEREF(__pyx_v_y);
    __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1667; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
    __pyx_t_3 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1667; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__inverse), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1667; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyObject_Call(__pyx_v_pj, ((PyObject *)__pyx_t_7), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1667; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 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 = 1667; __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 = 1667; __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 = 1667; __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_8 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1667; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_9 = Py_TYPE(__pyx_t_8)->tp_iternext;
      index = 0; __pyx_t_4 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_4)) goto __pyx_L53_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_4);
      index = 1; __pyx_t_7 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_7)) goto __pyx_L53_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_7);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_8), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1667; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_9 = NULL;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      goto __pyx_L54_unpacking_done;
      __pyx_L53_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_9 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1667; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_L54_unpacking_done:;
    }
    __pyx_v_lons = __pyx_t_4;
    __pyx_t_4 = 0;
    __pyx_v_lats = __pyx_t_7;
    __pyx_t_7 = 0;
    goto __pyx_L4;
  }

  /* "pygrib.pyx":1668
 *             x, y = np.meshgrid(x, y)
 *             lons, lats = pj(x, y, inverse=True)
 *         elif self['gridType'] == 'lambert':             # <<<<<<<<<<<<<<
 *             lat1 = self['latitudeOfFirstGridPointInDegrees']
 *             lon1 = self['longitudeOfFirstGridPointInDegrees']
 */
  __pyx_t_3 = PyObject_GetItem(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_n_s__gridType)); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1668; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_7 = PyObject_RichCompare(__pyx_t_3, ((PyObject *)__pyx_n_s__lambert), Py_EQ); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1668; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1668; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (__pyx_t_5) {

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

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

    /* "pygrib.pyx":1671
 *             lat1 = self['latitudeOfFirstGridPointInDegrees']
 *             lon1 = self['longitudeOfFirstGridPointInDegrees']
 *             try:             # <<<<<<<<<<<<<<
 *                 nx = self['Nx']
 *                 ny = self['Ny']
 */
    {
      __Pyx_ExceptionSave(&__pyx_t_12, &__pyx_t_11, &__pyx_t_10);
      __Pyx_XGOTREF(__pyx_t_12);
      __Pyx_XGOTREF(__pyx_t_11);
      __Pyx_XGOTREF(__pyx_t_10);
      /*try:*/ {

        /* "pygrib.pyx":1672
 *             lon1 = self['longitudeOfFirstGridPointInDegrees']
 *             try:
 *                 nx = self['Nx']             # <<<<<<<<<<<<<<
 *                 ny = self['Ny']
 *             except:
 */
        __pyx_t_7 = PyObject_GetItem(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_n_s__Nx)); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1672; __pyx_clineno = __LINE__; goto __pyx_L55_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_v_nx = __pyx_t_7;
        __pyx_t_7 = 0;

        /* "pygrib.pyx":1673
 *             try:
 *                 nx = self['Nx']
 *                 ny = self['Ny']             # <<<<<<<<<<<<<<
 *             except:
 *                 nx = self['Ni']
 */
        __pyx_t_7 = PyObject_GetItem(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_n_s__Ny)); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1673; __pyx_clineno = __LINE__; goto __pyx_L55_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_v_ny = __pyx_t_7;
        __pyx_t_7 = 0;
      }
      __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      goto __pyx_L62_try_end;
      __pyx_L55_error:;
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;

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

        /* "pygrib.pyx":1675
 *                 ny = self['Ny']
 *             except:
 *                 nx = self['Ni']             # <<<<<<<<<<<<<<
 *                 ny = self['Nj']
 *             dx = self['DxInMetres']
 */
        __pyx_t_8 = PyObject_GetItem(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_n_s__Ni)); if (!__pyx_t_8) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1675; __pyx_clineno = __LINE__; goto __pyx_L57_except_error;}
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_XDECREF_SET(__pyx_v_nx, __pyx_t_8);
        __pyx_t_8 = 0;

        /* "pygrib.pyx":1676
 *             except:
 *                 nx = self['Ni']
 *                 ny = self['Nj']             # <<<<<<<<<<<<<<
 *             dx = self['DxInMetres']
 *             dy = self['DyInMetres']
 */
        __pyx_t_8 = PyObject_GetItem(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_n_s__Nj)); if (!__pyx_t_8) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1676; __pyx_clineno = __LINE__; goto __pyx_L57_except_error;}
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_XDECREF_SET(__pyx_v_ny, __pyx_t_8);
        __pyx_t_8 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        goto __pyx_L56_exception_handled;
      }
      __pyx_L57_except_error:;
      __Pyx_XGIVEREF(__pyx_t_12);
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_ExceptionReset(__pyx_t_12, __pyx_t_11, __pyx_t_10);
      goto __pyx_L1_error;
      __pyx_L56_exception_handled:;
      __Pyx_XGIVEREF(__pyx_t_12);
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_ExceptionReset(__pyx_t_12, __pyx_t_11, __pyx_t_10);
      __pyx_L62_try_end:;
    }

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

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

    /* "pygrib.pyx":1679
 *             dx = self['DxInMetres']
 *             dy = self['DyInMetres']
 *             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 = 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__Proj); 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 = PyTuple_New(1); 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_INCREF(__pyx_v_self->projparams);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_self->projparams);
    __Pyx_GIVEREF(__pyx_v_self->projparams);
    __pyx_t_7 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), NULL); 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_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
    __pyx_v_pj = __pyx_t_7;
    __pyx_t_7 = 0;

    /* "pygrib.pyx":1680
 *             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_t_7 = PyTuple_New(2); 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_INCREF(__pyx_v_lon1);
    PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_lon1);
    __Pyx_GIVEREF(__pyx_v_lon1);
    __Pyx_INCREF(__pyx_v_lat1);
    PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_v_lat1);
    __Pyx_GIVEREF(__pyx_v_lat1);
    __pyx_t_4 = PyObject_Call(__pyx_v_pj, ((PyObject *)__pyx_t_7), NULL); 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);
    __Pyx_DECREF(((PyObject *)__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 = 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_3 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_7 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_3 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_3);
      #else
      __pyx_t_7 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1680; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_3 = PySequence_ITEM(sequence, 1); 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);
      #endif
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else
    {
      Py_ssize_t index = -1;
      __pyx_t_8 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1680; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_9 = Py_TYPE(__pyx_t_8)->tp_iternext;
      index = 0; __pyx_t_7 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_7)) goto __pyx_L65_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_7);
      index = 1; __pyx_t_3 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_3)) goto __pyx_L65_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_3);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_8), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1680; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_9 = NULL;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      goto __pyx_L66_unpacking_done;
      __pyx_L65_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_9 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1680; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_L66_unpacking_done:;
    }
    __pyx_v_llcrnrx = __pyx_t_7;
    __pyx_t_7 = 0;
    __pyx_v_llcrnry = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "pygrib.pyx":1681
 *             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 = 1681; __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 = 1681; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyTuple_New(1); 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_INCREF(__pyx_v_nx);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_nx);
    __Pyx_GIVEREF(__pyx_v_nx);
    __pyx_t_7 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), NULL); 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_3); __pyx_t_3 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
    __pyx_t_4 = PyNumber_Multiply(__pyx_v_dx, __pyx_t_7); 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_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = PyNumber_Add(__pyx_v_llcrnrx, __pyx_t_4); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1681; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_v_x = __pyx_t_7;
    __pyx_t_7 = 0;

    /* "pygrib.pyx":1682
 *             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 = 1682; __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 = 1682; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1682; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_INCREF(__pyx_v_ny);
    PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_ny);
    __Pyx_GIVEREF(__pyx_v_ny);
    __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1682; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
    __pyx_t_7 = PyNumber_Multiply(__pyx_v_dy, __pyx_t_3); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1682; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyNumber_Add(__pyx_v_llcrnry, __pyx_t_7); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1682; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_v_y = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "pygrib.pyx":1683
 *             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 = 1683; __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 = 1683; __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(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1683; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v_x);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_x);
    __Pyx_GIVEREF(__pyx_v_x);
    __Pyx_INCREF(__pyx_v_y);
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_y);
    __Pyx_GIVEREF(__pyx_v_y);
    __pyx_t_4 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1683; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 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 = 1683; __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 = 1683; __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 = 1683; __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_8 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1683; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_9 = Py_TYPE(__pyx_t_8)->tp_iternext;
      index = 0; __pyx_t_3 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_3)) goto __pyx_L67_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_3);
      index = 1; __pyx_t_7 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_7)) goto __pyx_L67_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_7);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_8), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1683; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_9 = NULL;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      goto __pyx_L68_unpacking_done;
      __pyx_L67_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_9 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1683; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_L68_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":1684
 *             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_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1684; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_v_x);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_x);
    __Pyx_GIVEREF(__pyx_v_x);
    __Pyx_INCREF(__pyx_v_y);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_y);
    __Pyx_GIVEREF(__pyx_v_y);
    __pyx_t_7 = PyDict_New(); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1684; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_7));
    __pyx_t_3 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1684; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    if (PyDict_SetItem(__pyx_t_7, ((PyObject *)__pyx_n_s__inverse), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1684; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyObject_Call(__pyx_v_pj, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_7)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1684; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
    __Pyx_DECREF(((PyObject *)__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 = 1684; __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 = 1684; __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 = 1684; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      #endif
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else
    {
      Py_ssize_t index = -1;
      __pyx_t_8 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1684; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_9 = Py_TYPE(__pyx_t_8)->tp_iternext;
      index = 0; __pyx_t_7 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_7)) goto __pyx_L69_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_7);
      index = 1; __pyx_t_4 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_4)) goto __pyx_L69_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_4);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_8), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1684; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_9 = NULL;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      goto __pyx_L70_unpacking_done;
      __pyx_L69_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_9 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1684; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_L70_unpacking_done:;
    }
    __pyx_v_lons = __pyx_t_7;
    __pyx_t_7 = 0;
    __pyx_v_lats = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L4;
  }

  /* "pygrib.pyx":1685
 *             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_3 = PyObject_GetItem(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_n_s__gridType)); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1685; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyObject_RichCompare(__pyx_t_3, ((PyObject *)__pyx_n_s__albers), Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1685; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1685; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__pyx_t_5) {

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

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

    /* "pygrib.pyx":1688
 *             lat1 = self['latitudeOfFirstGridPointInDegrees']
 *             lon1 = self['longitudeOfFirstGridPointInDegrees']
 *             try:             # <<<<<<<<<<<<<<
 *                 nx = self['Nx']
 *                 ny = self['Ny']
 */
    {
      __Pyx_ExceptionSave(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
      __Pyx_XGOTREF(__pyx_t_10);
      __Pyx_XGOTREF(__pyx_t_11);
      __Pyx_XGOTREF(__pyx_t_12);
      /*try:*/ {

        /* "pygrib.pyx":1689
 *             lon1 = self['longitudeOfFirstGridPointInDegrees']
 *             try:
 *                 nx = self['Nx']             # <<<<<<<<<<<<<<
 *                 ny = self['Ny']
 *             except:
 */
        __pyx_t_4 = PyObject_GetItem(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_n_s__Nx)); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1689; __pyx_clineno = __LINE__; goto __pyx_L71_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_v_nx = __pyx_t_4;
        __pyx_t_4 = 0;

        /* "pygrib.pyx":1690
 *             try:
 *                 nx = self['Nx']
 *                 ny = self['Ny']             # <<<<<<<<<<<<<<
 *             except:
 *                 nx = self['Ni']
 */
        __pyx_t_4 = PyObject_GetItem(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_n_s__Ny)); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1690; __pyx_clineno = __LINE__; goto __pyx_L71_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_v_ny = __pyx_t_4;
        __pyx_t_4 = 0;
      }
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
      goto __pyx_L78_try_end;
      __pyx_L71_error:;
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;

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

        /* "pygrib.pyx":1692
 *                 ny = self['Ny']
 *             except:
 *                 nx = self['Ni']             # <<<<<<<<<<<<<<
 *                 ny = self['Nj']
 *             dx = self['Dx']/1000.
 */
        __pyx_t_8 = PyObject_GetItem(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_n_s__Ni)); if (!__pyx_t_8) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1692; __pyx_clineno = __LINE__; goto __pyx_L73_except_error;}
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_XDECREF_SET(__pyx_v_nx, __pyx_t_8);
        __pyx_t_8 = 0;

        /* "pygrib.pyx":1693
 *             except:
 *                 nx = self['Ni']
 *                 ny = self['Nj']             # <<<<<<<<<<<<<<
 *             dx = self['Dx']/1000.
 *             dy = self['Dy']/1000.
 */
        __pyx_t_8 = PyObject_GetItem(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_n_s__Nj)); if (!__pyx_t_8) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1693; __pyx_clineno = __LINE__; goto __pyx_L73_except_error;}
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_XDECREF_SET(__pyx_v_ny, __pyx_t_8);
        __pyx_t_8 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        goto __pyx_L72_exception_handled;
      }
      __pyx_L73_except_error:;
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_XGIVEREF(__pyx_t_12);
      __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
      goto __pyx_L1_error;
      __pyx_L72_exception_handled:;
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_XGIVEREF(__pyx_t_12);
      __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
      __pyx_L78_try_end:;
    }

    /* "pygrib.pyx":1694
 *                 nx = self['Ni']
 *                 ny = self['Nj']
 *             dx = self['Dx']/1000.             # <<<<<<<<<<<<<<
 *             dy = self['Dy']/1000.
 *             scale = float(self['grib2divider'])
 */
    __pyx_t_7 = PyObject_GetItem(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_n_s__Dx)); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1694; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_3 = PyFloat_FromDouble(1000.); 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_t_4 = __Pyx_PyNumber_Divide(__pyx_t_7, __pyx_t_3); 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_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_dx = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "pygrib.pyx":1695
 *                 ny = self['Nj']
 *             dx = self['Dx']/1000.
 *             dy = self['Dy']/1000.             # <<<<<<<<<<<<<<
 *             scale = float(self['grib2divider'])
 *             pj = pyproj.Proj(self.projparams)
 */
    __pyx_t_4 = PyObject_GetItem(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_n_s__Dy)); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1695; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = PyFloat_FromDouble(1000.); 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_t_7 = __Pyx_PyNumber_Divide(__pyx_t_4, __pyx_t_3); 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_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_dy = __pyx_t_7;
    __pyx_t_7 = 0;

    /* "pygrib.pyx":1696
 *             dx = self['Dx']/1000.
 *             dy = self['Dy']/1000.
 *             scale = float(self['grib2divider'])             # <<<<<<<<<<<<<<
 *             pj = pyproj.Proj(self.projparams)
 *             llcrnrx, llcrnry = pj(lon1,lat1)
 */
    __pyx_t_7 = PyObject_GetItem(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_n_s__grib2divider)); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1696; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_13 = __Pyx_PyObject_AsDouble(__pyx_t_7); if (unlikely(__pyx_t_13 == ((double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1696; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = PyFloat_FromDouble(__pyx_t_13); 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_v_scale = __pyx_t_7;
    __pyx_t_7 = 0;

    /* "pygrib.pyx":1697
 *             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_7 = __Pyx_GetModuleGlobalName(__pyx_n_s__pyproj); 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__Proj); 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 = PyTuple_New(1); 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_INCREF(__pyx_v_self->projparams);
    PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_self->projparams);
    __Pyx_GIVEREF(__pyx_v_self->projparams);
    __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_7), 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_3); __pyx_t_3 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
    __pyx_v_pj = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "pygrib.pyx":1698
 *             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_t_4 = PyTuple_New(2); 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_INCREF(__pyx_v_lon1);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_lon1);
    __Pyx_GIVEREF(__pyx_v_lon1);
    __Pyx_INCREF(__pyx_v_lat1);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_lat1);
    __Pyx_GIVEREF(__pyx_v_lat1);
    __pyx_t_7 = PyObject_Call(__pyx_v_pj, ((PyObject *)__pyx_t_4), NULL); 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);
    __Pyx_DECREF(((PyObject *)__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 = 1698; __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_3 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_4 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_3 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_3);
      #else
      __pyx_t_4 = PySequence_ITEM(sequence, 0); 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_t_3 = PySequence_ITEM(sequence, 1); 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);
      #endif
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    } else
    {
      Py_ssize_t index = -1;
      __pyx_t_8 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1698; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_9 = Py_TYPE(__pyx_t_8)->tp_iternext;
      index = 0; __pyx_t_4 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_4)) goto __pyx_L81_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_4);
      index = 1; __pyx_t_3 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_3)) goto __pyx_L81_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_3);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_8), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1698; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_9 = NULL;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      goto __pyx_L82_unpacking_done;
      __pyx_L81_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_9 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1698; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_L82_unpacking_done:;
    }
    __pyx_v_llcrnrx = __pyx_t_4;
    __pyx_t_4 = 0;
    __pyx_v_llcrnry = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "pygrib.pyx":1699
 *             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 = 1699; __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 = 1699; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1699; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_INCREF(__pyx_v_nx);
    PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_nx);
    __Pyx_GIVEREF(__pyx_v_nx);
    __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_7), NULL); 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_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(((PyObject *)__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 = 1699; __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 = 1699; __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":1700
 *             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 = 1700; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s__arange); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1700; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1700; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_v_ny);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_ny);
    __Pyx_GIVEREF(__pyx_v_ny);
    __pyx_t_3 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1700; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
    __pyx_t_4 = PyNumber_Multiply(__pyx_v_dy, __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1700; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyNumber_Add(__pyx_v_llcrnry, __pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1700; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_v_y = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "pygrib.pyx":1701
 *             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 = 1701; __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 = 1701; __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(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1701; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v_x);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_x);
    __Pyx_GIVEREF(__pyx_v_x);
    __Pyx_INCREF(__pyx_v_y);
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_y);
    __Pyx_GIVEREF(__pyx_v_y);
    __pyx_t_7 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1701; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 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 = 1701; __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_4 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_3 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_4 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      #else
      __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1701; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1701; __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_8 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1701; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_9 = Py_TYPE(__pyx_t_8)->tp_iternext;
      index = 0; __pyx_t_3 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_3)) goto __pyx_L83_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_3);
      index = 1; __pyx_t_4 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_4)) goto __pyx_L83_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_4);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_8), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1701; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_9 = NULL;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      goto __pyx_L84_unpacking_done;
      __pyx_L83_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_9 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1701; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_L84_unpacking_done:;
    }
    __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_3);
    __pyx_t_3 = 0;
    __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "pygrib.pyx":1702
 *             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_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1702; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_INCREF(__pyx_v_x);
    PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_x);
    __Pyx_GIVEREF(__pyx_v_x);
    __Pyx_INCREF(__pyx_v_y);
    PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_v_y);
    __Pyx_GIVEREF(__pyx_v_y);
    __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1702; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
    __pyx_t_3 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1702; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__inverse), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1702; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyObject_Call(__pyx_v_pj, ((PyObject *)__pyx_t_7), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1702; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 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 = 1702; __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 = 1702; __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 = 1702; __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_8 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1702; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_9 = Py_TYPE(__pyx_t_8)->tp_iternext;
      index = 0; __pyx_t_4 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_4)) goto __pyx_L85_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_4);
      index = 1; __pyx_t_7 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_7)) goto __pyx_L85_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_7);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_8), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1702; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_9 = NULL;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      goto __pyx_L86_unpacking_done;
      __pyx_L85_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_9 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1702; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_L86_unpacking_done:;
    }
    __pyx_v_lons = __pyx_t_4;
    __pyx_t_4 = 0;
    __pyx_v_lats = __pyx_t_7;
    __pyx_t_7 = 0;
    goto __pyx_L4;
  }

  /* "pygrib.pyx":1703
 *             x, y = np.meshgrid(x, y)
 *             lons, lats = pj(x, y, inverse=True)
 *         elif self['gridType'] == 'space_view':             # <<<<<<<<<<<<<<
 *             try:
 *                 nx = self['Nx']
 */
  __pyx_t_3 = PyObject_GetItem(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_n_s__gridType)); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1703; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_7 = PyObject_RichCompare(__pyx_t_3, ((PyObject *)__pyx_n_s__space_view), Py_EQ); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1703; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1703; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (__pyx_t_5) {

    /* "pygrib.pyx":1704
 *             lons, lats = pj(x, y, inverse=True)
 *         elif self['gridType'] == 'space_view':
 *             try:             # <<<<<<<<<<<<<<
 *                 nx = self['Nx']
 *                 ny = self['Ny']
 */
    {
      __Pyx_ExceptionSave(&__pyx_t_12, &__pyx_t_11, &__pyx_t_10);
      __Pyx_XGOTREF(__pyx_t_12);
      __Pyx_XGOTREF(__pyx_t_11);
      __Pyx_XGOTREF(__pyx_t_10);
      /*try:*/ {

        /* "pygrib.pyx":1705
 *         elif self['gridType'] == 'space_view':
 *             try:
 *                 nx = self['Nx']             # <<<<<<<<<<<<<<
 *                 ny = self['Ny']
 *             except:
 */
        __pyx_t_7 = PyObject_GetItem(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_n_s__Nx)); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1705; __pyx_clineno = __LINE__; goto __pyx_L87_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_v_nx = __pyx_t_7;
        __pyx_t_7 = 0;

        /* "pygrib.pyx":1706
 *             try:
 *                 nx = self['Nx']
 *                 ny = self['Ny']             # <<<<<<<<<<<<<<
 *             except:
 *                 nx = self['Ni']
 */
        __pyx_t_7 = PyObject_GetItem(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_n_s__Ny)); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1706; __pyx_clineno = __LINE__; goto __pyx_L87_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_v_ny = __pyx_t_7;
        __pyx_t_7 = 0;
      }
      __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      goto __pyx_L94_try_end;
      __pyx_L87_error:;
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;

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

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

        /* "pygrib.pyx":1709
 *             except:
 *                 nx = self['Ni']
 *                 ny = self['Nj']             # <<<<<<<<<<<<<<
 *             # general case of 'near-side perspective projection' (untested)
 *             if self.projparams['proj'] == 'nsper' and \
 */
        __pyx_t_8 = PyObject_GetItem(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_n_s__Nj)); if (!__pyx_t_8) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1709; __pyx_clineno = __LINE__; goto __pyx_L89_except_error;}
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_XDECREF_SET(__pyx_v_ny, __pyx_t_8);
        __pyx_t_8 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        goto __pyx_L88_exception_handled;
      }
      __pyx_L89_except_error:;
      __Pyx_XGIVEREF(__pyx_t_12);
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_ExceptionReset(__pyx_t_12, __pyx_t_11, __pyx_t_10);
      goto __pyx_L1_error;
      __pyx_L88_exception_handled:;
      __Pyx_XGIVEREF(__pyx_t_12);
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_ExceptionReset(__pyx_t_12, __pyx_t_11, __pyx_t_10);
      __pyx_L94_try_end:;
    }

    /* "pygrib.pyx":1711
 *                 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_4 = PyObject_GetItem(__pyx_v_self->projparams, ((PyObject *)__pyx_n_s__proj)); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1711; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = PyObject_RichCompare(__pyx_t_4, ((PyObject *)__pyx_n_s__nsper), Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1711; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1711; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (__pyx_t_5) {

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

      /* "pygrib.pyx":1713
 *             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_7 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_179), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1713; __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 = 1713; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L97;
    }
    __pyx_L97:;

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

    /* "pygrib.pyx":1716
 *             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_7 = PyObject_GetItem(__pyx_v_self->projparams, ((PyObject *)__pyx_n_s__lon_0)); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1716; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_v_lon_0 = __pyx_t_7;
    __pyx_t_7 = 0;
    __pyx_t_7 = PyObject_GetItem(__pyx_v_self->projparams, ((PyObject *)__pyx_n_s__lat_0)); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1716; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_v_lat_0 = __pyx_t_7;
    __pyx_t_7 = 0;

    /* "pygrib.pyx":1718
 *             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_7 = PyFloat_FromDouble(90.); 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_4 = PyNumber_Add(__pyx_v_lon_0, __pyx_t_7); 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_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = PyFloat_FromDouble(180.); 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_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); 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_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__pi); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1718; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyNumber_Divide(__pyx_t_7, __pyx_t_8); 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_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1718; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s__arcsin); 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_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_8 = PyObject_GetItem(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_n_s__Nr)); if (!__pyx_t_8) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1718; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_14 = __Pyx_PyNumber_Divide(__pyx_v_scale, __pyx_t_8); 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_8); __pyx_t_8 = 0;
    __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1718; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_14);
    __Pyx_GIVEREF(__pyx_t_14);
    __pyx_t_14 = 0;
    __pyx_t_14 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_t_8), NULL); 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_7); __pyx_t_7 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
    __pyx_t_8 = PyNumber_Multiply(__pyx_t_3, __pyx_t_14); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1718; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    __pyx_t_14 = PyNumber_Subtract(__pyx_t_4, __pyx_t_8); 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_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_v_lonmax = __pyx_t_14;
    __pyx_t_14 = 0;

    /* "pygrib.pyx":1721
 *             # 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_14 = PyFloat_FromDouble(90.); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1721; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_14);
    __pyx_t_8 = PyNumber_Add(__pyx_v_lat_0, __pyx_t_14); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1721; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    __pyx_t_14 = PyFloat_FromDouble(180.); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1721; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_14);
    __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1721; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s__pi); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1721; __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_PyNumber_Divide(__pyx_t_14, __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1721; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    __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 = 1721; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__arcsin); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1721; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_14);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyObject_GetItem(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_n_s__Nr)); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1721; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_7 = __Pyx_PyNumber_Divide(__pyx_v_scale, __pyx_t_3); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1721; __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 = 1721; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_7);
    __Pyx_GIVEREF(__pyx_t_7);
    __pyx_t_7 = 0;
    __pyx_t_7 = PyObject_Call(__pyx_t_14, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1721; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
    __pyx_t_3 = PyNumber_Multiply(__pyx_t_4, __pyx_t_7); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1721; __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;
    __pyx_t_7 = PyNumber_Subtract(__pyx_t_8, __pyx_t_3); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1721; __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_3); __pyx_t_3 = 0;
    __pyx_v_latmax = __pyx_t_7;
    __pyx_t_7 = 0;

    /* "pygrib.pyx":1724
 *             # 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_7 = PyNumber_Multiply(__pyx_int_1000, __pyx_v_latmax); 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_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_7);
    __Pyx_GIVEREF(__pyx_t_7);
    __pyx_t_7 = 0;
    __pyx_t_7 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_3), NULL); 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(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
    __pyx_t_3 = PyFloat_FromDouble(1000.); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_8 = __Pyx_PyNumber_Divide(__pyx_t_7, __pyx_t_3); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF_SET(__pyx_v_latmax, __pyx_t_8);
    __pyx_t_8 = 0;

    /* "pygrib.pyx":1725
 *             # 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_8 = PyNumber_Multiply(__pyx_int_1000, __pyx_v_lonmax); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1725; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1725; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_8);
    __Pyx_GIVEREF(__pyx_t_8);
    __pyx_t_8 = 0;
    __pyx_t_8 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1725; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
    __pyx_t_3 = PyFloat_FromDouble(1000.); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1725; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_7 = __Pyx_PyNumber_Divide(__pyx_t_8, __pyx_t_3); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1725; __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_3); __pyx_t_3 = 0;
    __Pyx_DECREF_SET(__pyx_v_lonmax, __pyx_t_7);
    __pyx_t_7 = 0;

    /* "pygrib.pyx":1726
 *             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_7 = __Pyx_GetModuleGlobalName(__pyx_n_s__pyproj); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1726; __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 = 1726; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1726; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_INCREF(__pyx_v_self->projparams);
    PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_self->projparams);
    __Pyx_GIVEREF(__pyx_v_self->projparams);
    __pyx_t_8 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1726; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
    __pyx_v_pj = __pyx_t_8;
    __pyx_t_8 = 0;

    /* "pygrib.pyx":1727
 *             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_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1727; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_INCREF(__pyx_v_lon_0);
    PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_lon_0);
    __Pyx_GIVEREF(__pyx_v_lon_0);
    __Pyx_INCREF(__pyx_v_latmax);
    PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_v_latmax);
    __Pyx_GIVEREF(__pyx_v_latmax);
    __pyx_t_7 = PyObject_Call(__pyx_v_pj, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1727; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 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 = 1727; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      #if CYTHON_COMPILING_IN_CPYTHON
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_8 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_8 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_3 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_INCREF(__pyx_t_3);
      #else
      __pyx_t_8 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1727; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1727; __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_4 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1727; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_9 = Py_TYPE(__pyx_t_4)->tp_iternext;
      index = 0; __pyx_t_8 = __pyx_t_9(__pyx_t_4); if (unlikely(!__pyx_t_8)) goto __pyx_L98_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_8);
      index = 1; __pyx_t_3 = __pyx_t_9(__pyx_t_4); if (unlikely(!__pyx_t_3)) goto __pyx_L98_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_3);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_4), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1727; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_9 = NULL;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      goto __pyx_L99_unpacking_done;
      __pyx_L98_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_9 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1727; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_L99_unpacking_done:;
    }
    __pyx_v_x1 = __pyx_t_8;
    __pyx_t_8 = 0;
    __pyx_v_y1 = __pyx_t_3;
    __pyx_t_3 = 0;
    __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1727; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_INCREF(__pyx_v_lonmax);
    PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_lonmax);
    __Pyx_GIVEREF(__pyx_v_lonmax);
    __Pyx_INCREF(__pyx_v_lat_0);
    PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_v_lat_0);
    __Pyx_GIVEREF(__pyx_v_lat_0);
    __pyx_t_3 = PyObject_Call(__pyx_v_pj, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1727; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(((PyObject *)__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 = 1727; __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_8 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_7 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_8 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_8);
      #else
      __pyx_t_7 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1727; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_8 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1727; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      #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 = 1727; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_9 = Py_TYPE(__pyx_t_4)->tp_iternext;
      index = 0; __pyx_t_7 = __pyx_t_9(__pyx_t_4); if (unlikely(!__pyx_t_7)) goto __pyx_L100_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_7);
      index = 1; __pyx_t_8 = __pyx_t_9(__pyx_t_4); if (unlikely(!__pyx_t_8)) goto __pyx_L100_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_8);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_4), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1727; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_9 = NULL;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      goto __pyx_L101_unpacking_done;
      __pyx_L100_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_9 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1727; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_L101_unpacking_done:;
    }
    __pyx_v_x2 = __pyx_t_7;
    __pyx_t_7 = 0;
    __pyx_v_y2 = __pyx_t_8;
    __pyx_t_8 = 0;

    /* "pygrib.pyx":1728
 *             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_3 = PyNumber_Multiply(__pyx_int_2, __pyx_v_x2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1728; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_v_width = __pyx_t_3;
    __pyx_t_3 = 0;
    __pyx_t_3 = PyNumber_Multiply(__pyx_int_2, __pyx_v_y1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1728; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_v_height = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "pygrib.pyx":1729
 *             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_3 = PyObject_GetItem(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_n_s__dx)); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1729; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_8 = __Pyx_PyNumber_Divide(__pyx_v_width, __pyx_t_3); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1729; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_dx = __pyx_t_8;
    __pyx_t_8 = 0;

    /* "pygrib.pyx":1730
 *             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_8 = PyObject_GetItem(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_n_s__dy)); if (!__pyx_t_8) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1730; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_3 = __Pyx_PyNumber_Divide(__pyx_v_height, __pyx_t_8); 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);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_v_dy = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "pygrib.pyx":1731
 *             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_3 = PyNumber_Subtract(__pyx_v_nx, __pyx_int_1); 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_8 = PyNumber_Multiply(__pyx_v_dx, __pyx_t_3); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1731; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_xmax = __pyx_t_8;
    __pyx_t_8 = 0;
    __pyx_t_8 = PyNumber_Subtract(__pyx_v_ny, __pyx_int_1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1731; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_3 = PyNumber_Multiply(__pyx_v_dy, __pyx_t_8); 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_8); __pyx_t_8 = 0;
    __pyx_v_ymax = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "pygrib.pyx":1732
 *             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_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); 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_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__linspace); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1732; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyFloat_FromDouble(-0.5); 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_t_7 = PyNumber_Multiply(__pyx_t_3, __pyx_v_xmax); 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_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyFloat_FromDouble(0.5); 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_t_4 = PyNumber_Multiply(__pyx_t_3, __pyx_v_xmax); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1732; __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(3); 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);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_7);
    __Pyx_GIVEREF(__pyx_t_7);
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_v_nx);
    PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_nx);
    __Pyx_GIVEREF(__pyx_v_nx);
    __pyx_t_7 = 0;
    __pyx_t_4 = 0;
    __pyx_t_4 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1732; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
    __pyx_v_x = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "pygrib.pyx":1733
 *             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_4 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1733; __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 = 1733; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyFloat_FromDouble(-0.5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1733; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_8 = PyNumber_Multiply(__pyx_t_4, __pyx_v_ymax); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1733; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyFloat_FromDouble(0.5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1733; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_7 = PyNumber_Multiply(__pyx_t_4, __pyx_v_ymax); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1733; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1733; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_8);
    __Pyx_GIVEREF(__pyx_t_8);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_7);
    __Pyx_GIVEREF(__pyx_t_7);
    __Pyx_INCREF(__pyx_v_ny);
    PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_ny);
    __Pyx_GIVEREF(__pyx_v_ny);
    __pyx_t_8 = 0;
    __pyx_t_7 = 0;
    __pyx_t_7 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1733; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
    __pyx_v_y = __pyx_t_7;
    __pyx_t_7 = 0;

    /* "pygrib.pyx":1734
 *             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_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_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s__meshgrid); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1734; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = PyTuple_New(2); 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_INCREF(__pyx_v_x);
    PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_x);
    __Pyx_GIVEREF(__pyx_v_x);
    __Pyx_INCREF(__pyx_v_y);
    PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_v_y);
    __Pyx_GIVEREF(__pyx_v_y);
    __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_7), 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_4); __pyx_t_4 = 0;
    __Pyx_DECREF(((PyObject *)__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 = 1734; __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 = 1734; __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 = 1734; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      #endif
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else
    {
      Py_ssize_t index = -1;
      __pyx_t_8 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1734; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_9 = Py_TYPE(__pyx_t_8)->tp_iternext;
      index = 0; __pyx_t_7 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_7)) goto __pyx_L102_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_7);
      index = 1; __pyx_t_4 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_4)) goto __pyx_L102_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_4);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_8), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1734; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_9 = NULL;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      goto __pyx_L103_unpacking_done;
      __pyx_L102_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_9 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1734; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_L103_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":1735
 *             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_3 = PyTuple_New(2); 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_INCREF(__pyx_v_x);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_x);
    __Pyx_GIVEREF(__pyx_v_x);
    __Pyx_INCREF(__pyx_v_y);
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_y);
    __Pyx_GIVEREF(__pyx_v_y);
    __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1735; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
    __pyx_t_7 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1735; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__inverse), __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1735; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = PyObject_Call(__pyx_v_pj, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1735; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
    __Pyx_DECREF(((PyObject *)__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 = 1735; __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_3 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_4 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_3 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_3);
      #else
      __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1735; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = PySequence_ITEM(sequence, 1); 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);
      #endif
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    } else
    {
      Py_ssize_t index = -1;
      __pyx_t_8 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1735; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_9 = Py_TYPE(__pyx_t_8)->tp_iternext;
      index = 0; __pyx_t_4 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_4)) goto __pyx_L104_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_4);
      index = 1; __pyx_t_3 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_3)) goto __pyx_L104_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_3);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_8), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1735; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_9 = NULL;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      goto __pyx_L105_unpacking_done;
      __pyx_L104_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_9 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1735; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_L105_unpacking_done:;
    }
    __pyx_v_lons = __pyx_t_4;
    __pyx_t_4 = 0;
    __pyx_v_lats = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "pygrib.pyx":1737
 *             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_7 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1737; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s__fabs); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1737; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1737; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_INCREF(__pyx_v_lons);
    PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_lons);
    __Pyx_GIVEREF(__pyx_v_lons);
    __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1737; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
    __pyx_v_abslons = __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 = 1737; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s__fabs); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1737; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1737; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_v_lats);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_lats);
    __Pyx_GIVEREF(__pyx_v_lats);
    __pyx_t_3 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1737; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
    __pyx_v_abslats = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "pygrib.pyx":1738
 *             # 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_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1738; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__where); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1738; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyFloat_FromDouble(1.e20); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1738; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_7 = PyObject_RichCompare(__pyx_v_abslons, __pyx_t_3, Py_LT); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1738; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyFloat_FromDouble(1.e30); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1738; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1738; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_7);
    __Pyx_GIVEREF(__pyx_t_7);
    __Pyx_INCREF(__pyx_v_lons);
    PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_v_lons);
    __Pyx_GIVEREF(__pyx_v_lons);
    PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    __pyx_t_7 = 0;
    __pyx_t_3 = 0;
    __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1738; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
    __Pyx_DECREF_SET(__pyx_v_lons, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "pygrib.pyx":1739
 *             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_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); 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_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__where); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1739; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyFloat_FromDouble(1.e20); 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_t_4 = PyObject_RichCompare(__pyx_v_abslats, __pyx_t_3, Py_LT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1739; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyFloat_FromDouble(1.e30); 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_t_7 = PyTuple_New(3); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1739; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_v_lats);
    PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_v_lats);
    __Pyx_GIVEREF(__pyx_v_lats);
    PyTuple_SET_ITEM(__pyx_t_7, 2, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    __pyx_t_4 = 0;
    __pyx_t_3 = 0;
    __pyx_t_3 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_t_7), NULL); 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_8); __pyx_t_8 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
    __Pyx_DECREF_SET(__pyx_v_lats, __pyx_t_3);
    __pyx_t_3 = 0;
    goto __pyx_L4;
  }

  /* "pygrib.pyx":1740
 *             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), ((PyObject *)__pyx_n_s__gridType)); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1740; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_7 = PyObject_RichCompare(__pyx_t_3, ((PyObject *)__pyx_n_s_161), Py_EQ); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1740; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1740; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (__pyx_t_2) {

    /* "pygrib.pyx":1741
 *             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_7 = PyObject_GetItem(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_n_s__Dx)); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1741; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_3 = PyFloat_FromDouble(1.e3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1741; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_8 = __Pyx_PyNumber_Divide(__pyx_t_7, __pyx_t_3); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1741; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_dx = __pyx_t_8;
    __pyx_t_8 = 0;

    /* "pygrib.pyx":1742
 *         elif self['gridType'] == "equatorial_azimuthal_equidistant":
 *             dx = self['Dx']/1.e3
 *             dy = self['Dy']/1.e3             # <<<<<<<<<<<<<<
 *             lat1 = self['latitudeOfFirstGridPointInDegrees']
 *             lon1 = self['longitudeOfFirstGridPointInDegrees']
 */
    __pyx_t_8 = PyObject_GetItem(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_n_s__Dy)); if (!__pyx_t_8) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1742; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_3 = PyFloat_FromDouble(1.e3); 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_t_7 = __Pyx_PyNumber_Divide(__pyx_t_8, __pyx_t_3); 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_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_dy = __pyx_t_7;
    __pyx_t_7 = 0;

    /* "pygrib.pyx":1743
 *             dx = self['Dx']/1.e3
 *             dy = self['Dy']/1.e3
 *             lat1 = self['latitudeOfFirstGridPointInDegrees']             # <<<<<<<<<<<<<<
 *             lon1 = self['longitudeOfFirstGridPointInDegrees']
 *             pj = pyproj.Proj(self.projparams)
 */
    __pyx_t_7 = PyObject_GetItem(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_n_s_171)); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1743; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_v_lat1 = __pyx_t_7;
    __pyx_t_7 = 0;

    /* "pygrib.pyx":1744
 *             dy = self['Dy']/1.e3
 *             lat1 = self['latitudeOfFirstGridPointInDegrees']
 *             lon1 = self['longitudeOfFirstGridPointInDegrees']             # <<<<<<<<<<<<<<
 *             pj = pyproj.Proj(self.projparams)
 *             llcrnrx, llcrnry = pj(lon1,lat1)
 */
    __pyx_t_7 = PyObject_GetItem(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_n_s_169)); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1744; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_v_lon1 = __pyx_t_7;
    __pyx_t_7 = 0;

    /* "pygrib.pyx":1745
 *             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 = 1745; __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 = 1745; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1745; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_INCREF(__pyx_v_self->projparams);
    PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_self->projparams);
    __Pyx_GIVEREF(__pyx_v_self->projparams);
    __pyx_t_8 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1745; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
    __pyx_v_pj = __pyx_t_8;
    __pyx_t_8 = 0;

    /* "pygrib.pyx":1746
 *             lon1 = self['longitudeOfFirstGridPointInDegrees']
 *             pj = pyproj.Proj(self.projparams)
 *             llcrnrx, llcrnry = pj(lon1,lat1)             # <<<<<<<<<<<<<<
 *             try:
 *                 nx = self['Nx']
 */
    __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1746; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_INCREF(__pyx_v_lon1);
    PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_lon1);
    __Pyx_GIVEREF(__pyx_v_lon1);
    __Pyx_INCREF(__pyx_v_lat1);
    PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_v_lat1);
    __Pyx_GIVEREF(__pyx_v_lat1);
    __pyx_t_7 = PyObject_Call(__pyx_v_pj, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1746; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 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 = 1746; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      #if CYTHON_COMPILING_IN_CPYTHON
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_8 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_8 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_3 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_INCREF(__pyx_t_3);
      #else
      __pyx_t_8 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1746; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1746; __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_4 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1746; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_9 = Py_TYPE(__pyx_t_4)->tp_iternext;
      index = 0; __pyx_t_8 = __pyx_t_9(__pyx_t_4); if (unlikely(!__pyx_t_8)) goto __pyx_L106_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_8);
      index = 1; __pyx_t_3 = __pyx_t_9(__pyx_t_4); if (unlikely(!__pyx_t_3)) goto __pyx_L106_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_3);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_4), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1746; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_9 = NULL;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      goto __pyx_L107_unpacking_done;
      __pyx_L106_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_9 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1746; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_L107_unpacking_done:;
    }
    __pyx_v_llcrnrx = __pyx_t_8;
    __pyx_t_8 = 0;
    __pyx_v_llcrnry = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "pygrib.pyx":1747
 *             pj = pyproj.Proj(self.projparams)
 *             llcrnrx, llcrnry = pj(lon1,lat1)
 *             try:             # <<<<<<<<<<<<<<
 *                 nx = self['Nx']
 *                 ny = self['Ny']
 */
    {
      __Pyx_ExceptionSave(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
      __Pyx_XGOTREF(__pyx_t_10);
      __Pyx_XGOTREF(__pyx_t_11);
      __Pyx_XGOTREF(__pyx_t_12);
      /*try:*/ {

        /* "pygrib.pyx":1748
 *             llcrnrx, llcrnry = pj(lon1,lat1)
 *             try:
 *                 nx = self['Nx']             # <<<<<<<<<<<<<<
 *                 ny = self['Ny']
 *             except:
 */
        __pyx_t_7 = PyObject_GetItem(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_n_s__Nx)); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1748; __pyx_clineno = __LINE__; goto __pyx_L108_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_v_nx = __pyx_t_7;
        __pyx_t_7 = 0;

        /* "pygrib.pyx":1749
 *             try:
 *                 nx = self['Nx']
 *                 ny = self['Ny']             # <<<<<<<<<<<<<<
 *             except:
 *                 nx = self['Ni']
 */
        __pyx_t_7 = PyObject_GetItem(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_n_s__Ny)); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1749; __pyx_clineno = __LINE__; goto __pyx_L108_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_v_ny = __pyx_t_7;
        __pyx_t_7 = 0;
      }
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
      goto __pyx_L115_try_end;
      __pyx_L108_error:;
      __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;

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

        /* "pygrib.pyx":1751
 *                 ny = self['Ny']
 *             except:
 *                 nx = self['Ni']             # <<<<<<<<<<<<<<
 *                 ny = self['Nj']
 *             x = llcrnrx+dx*np.arange(nx)
 */
        __pyx_t_4 = PyObject_GetItem(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_n_s__Ni)); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1751; __pyx_clineno = __LINE__; goto __pyx_L110_except_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_XDECREF_SET(__pyx_v_nx, __pyx_t_4);
        __pyx_t_4 = 0;

        /* "pygrib.pyx":1752
 *             except:
 *                 nx = self['Ni']
 *                 ny = self['Nj']             # <<<<<<<<<<<<<<
 *             x = llcrnrx+dx*np.arange(nx)
 *             y = llcrnry+dy*np.arange(ny)
 */
        __pyx_t_4 = PyObject_GetItem(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_n_s__Nj)); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1752; __pyx_clineno = __LINE__; goto __pyx_L110_except_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_XDECREF_SET(__pyx_v_ny, __pyx_t_4);
        __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        goto __pyx_L109_exception_handled;
      }
      __pyx_L110_except_error:;
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_XGIVEREF(__pyx_t_12);
      __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
      goto __pyx_L1_error;
      __pyx_L109_exception_handled:;
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_XGIVEREF(__pyx_t_12);
      __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
      __pyx_L115_try_end:;
    }

    /* "pygrib.pyx":1753
 *                 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_8 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1753; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s__arange); 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_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1753; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_INCREF(__pyx_v_nx);
    PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_nx);
    __Pyx_GIVEREF(__pyx_v_nx);
    __pyx_t_7 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_8), NULL); 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_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
    __pyx_t_8 = PyNumber_Multiply(__pyx_v_dx, __pyx_t_7); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1753; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = PyNumber_Add(__pyx_v_llcrnrx, __pyx_t_8); 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_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_v_x = __pyx_t_7;
    __pyx_t_7 = 0;

    /* "pygrib.pyx":1754
 *                 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_7 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1754; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s__arange); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1754; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1754; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_INCREF(__pyx_v_ny);
    PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_ny);
    __Pyx_GIVEREF(__pyx_v_ny);
    __pyx_t_3 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1754; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
    __pyx_t_7 = PyNumber_Multiply(__pyx_v_dy, __pyx_t_3); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1754; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyNumber_Add(__pyx_v_llcrnry, __pyx_t_7); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1754; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_v_y = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "pygrib.pyx":1755
 *             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_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1755; __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 = 1755; __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(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1755; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v_x);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_x);
    __Pyx_GIVEREF(__pyx_v_x);
    __Pyx_INCREF(__pyx_v_y);
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_y);
    __Pyx_GIVEREF(__pyx_v_y);
    __pyx_t_8 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1755; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
    if ((likely(PyTuple_CheckExact(__pyx_t_8))) || (PyList_CheckExact(__pyx_t_8))) {
      PyObject* sequence = __pyx_t_8;
      #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 = 1755; __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 = 1755; __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 = 1755; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      #endif
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    } else
    {
      Py_ssize_t index = -1;
      __pyx_t_4 = PyObject_GetIter(__pyx_t_8); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1755; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_9 = Py_TYPE(__pyx_t_4)->tp_iternext;
      index = 0; __pyx_t_3 = __pyx_t_9(__pyx_t_4); if (unlikely(!__pyx_t_3)) goto __pyx_L118_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_3);
      index = 1; __pyx_t_7 = __pyx_t_9(__pyx_t_4); if (unlikely(!__pyx_t_7)) goto __pyx_L118_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_7);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_4), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1755; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_9 = NULL;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      goto __pyx_L119_unpacking_done;
      __pyx_L118_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_9 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1755; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_L119_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":1756
 *             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_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1756; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_INCREF(__pyx_v_x);
    PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_x);
    __Pyx_GIVEREF(__pyx_v_x);
    __Pyx_INCREF(__pyx_v_y);
    PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_v_y);
    __Pyx_GIVEREF(__pyx_v_y);
    __pyx_t_7 = PyDict_New(); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1756; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_7));
    __pyx_t_3 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1756; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    if (PyDict_SetItem(__pyx_t_7, ((PyObject *)__pyx_n_s__inverse), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1756; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyObject_Call(__pyx_v_pj, ((PyObject *)__pyx_t_8), ((PyObject *)__pyx_t_7)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1756; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
    __Pyx_DECREF(((PyObject *)__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 = 1756; __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_8 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_7 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_8 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_8);
      #else
      __pyx_t_7 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1756; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_8 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1756; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      #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 = 1756; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_9 = Py_TYPE(__pyx_t_4)->tp_iternext;
      index = 0; __pyx_t_7 = __pyx_t_9(__pyx_t_4); if (unlikely(!__pyx_t_7)) goto __pyx_L120_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_7);
      index = 1; __pyx_t_8 = __pyx_t_9(__pyx_t_4); if (unlikely(!__pyx_t_8)) goto __pyx_L120_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_8);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_4), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1756; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_9 = NULL;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      goto __pyx_L121_unpacking_done;
      __pyx_L120_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_9 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1756; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_L121_unpacking_done:;
    }
    __pyx_v_lons = __pyx_t_7;
    __pyx_t_7 = 0;
    __pyx_v_lats = __pyx_t_8;
    __pyx_t_8 = 0;
    goto __pyx_L4;
  }

  /* "pygrib.pyx":1757
 *             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_3 = PyObject_GetItem(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_n_s__gridType)); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1757; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_8 = PyObject_RichCompare(__pyx_t_3, ((PyObject *)__pyx_n_s_162), Py_EQ); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1757; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1757; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  if (__pyx_t_2) {

    /* "pygrib.pyx":1758
 *             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_8 = PyObject_GetItem(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_n_s__Dx)); if (!__pyx_t_8) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1758; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_3 = PyFloat_FromDouble(1.e3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1758; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_7 = __Pyx_PyNumber_Divide(__pyx_t_8, __pyx_t_3); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1758; __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_3); __pyx_t_3 = 0;
    __pyx_v_dx = __pyx_t_7;
    __pyx_t_7 = 0;

    /* "pygrib.pyx":1759
 *         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), ((PyObject *)__pyx_n_s__Dy)); if (!__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 = PyFloat_FromDouble(1.e3); 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_t_8 = __Pyx_PyNumber_Divide(__pyx_t_7, __pyx_t_3); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1759; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_dy = __pyx_t_8;
    __pyx_t_8 = 0;

    /* "pygrib.pyx":1760
 *             dx = self['Dx']/1.e3
 *             dy = self['Dy']/1.e3
 *             lat1 = self['latitudeOfFirstGridPointInDegrees']             # <<<<<<<<<<<<<<
 *             lon1 = self['longitudeOfFirstGridPointInDegrees']
 *             pj = pyproj.Proj(self.projparams)
 */
    __pyx_t_8 = PyObject_GetItem(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_n_s_171)); if (!__pyx_t_8) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1760; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_v_lat1 = __pyx_t_8;
    __pyx_t_8 = 0;

    /* "pygrib.pyx":1761
 *             dy = self['Dy']/1.e3
 *             lat1 = self['latitudeOfFirstGridPointInDegrees']
 *             lon1 = self['longitudeOfFirstGridPointInDegrees']             # <<<<<<<<<<<<<<
 *             pj = pyproj.Proj(self.projparams)
 *             llcrnrx, llcrnry = pj(lon1,lat1)
 */
    __pyx_t_8 = PyObject_GetItem(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_n_s_169)); if (!__pyx_t_8) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1761; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_v_lon1 = __pyx_t_8;
    __pyx_t_8 = 0;

    /* "pygrib.pyx":1762
 *             lat1 = self['latitudeOfFirstGridPointInDegrees']
 *             lon1 = self['longitudeOfFirstGridPointInDegrees']
 *             pj = pyproj.Proj(self.projparams)             # <<<<<<<<<<<<<<
 *             llcrnrx, llcrnry = pj(lon1,lat1)
 *             try:
 */
    __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s__pyproj); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1762; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s__Proj); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1762; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1762; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_INCREF(__pyx_v_self->projparams);
    PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_self->projparams);
    __Pyx_GIVEREF(__pyx_v_self->projparams);
    __pyx_t_7 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1762; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
    __pyx_v_pj = __pyx_t_7;
    __pyx_t_7 = 0;

    /* "pygrib.pyx":1763
 *             lon1 = self['longitudeOfFirstGridPointInDegrees']
 *             pj = pyproj.Proj(self.projparams)
 *             llcrnrx, llcrnry = pj(lon1,lat1)             # <<<<<<<<<<<<<<
 *             try:
 *                 nx = self['Nx']
 */
    __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1763; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_INCREF(__pyx_v_lon1);
    PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_lon1);
    __Pyx_GIVEREF(__pyx_v_lon1);
    __Pyx_INCREF(__pyx_v_lat1);
    PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_v_lat1);
    __Pyx_GIVEREF(__pyx_v_lat1);
    __pyx_t_8 = PyObject_Call(__pyx_v_pj, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1763; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
    if ((likely(PyTuple_CheckExact(__pyx_t_8))) || (PyList_CheckExact(__pyx_t_8))) {
      PyObject* sequence = __pyx_t_8;
      #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 = 1763; __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_3 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_7 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_3 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_3);
      #else
      __pyx_t_7 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1763; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1763; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      #endif
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    } else
    {
      Py_ssize_t index = -1;
      __pyx_t_4 = PyObject_GetIter(__pyx_t_8); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1763; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_9 = Py_TYPE(__pyx_t_4)->tp_iternext;
      index = 0; __pyx_t_7 = __pyx_t_9(__pyx_t_4); if (unlikely(!__pyx_t_7)) goto __pyx_L122_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_7);
      index = 1; __pyx_t_3 = __pyx_t_9(__pyx_t_4); if (unlikely(!__pyx_t_3)) goto __pyx_L122_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_3);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_4), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1763; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_9 = NULL;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      goto __pyx_L123_unpacking_done;
      __pyx_L122_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_9 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1763; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_L123_unpacking_done:;
    }
    __pyx_v_llcrnrx = __pyx_t_7;
    __pyx_t_7 = 0;
    __pyx_v_llcrnry = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "pygrib.pyx":1764
 *             pj = pyproj.Proj(self.projparams)
 *             llcrnrx, llcrnry = pj(lon1,lat1)
 *             try:             # <<<<<<<<<<<<<<
 *                 nx = self['Nx']
 *                 ny = self['Ny']
 */
    {
      __Pyx_ExceptionSave(&__pyx_t_12, &__pyx_t_11, &__pyx_t_10);
      __Pyx_XGOTREF(__pyx_t_12);
      __Pyx_XGOTREF(__pyx_t_11);
      __Pyx_XGOTREF(__pyx_t_10);
      /*try:*/ {

        /* "pygrib.pyx":1765
 *             llcrnrx, llcrnry = pj(lon1,lat1)
 *             try:
 *                 nx = self['Nx']             # <<<<<<<<<<<<<<
 *                 ny = self['Ny']
 *             except:
 */
        __pyx_t_8 = PyObject_GetItem(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_n_s__Nx)); if (!__pyx_t_8) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1765; __pyx_clineno = __LINE__; goto __pyx_L124_error;}
        __Pyx_GOTREF(__pyx_t_8);
        __pyx_v_nx = __pyx_t_8;
        __pyx_t_8 = 0;

        /* "pygrib.pyx":1766
 *             try:
 *                 nx = self['Nx']
 *                 ny = self['Ny']             # <<<<<<<<<<<<<<
 *             except:
 *                 nx = self['Ni']
 */
        __pyx_t_8 = PyObject_GetItem(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_n_s__Ny)); if (!__pyx_t_8) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1766; __pyx_clineno = __LINE__; goto __pyx_L124_error;}
        __Pyx_GOTREF(__pyx_t_8);
        __pyx_v_ny = __pyx_t_8;
        __pyx_t_8 = 0;
      }
      __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      goto __pyx_L131_try_end;
      __pyx_L124_error:;
      __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;

      /* "pygrib.pyx":1767
 *                 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_8, &__pyx_t_3, &__pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1767; __pyx_clineno = __LINE__; goto __pyx_L126_except_error;}
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_GOTREF(__pyx_t_7);

        /* "pygrib.pyx":1768
 *                 ny = self['Ny']
 *             except:
 *                 nx = self['Ni']             # <<<<<<<<<<<<<<
 *                 ny = self['Nj']
 *             x = llcrnrx+dx*np.arange(nx)
 */
        __pyx_t_4 = PyObject_GetItem(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_n_s__Ni)); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1768; __pyx_clineno = __LINE__; goto __pyx_L126_except_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_XDECREF_SET(__pyx_v_nx, __pyx_t_4);
        __pyx_t_4 = 0;

        /* "pygrib.pyx":1769
 *             except:
 *                 nx = self['Ni']
 *                 ny = self['Nj']             # <<<<<<<<<<<<<<
 *             x = llcrnrx+dx*np.arange(nx)
 *             y = llcrnry+dy*np.arange(ny)
 */
        __pyx_t_4 = PyObject_GetItem(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_n_s__Nj)); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1769; __pyx_clineno = __LINE__; goto __pyx_L126_except_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_XDECREF_SET(__pyx_v_ny, __pyx_t_4);
        __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        goto __pyx_L125_exception_handled;
      }
      __pyx_L126_except_error:;
      __Pyx_XGIVEREF(__pyx_t_12);
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_ExceptionReset(__pyx_t_12, __pyx_t_11, __pyx_t_10);
      goto __pyx_L1_error;
      __pyx_L125_exception_handled:;
      __Pyx_XGIVEREF(__pyx_t_12);
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_ExceptionReset(__pyx_t_12, __pyx_t_11, __pyx_t_10);
      __pyx_L131_try_end:;
    }

    /* "pygrib.pyx":1770
 *                 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 = 1770; __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 = 1770; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1770; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_INCREF(__pyx_v_nx);
    PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_nx);
    __Pyx_GIVEREF(__pyx_v_nx);
    __pyx_t_8 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1770; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
    __pyx_t_7 = PyNumber_Multiply(__pyx_v_dx, __pyx_t_8); 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_8); __pyx_t_8 = 0;
    __pyx_t_8 = PyNumber_Add(__pyx_v_llcrnrx, __pyx_t_7); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1770; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_v_x = __pyx_t_8;
    __pyx_t_8 = 0;

    /* "pygrib.pyx":1771
 *                 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_8 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1771; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s__arange); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1771; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1771; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_INCREF(__pyx_v_ny);
    PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_ny);
    __Pyx_GIVEREF(__pyx_v_ny);
    __pyx_t_3 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1771; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
    __pyx_t_8 = PyNumber_Multiply(__pyx_v_dy, __pyx_t_3); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1771; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyNumber_Add(__pyx_v_llcrnry, __pyx_t_8); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1771; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_v_y = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "pygrib.pyx":1772
 *             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_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); 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_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__meshgrid); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1772; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1772; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v_x);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_x);
    __Pyx_GIVEREF(__pyx_v_x);
    __Pyx_INCREF(__pyx_v_y);
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_y);
    __Pyx_GIVEREF(__pyx_v_y);
    __pyx_t_7 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_t_3), NULL); 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_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 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 = 1772; __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_8 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_3 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_8 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_8);
      #else
      __pyx_t_3 = PySequence_ITEM(sequence, 0); 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_t_8 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1772; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      #endif
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    } else
    {
      Py_ssize_t index = -1;
      __pyx_t_4 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1772; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_9 = Py_TYPE(__pyx_t_4)->tp_iternext;
      index = 0; __pyx_t_3 = __pyx_t_9(__pyx_t_4); if (unlikely(!__pyx_t_3)) goto __pyx_L134_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_3);
      index = 1; __pyx_t_8 = __pyx_t_9(__pyx_t_4); if (unlikely(!__pyx_t_8)) goto __pyx_L134_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_8);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_4), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1772; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_9 = NULL;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      goto __pyx_L135_unpacking_done;
      __pyx_L134_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_9 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1772; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_L135_unpacking_done:;
    }
    __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_3);
    __pyx_t_3 = 0;
    __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_8);
    __pyx_t_8 = 0;

    /* "pygrib.pyx":1773
 *             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_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1773; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_INCREF(__pyx_v_x);
    PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_x);
    __Pyx_GIVEREF(__pyx_v_x);
    __Pyx_INCREF(__pyx_v_y);
    PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_v_y);
    __Pyx_GIVEREF(__pyx_v_y);
    __pyx_t_8 = PyDict_New(); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1773; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_8));
    __pyx_t_3 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1773; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    if (PyDict_SetItem(__pyx_t_8, ((PyObject *)__pyx_n_s__inverse), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1773; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyObject_Call(__pyx_v_pj, ((PyObject *)__pyx_t_7), ((PyObject *)__pyx_t_8)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1773; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 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 = 1773; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      #if CYTHON_COMPILING_IN_CPYTHON
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_8 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_7 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_8 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_7 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_INCREF(__pyx_t_7);
      #else
      __pyx_t_8 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1773; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_7 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1773; __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 = 1773; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_9 = Py_TYPE(__pyx_t_4)->tp_iternext;
      index = 0; __pyx_t_8 = __pyx_t_9(__pyx_t_4); if (unlikely(!__pyx_t_8)) goto __pyx_L136_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_8);
      index = 1; __pyx_t_7 = __pyx_t_9(__pyx_t_4); if (unlikely(!__pyx_t_7)) goto __pyx_L136_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_7);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_4), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1773; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_9 = NULL;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      goto __pyx_L137_unpacking_done;
      __pyx_L136_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_9 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1773; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_L137_unpacking_done:;
    }
    __pyx_v_lons = __pyx_t_8;
    __pyx_t_8 = 0;
    __pyx_v_lats = __pyx_t_7;
    __pyx_t_7 = 0;
    goto __pyx_L4;
  }

  /* "pygrib.pyx":1774
 *             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_3 = PyObject_GetItem(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_n_s__gridType)); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1774; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_7 = PyObject_RichCompare(__pyx_t_3, ((PyObject *)__pyx_n_s__mercator), Py_EQ); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1774; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1774; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (__pyx_t_2) {

    /* "pygrib.pyx":1775
 *             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 = 1775; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_3 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1775; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1775; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_INCREF(((PyObject *)__pyx_n_s__grib2divider));
    PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)__pyx_n_s__grib2divider));
    __Pyx_GIVEREF(((PyObject *)__pyx_n_s__grib2divider));
    PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    __pyx_t_3 = 0;
    __pyx_t_3 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1775; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
    __pyx_v_scale = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "pygrib.pyx":1776
 *         elif self['gridType'] == 'mercator':
 *             scale = self._get_key('grib2divider',False)
 *             if scale:             # <<<<<<<<<<<<<<
 *                 scale = float(scale)
 *             else:
 */
    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_scale); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1776; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (__pyx_t_2) {

      /* "pygrib.pyx":1777
 *             scale = self._get_key('grib2divider',False)
 *             if scale:
 *                 scale = float(scale)             # <<<<<<<<<<<<<<
 *             else:
 *                 scale = 1000.
 */
      __pyx_t_13 = __Pyx_PyObject_AsDouble(__pyx_v_scale); if (unlikely(__pyx_t_13 == ((double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1777; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_3 = PyFloat_FromDouble(__pyx_t_13); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1777; __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;
      goto __pyx_L138;
    }
    /*else*/ {

      /* "pygrib.pyx":1779
 *                 scale = float(scale)
 *             else:
 *                 scale = 1000.             # <<<<<<<<<<<<<<
 *             lon1 = self['longitudeOfFirstGridPoint']/scale
 *             lon2 = self['longitudeOfLastGridPoint']/scale
 */
      __pyx_t_3 = PyFloat_FromDouble(1000.); 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_DECREF_SET(__pyx_v_scale, __pyx_t_3);
      __pyx_t_3 = 0;
    }
    __pyx_L138:;

    /* "pygrib.pyx":1780
 *             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), ((PyObject *)__pyx_n_s_163)); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1780; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_8 = __Pyx_PyNumber_Divide(__pyx_t_3, __pyx_v_scale); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1780; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_lon1 = __pyx_t_8;
    __pyx_t_8 = 0;

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

    /* "pygrib.pyx":1782
 *             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 = 1782; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_8 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1782; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1782; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_INCREF(((PyObject *)__pyx_n_s__truncateDegrees));
    PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_n_s__truncateDegrees));
    __Pyx_GIVEREF(((PyObject *)__pyx_n_s__truncateDegrees));
    PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_8);
    __Pyx_GIVEREF(__pyx_t_8);
    __pyx_t_8 = 0;
    __pyx_t_8 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1782; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1782; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    if (__pyx_t_2) {

      /* "pygrib.pyx":1783
 *             lon2 = self['longitudeOfLastGridPoint']/scale
 *             if self._get_key('truncateDegrees',False):
 *                 lon1 = int(lon1)             # <<<<<<<<<<<<<<
 *                 lon2 = int(lon2)
 *             lat1 = self['latitudeOfFirstGridPoint']/scale
 */
      __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1783; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_INCREF(__pyx_v_lon1);
      PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_lon1);
      __Pyx_GIVEREF(__pyx_v_lon1);
      __pyx_t_7 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_8), NULL); 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(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
      __Pyx_DECREF_SET(__pyx_v_lon1, __pyx_t_7);
      __pyx_t_7 = 0;

      /* "pygrib.pyx":1784
 *             if self._get_key('truncateDegrees',False):
 *                 lon1 = int(lon1)
 *                 lon2 = int(lon2)             # <<<<<<<<<<<<<<
 *             lat1 = self['latitudeOfFirstGridPoint']/scale
 *             lat2 = self['latitudeOfLastGridPoint']/scale
 */
      __pyx_t_7 = PyTuple_New(1); 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_INCREF(__pyx_v_lon2);
      PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_lon2);
      __Pyx_GIVEREF(__pyx_v_lon2);
      __pyx_t_8 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1784; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
      __Pyx_DECREF_SET(__pyx_v_lon2, __pyx_t_8);
      __pyx_t_8 = 0;
      goto __pyx_L139;
    }
    __pyx_L139:;

    /* "pygrib.pyx":1785
 *                 lon1 = int(lon1)
 *                 lon2 = int(lon2)
 *             lat1 = self['latitudeOfFirstGridPoint']/scale             # <<<<<<<<<<<<<<
 *             lat2 = self['latitudeOfLastGridPoint']/scale
 *             if self._get_key('truncateDegrees',False):
 */
    __pyx_t_8 = PyObject_GetItem(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_n_s_180)); if (!__pyx_t_8) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1785; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_7 = __Pyx_PyNumber_Divide(__pyx_t_8, __pyx_v_scale); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1785; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_v_lat1 = __pyx_t_7;
    __pyx_t_7 = 0;

    /* "pygrib.pyx":1786
 *                 lon2 = int(lon2)
 *             lat1 = self['latitudeOfFirstGridPoint']/scale
 *             lat2 = self['latitudeOfLastGridPoint']/scale             # <<<<<<<<<<<<<<
 *             if self._get_key('truncateDegrees',False):
 *                 lat1 = int(lat1)
 */
    __pyx_t_7 = PyObject_GetItem(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_n_s_181)); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1786; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = __Pyx_PyNumber_Divide(__pyx_t_7, __pyx_v_scale); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1786; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_v_lat2 = __pyx_t_8;
    __pyx_t_8 = 0;

    /* "pygrib.pyx":1787
 *             lat1 = self['latitudeOfFirstGridPoint']/scale
 *             lat2 = self['latitudeOfLastGridPoint']/scale
 *             if self._get_key('truncateDegrees',False):             # <<<<<<<<<<<<<<
 *                 lat1 = int(lat1)
 *                 lat2 = int(lat2)
 */
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s___get_key); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1787; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_7 = __Pyx_PyBool_FromLong(0); 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_3 = PyTuple_New(2); 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_INCREF(((PyObject *)__pyx_n_s__truncateDegrees));
    PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_n_s__truncateDegrees));
    __Pyx_GIVEREF(((PyObject *)__pyx_n_s__truncateDegrees));
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_7);
    __Pyx_GIVEREF(__pyx_t_7);
    __pyx_t_7 = 0;
    __pyx_t_7 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_t_3), NULL); 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_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1787; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (__pyx_t_2) {

      /* "pygrib.pyx":1788
 *             lat2 = self['latitudeOfLastGridPoint']/scale
 *             if self._get_key('truncateDegrees',False):
 *                 lat1 = int(lat1)             # <<<<<<<<<<<<<<
 *                 lat2 = int(lat2)
 *             pj = pyproj.Proj(self.projparams)
 */
      __pyx_t_7 = PyTuple_New(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);
      __Pyx_INCREF(__pyx_v_lat1);
      PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_lat1);
      __Pyx_GIVEREF(__pyx_v_lat1);
      __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__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(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
      __Pyx_DECREF_SET(__pyx_v_lat1, __pyx_t_3);
      __pyx_t_3 = 0;

      /* "pygrib.pyx":1789
 *             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 = PyTuple_New(1); 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_INCREF(__pyx_v_lat2);
      PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_lat2);
      __Pyx_GIVEREF(__pyx_v_lat2);
      __pyx_t_7 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_3), NULL); 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_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
      __Pyx_DECREF_SET(__pyx_v_lat2, __pyx_t_7);
      __pyx_t_7 = 0;
      goto __pyx_L140;
    }
    __pyx_L140:;

    /* "pygrib.pyx":1790
 *                 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 = 1790; __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 = 1790; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1790; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_INCREF(__pyx_v_self->projparams);
    PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_self->projparams);
    __Pyx_GIVEREF(__pyx_v_self->projparams);
    __pyx_t_8 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1790; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
    __pyx_v_pj = __pyx_t_8;
    __pyx_t_8 = 0;

    /* "pygrib.pyx":1791
 *                 lat2 = int(lat2)
 *             pj = pyproj.Proj(self.projparams)
 *             llcrnrx, llcrnry = pj(lon1,lat1)             # <<<<<<<<<<<<<<
 *             urcrnrx, urcrnry = pj(lon2,lat2)
 *             try:
 */
    __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1791; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_INCREF(__pyx_v_lon1);
    PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_lon1);
    __Pyx_GIVEREF(__pyx_v_lon1);
    __Pyx_INCREF(__pyx_v_lat1);
    PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_v_lat1);
    __Pyx_GIVEREF(__pyx_v_lat1);
    __pyx_t_7 = PyObject_Call(__pyx_v_pj, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1791; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 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 = 1791; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      #if CYTHON_COMPILING_IN_CPYTHON
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_8 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_8 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_3 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_INCREF(__pyx_t_3);
      #else
      __pyx_t_8 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1791; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1791; __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_4 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1791; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_9 = Py_TYPE(__pyx_t_4)->tp_iternext;
      index = 0; __pyx_t_8 = __pyx_t_9(__pyx_t_4); if (unlikely(!__pyx_t_8)) goto __pyx_L141_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_8);
      index = 1; __pyx_t_3 = __pyx_t_9(__pyx_t_4); if (unlikely(!__pyx_t_3)) goto __pyx_L141_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_3);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_4), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1791; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_9 = NULL;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      goto __pyx_L142_unpacking_done;
      __pyx_L141_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_9 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1791; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_L142_unpacking_done:;
    }
    __pyx_v_llcrnrx = __pyx_t_8;
    __pyx_t_8 = 0;
    __pyx_v_llcrnry = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "pygrib.pyx":1792
 *             pj = pyproj.Proj(self.projparams)
 *             llcrnrx, llcrnry = pj(lon1,lat1)
 *             urcrnrx, urcrnry = pj(lon2,lat2)             # <<<<<<<<<<<<<<
 *             try:
 *                 nx = self['Nx']
 */
    __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1792; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_INCREF(__pyx_v_lon2);
    PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_lon2);
    __Pyx_GIVEREF(__pyx_v_lon2);
    __Pyx_INCREF(__pyx_v_lat2);
    PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_v_lat2);
    __Pyx_GIVEREF(__pyx_v_lat2);
    __pyx_t_3 = PyObject_Call(__pyx_v_pj, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1792; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(((PyObject *)__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 = 1792; __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_8 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_7 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_8 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_8);
      #else
      __pyx_t_7 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1792; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_8 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1792; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      #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 = 1792; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_9 = Py_TYPE(__pyx_t_4)->tp_iternext;
      index = 0; __pyx_t_7 = __pyx_t_9(__pyx_t_4); if (unlikely(!__pyx_t_7)) goto __pyx_L143_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_7);
      index = 1; __pyx_t_8 = __pyx_t_9(__pyx_t_4); if (unlikely(!__pyx_t_8)) goto __pyx_L143_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_8);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_4), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1792; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_9 = NULL;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      goto __pyx_L144_unpacking_done;
      __pyx_L143_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_9 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1792; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_L144_unpacking_done:;
    }
    __pyx_v_urcrnrx = __pyx_t_7;
    __pyx_t_7 = 0;
    __pyx_v_urcrnry = __pyx_t_8;
    __pyx_t_8 = 0;

    /* "pygrib.pyx":1793
 *             llcrnrx, llcrnry = pj(lon1,lat1)
 *             urcrnrx, urcrnry = pj(lon2,lat2)
 *             try:             # <<<<<<<<<<<<<<
 *                 nx = self['Nx']
 *                 ny = self['Ny']
 */
    {
      __Pyx_ExceptionSave(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
      __Pyx_XGOTREF(__pyx_t_10);
      __Pyx_XGOTREF(__pyx_t_11);
      __Pyx_XGOTREF(__pyx_t_12);
      /*try:*/ {

        /* "pygrib.pyx":1794
 *             urcrnrx, urcrnry = pj(lon2,lat2)
 *             try:
 *                 nx = self['Nx']             # <<<<<<<<<<<<<<
 *                 ny = self['Ny']
 *             except:
 */
        __pyx_t_3 = PyObject_GetItem(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_n_s__Nx)); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1794; __pyx_clineno = __LINE__; goto __pyx_L145_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_v_nx = __pyx_t_3;
        __pyx_t_3 = 0;

        /* "pygrib.pyx":1795
 *             try:
 *                 nx = self['Nx']
 *                 ny = self['Ny']             # <<<<<<<<<<<<<<
 *             except:
 *                 nx = self['Ni']
 */
        __pyx_t_3 = PyObject_GetItem(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_n_s__Ny)); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1795; __pyx_clineno = __LINE__; goto __pyx_L145_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_v_ny = __pyx_t_3;
        __pyx_t_3 = 0;
      }
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
      goto __pyx_L152_try_end;
      __pyx_L145_error:;
      __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "pygrib.pyx":1796
 *                 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_8, &__pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1796; __pyx_clineno = __LINE__; goto __pyx_L147_except_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_GOTREF(__pyx_t_7);

        /* "pygrib.pyx":1797
 *                 ny = self['Ny']
 *             except:
 *                 nx = self['Ni']             # <<<<<<<<<<<<<<
 *                 ny = self['Nj']
 *             dx = (urcrnrx-llcrnrx)/(nx-1)
 */
        __pyx_t_4 = PyObject_GetItem(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_n_s__Ni)); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1797; __pyx_clineno = __LINE__; goto __pyx_L147_except_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_XDECREF_SET(__pyx_v_nx, __pyx_t_4);
        __pyx_t_4 = 0;

        /* "pygrib.pyx":1798
 *             except:
 *                 nx = self['Ni']
 *                 ny = self['Nj']             # <<<<<<<<<<<<<<
 *             dx = (urcrnrx-llcrnrx)/(nx-1)
 *             dy = (urcrnry-llcrnry)/(ny-1)
 */
        __pyx_t_4 = PyObject_GetItem(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_n_s__Nj)); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1798; __pyx_clineno = __LINE__; goto __pyx_L147_except_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_XDECREF_SET(__pyx_v_ny, __pyx_t_4);
        __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        goto __pyx_L146_exception_handled;
      }
      __pyx_L147_except_error:;
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_XGIVEREF(__pyx_t_12);
      __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
      goto __pyx_L1_error;
      __pyx_L146_exception_handled:;
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_XGIVEREF(__pyx_t_12);
      __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
      __pyx_L152_try_end:;
    }

    /* "pygrib.pyx":1799
 *                 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 = 1799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = PyNumber_Subtract(__pyx_v_nx, __pyx_int_1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_3 = __Pyx_PyNumber_Divide(__pyx_t_7, __pyx_t_8); 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_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_v_dx = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "pygrib.pyx":1800
 *                 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 = 1800; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_8 = PyNumber_Subtract(__pyx_v_ny, __pyx_int_1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1800; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_7 = __Pyx_PyNumber_Divide(__pyx_t_3, __pyx_t_8); 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_8); __pyx_t_8 = 0;
    __pyx_v_dy = __pyx_t_7;
    __pyx_t_7 = 0;

    /* "pygrib.pyx":1801
 *             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_7 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); 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_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s__arange); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1801; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1801; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_INCREF(__pyx_v_nx);
    PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_nx);
    __Pyx_GIVEREF(__pyx_v_nx);
    __pyx_t_3 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_t_7), NULL); 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_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
    __pyx_t_7 = PyNumber_Multiply(__pyx_v_dx, __pyx_t_3); 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_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyNumber_Add(__pyx_v_llcrnrx, __pyx_t_7); 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_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_v_x = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "pygrib.pyx":1802
 *             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 = 1802; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__arange); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1802; __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 = 1802; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v_ny);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_ny);
    __Pyx_GIVEREF(__pyx_v_ny);
    __pyx_t_8 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1802; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
    __pyx_t_3 = PyNumber_Multiply(__pyx_v_dy, __pyx_t_8); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1802; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_8 = PyNumber_Add(__pyx_v_llcrnry, __pyx_t_3); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1802; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_y = __pyx_t_8;
    __pyx_t_8 = 0;

    /* "pygrib.pyx":1803
 *             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_8 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s__meshgrid); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_INCREF(__pyx_v_x);
    PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_x);
    __Pyx_GIVEREF(__pyx_v_x);
    __Pyx_INCREF(__pyx_v_y);
    PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_v_y);
    __Pyx_GIVEREF(__pyx_v_y);
    __pyx_t_7 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 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 = 1803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      #if CYTHON_COMPILING_IN_CPYTHON
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_8 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_8 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_3 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_INCREF(__pyx_t_3);
      #else
      __pyx_t_8 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1803; __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_4 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_9 = Py_TYPE(__pyx_t_4)->tp_iternext;
      index = 0; __pyx_t_8 = __pyx_t_9(__pyx_t_4); if (unlikely(!__pyx_t_8)) goto __pyx_L155_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_8);
      index = 1; __pyx_t_3 = __pyx_t_9(__pyx_t_4); if (unlikely(!__pyx_t_3)) goto __pyx_L155_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_3);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_4), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_9 = NULL;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      goto __pyx_L156_unpacking_done;
      __pyx_L155_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_9 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_L156_unpacking_done:;
    }
    __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_8);
    __pyx_t_8 = 0;
    __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "pygrib.pyx":1804
 *             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 = 1804; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_INCREF(__pyx_v_x);
    PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_x);
    __Pyx_GIVEREF(__pyx_v_x);
    __Pyx_INCREF(__pyx_v_y);
    PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_v_y);
    __Pyx_GIVEREF(__pyx_v_y);
    __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1804; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
    __pyx_t_8 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1804; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__inverse), __pyx_t_8) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1804; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_8 = PyObject_Call(__pyx_v_pj, ((PyObject *)__pyx_t_7), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1804; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
    if ((likely(PyTuple_CheckExact(__pyx_t_8))) || (PyList_CheckExact(__pyx_t_8))) {
      PyObject* sequence = __pyx_t_8;
      #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 = 1804; __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 = 1804; __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 = 1804; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      #endif
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    } else
    {
      Py_ssize_t index = -1;
      __pyx_t_4 = PyObject_GetIter(__pyx_t_8); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1804; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_9 = Py_TYPE(__pyx_t_4)->tp_iternext;
      index = 0; __pyx_t_3 = __pyx_t_9(__pyx_t_4); if (unlikely(!__pyx_t_3)) goto __pyx_L157_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_3);
      index = 1; __pyx_t_7 = __pyx_t_9(__pyx_t_4); if (unlikely(!__pyx_t_7)) goto __pyx_L157_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_7);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_4), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1804; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_9 = NULL;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      goto __pyx_L158_unpacking_done;
      __pyx_L157_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_9 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1804; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_L158_unpacking_done:;
    }
    __pyx_v_lons = __pyx_t_3;
    __pyx_t_3 = 0;
    __pyx_v_lats = __pyx_t_7;
    __pyx_t_7 = 0;
    goto __pyx_L4;
  }

  /* "pygrib.pyx":1805
 *             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_8 = PyObject_GetItem(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_n_s__gridType)); if (!__pyx_t_8) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1805; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_7 = PyObject_RichCompare(__pyx_t_8, ((PyObject *)__pyx_n_s__rotated_ll), Py_EQ); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1805; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1805; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (!((int)__pyx_t_2)) {
    __pyx_t_7 = PyObject_RichCompare(__pyx_t_8, ((PyObject *)__pyx_n_s__rotated_gg), Py_EQ); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1805; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1805; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_1 = ((int)__pyx_t_5);
  } else {
    __pyx_t_1 = ((int)__pyx_t_2);
  }
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "pygrib.pyx":1806
 *             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_8 = PyObject_GetItem(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_n_s__distinctLatitudes)); if (!__pyx_t_8) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1806; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_v_rotatedlats = __pyx_t_8;
    __pyx_t_8 = 0;

    /* "pygrib.pyx":1807
 *         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_8 = PyObject_GetItem(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_n_s__distinctLongitudes)); if (!__pyx_t_8) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1807; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_v_rotatedlons = __pyx_t_8;
    __pyx_t_8 = 0;

    /* "pygrib.pyx":1808
 *             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_8 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1808; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s__pi); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1808; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_8 = PyFloat_FromDouble(180.); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1808; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_3 = __Pyx_PyNumber_Divide(__pyx_t_7, __pyx_t_8); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1808; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_v_d2r = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "pygrib.pyx":1809
 *             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_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1809; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__meshgrid); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1809; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyNumber_Multiply(__pyx_v_rotatedlons, __pyx_v_d2r); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1809; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_7 = PyNumber_Multiply(__pyx_v_rotatedlats, __pyx_v_d2r); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1809; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1809; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_7);
    __Pyx_GIVEREF(__pyx_t_7);
    __pyx_t_3 = 0;
    __pyx_t_7 = 0;
    __pyx_t_7 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1809; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(((PyObject *)__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 = 1809; __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_8 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_4 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_8 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_8);
      #else
      __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1809; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_8 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1809; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      #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 = 1809; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_9 = Py_TYPE(__pyx_t_3)->tp_iternext;
      index = 0; __pyx_t_4 = __pyx_t_9(__pyx_t_3); if (unlikely(!__pyx_t_4)) goto __pyx_L159_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_4);
      index = 1; __pyx_t_8 = __pyx_t_9(__pyx_t_3); if (unlikely(!__pyx_t_8)) goto __pyx_L159_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_8);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_3), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1809; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_9 = NULL;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      goto __pyx_L160_unpacking_done;
      __pyx_L159_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_9 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1809; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_L160_unpacking_done:;
    }
    __pyx_v_lonsr = __pyx_t_4;
    __pyx_t_4 = 0;
    __pyx_v_latsr = __pyx_t_8;
    __pyx_t_8 = 0;

    /* "pygrib.pyx":1810
 *             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_7 = __Pyx_GetModuleGlobalName(__pyx_n_s__pyproj); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1810; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s__Proj); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1810; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1810; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_INCREF(__pyx_v_self->projparams);
    PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_self->projparams);
    __Pyx_GIVEREF(__pyx_v_self->projparams);
    __pyx_t_4 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1810; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
    __pyx_v_pj = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "pygrib.pyx":1811
 *             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_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1811; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_v_lonsr);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_lonsr);
    __Pyx_GIVEREF(__pyx_v_lonsr);
    __Pyx_INCREF(__pyx_v_latsr);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_latsr);
    __Pyx_GIVEREF(__pyx_v_latsr);
    __pyx_t_7 = PyDict_New(); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1811; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_7));
    __pyx_t_8 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1811; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    if (PyDict_SetItem(__pyx_t_7, ((PyObject *)__pyx_n_s__inverse), __pyx_t_8) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1811; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_8 = PyObject_Call(__pyx_v_pj, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_7)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1811; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
    if ((likely(PyTuple_CheckExact(__pyx_t_8))) || (PyList_CheckExact(__pyx_t_8))) {
      PyObject* sequence = __pyx_t_8;
      #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 = 1811; __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 = 1811; __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 = 1811; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      #endif
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    } else
    {
      Py_ssize_t index = -1;
      __pyx_t_3 = PyObject_GetIter(__pyx_t_8); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1811; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_9 = Py_TYPE(__pyx_t_3)->tp_iternext;
      index = 0; __pyx_t_7 = __pyx_t_9(__pyx_t_3); if (unlikely(!__pyx_t_7)) goto __pyx_L161_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_7);
      index = 1; __pyx_t_4 = __pyx_t_9(__pyx_t_3); if (unlikely(!__pyx_t_4)) goto __pyx_L161_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_4);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_3), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1811; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_9 = NULL;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      goto __pyx_L162_unpacking_done;
      __pyx_L161_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_9 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1811; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_L162_unpacking_done:;
    }
    __pyx_v_lons = __pyx_t_7;
    __pyx_t_7 = 0;
    __pyx_v_lats = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L4;
  }
  /*else*/ {

    /* "pygrib.pyx":1813
 *             lons,lats = pj(lonsr,latsr,inverse=True)
 *         else:
 *             raise ValueError('unsupported grid %s' % self['gridType'])             # <<<<<<<<<<<<<<
 *         return lats, lons
 * 
 */
    __pyx_t_8 = PyObject_GetItem(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_n_s__gridType)); if (!__pyx_t_8) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1813; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_168), __pyx_t_8); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1813; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1813; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)__pyx_t_4));
    __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
    __pyx_t_4 = 0;
    __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1813; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 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 = 1813; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_L4:;

  /* "pygrib.pyx":1814
 *         else:
 *             raise ValueError('unsupported grid %s' % self['gridType'])
 *         return lats, lons             # <<<<<<<<<<<<<<
 * 
 * cdef class index(object):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1814; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF(__pyx_v_lats);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_lats);
  __Pyx_GIVEREF(__pyx_v_lats);
  __Pyx_INCREF(__pyx_v_lons);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_lons);
  __Pyx_GIVEREF(__pyx_v_lons);
  __pyx_r = ((PyObject *)__pyx_t_4);
  __pyx_t_4 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_14);
  __Pyx_AddTraceback("pygrib.gribmessage.latlons", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_nx);
  __Pyx_XDECREF(__pyx_v_ny);
  __Pyx_XDECREF(__pyx_v_lon1);
  __Pyx_XDECREF(__pyx_v_lon2);
  __Pyx_XDECREF(__pyx_v_lat1);
  __Pyx_XDECREF(__pyx_v_lat2);
  __Pyx_XDECREF(__pyx_v_lats);
  __Pyx_XDECREF(__pyx_v_lons);
  __Pyx_XDECREF(__pyx_v_dx);
  __Pyx_XDECREF(__pyx_v_dy);
  __Pyx_XDECREF(__pyx_v_pj);
  __Pyx_XDECREF(__pyx_v_llcrnrx);
  __Pyx_XDECREF(__pyx_v_llcrnry);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_y);
  __Pyx_XDECREF(__pyx_v_scale);
  __Pyx_XDECREF(__pyx_v_lon_0);
  __Pyx_XDECREF(__pyx_v_lat_0);
  __Pyx_XDECREF(__pyx_v_lonmax);
  __Pyx_XDECREF(__pyx_v_latmax);
  __Pyx_XDECREF(__pyx_v_x1);
  __Pyx_XDECREF(__pyx_v_y1);
  __Pyx_XDECREF(__pyx_v_x2);
  __Pyx_XDECREF(__pyx_v_y2);
  __Pyx_XDECREF(__pyx_v_width);
  __Pyx_XDECREF(__pyx_v_height);
  __Pyx_XDECREF(__pyx_v_xmax);
  __Pyx_XDECREF(__pyx_v_ymax);
  __Pyx_XDECREF(__pyx_v_abslons);
  __Pyx_XDECREF(__pyx_v_abslats);
  __Pyx_XDECREF(__pyx_v_urcrnrx);
  __Pyx_XDECREF(__pyx_v_urcrnry);
  __Pyx_XDECREF(__pyx_v_rotatedlats);
  __Pyx_XDECREF(__pyx_v_rotatedlons);
  __Pyx_XDECREF(__pyx_v_d2r);
  __Pyx_XDECREF(__pyx_v_lonsr);
  __Pyx_XDECREF(__pyx_v_latsr);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* 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));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pygrib.pyx":837
 *     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):
 */

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;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __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));
  __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;

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

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

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __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));
  __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;

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

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

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __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));
  __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;

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

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

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __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));
  __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;

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

  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* 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));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pygrib.pyx":838
 *     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__()" !
 */

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;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __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));
  __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;

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

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

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __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));
  __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;

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

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

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __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));
  __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;

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

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

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __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));
  __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;

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

  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* 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 = 1865; __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 = 1865; __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);
  __Pyx_XDECREF(__pyx_v_args);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pygrib.pyx":1865
 *     cdef grib_index *_gi
 *     cdef public object keys, types, name
 *     def __cinit__(self, filename, *args):             # <<<<<<<<<<<<<<
 *         # initialize C level objects.
 *         cdef grib_index *gi
 */

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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "pygrib.pyx":1870
 *         cdef int err
 *         cdef char *filenamec, *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 = 1870; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_bytestr = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pygrib.pyx":1871
 *         cdef char *filenamec, *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 = 1871; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_filenamec = __pyx_t_2;

  /* "pygrib.pyx":1872
 *         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(((PyObject *)__pyx_v_args), ((PyObject *)__pyx_empty_tuple), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1872; __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 = 1872; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_3) {

    /* "pygrib.pyx":1875
 *             #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":1876
 *             # 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":1877
 *             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 = 1877; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_1));
      __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1877; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_1));
      __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
      __pyx_t_1 = 0;
      __pyx_t_1 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1877; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(((PyObject *)__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 = 1877; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L4;
    }
    __pyx_L4:;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "pygrib.pyx":1879
 *                 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)
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_kp_s_182), __pyx_n_s__join); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1879; __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 = 1879; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(((PyObject *)__pyx_v_args));
    PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_v_args));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_args));
    __pyx_t_5 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1879; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
    __pyx_t_4 = __pyx_f_6pygrib__strencode(__pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1879; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF_SET(__pyx_v_bytestr, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "pygrib.pyx":1880
 *         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 = 1880; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_keys = __pyx_t_2;

    /* "pygrib.pyx":1881
 *             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":1882
 *             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":1883
 *             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 = 1883; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_4));
      __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1883; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_4));
      __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
      __pyx_t_4 = 0;
      __pyx_t_4 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_t_5), 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(((PyObject *)__pyx_t_5)); __pyx_t_5 = 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 = 1883; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L5;
    }
    __pyx_L5:;

    /* "pygrib.pyx":1884
 *             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 = 1884; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_v_filename);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_filename);
    __Pyx_GIVEREF(__pyx_v_filename);
    __pyx_t_5 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_6pygrib_open)), ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1884; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
    __pyx_v_grbs = ((struct __pyx_obj_6pygrib_open *)__pyx_t_5);
    __pyx_t_5 = 0;

    /* "pygrib.pyx":1885
 *                 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 = 1885; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (__pyx_t_3) {

      /* "pygrib.pyx":1888
 *                 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_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_183), __pyx_v_filename); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1888; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_5));
      __pyx_v_msg = ((PyObject *)__pyx_t_5);
      __pyx_t_5 = 0;

      /* "pygrib.pyx":1889
 * 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_5 = __Pyx_GetModuleGlobalName(__pyx_n_s__warnings); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1889; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s__warn); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1889; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __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 = 1889; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_INCREF(__pyx_v_msg);
      PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_msg);
      __Pyx_GIVEREF(__pyx_v_msg);
      __pyx_t_1 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1889; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L6;
    }
    __pyx_L6:;

    /* "pygrib.pyx":1890
 * messages will not be indexed correctly""" % filename
 *                 warnings.warn(msg)
 *             grbs.close()             # <<<<<<<<<<<<<<
 *     def __init__(self, filename, *args):
 *         # initalize Python level objects
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_grbs), __pyx_n_s__close); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1890; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1890; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __pyx_L3:;

  __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_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;
}

/* 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 = 1891; __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 = 1891; __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);
  __Pyx_XDECREF(__pyx_v_args);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pygrib.pyx":1891
 *                 warnings.warn(msg)
 *             grbs.close()
 *     def __init__(self, filename, *args):             # <<<<<<<<<<<<<<
 *         # initalize Python level objects
 *         self.name = filename
 */

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":1893
 *     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":1894
 *         # 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":1895
 *         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":1896
 *         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(((PyObject *)__pyx_v_args), ((PyObject *)__pyx_empty_tuple), Py_NE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1896; __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 = 1896; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "pygrib.pyx":1898
 *         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 = 1898; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = ((PyObject *)__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 = 1898; __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 = 1898; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #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 = 1898; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_k_tuple_184), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1898; __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, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1898; __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 = 1898; __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":1900
 *             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 = 1900; __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":1901
 *             # if type is declared, save it (None if not declared)
 *             types = []
 *             for arg in args:             # <<<<<<<<<<<<<<
 *                 try:
 *                     type = arg.split(':')[1]
 */
    __pyx_t_1 = ((PyObject *)__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 = 1901; __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 = 1901; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #endif
      __Pyx_XDECREF_SET(__pyx_v_arg, __pyx_t_3);
      __pyx_t_3 = 0;

      /* "pygrib.pyx":1902
 *             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":1903
 *             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 = 1903; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
          __Pyx_GOTREF(__pyx_t_3);
          __pyx_t_5 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_k_tuple_185), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1903; __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, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1903; __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;
        }
        __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":1904
 *                 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 = 1904; __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":1905
 *                     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;
        }
        __pyx_L10_except_error:;
        __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":1906
 *                 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 = 1906; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "pygrib.pyx":1907
 *                     type = None
 *                 types.append(type)
 *             self.keys = keys             # <<<<<<<<<<<<<<
 *             self.types = types
 *     def __call__(self, **kwargs):
 */
    __Pyx_INCREF(((PyObject *)__pyx_v_keys));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_keys));
    __Pyx_GOTREF(__pyx_v_self->keys);
    __Pyx_DECREF(__pyx_v_self->keys);
    __pyx_v_self->keys = ((PyObject *)__pyx_v_keys);

    /* "pygrib.pyx":1908
 *                 types.append(type)
 *             self.keys = keys
 *             self.types = types             # <<<<<<<<<<<<<<
 *     def __call__(self, **kwargs):
 *         """same as L{select}"""
 */
    __Pyx_INCREF(((PyObject *)__pyx_v_types));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_types));
    __Pyx_GOTREF(__pyx_v_self->types);
    __Pyx_DECREF(__pyx_v_self->types);
    __pyx_v_self->types = ((PyObject *)__pyx_v_types);
    goto __pyx_L3;
  }
  __pyx_L3:;

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

/* 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;
  __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_4__call__(((struct __pyx_obj_6pygrib_index *)__pyx_v_self), __pyx_v_kwargs);
  __Pyx_XDECREF(__pyx_v_kwargs);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pygrib.pyx":1909
 *             self.keys = keys
 *             self.types = types
 *     def __call__(self, **kwargs):             # <<<<<<<<<<<<<<
 *         """same as L{select}"""
 *         return self.select(**kwargs)
 */

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;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__call__", 0);

  /* "pygrib.pyx":1911
 *     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 = 1911; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = ((PyObject *)__pyx_v_kwargs);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1911; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  __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.index.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* 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);
  __Pyx_XDECREF(__pyx_v_kwargs);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pygrib.pyx":1912
 *         """same as L{select}"""
 *         return self.select(**kwargs)
 *     def select(self, **kwargs):             # <<<<<<<<<<<<<<
 *         """
 * select(**kwargs)
 */

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;
  int __pyx_t_13;
  long __pyx_t_14;
  double __pyx_t_15;
  int __pyx_t_16;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("select", 0);

  /* "pygrib.pyx":1945
 *         # 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":1946
 *         # 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 = 1946; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (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 = 1946; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  for (;;) {
    if (!__pyx_t_4 && 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 = 1946; __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 = 1946; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #endif
    } else if (!__pyx_t_4 && PyTuple_CheckExact(__pyx_t_2)) {
      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 = 1946; __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 = 1946; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #endif
    } else {
      __pyx_t_1 = __pyx_t_4(__pyx_t_2);
      if (unlikely(!__pyx_t_1)) {
        if (PyErr_Occurred()) {
          if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
          else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1946; __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 = 1946; __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 = 1946; __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 = 1946; __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 = 1946; __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 = 1946; __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 = 1946; __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":1947
 *         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_9 = (__pyx_v_self->keys != Py_None);
    if ((__pyx_t_9 != 0)) {
      __pyx_t_10 = (__Pyx_PySequence_Contains(__pyx_v_k, __pyx_v_self->keys, Py_NE)); if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1947; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_11 = (__pyx_t_10 != 0);
    } else {
      __pyx_t_11 = (__pyx_t_9 != 0);
    }
    if (__pyx_t_11) {

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

    /* "pygrib.pyx":1949
 *             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_11 = (__pyx_v_self->types != Py_None);
    __pyx_t_9 = (__pyx_t_11 != 0);
    if (__pyx_t_9) {

      /* "pygrib.pyx":1950
 *                 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_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->keys, __pyx_n_s__index); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1950; __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 = 1950; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_INCREF(__pyx_v_k);
      PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_k);
      __Pyx_GIVEREF(__pyx_v_k);
      __pyx_t_5 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1950; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
      __pyx_t_6 = PyObject_GetItem(__pyx_v_self->types, __pyx_t_5); if (!__pyx_t_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1950; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF_SET(__pyx_v_typ, __pyx_t_6);
      __pyx_t_6 = 0;
      goto __pyx_L8;
    }
    /*else*/ {

      /* "pygrib.pyx":1952
 *                 typ = self.types[self.keys.index(k)]
 *             else:
 *                 typ = None             # <<<<<<<<<<<<<<
 *             bytestr = _strencode(k)
 *             key = bytestr
 */
      __Pyx_INCREF(Py_None);
      __Pyx_XDECREF_SET(__pyx_v_typ, Py_None);
    }
    __pyx_L8:;

    /* "pygrib.pyx":1953
 *             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 = 1953; __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":1954
 *                 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 = 1954; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_key = __pyx_t_12;

    /* "pygrib.pyx":1955
 *             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":1956
 *             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_9 = (__pyx_v_err != 0);
    if (__pyx_t_9) {

      /* "pygrib.pyx":1957
 *             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 = 1957; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_6));
      __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1957; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_6));
      __Pyx_GIVEREF(((PyObject *)__pyx_t_6));
      __pyx_t_6 = 0;
      __pyx_t_6 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1957; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 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 = 1957; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L9;
    }
    __pyx_L9:;

    /* "pygrib.pyx":1958
 *             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 = 1958; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_5 = PyNumber_Add(__pyx_v_sizetot, __pyx_t_6); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1958; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF_SET(__pyx_v_sizetot, __pyx_t_5);
    __pyx_t_5 = 0;

    /* "pygrib.pyx":1960
 *             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_9 = ((!(__pyx_v_size != 0)) != 0);
    if (__pyx_t_9) {

      /* "pygrib.pyx":1961
 *             # 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;
      goto __pyx_L10;
    }
    __pyx_L10:;

    /* "pygrib.pyx":1962
 *             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_5 = PyObject_RichCompare(__pyx_v_typ, ((PyObject *)__pyx_n_s__l), Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1962; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1962; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (!__pyx_t_9) {
      __pyx_t_5 = PyObject_RichCompare(((PyObject *)Py_TYPE(__pyx_v_v)), ((PyObject *)((PyObject*)(&PyInt_Type))), Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1962; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1962; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (!__pyx_t_11) {
        __pyx_t_5 = PyObject_RichCompare(((PyObject *)Py_TYPE(__pyx_v_v)), ((PyObject *)((PyObject*)(&PyLong_Type))), Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1962; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1962; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_t_13 = __pyx_t_10;
      } else {
        __pyx_t_13 = __pyx_t_11;
      }
      __pyx_t_11 = __pyx_t_13;
    } else {
      __pyx_t_11 = __pyx_t_9;
    }
    if (__pyx_t_11) {

      /* "pygrib.pyx":1963
 *                 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_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1963; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_INCREF(__pyx_v_v);
      PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_v);
      __Pyx_GIVEREF(__pyx_v_v);
      __pyx_t_6 = PyObject_Call(((PyObject *)((PyObject*)(&PyLong_Type))), ((PyObject *)__pyx_t_5), NULL); 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_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
      __pyx_t_14 = __Pyx_PyInt_AsLong(__pyx_t_6); if (unlikely((__pyx_t_14 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1963; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_v_longval = __pyx_t_14;

      /* "pygrib.pyx":1964
 *             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":1965
 *                 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_11 = (__pyx_v_err != 0);
      if (__pyx_t_11) {

        /* "pygrib.pyx":1966
 *                 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 = 1966; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(((PyObject *)__pyx_t_6));
        __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1966; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_5);
        PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_6));
        __Pyx_GIVEREF(((PyObject *)__pyx_t_6));
        __pyx_t_6 = 0;
        __pyx_t_6 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1966; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 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 = 1966; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        goto __pyx_L12;
      }
      __pyx_L12:;
      goto __pyx_L11;
    }

    /* "pygrib.pyx":1967
 *                 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_6 = PyObject_RichCompare(__pyx_v_typ, ((PyObject *)__pyx_n_s__d), Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1967; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1967; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (!__pyx_t_11) {
      __pyx_t_6 = PyObject_RichCompare(((PyObject *)Py_TYPE(__pyx_v_v)), ((PyObject *)((PyObject*)(&PyFloat_Type))), Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1967; __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 = 1967; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_13 = __pyx_t_9;
    } else {
      __pyx_t_13 = __pyx_t_11;
    }
    if (__pyx_t_13) {

      /* "pygrib.pyx":1968
 *                     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_15 = __Pyx_PyObject_AsDouble(__pyx_v_v); if (unlikely(__pyx_t_15 == ((double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1968; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_v_doubval = __pyx_t_15;

      /* "pygrib.pyx":1969
 *             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":1970
 *                 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_13 = (__pyx_v_err != 0);
      if (__pyx_t_13) {

        /* "pygrib.pyx":1971
 *                 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 = 1971; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(((PyObject *)__pyx_t_6));
        __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1971; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_5);
        PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_6));
        __Pyx_GIVEREF(((PyObject *)__pyx_t_6));
        __pyx_t_6 = 0;
        __pyx_t_6 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_t_5), 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(((PyObject *)__pyx_t_5)); __pyx_t_5 = 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;}
        goto __pyx_L13;
      }
      __pyx_L13:;
      goto __pyx_L11;
    }

    /* "pygrib.pyx":1972
 *                 if err:
 *                     raise RuntimeError(grib_get_error_message(err))
 *             elif typ == 's' or _is_stringlike(v):             # <<<<<<<<<<<<<<
 *                 bytestr = _strencode(v)
 *                 strval = bytestr
 */
    __pyx_t_6 = PyObject_RichCompare(__pyx_v_typ, ((PyObject *)__pyx_n_s__s), 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_13 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_13 < 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;
    if (!__pyx_t_13) {
      __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s___is_stringlike); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1972; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1972; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_INCREF(__pyx_v_v);
      PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_v);
      __Pyx_GIVEREF(__pyx_v_v);
      __pyx_t_1 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1972; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
      __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1972; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_9 = __pyx_t_11;
    } else {
      __pyx_t_9 = __pyx_t_13;
    }
    if (__pyx_t_9) {

      /* "pygrib.pyx":1973
 *                     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_1 = __pyx_f_6pygrib__strencode(__pyx_v_v, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1973; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF_SET(__pyx_v_bytestr, __pyx_t_1);
      __pyx_t_1 = 0;

      /* "pygrib.pyx":1974
 *             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 = 1974; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_v_strval = __pyx_t_12;

      /* "pygrib.pyx":1975
 *                 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":1976
 *                 strval = bytestr
 *                 err = grib_index_select_string(self._gi, key, strval)
 *                 if err:             # <<<<<<<<<<<<<<
 *                     raise RuntimeError(grib_get_error_message(err))
 *             else:
 */
      __pyx_t_9 = (__pyx_v_err != 0);
      if (__pyx_t_9) {

        /* "pygrib.pyx":1977
 *                 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_1 = __Pyx_PyBytes_FromString(grib_get_error_message(__pyx_v_err)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1977; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(((PyObject *)__pyx_t_1));
        __pyx_t_5 = PyTuple_New(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);
        PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_1));
        __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
        __pyx_t_1 = 0;
        __pyx_t_1 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_t_5), NULL); 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_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 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 = 1977; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        goto __pyx_L14;
      }
      __pyx_L14:;
      goto __pyx_L11;
    }
    /*else*/ {

      /* "pygrib.pyx":1979
 *                     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_t_1 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_k_tuple_189), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1979; __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 = 1979; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_L11:;
    __pyx_L3_continue:;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pygrib.pyx":1981
 *                 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 = PyObject_RichCompare(__pyx_v_sizetot, __pyx_int_0, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1981; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1981; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_9) {

    /* "pygrib.pyx":1982
 *         # 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 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_190), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1982; __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 = 1982; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L15;
  }
  __pyx_L15:;

  /* "pygrib.pyx":1984
 *             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 = 1984; __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":1985
 *         # 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) {
    if (!1) break;

    /* "pygrib.pyx":1986
 *         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":1987
 *         while 1:
 *             gh = grib_handle_new_from_index(self._gi, &err)
 *             if err or gh == NULL:             # <<<<<<<<<<<<<<
 *                 break
 *             else:
 */
    if (!(__pyx_v_err != 0)) {
      __pyx_t_9 = (__pyx_v_gh == NULL);
      __pyx_t_13 = __pyx_t_9;
    } else {
      __pyx_t_13 = (__pyx_v_err != 0);
    }
    if (__pyx_t_13) {

      /* "pygrib.pyx":1988
 *             gh = grib_handle_new_from_index(self._gi, &err)
 *             if err or gh == NULL:
 *                 break             # <<<<<<<<<<<<<<
 *             else:
 *                 messagenumber = messagenumber + 1
 */
      goto __pyx_L17_break;
      goto __pyx_L18;
    }
    /*else*/ {

      /* "pygrib.pyx":1990
 *                 break
 *             else:
 *                 messagenumber = messagenumber + 1             # <<<<<<<<<<<<<<
 *             grbs.append(_create_gribmessage(gh, messagenumber))
 *             err = grib_handle_delete(gh)
 */
      __pyx_t_2 = PyNumber_Add(__pyx_v_messagenumber, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1990; __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;
    }
    __pyx_L18:;

    /* "pygrib.pyx":1991
 *             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 = 1991; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_16 = __Pyx_PyList_Append(__pyx_v_grbs, __pyx_t_2); if (unlikely(__pyx_t_16 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1991; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "pygrib.pyx":1992
 *                 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":1993
 *             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_13 = (__pyx_v_err != 0);
    if (__pyx_t_13) {

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

  /* "pygrib.pyx":1995
 *             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_13 = (((PyObject *)__pyx_v_grbs) != Py_None) && (PyList_GET_SIZE(((PyObject *)__pyx_v_grbs)) != 0);
  __pyx_t_9 = ((!__pyx_t_13) != 0);
  if (__pyx_t_9) {

    /* "pygrib.pyx":1996
 *                 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 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_191), NULL); 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_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1996; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L20;
  }
  __pyx_L20:;

  /* "pygrib.pyx":1998
 *             raise ValueError('no matches found')
 *         # return the list of grib messages.
 *         return grbs             # <<<<<<<<<<<<<<
 *     def write(self,filename):
 *         """
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_grbs));
  __pyx_r = ((PyObject *)__pyx_v_grbs);
  goto __pyx_L0;

  __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_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;
}

/* 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));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pygrib.pyx":1999
 *         # return the list of grib messages.
 *         return grbs
 *     def write(self,filename):             # <<<<<<<<<<<<<<
 *         """
 *         write(filename)
 */

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":2005
 *         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 = 2005; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_bytestr = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pygrib.pyx":2006
 *         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 = 2006; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_filenamec = __pyx_t_2;

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

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

/* 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));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pygrib.pyx":2010
 *         if err:
 *             raise RuntimeError(grib_get_error_message(err))
 *     def close(self):             # <<<<<<<<<<<<<<
 *         """
 *         close()
 */

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":2015
 * 
 *         deallocate C structures associated with class instance"""
 *         grib_index_delete(self._gi)             # <<<<<<<<<<<<<<
 *         self._gi = NULL
 * 
 */
  grib_index_delete(__pyx_v_self->_gi);

  /* "pygrib.pyx":2016
 *         deallocate C structures associated with class instance"""
 *         grib_index_delete(self._gi)
 *         self._gi = NULL             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(self):
 */
  __pyx_v_self->_gi = NULL;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* 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));
  __Pyx_RefNannyFinishContext();
}

/* "pygrib.pyx":2018
 *         self._gi = NULL
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         # deallocate storage when there are no more references
 *         # to the object.
 */

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":2021
 *         # 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":2022
 *         # to the object.
 *         if self._gi != NULL:
 *             grib_index_delete(self._gi)             # <<<<<<<<<<<<<<
 * 
 * def _is_stringlike(a):
 */
    grib_index_delete(__pyx_v_self->_gi);
    goto __pyx_L3;
  }
  __pyx_L3:;

  __Pyx_RefNannyFinishContext();
}

/* 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));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pygrib.pyx":1864
 * """
 *     cdef grib_index *_gi
 *     cdef public object keys, types, name             # <<<<<<<<<<<<<<
 *     def __cinit__(self, filename, *args):
 *         # initialize C level objects.
 */

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;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __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));
  __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;

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

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

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __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));
  __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;

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

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

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __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));
  __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;

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

  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* 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 = {__Pyx_NAMESTR("_is_stringlike"), (PyCFunction)__pyx_pw_6pygrib_23_is_stringlike, METH_O, __Pyx_DOCSTR(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));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pygrib.pyx":2024
 *             grib_index_delete(self._gi)
 * 
 * def _is_stringlike(a):             # <<<<<<<<<<<<<<
 *     if type(a) == str or type(a) == bytes or type(a) == unicode:
 *         return True
 */

static PyObject *__pyx_pf_6pygrib_22_is_stringlike(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_a) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_is_stringlike", 0);

  /* "pygrib.pyx":2025
 * 
 * def _is_stringlike(a):
 *     if type(a) == str or type(a) == bytes or type(a) == unicode:             # <<<<<<<<<<<<<<
 *         return True
 *     else:
 */
  __pyx_t_1 = PyObject_RichCompare(((PyObject *)Py_TYPE(__pyx_v_a)), ((PyObject *)((PyObject*)(&PyString_Type))), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2025; __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 = 2025; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (!__pyx_t_2) {
    __pyx_t_1 = PyObject_RichCompare(((PyObject *)Py_TYPE(__pyx_v_a)), ((PyObject *)((PyObject*)(&PyBytes_Type))), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2025; __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 = 2025; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (!__pyx_t_3) {
      __pyx_t_1 = PyObject_RichCompare(((PyObject *)Py_TYPE(__pyx_v_a)), ((PyObject *)((PyObject*)(&PyUnicode_Type))), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2025; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2025; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_5 = __pyx_t_4;
    } else {
      __pyx_t_5 = __pyx_t_3;
    }
    __pyx_t_3 = __pyx_t_5;
  } else {
    __pyx_t_3 = __pyx_t_2;
  }
  if (__pyx_t_3) {

    /* "pygrib.pyx":2026
 * 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_t_1 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2026; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "pygrib.pyx":2028
 *         return True
 *     else:
 *         return False             # <<<<<<<<<<<<<<
 * 
 * def _is_container(a):
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2028; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;
  }
  __pyx_L3:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __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;
}

/* 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 = {__Pyx_NAMESTR("_is_container"), (PyCFunction)__pyx_pw_6pygrib_25_is_container, METH_O, __Pyx_DOCSTR(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));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pygrib.pyx":2030
 *         return False
 * 
 * def _is_container(a):             # <<<<<<<<<<<<<<
 *     # is object container-like?  (can test for
 *     # membership with "is in", but not a string)
 */

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":2033
 *     # 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_Contains(__pyx_int_1, __pyx_v_a, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2033; __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":2034
 *     # 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 = 2034; __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_t_8 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2034; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_r = __pyx_t_8;
      __pyx_t_8 = 0;
      __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_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_L4_exception_handled;
    }
    __pyx_L5_except_error:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L1_error;
    __pyx_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_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":2035
 *     try: 1 in a
 *     except: return False
 *     if _is_stringlike(a): return False             # <<<<<<<<<<<<<<
 *     return True
 * 
 */
  __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s___is_stringlike); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2035; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2035; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_INCREF(__pyx_v_a);
  PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_a);
  __Pyx_GIVEREF(__pyx_v_a);
  __pyx_t_5 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2035; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2035; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (__pyx_t_4) {
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_5 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2035; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_r = __pyx_t_5;
    __pyx_t_5 = 0;
    goto __pyx_L0;
    goto __pyx_L13;
  }
  __pyx_L13:;

  /* "pygrib.pyx":2036
 *     except: return False
 *     if _is_stringlike(a): return False
 *     return True             # <<<<<<<<<<<<<<
 * 
 * def _find(grb, **kwargs):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_5 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2036; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_r = __pyx_t_5;
  __pyx_t_5 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __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;
}

/* 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 = {__Pyx_NAMESTR("_find"), (PyCFunction)__pyx_pw_6pygrib_27_find, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(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 = 2038; __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 = 2038; __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);
  __Pyx_XDECREF(__pyx_v_kwargs);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pygrib.pyx":2038
 *     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.
 */

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;
  PyObject *__pyx_v_iscallable = 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;
  int __pyx_t_12;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_find", 0);

  /* "pygrib.pyx":2043
 *     # 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 = 2043; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (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 = 2043; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  for (;;) {
    if (!__pyx_t_4 && 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 = 2043; __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 = 2043; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #endif
    } else if (!__pyx_t_4 && PyTuple_CheckExact(__pyx_t_2)) {
      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 = 2043; __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 = 2043; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #endif
    } else {
      __pyx_t_1 = __pyx_t_4(__pyx_t_2);
      if (unlikely(!__pyx_t_1)) {
        if (PyErr_Occurred()) {
          if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
          else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2043; __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 = 2043; __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 = 2043; __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 = 2043; __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 = 2043; __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 = 2043; __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 = 2043; __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":2044
 *     # 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_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_grb, __pyx_n_s__has_key); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2044; __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 = 2044; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_INCREF(__pyx_v_k);
    PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_k);
    __Pyx_GIVEREF(__pyx_v_k);
    __pyx_t_5 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2044; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
    __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2044; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_10 = ((!__pyx_t_9) != 0);
    if (__pyx_t_10) {
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_5 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2044; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_r = __pyx_t_5;
      __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      goto __pyx_L0;
      goto __pyx_L7;
    }
    __pyx_L7:;

    /* "pygrib.pyx":2046
 *         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_5 = __Pyx_GetModuleGlobalName(__pyx_n_s___is_container); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2046; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2046; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_INCREF(__pyx_v_v);
    PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_v);
    __Pyx_GIVEREF(__pyx_v_v);
    __pyx_t_1 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2046; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
    __Pyx_XDECREF_SET(__pyx_v_iscontainer, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "pygrib.pyx":2048
 *         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, ((PyObject *)__pyx_n_s____call__)); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2048; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_t_10); 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);
    __Pyx_XDECREF_SET(__pyx_v_iscallable, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "pygrib.pyx":2051
 *         # 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_10 = __Pyx_PyObject_IsTrue(__pyx_v_iscontainer); if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2051; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_9 = (!__pyx_t_10);
    if (__pyx_t_9) {
      __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_v_iscallable); if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2051; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_11 = (!__pyx_t_10);
      if (__pyx_t_11) {
        __pyx_t_1 = __Pyx_GetAttr(__pyx_v_grb, __pyx_v_k); 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_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 = 2051; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2051; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __pyx_t_12 = __pyx_t_10;
      } else {
        __pyx_t_12 = __pyx_t_11;
      }
      __pyx_t_11 = __pyx_t_12;
    } else {
      __pyx_t_11 = __pyx_t_9;
    }
    if (__pyx_t_11) {

      /* "pygrib.pyx":2052
 *         # 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;
      goto __pyx_L8;
    }

    /* "pygrib.pyx":2053
 *         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 = 2053; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (__pyx_t_11) {
      __pyx_t_6 = __Pyx_GetAttr(__pyx_v_grb, __pyx_v_k); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2053; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_9 = (__Pyx_PySequence_Contains(__pyx_t_6, __pyx_v_v, Py_EQ)); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2053; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_12 = __pyx_t_9;
    } else {
      __pyx_t_12 = __pyx_t_11;
    }
    if (__pyx_t_12) {

      /* "pygrib.pyx":2054
 *             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;
      goto __pyx_L8;
    }

    /* "pygrib.pyx":2055
 *         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_12 = __Pyx_PyObject_IsTrue(__pyx_v_iscallable); if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2055; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (__pyx_t_12) {
      __pyx_t_6 = __Pyx_GetAttr(__pyx_v_grb, __pyx_v_k); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2055; __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 = 2055; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_6);
      __pyx_t_6 = 0;
      __pyx_t_6 = PyObject_Call(__pyx_v_v, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2055; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(((PyObject *)__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 = 2055; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_9 = __pyx_t_11;
    } else {
      __pyx_t_9 = __pyx_t_12;
    }
    if (__pyx_t_9) {

      /* "pygrib.pyx":2056
 *             continue
 *         elif iscallable and v(getattr(grb,k)): # v a function
 *             continue             # <<<<<<<<<<<<<<
 *         else:
 *             return False
 */
      goto __pyx_L3_continue;
      goto __pyx_L8;
    }
    /*else*/ {

      /* "pygrib.pyx":2058
 *             continue
 *         else:
 *             return False             # <<<<<<<<<<<<<<
 *     return True
 * 
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_6 = __Pyx_PyBool_FromLong(0); 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_r = __pyx_t_6;
      __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      goto __pyx_L0;
    }
    __pyx_L8:;
    __pyx_L3_continue:;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pygrib.pyx":2059
 *         else:
 *             return False
 *     return True             # <<<<<<<<<<<<<<
 * 
 * cdef _strencode(pystr,encoding=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2059; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __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_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __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_XDECREF(__pyx_v_iscallable);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pygrib.pyx":2061
 *     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;
  int __pyx_t_9;
  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":2064
 *     # 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":2065
 *     # 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 = 2065; __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;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "pygrib.pyx":2066
 *     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":2067
 *         encoding = default_encoding
 *     try:
 *         return pystr.encode(encoding)             # <<<<<<<<<<<<<<
 *     except AttributeError:
 *         return pystr # already bytes?
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_pystr, __pyx_n_s__encode); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2067; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2067; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_INCREF(__pyx_v_encoding);
      PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_encoding);
      __Pyx_GIVEREF(__pyx_v_encoding);
      __pyx_t_8 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2067; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
      __pyx_r = __pyx_t_8;
      __pyx_t_8 = 0;
      goto __pyx_L8_try_return;
    }
    __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_L11_try_end;
    __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_L4_error:;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;

    /* "pygrib.pyx":2068
 *     try:
 *         return pystr.encode(encoding)
 *     except AttributeError:             # <<<<<<<<<<<<<<
 *         return pystr # already bytes?
 */
    __pyx_t_9 = PyErr_ExceptionMatches(__pyx_builtin_AttributeError);
    if (__pyx_t_9) {
      __Pyx_AddTraceback("pygrib._strencode", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_8, &__pyx_t_7, &__pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2068; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_GOTREF(__pyx_t_3);

      /* "pygrib.pyx":2069
 *         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_8); __pyx_t_8 = 0;
      goto __pyx_L7_except_return;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      goto __pyx_L5_exception_handled;
    }
    __pyx_L6_except_error:;
    __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_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;
    __pyx_L5_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_L11_try_end:;
  }

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __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_gribmessage(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_6pygrib_gribmessage *p;
  PyObject *o;
  o = (*t->tp_alloc)(t, 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;
  PyObject_GC_UnTrack(o);
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    ++Py_REFCNT(o);
    __pyx_pw_6pygrib_11gribmessage_3__dealloc__(o);
    if (PyErr_Occurred()) PyErr_WriteUnraisable(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) {
  struct __pyx_obj_6pygrib_gribmessage *p = (struct __pyx_obj_6pygrib_gribmessage *)o;
  PyObject* tmp;
  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 %s", 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[] = {
  {__Pyx_NAMESTR("__getattr__"), (PyCFunction)__pyx_pw_6pygrib_11gribmessage_5__getattr__, METH_O|METH_COEXIST, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("_get_key"), (PyCFunction)__pyx_pw_6pygrib_11gribmessage_11_get_key, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6pygrib_11gribmessage_10_get_key)},
  {__Pyx_NAMESTR("expand_grid"), (PyCFunction)__pyx_pw_6pygrib_11gribmessage_13expand_grid, METH_O, __Pyx_DOCSTR(__pyx_doc_6pygrib_11gribmessage_12expand_grid)},
  {__Pyx_NAMESTR("is_missing"), (PyCFunction)__pyx_pw_6pygrib_11gribmessage_15is_missing, METH_O, __Pyx_DOCSTR(__pyx_doc_6pygrib_11gribmessage_14is_missing)},
  {__Pyx_NAMESTR("keys"), (PyCFunction)__pyx_pw_6pygrib_11gribmessage_17keys, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_6pygrib_11gribmessage_16keys)},
  {__Pyx_NAMESTR("_read_only_keys"), (PyCFunction)__pyx_pw_6pygrib_11gribmessage_19_read_only_keys, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_6pygrib_11gribmessage_18_read_only_keys)},
  {__Pyx_NAMESTR("data"), (PyCFunction)__pyx_pw_6pygrib_11gribmessage_21data, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6pygrib_11gribmessage_20data)},
  {__Pyx_NAMESTR("has_key"), (PyCFunction)__pyx_pw_6pygrib_11gribmessage_27has_key, METH_O, __Pyx_DOCSTR(__pyx_doc_6pygrib_11gribmessage_26has_key)},
  {__Pyx_NAMESTR("valid_key"), (PyCFunction)__pyx_pw_6pygrib_11gribmessage_29valid_key, METH_O, __Pyx_DOCSTR(__pyx_doc_6pygrib_11gribmessage_28valid_key)},
  {__Pyx_NAMESTR("tostring"), (PyCFunction)__pyx_pw_6pygrib_11gribmessage_31tostring, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_6pygrib_11gribmessage_30tostring)},
  {__Pyx_NAMESTR("_unshape_mask"), (PyCFunction)__pyx_pw_6pygrib_11gribmessage_33_unshape_mask, METH_O, __Pyx_DOCSTR(__pyx_doc_6pygrib_11gribmessage_32_unshape_mask)},
  {__Pyx_NAMESTR("_reshape_mask"), (PyCFunction)__pyx_pw_6pygrib_11gribmessage_35_reshape_mask, METH_O, __Pyx_DOCSTR(__pyx_doc_6pygrib_11gribmessage_34_reshape_mask)},
  {__Pyx_NAMESTR("_set_projparams"), (PyCFunction)__pyx_pw_6pygrib_11gribmessage_37_set_projparams, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_6pygrib_11gribmessage_36_set_projparams)},
  {__Pyx_NAMESTR("latlons"), (PyCFunction)__pyx_pw_6pygrib_11gribmessage_39latlons, METH_NOARGS, __Pyx_DOCSTR(__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)
  __Pyx_NAMESTR("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*/
  #else
  0, /*reserved*/
  #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*/
  __Pyx_DOCSTR("\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*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
  #if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE)
  0, /*tp_finalize*/
  #endif
};

static PyObject *__pyx_tp_new_6pygrib_open(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_6pygrib_open *p;
  PyObject *o;
  o = (*t->tp_alloc)(t, 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;
  PyObject_GC_UnTrack(o);
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    ++Py_REFCNT(o);
    __pyx_pw_6pygrib_4open_27__dealloc__(o);
    if (PyErr_Occurred()) PyErr_WriteUnraisable(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) {
  struct __pyx_obj_6pygrib_open *p = (struct __pyx_obj_6pygrib_open *)o;
  PyObject* tmp;
  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[] = {
  {__Pyx_NAMESTR("__next__"), (PyCFunction)__pyx_pw_6pygrib_4open_7__next__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("__enter__"), (PyCFunction)__pyx_pw_6pygrib_4open_13__enter__, METH_NOARGS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("__exit__"), (PyCFunction)__pyx_pw_6pygrib_4open_15__exit__, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("tell"), (PyCFunction)__pyx_pw_6pygrib_4open_17tell, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_6pygrib_4open_16tell)},
  {__Pyx_NAMESTR("seek"), (PyCFunction)__pyx_pw_6pygrib_4open_19seek, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6pygrib_4open_18seek)},
  {__Pyx_NAMESTR("readline"), (PyCFunction)__pyx_pw_6pygrib_4open_21readline, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_6pygrib_4open_20readline)},
  {__Pyx_NAMESTR("read"), (PyCFunction)__pyx_pw_6pygrib_4open_23read, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6pygrib_4open_22read)},
  {__Pyx_NAMESTR("close"), (PyCFunction)__pyx_pw_6pygrib_4open_25close, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_6pygrib_4open_24close)},
  {__Pyx_NAMESTR("rewind"), (PyCFunction)__pyx_pw_6pygrib_4open_29rewind, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_6pygrib_4open_28rewind)},
  {__Pyx_NAMESTR("message"), (PyCFunction)__pyx_pw_6pygrib_4open_31message, METH_O, __Pyx_DOCSTR(__pyx_doc_6pygrib_4open_30message)},
  {__Pyx_NAMESTR("select"), (PyCFunction)__pyx_pw_6pygrib_4open_33select, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6pygrib_4open_32select)},
  {__Pyx_NAMESTR("_advance"), (PyCFunction)__pyx_pw_6pygrib_4open_35_advance, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__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)
  __Pyx_NAMESTR("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*/
  #else
  0, /*reserved*/
  #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*/
  __Pyx_DOCSTR(" \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*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
  #if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE)
  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;
  o = (*t->tp_alloc)(t, 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;
  PyObject_GC_UnTrack(o);
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    ++Py_REFCNT(o);
    __pyx_pw_6pygrib_5index_13__dealloc__(o);
    if (PyErr_Occurred()) PyErr_WriteUnraisable(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) {
  struct __pyx_obj_6pygrib_index *p = (struct __pyx_obj_6pygrib_index *)o;
  PyObject* tmp;
  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[] = {
  {__Pyx_NAMESTR("select"), (PyCFunction)__pyx_pw_6pygrib_5index_7select, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6pygrib_5index_6select)},
  {__Pyx_NAMESTR("write"), (PyCFunction)__pyx_pw_6pygrib_5index_9write, METH_O, __Pyx_DOCSTR(__pyx_doc_6pygrib_5index_8write)},
  {__Pyx_NAMESTR("close"), (PyCFunction)__pyx_pw_6pygrib_5index_11close, METH_NOARGS, __Pyx_DOCSTR(__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)
  __Pyx_NAMESTR("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*/
  #else
  0, /*reserved*/
  #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*/
  __Pyx_DOCSTR(" \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>>> 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>>> 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.\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).\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*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
  #if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE)
  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
    __Pyx_NAMESTR("pygrib"),
    __Pyx_DOCSTR(__pyx_k_192), /* 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_n_s_1, __pyx_k_1, sizeof(__pyx_k_1), 0, 0, 1, 1},
  {&__pyx_kp_s_10, __pyx_k_10, sizeof(__pyx_k_10), 0, 0, 1, 0},
  {&__pyx_kp_s_104, __pyx_k_104, sizeof(__pyx_k_104), 0, 0, 1, 0},
  {&__pyx_kp_s_105, __pyx_k_105, sizeof(__pyx_k_105), 0, 0, 1, 0},
  {&__pyx_kp_s_106, __pyx_k_106, sizeof(__pyx_k_106), 0, 0, 1, 0},
  {&__pyx_n_s_108, __pyx_k_108, sizeof(__pyx_k_108), 0, 0, 1, 1},
  {&__pyx_kp_s_112, __pyx_k_112, sizeof(__pyx_k_112), 0, 0, 1, 0},
  {&__pyx_kp_s_115, __pyx_k_115, sizeof(__pyx_k_115), 0, 0, 1, 0},
  {&__pyx_n_s_117, __pyx_k_117, sizeof(__pyx_k_117), 0, 0, 1, 1},
  {&__pyx_kp_s_12, __pyx_k_12, sizeof(__pyx_k_12), 0, 0, 1, 0},
  {&__pyx_n_s_139, __pyx_k_139, sizeof(__pyx_k_139), 0, 0, 1, 1},
  {&__pyx_n_s_141, __pyx_k_141, sizeof(__pyx_k_141), 0, 0, 1, 1},
  {&__pyx_n_s_142, __pyx_k_142, sizeof(__pyx_k_142), 0, 0, 1, 1},
  {&__pyx_n_s_143, __pyx_k_143, sizeof(__pyx_k_143), 0, 0, 1, 1},
  {&__pyx_n_s_144, __pyx_k_144, sizeof(__pyx_k_144), 0, 0, 1, 1},
  {&__pyx_n_s_145, __pyx_k_145, sizeof(__pyx_k_145), 0, 0, 1, 1},
  {&__pyx_n_s_146, __pyx_k_146, sizeof(__pyx_k_146), 0, 0, 1, 1},
  {&__pyx_n_s_148, __pyx_k_148, sizeof(__pyx_k_148), 0, 0, 1, 1},
  {&__pyx_kp_s_149, __pyx_k_149, sizeof(__pyx_k_149), 0, 0, 1, 0},
  {&__pyx_kp_s_15, __pyx_k_15, sizeof(__pyx_k_15), 0, 0, 1, 0},
  {&__pyx_n_s_151, __pyx_k_151, sizeof(__pyx_k_151), 0, 0, 1, 1},
  {&__pyx_n_s_152, __pyx_k_152, sizeof(__pyx_k_152), 0, 0, 1, 1},
  {&__pyx_n_s_154, __pyx_k_154, sizeof(__pyx_k_154), 0, 0, 1, 1},
  {&__pyx_kp_s_156, __pyx_k_156, sizeof(__pyx_k_156), 0, 0, 1, 0},
  {&__pyx_n_s_158, __pyx_k_158, sizeof(__pyx_k_158), 0, 0, 1, 1},
  {&__pyx_n_s_159, __pyx_k_159, sizeof(__pyx_k_159), 0, 0, 1, 1},
  {&__pyx_n_s_160, __pyx_k_160, sizeof(__pyx_k_160), 0, 0, 1, 1},
  {&__pyx_n_s_161, __pyx_k_161, sizeof(__pyx_k_161), 0, 0, 1, 1},
  {&__pyx_n_s_162, __pyx_k_162, sizeof(__pyx_k_162), 0, 0, 1, 1},
  {&__pyx_n_s_163, __pyx_k_163, sizeof(__pyx_k_163), 0, 0, 1, 1},
  {&__pyx_n_s_164, __pyx_k_164, sizeof(__pyx_k_164), 0, 0, 1, 1},
  {&__pyx_n_s_165, __pyx_k_165, sizeof(__pyx_k_165), 0, 0, 1, 1},
  {&__pyx_n_s_166, __pyx_k_166, sizeof(__pyx_k_166), 0, 0, 1, 1},
  {&__pyx_n_s_167, __pyx_k_167, sizeof(__pyx_k_167), 0, 0, 1, 1},
  {&__pyx_kp_s_168, __pyx_k_168, sizeof(__pyx_k_168), 0, 0, 1, 0},
  {&__pyx_n_s_169, __pyx_k_169, sizeof(__pyx_k_169), 0, 0, 1, 1},
  {&__pyx_kp_s_17, __pyx_k_17, sizeof(__pyx_k_17), 0, 0, 1, 0},
  {&__pyx_n_s_170, __pyx_k_170, sizeof(__pyx_k_170), 0, 0, 1, 1},
  {&__pyx_n_s_171, __pyx_k_171, sizeof(__pyx_k_171), 0, 0, 1, 1},
  {&__pyx_n_s_172, __pyx_k_172, sizeof(__pyx_k_172), 0, 0, 1, 1},
  {&__pyx_n_s_176, __pyx_k_176, sizeof(__pyx_k_176), 0, 0, 1, 1},
  {&__pyx_n_s_177, __pyx_k_177, sizeof(__pyx_k_177), 0, 0, 1, 1},
  {&__pyx_kp_s_178, __pyx_k_178, sizeof(__pyx_k_178), 0, 0, 1, 0},
  {&__pyx_n_s_180, __pyx_k_180, sizeof(__pyx_k_180), 0, 0, 1, 1},
  {&__pyx_n_s_181, __pyx_k_181, sizeof(__pyx_k_181), 0, 0, 1, 1},
  {&__pyx_kp_s_182, __pyx_k_182, sizeof(__pyx_k_182), 0, 0, 1, 0},
  {&__pyx_kp_s_183, __pyx_k_183, sizeof(__pyx_k_183), 0, 0, 1, 0},
  {&__pyx_kp_s_186, __pyx_k_186, sizeof(__pyx_k_186), 0, 0, 1, 0},
  {&__pyx_kp_s_188, __pyx_k_188, sizeof(__pyx_k_188), 0, 0, 1, 0},
  {&__pyx_kp_s_19, __pyx_k_19, sizeof(__pyx_k_19), 0, 0, 1, 0},
  {&__pyx_kp_s_193, __pyx_k_193, sizeof(__pyx_k_193), 0, 0, 1, 0},
  {&__pyx_n_s_194, __pyx_k_194, sizeof(__pyx_k_194), 0, 0, 1, 1},
  {&__pyx_kp_s_195, __pyx_k_195, sizeof(__pyx_k_195), 0, 0, 1, 0},
  {&__pyx_n_s_199, __pyx_k_199, sizeof(__pyx_k_199), 0, 0, 1, 1},
  {&__pyx_kp_s_2, __pyx_k_2, sizeof(__pyx_k_2), 0, 0, 1, 0},
  {&__pyx_n_s_20, __pyx_k_20, sizeof(__pyx_k_20), 0, 0, 1, 1},
  {&__pyx_kp_s_200, __pyx_k_200, sizeof(__pyx_k_200), 0, 0, 1, 0},
  {&__pyx_n_s_203, __pyx_k_203, sizeof(__pyx_k_203), 0, 0, 1, 1},
  {&__pyx_kp_s_206, __pyx_k_206, sizeof(__pyx_k_206), 0, 0, 1, 0},
  {&__pyx_kp_s_24, __pyx_k_24, sizeof(__pyx_k_24), 0, 0, 1, 0},
  {&__pyx_kp_s_27, __pyx_k_27, sizeof(__pyx_k_27), 0, 0, 1, 0},
  {&__pyx_kp_s_28, __pyx_k_28, sizeof(__pyx_k_28), 0, 0, 1, 0},
  {&__pyx_kp_s_29, __pyx_k_29, sizeof(__pyx_k_29), 0, 0, 1, 0},
  {&__pyx_kp_s_3, __pyx_k_3, sizeof(__pyx_k_3), 0, 0, 1, 0},
  {&__pyx_kp_s_30, __pyx_k_30, sizeof(__pyx_k_30), 0, 0, 1, 0},
  {&__pyx_kp_s_33, __pyx_k_33, sizeof(__pyx_k_33), 0, 0, 1, 0},
  {&__pyx_kp_s_38, __pyx_k_38, sizeof(__pyx_k_38), 0, 0, 1, 0},
  {&__pyx_kp_s_39, __pyx_k_39, sizeof(__pyx_k_39), 0, 0, 1, 0},
  {&__pyx_n_s_46, __pyx_k_46, sizeof(__pyx_k_46), 0, 0, 1, 1},
  {&__pyx_n_s_48, __pyx_k_48, sizeof(__pyx_k_48), 0, 0, 1, 1},
  {&__pyx_kp_s_5, __pyx_k_5, sizeof(__pyx_k_5), 0, 0, 1, 0},
  {&__pyx_n_s_50, __pyx_k_50, sizeof(__pyx_k_50), 0, 0, 1, 1},
  {&__pyx_n_s_52, __pyx_k_52, sizeof(__pyx_k_52), 0, 0, 1, 1},
  {&__pyx_n_s_54, __pyx_k_54, sizeof(__pyx_k_54), 0, 0, 1, 1},
  {&__pyx_n_s_56, __pyx_k_56, sizeof(__pyx_k_56), 0, 0, 1, 1},
  {&__pyx_n_s_58, __pyx_k_58, sizeof(__pyx_k_58), 0, 0, 1, 1},
  {&__pyx_kp_s_6, __pyx_k_6, sizeof(__pyx_k_6), 0, 0, 1, 0},
  {&__pyx_kp_s_60, __pyx_k_60, sizeof(__pyx_k_60), 0, 0, 1, 0},
  {&__pyx_kp_s_61, __pyx_k_61, sizeof(__pyx_k_61), 0, 0, 1, 0},
  {&__pyx_kp_s_62, __pyx_k_62, sizeof(__pyx_k_62), 0, 0, 1, 0},
  {&__pyx_kp_s_66, __pyx_k_66, sizeof(__pyx_k_66), 0, 0, 1, 0},
  {&__pyx_kp_s_67, __pyx_k_67, sizeof(__pyx_k_67), 0, 0, 1, 0},
  {&__pyx_kp_s_71, __pyx_k_71, sizeof(__pyx_k_71), 0, 0, 1, 0},
  {&__pyx_kp_s_72, __pyx_k_72, sizeof(__pyx_k_72), 0, 0, 1, 0},
  {&__pyx_n_s_74, __pyx_k_74, sizeof(__pyx_k_74), 0, 0, 1, 1},
  {&__pyx_kp_s_76, __pyx_k_76, sizeof(__pyx_k_76), 0, 0, 1, 0},
  {&__pyx_kp_s_77, __pyx_k_77, sizeof(__pyx_k_77), 0, 0, 1, 0},
  {&__pyx_kp_s_78, __pyx_k_78, sizeof(__pyx_k_78), 0, 0, 1, 0},
  {&__pyx_kp_s_79, __pyx_k_79, sizeof(__pyx_k_79), 0, 0, 1, 0},
  {&__pyx_kp_s_8, __pyx_k_8, sizeof(__pyx_k_8), 0, 0, 1, 0},
  {&__pyx_kp_s_81, __pyx_k_81, sizeof(__pyx_k_81), 0, 0, 1, 0},
  {&__pyx_kp_s_82, __pyx_k_82, sizeof(__pyx_k_82), 0, 0, 1, 0},
  {&__pyx_kp_s_83, __pyx_k_83, sizeof(__pyx_k_83), 0, 0, 1, 0},
  {&__pyx_kp_s_84, __pyx_k_84, sizeof(__pyx_k_84), 0, 0, 1, 0},
  {&__pyx_kp_s_85, __pyx_k_85, sizeof(__pyx_k_85), 0, 0, 1, 0},
  {&__pyx_kp_s_86, __pyx_k_86, sizeof(__pyx_k_86), 0, 0, 1, 0},
  {&__pyx_kp_s_87, __pyx_k_87, sizeof(__pyx_k_87), 0, 0, 1, 0},
  {&__pyx_n_s_89, __pyx_k_89, sizeof(__pyx_k_89), 0, 0, 1, 1},
  {&__pyx_n_s_91, __pyx_k_91, sizeof(__pyx_k_91), 0, 0, 1, 1},
  {&__pyx_n_s_93, __pyx_k_93, sizeof(__pyx_k_93), 0, 0, 1, 1},
  {&__pyx_n_s_95, __pyx_k_95, sizeof(__pyx_k_95), 0, 0, 1, 1},
  {&__pyx_kp_s_97, __pyx_k_97, sizeof(__pyx_k_97), 0, 0, 1, 0},
  {&__pyx_kp_s_98, __pyx_k_98, sizeof(__pyx_k_98), 0, 0, 1, 0},
  {&__pyx_kp_s_99, __pyx_k_99, sizeof(__pyx_k_99), 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_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_n_s____call__, __pyx_k____call__, sizeof(__pyx_k____call__), 0, 0, 1, 1},
  {&__pyx_n_s____dict__, __pyx_k____dict__, sizeof(__pyx_k____dict__), 0, 0, 1, 1},
  {&__pyx_n_s____getitem__, __pyx_k____getitem__, sizeof(__pyx_k____getitem__), 0, 0, 1, 1},
  {&__pyx_n_s____import__, __pyx_k____import__, sizeof(__pyx_k____import__), 0, 0, 1, 1},
  {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1},
  {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1},
  {&__pyx_n_s____version__, __pyx_k____version__, sizeof(__pyx_k____version__), 0, 0, 1, 1},
  {&__pyx_n_s___advance, __pyx_k___advance, sizeof(__pyx_k___advance), 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___find, __pyx_k___find, sizeof(__pyx_k___find), 0, 0, 1, 1},
  {&__pyx_n_s___ftimedict, __pyx_k___ftimedict, sizeof(__pyx_k___ftimedict), 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___gh, __pyx_k___gh, sizeof(__pyx_k___gh), 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_stringlike, __pyx_k___is_stringlike, sizeof(__pyx_k___is_stringlike), 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___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___reshape_mask, __pyx_k___reshape_mask, sizeof(__pyx_k___reshape_mask), 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___set_projparams, __pyx_k___set_projparams, sizeof(__pyx_k___set_projparams), 0, 0, 1, 1},
  {&__pyx_n_s___unshape_mask, __pyx_k___unshape_mask, sizeof(__pyx_k___unshape_mask), 0, 0, 1, 1},
  {&__pyx_n_s__a, __pyx_k__a, sizeof(__pyx_k__a), 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__analDate, __pyx_k__analDate, sizeof(__pyx_k__analDate), 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_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__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_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_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__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_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_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_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_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__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_n_s__from_what, __pyx_k__from_what, sizeof(__pyx_k__from_what), 0, 0, 1, 1},
  {&__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__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__gh, __pyx_k__gh, sizeof(__pyx_k__gh), 0, 0, 1, 1},
  {&__pyx_n_s__grb, __pyx_k__grb, sizeof(__pyx_k__grb), 0, 0, 1, 1},
  {&__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_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__index, __pyx_k__index, sizeof(__pyx_k__index), 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_missing, __pyx_k__is_missing, sizeof(__pyx_k__is_missing), 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__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_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__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__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_n_s__linspace, __pyx_k__linspace, sizeof(__pyx_k__linspace), 0, 0, 1, 1},
  {&__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__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__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__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_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_n_s__nmsgs, __pyx_k__nmsgs, sizeof(__pyx_k__nmsgs), 0, 0, 1, 1},
  {&__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__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_n_s__power, __pyx_k__power, sizeof(__pyx_k__power), 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__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__redtoreg, __pyx_k__redtoreg, sizeof(__pyx_k__redtoreg), 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_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__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__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_n_s__s, __pyx_k__s, sizeof(__pyx_k__s), 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__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__stepUnits, __pyx_k__stepUnits, sizeof(__pyx_k__stepUnits), 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__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_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__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__units, __pyx_k__units, sizeof(__pyx_k__units), 0, 0, 1, 1},
  {&__pyx_n_s__unknown, __pyx_k__unknown, sizeof(__pyx_k__unknown), 0, 0, 1, 1},
  {&__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_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__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_n_s__where, __pyx_k__where, sizeof(__pyx_k__where), 0, 0, 1, 1},
  {&__pyx_n_s__xrange, __pyx_k__xrange, sizeof(__pyx_k__xrange), 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 = 186; __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 = 337; __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 = 400; __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 = 432; __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 = 436; __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 = 451; __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 = 451; __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 = 461; __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 = 625; __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 = 841; __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 = 852; __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 = 1904; __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":337
 *     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_k_tuple_4 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_3)); if (unlikely(!__pyx_k_tuple_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_4);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_4));

  /* "pygrib.pyx":461
 *             return grb
 *         else:
 *             raise KeyError('key must be an integer message number or a slice')             # <<<<<<<<<<<<<<
 *     def __call__(self, **kwargs):
 *         """same as L{select}"""
 */
  __pyx_k_tuple_7 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_6)); if (unlikely(!__pyx_k_tuple_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 461; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_7);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_7));

  /* "pygrib.pyx":481
 *         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_k_tuple_9 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_8)); if (unlikely(!__pyx_k_tuple_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 481; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_9);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_9));

  /* "pygrib.pyx":564
 *         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_k_tuple_11 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_10)); if (unlikely(!__pyx_k_tuple_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_11);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_11));

  /* "pygrib.pyx":615
 *         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_k_tuple_13 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_12)); if (unlikely(!__pyx_k_tuple_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_13);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_13));

  /* "pygrib.pyx":623
 *         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_k_tuple_16 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_15)); if (unlikely(!__pyx_k_tuple_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 623; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_16);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_16));

  /* "pygrib.pyx":633
 *                 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_k_tuple_18 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_17)); if (unlikely(!__pyx_k_tuple_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 633; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_18);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_18));

  /* "pygrib.pyx":718
 *     """
 *     grb.fcstimeunits = ""
 *     if grb.has_key('indicatorOfUnitOfTimeRange') and\             # <<<<<<<<<<<<<<
 *        grb.indicatorOfUnitOfTimeRange in _ftimedict:
 *         grb.fcstimeunits = _ftimedict[grb.indicatorOfUnitOfTimeRange]
 */
  __pyx_k_tuple_21 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s_20)); if (unlikely(!__pyx_k_tuple_21)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 718; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_21);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_21));

  /* "pygrib.pyx":721
 *        grb.indicatorOfUnitOfTimeRange in _ftimedict:
 *         grb.fcstimeunits = _ftimedict[grb.indicatorOfUnitOfTimeRange]
 *     if grb.has_key('forecastTime'):             # <<<<<<<<<<<<<<
 *         if grb.has_key('stepRange'):
 *             # this is a hack to work around grib_api bug
 */
  __pyx_k_tuple_22 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__forecastTime)); if (unlikely(!__pyx_k_tuple_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 721; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_22);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_22));

  /* "pygrib.pyx":722
 *         grb.fcstimeunits = _ftimedict[grb.indicatorOfUnitOfTimeRange]
 *     if grb.has_key('forecastTime'):
 *         if grb.has_key('stepRange'):             # <<<<<<<<<<<<<<
 *             # this is a hack to work around grib_api bug
 *             # sometimes stepUnits and indicatorOfUnitOfTimeRange
 */
  __pyx_k_tuple_23 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__stepRange)); if (unlikely(!__pyx_k_tuple_23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_23);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_23));

  /* "pygrib.pyx":730
 *             # if it's a range, use the end of the range to define validDate
 *             try:
 *                 ftime = float(ftime.split('-')[1])             # <<<<<<<<<<<<<<
 *             except:
 *                 ftime = grb.forecastTime
 */
  __pyx_k_tuple_25 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_24)); if (unlikely(!__pyx_k_tuple_25)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 730; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_25);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_25));

  /* "pygrib.pyx":737
 *     else:
 *         ftime = 0
 *     if grb.has_key('julianDay'):             # <<<<<<<<<<<<<<
 *         # don't do anything if datetime fails (because of a miscoded julianDay)
 *         try:
 */
  __pyx_k_tuple_26 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__julianDay)); if (unlikely(!__pyx_k_tuple_26)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 737; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_26);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_26));

  /* "pygrib.pyx":841
 *     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_k_tuple_31 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_30)); if (unlikely(!__pyx_k_tuple_31)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_31);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_31));

  /* "pygrib.pyx":864
 *         """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_k_tuple_32 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__name)); if (unlikely(!__pyx_k_tuple_32)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 864; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_32);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_32));

  /* "pygrib.pyx":867
 *             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_k_tuple_34 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__parameterName)); if (unlikely(!__pyx_k_tuple_34)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 867; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_34);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_34));

  /* "pygrib.pyx":869
 *             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_k_tuple_35 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__units)); if (unlikely(!__pyx_k_tuple_35)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 869; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_35);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_35));

  /* "pygrib.pyx":872
 *             if self['units'] != 'unknown':
 *                 inventory.append(':'+self['units'])
 *             elif self.valid_key('parameterUnits'):             # <<<<<<<<<<<<<<
 *                 inventory.append(':'+self['parameterUnits'])
 *         if self.valid_key('stepType'):
 */
  __pyx_k_tuple_36 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__parameterUnits)); if (unlikely(!__pyx_k_tuple_36)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 872; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_36);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_36));

  /* "pygrib.pyx":874
 *             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_k_tuple_37 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__stepType)); if (unlikely(!__pyx_k_tuple_37)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 874; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_37);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_37));

  /* "pygrib.pyx":876
 *         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_k_tuple_40 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__typeOfGrid)); if (unlikely(!__pyx_k_tuple_40)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 876; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_40);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_40));
  __pyx_k_tuple_41 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__gridType)); if (unlikely(!__pyx_k_tuple_41)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 876; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_41);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_41));

  /* "pygrib.pyx":877
 *             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_k_tuple_42 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__typeOfGrid)); if (unlikely(!__pyx_k_tuple_42)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 877; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_42);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_42));

  /* "pygrib.pyx":881
 *             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_k_tuple_43 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__typeOfLevel)); if (unlikely(!__pyx_k_tuple_43)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 881; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_43);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_43));

  /* "pygrib.pyx":883
 *         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_k_tuple_44 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__topLevel)); if (unlikely(!__pyx_k_tuple_44)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 883; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_44);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_44));
  __pyx_k_tuple_45 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__bottomLevel)); if (unlikely(!__pyx_k_tuple_45)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 883; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_45);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_45));

  /* "pygrib.pyx":886
 *             toplev = None; botlev = None
 *             levunits = 'unknown'
 *             if self.valid_key('unitsOfFirstFixedSurface'):             # <<<<<<<<<<<<<<
 *                 levunits = self['unitsOfFirstFixedSurface']
 *             if self.valid_key('typeOfFirstFixedSurface') and self['typeOfFirstFixedSurface'] != 255:
 */
  __pyx_k_tuple_47 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s_46)); if (unlikely(!__pyx_k_tuple_47)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 886; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_47);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_47));

  /* "pygrib.pyx":888
 *             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_k_tuple_49 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s_48)); if (unlikely(!__pyx_k_tuple_49)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 888; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_49);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_49));

  /* "pygrib.pyx":890
 *             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_k_tuple_51 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s_50)); if (unlikely(!__pyx_k_tuple_51)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_51);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_51));

  /* "pygrib.pyx":891
 *                 toplev = self['topLevel']
 *                 if self.valid_key('scaledValueOfFirstFixedSurface') and\
 *                    self.valid_key('scaleFactorOfFirstFixedSurface'):             # <<<<<<<<<<<<<<
 *                    if self['scaleFactorOfFirstFixedSurface']:
 *                        toplev = self['scaledValueOfFirstFixedSurface']/\
 */
  __pyx_k_tuple_53 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s_52)); if (unlikely(!__pyx_k_tuple_53)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 891; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_53);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_53));

  /* "pygrib.pyx":897
 *                    else:
 *                        toplev = self['scaledValueOfFirstFixedSurface']
 *             if self.valid_key('typeOfSecondFixedSurface') and self['typeOfSecondFixedSurface'] != 255:             # <<<<<<<<<<<<<<
 *                 botlev = self['bottomLevel']
 *                 if self.valid_key('scaledValueOfSecondFixedSurface') and\
 */
  __pyx_k_tuple_55 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s_54)); if (unlikely(!__pyx_k_tuple_55)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 897; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_55);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_55));

  /* "pygrib.pyx":899
 *             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_k_tuple_57 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s_56)); if (unlikely(!__pyx_k_tuple_57)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 899; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_57);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_57));

  /* "pygrib.pyx":900
 *                 botlev = self['bottomLevel']
 *                 if self.valid_key('scaledValueOfSecondFixedSurface') and\
 *                    self.valid_key('scaleFactorOfSecondFixedSurface'):             # <<<<<<<<<<<<<<
 *                    if self['scaleFactorOfSecondFixedSurface']:
 *                        botlev = self['scaledValueOfSecondFixedSurface']/\
 */
  __pyx_k_tuple_59 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s_58)); if (unlikely(!__pyx_k_tuple_59)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 900; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_59);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_59));

  /* "pygrib.pyx":915
 *             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_k_tuple_63 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__level)); if (unlikely(!__pyx_k_tuple_63)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 915; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_63);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_63));

  /* "pygrib.pyx":917
 *         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_k_tuple_64 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__stepRange)); if (unlikely(!__pyx_k_tuple_64)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 917; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_64);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_64));

  /* "pygrib.pyx":919
 *         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_k_tuple_65 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__stepType)); if (unlikely(!__pyx_k_tuple_65)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 919; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_65);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_65));

  /* "pygrib.pyx":924
 *             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_k_tuple_68 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__forecastTime)); if (unlikely(!__pyx_k_tuple_68)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 924; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_68);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_68));

  /* "pygrib.pyx":927
 *             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_k_tuple_69 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__dataDate)); if (unlikely(!__pyx_k_tuple_69)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 927; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_69);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_69));
  __pyx_k_tuple_70 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__dataTime)); if (unlikely(!__pyx_k_tuple_70)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 927; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_70);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_70));

  /* "pygrib.pyx":933
 *         #    inventory.append(
 *         #    ':valid '+repr(self['validityDate'])+repr(self['validityTime']))
 *         if self.valid_key('perturbationNumber') and\             # <<<<<<<<<<<<<<
 *            self.valid_key('typeOfEnsembleForecast'):
 *             ens_type = self['typeOfEnsembleForecast']
 */
  __pyx_k_tuple_73 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__perturbationNumber)); if (unlikely(!__pyx_k_tuple_73)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 933; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_73);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_73));

  /* "pygrib.pyx":934
 *         #    ':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_k_tuple_75 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s_74)); if (unlikely(!__pyx_k_tuple_75)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 934; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_75);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_75));

  /* "pygrib.pyx":945
 *             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_k_tuple_80 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__derivedForecast)); if (unlikely(!__pyx_k_tuple_80)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 945; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_80);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_80));

  /* "pygrib.pyx":960
 *             elif self['derivedForecast'] == 6:
 *                 inventory.append(":ens mean of cluster")
 *         if self.valid_key('probabilityTypeName'):             # <<<<<<<<<<<<<<
 *             inventory.append(":"+self['probabilityTypeName'])
 *             lowerlim = None
 */
  __pyx_k_tuple_88 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__probabilityTypeName)); if (unlikely(!__pyx_k_tuple_88)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 960; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_88);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_88));

  /* "pygrib.pyx":963
 *             inventory.append(":"+self['probabilityTypeName'])
 *             lowerlim = None
 *             if self.valid_key('scaledValueOfLowerLimit') and\             # <<<<<<<<<<<<<<
 *                self.valid_key('scaleFactorOfLowerLimit'):
 *                if self['scaledValueOfLowerLimit'] and\
 */
  __pyx_k_tuple_90 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s_89)); if (unlikely(!__pyx_k_tuple_90)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 963; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_90);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_90));

  /* "pygrib.pyx":964
 *             lowerlim = None
 *             if self.valid_key('scaledValueOfLowerLimit') and\
 *                self.valid_key('scaleFactorOfLowerLimit'):             # <<<<<<<<<<<<<<
 *                if self['scaledValueOfLowerLimit'] and\
 *                   self['scaleFactorOfLowerLimit']:
 */
  __pyx_k_tuple_92 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s_91)); if (unlikely(!__pyx_k_tuple_92)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 964; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_92);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_92));

  /* "pygrib.pyx":970
 *                               np.power(10.0,self['scaleFactorOfLowerLimit'])
 *             upperlim = None
 *             if self.valid_key('scaledValueOfUpperLimit') and\             # <<<<<<<<<<<<<<
 *                self.valid_key('scaleFactorOfUpperLimit'):
 *                if self['scaledValueOfUpperLimit'] and\
 */
  __pyx_k_tuple_94 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s_93)); if (unlikely(!__pyx_k_tuple_94)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 970; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_94);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_94));

  /* "pygrib.pyx":971
 *             upperlim = None
 *             if self.valid_key('scaledValueOfUpperLimit') and\
 *                self.valid_key('scaleFactorOfUpperLimit'):             # <<<<<<<<<<<<<<
 *                if self['scaledValueOfUpperLimit'] and\
 *                   self['scaleFactorOfUpperLimit']:
 */
  __pyx_k_tuple_96 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s_95)); if (unlikely(!__pyx_k_tuple_96)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 971; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_96);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_96));

  /* "pygrib.pyx":1106
 *             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_k_slice_100 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_100)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_slice_100);
  __Pyx_GIVEREF(__pyx_k_slice_100);
  __pyx_k_tuple_101 = PyTuple_Pack(2, __pyx_k_slice_100, __pyx_int_0); if (unlikely(!__pyx_k_tuple_101)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_101);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_101));

  /* "pygrib.pyx":1107
 *             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_k_slice_102 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_102)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_slice_102);
  __Pyx_GIVEREF(__pyx_k_slice_102);
  __pyx_k_tuple_103 = PyTuple_Pack(2, __pyx_int_0, __pyx_k_slice_102); if (unlikely(!__pyx_k_tuple_103)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_103);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_103));

  /* "pygrib.pyx":1204
 *         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_k_tuple_107 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__grid_complex)); if (unlikely(!__pyx_k_tuple_107)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1204; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_107);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_107));

  /* "pygrib.pyx":1234
 *                 return longval
 *             else: # array
 *                 if self.has_key('jPointsAreConsecutive') and\             # <<<<<<<<<<<<<<
 *                    self['jPointsAreConsecutive']:
 *                     storageorder='F'
 */
  __pyx_k_tuple_109 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s_108)); if (unlikely(!__pyx_k_tuple_109)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1234; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_109);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_109));

  /* "pygrib.pyx":1254
 *                 return doubleval
 *             else: # array
 *                 if self.has_key('jPointsAreConsecutive') and\             # <<<<<<<<<<<<<<
 *                    self['jPointsAreConsecutive']:
 *                     storageorder='F'
 */
  __pyx_k_tuple_110 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s_108)); if (unlikely(!__pyx_k_tuple_110)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1254; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_110);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_110));

  /* "pygrib.pyx":1318
 *         bytestr = b'values'
 *         name = bytestr
 *         usenceplib = self.packingType.startswith('grid_complex')             # <<<<<<<<<<<<<<
 *         # this workaround only needed for grib_api < 1.9.16.
 *         if usenceplib:
 */
  __pyx_k_tuple_111 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__grid_complex)); if (unlikely(!__pyx_k_tuple_111)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1318; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_111);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_111));

  /* "pygrib.pyx":1334
 *         """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_k_tuple_113 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_112)); if (unlikely(!__pyx_k_tuple_113)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1334; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_113);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_113));

  /* "pygrib.pyx":1339
 *             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_k_tuple_114 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__reduced)); if (unlikely(!__pyx_k_tuple_114)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1339; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_114);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_114));

  /* "pygrib.pyx":1341
 *         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_k_tuple_116 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_115)); if (unlikely(!__pyx_k_tuple_116)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1341; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_116);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_116));

  /* "pygrib.pyx":1356
 *             if self['alternativeRowScanning']:
 *                 datsave = datarr.copy()
 *                 datarr[1::2,::-1] = datsave[1::2,:]             # <<<<<<<<<<<<<<
 *         return datarr
 *     def _reshape_mask(self, datarr):
 */
  __pyx_k_slice_118 = PySlice_New(__pyx_int_1, Py_None, __pyx_int_2); if (unlikely(!__pyx_k_slice_118)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_slice_118);
  __Pyx_GIVEREF(__pyx_k_slice_118);
  __pyx_k_slice_119 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_119)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_slice_119);
  __Pyx_GIVEREF(__pyx_k_slice_119);
  __pyx_k_tuple_120 = PyTuple_Pack(2, __pyx_k_slice_118, __pyx_k_slice_119); if (unlikely(!__pyx_k_tuple_120)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_120);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_120));
  __pyx_k_slice_121 = PySlice_New(__pyx_int_1, Py_None, __pyx_int_2); if (unlikely(!__pyx_k_slice_121)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_slice_121);
  __Pyx_GIVEREF(__pyx_k_slice_121);
  __pyx_k_slice_122 = PySlice_New(Py_None, Py_None, __pyx_int_neg_1); if (unlikely(!__pyx_k_slice_122)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_slice_122);
  __Pyx_GIVEREF(__pyx_k_slice_122);
  __pyx_k_tuple_123 = PyTuple_Pack(2, __pyx_k_slice_121, __pyx_k_slice_122); if (unlikely(!__pyx_k_tuple_123)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_123);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_123));

  /* "pygrib.pyx":1363
 *         from redtoreg import _redtoreg
 *         if datarr.ndim > 2:
 *             raise ValueError('array must be 1d or 2d')             # <<<<<<<<<<<<<<
 *         # reduced grid.
 *         if self['gridType'].startswith('reduced'):
 */
  __pyx_k_tuple_124 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_112)); if (unlikely(!__pyx_k_tuple_124)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1363; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_124);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_124));

  /* "pygrib.pyx":1365
 *             raise ValueError('array must be 1d or 2d')
 *         # reduced grid.
 *         if self['gridType'].startswith('reduced'):             # <<<<<<<<<<<<<<
 *             try:
 *                 ny = self['Ny']
 */
  __pyx_k_tuple_125 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__reduced)); if (unlikely(!__pyx_k_tuple_125)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1365; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_125);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_125));

  /* "pygrib.pyx":1370
 *             except:
 *                 ny = self['Nj']
 *             if self.has_key('missingValue'):             # <<<<<<<<<<<<<<
 *                 missval = self['missingValue']
 *             else:
 */
  __pyx_k_tuple_126 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__missingValue)); if (unlikely(!__pyx_k_tuple_126)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1370; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_126);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_126));

  /* "pygrib.pyx":1379
 *             else:
 *                 nx = None
 *         elif self.has_key('Nx') and self.has_key('Ny'):             # <<<<<<<<<<<<<<
 *             nx = self['Nx']
 *             ny = self['Ny']
 */
  __pyx_k_tuple_127 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__Nx)); if (unlikely(!__pyx_k_tuple_127)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1379; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_127);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_127));
  __pyx_k_tuple_128 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__Ny)); if (unlikely(!__pyx_k_tuple_128)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1379; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_128);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_128));

  /* "pygrib.pyx":1383
 *             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_k_tuple_129 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__Ni)); if (unlikely(!__pyx_k_tuple_129)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1383; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_129);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_129));
  __pyx_k_tuple_130 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__Nj)); if (unlikely(!__pyx_k_tuple_130)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1383; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_130);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_130));

  /* "pygrib.pyx":1405
 *            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_k_slice_131 = PySlice_New(__pyx_int_1, Py_None, __pyx_int_2); if (unlikely(!__pyx_k_slice_131)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1405; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_slice_131);
  __Pyx_GIVEREF(__pyx_k_slice_131);
  __pyx_k_slice_132 = PySlice_New(Py_None, Py_None, __pyx_int_neg_1); if (unlikely(!__pyx_k_slice_132)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1405; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_slice_132);
  __Pyx_GIVEREF(__pyx_k_slice_132);
  __pyx_k_tuple_133 = PyTuple_Pack(2, __pyx_k_slice_131, __pyx_k_slice_132); if (unlikely(!__pyx_k_tuple_133)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1405; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_133);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_133));
  __pyx_k_slice_134 = PySlice_New(__pyx_int_1, Py_None, __pyx_int_2); if (unlikely(!__pyx_k_slice_134)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1405; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_slice_134);
  __Pyx_GIVEREF(__pyx_k_slice_134);
  __pyx_k_slice_135 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_135)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1405; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_slice_135);
  __Pyx_GIVEREF(__pyx_k_slice_135);
  __pyx_k_tuple_136 = PyTuple_Pack(2, __pyx_k_slice_134, __pyx_k_slice_135); if (unlikely(!__pyx_k_tuple_136)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1405; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_136);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_136));

  /* "pygrib.pyx":1408
 *            # 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_k_tuple_137 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__missingValue)); if (unlikely(!__pyx_k_tuple_137)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1408; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_137);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_137));

  /* "pygrib.pyx":1421
 *         # 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_k_tuple_138 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__radius)); if (unlikely(!__pyx_k_tuple_138)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1421; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_138);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_138));

  /* "pygrib.pyx":1429
 *                 projparams['b']=6371229.0
 *             elif self['shapeOfTheEarth'] in [3,7]:
 *                 if self.has_key('scaleFactorOfMajorAxisOfOblateSpheroidEarth'):             # <<<<<<<<<<<<<<
 *                     scalea = self['scaleFactorOfMajorAxisOfOblateSpheroidEarth']
 *                     scaleb = self['scaleFactorOfMinorAxisOfOblateSpheroidEarth']
 */
  __pyx_k_tuple_140 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s_139)); if (unlikely(!__pyx_k_tuple_140)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1429; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_140);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_140));

  /* "pygrib.pyx":1457
 *                 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_k_tuple_147 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s_146)); if (unlikely(!__pyx_k_tuple_147)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1457; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_147);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_147));

  /* "pygrib.pyx":1479
 *                 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_k_tuple_150 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_149)); if (unlikely(!__pyx_k_tuple_150)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1479; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_150);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_150));

  /* "pygrib.pyx":1486
 *             projparams['proj']='stere'
 *             projparams['lat_ts']=self['latitudeWhereDxAndDyAreSpecifiedInDegrees']
 *             if self.has_key('projectionCentreFlag'):             # <<<<<<<<<<<<<<
 *                 projcenterflag = self['projectionCentreFlag']
 *             elif self.has_key('projectionCenterFlag'):
 */
  __pyx_k_tuple_153 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s_152)); if (unlikely(!__pyx_k_tuple_153)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1486; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_153);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_153));

  /* "pygrib.pyx":1488
 *             if self.has_key('projectionCentreFlag'):
 *                 projcenterflag = self['projectionCentreFlag']
 *             elif self.has_key('projectionCenterFlag'):             # <<<<<<<<<<<<<<
 *                 projcenterflag = self['projectionCenterFlag']
 *             else:
 */
  __pyx_k_tuple_155 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s_154)); if (unlikely(!__pyx_k_tuple_155)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1488; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_155);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_155));

  /* "pygrib.pyx":1491
 *                 projcenterflag = self['projectionCenterFlag']
 *             else:
 *                 if not tolerate_badgrib: raise KeyError('cannot find projection center flag')             # <<<<<<<<<<<<<<
 *             if projcenterflag == 0:
 *                 projparams['lat_0']=90.
 */
  __pyx_k_tuple_157 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_156)); if (unlikely(!__pyx_k_tuple_157)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1491; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_157);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_157));

  /* "pygrib.pyx":1599
 *             # (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_k_tuple_173 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__grid_complex)); if (unlikely(!__pyx_k_tuple_173)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1599; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_173);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_173));

  /* "pygrib.pyx":1606
 *             else:
 *                 lats = self['distinctLatitudes']
 *                 if lat2 < lat1 and lats[-1] > lats[0]: lats = lats[::-1]             # <<<<<<<<<<<<<<
 *                 lons = self['distinctLongitudes']
 *             # don't trust distinctLongitudes
 */
  __pyx_k_slice_174 = PySlice_New(Py_None, Py_None, __pyx_int_neg_1); if (unlikely(!__pyx_k_slice_174)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1606; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_slice_174);
  __Pyx_GIVEREF(__pyx_k_slice_174);

  /* "pygrib.pyx":1619
 *                 lat2 = self['latitudeOfLastGridPointInDegrees']
 *                 lats = self['distinctLatitudes']
 *                 if lat2 < lat1 and lats[-1] > lats[0]: lats = lats[::-1]             # <<<<<<<<<<<<<<
 *                 ny = self['Nj']
 *                 nx = 2*ny
 */
  __pyx_k_slice_175 = PySlice_New(Py_None, Py_None, __pyx_int_neg_1); if (unlikely(!__pyx_k_slice_175)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1619; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_slice_175);
  __Pyx_GIVEREF(__pyx_k_slice_175);

  /* "pygrib.pyx":1713
 *             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_k_tuple_179 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_178)); if (unlikely(!__pyx_k_tuple_179)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1713; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_179);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_179));

  /* "pygrib.pyx":1898
 *         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_k_tuple_184 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_33)); if (unlikely(!__pyx_k_tuple_184)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1898; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_184);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_184));

  /* "pygrib.pyx":1903
 *             for arg in args:
 *                 try:
 *                     type = arg.split(':')[1]             # <<<<<<<<<<<<<<
 *                 except IndexError:
 *                     type = None
 */
  __pyx_k_tuple_185 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_33)); if (unlikely(!__pyx_k_tuple_185)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1903; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_185);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_185));

  /* "pygrib.pyx":1948
 *         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_k_tuple_187 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_186)); if (unlikely(!__pyx_k_tuple_187)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1948; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_187);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_187));

  /* "pygrib.pyx":1979
 *                     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_k_tuple_189 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_188)); if (unlikely(!__pyx_k_tuple_189)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1979; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_189);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_189));

  /* "pygrib.pyx":1982
 *         # 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_k_tuple_190 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_12)); if (unlikely(!__pyx_k_tuple_190)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1982; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_190);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_190));

  /* "pygrib.pyx":1996
 *                 raise RuntimeError(grib_get_error_message(err))
 *         if not grbs:
 *             raise ValueError('no matches found')             # <<<<<<<<<<<<<<
 *         # return the list of grib messages.
 *         return grbs
 */
  __pyx_k_tuple_191 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_12)); if (unlikely(!__pyx_k_tuple_191)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1996; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_191);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_191));

  /* "pygrib.pyx":190
 *         from mpl_toolkits.basemap import pyproj
 *     except:
 *         raise ImportError("either pyproj or basemap required")             # <<<<<<<<<<<<<<
 * from ncepgrib2 import Grib2Decode
 * import_array()
 */
  __pyx_k_tuple_196 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_195)); if (unlikely(!__pyx_k_tuple_196)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_196);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_196));

  /* "pygrib.pyx":304
 * #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_k_tuple_197 = PyTuple_Pack(5, ((PyObject *)__pyx_n_s__div), ((PyObject *)__pyx_n_s__v), ((PyObject *)__pyx_n_s__revision), ((PyObject *)__pyx_n_s__minor), ((PyObject *)__pyx_n_s__major)); if (unlikely(!__pyx_k_tuple_197)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_197);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_197));
  __pyx_k_codeobj_198 = (PyObject*)__Pyx_PyCode_New(0, 0, 5, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_197, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_200, __pyx_n_s_199, 304, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_198)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pygrib.pyx":314
 * tolerate_badgrib = False
 * 
 * def tolerate_badgrib_on():             # <<<<<<<<<<<<<<
 *     """
 *     don't raise an exception when a missing or malformed key is encountered.
 */
  __pyx_k_codeobj_201 = (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_200, __pyx_n_s__tolerate_badgrib_on, 314, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_201)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pygrib.pyx":321
 *     tolerate_badgrib = True
 * 
 * def tolerate_badgrib_off():             # <<<<<<<<<<<<<<
 *     """
 *     raise an exception when a missing or malformed key is encountered
 */
  __pyx_k_codeobj_202 = (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_200, __pyx_n_s_203, 321, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_202)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 321; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pygrib.pyx":329
 *     tolerate_badgrib = False
 * 
 * def gaulats(object nlats):             # <<<<<<<<<<<<<<
 *     """
 *     gaulats(nlats)
 */
  __pyx_k_tuple_204 = PyTuple_Pack(2, ((PyObject *)__pyx_n_s__nlats), ((PyObject *)__pyx_n_s__lats)); if (unlikely(!__pyx_k_tuple_204)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_204);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_204));
  __pyx_k_codeobj_205 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_204, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_200, __pyx_n_s__gaulats, 329, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_205)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pygrib.pyx":360
 * grib_multi_support_on(NULL)
 * 
 * def multi_support_on():             # <<<<<<<<<<<<<<
 *     """turn on support for multi-field grib messages (default)"""
 *     grib_multi_support_on(NULL)
 */
  __pyx_k_codeobj_207 = (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_200, __pyx_n_s__multi_support_on, 360, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_207)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pygrib.pyx":364
 *     grib_multi_support_on(NULL)
 * 
 * def multi_support_off():             # <<<<<<<<<<<<<<
 *     """turn off support for multi-field grib messages"""
 *     grib_multi_support_off(NULL)
 */
  __pyx_k_codeobj_208 = (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_200, __pyx_n_s__multi_support_off, 364, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_208)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pygrib.pyx":643
 * ['_gh','fcstimeunits','expand_reduced','projparams','messagenumber','_all_keys','_ro_keys']
 * 
 * def julian_to_datetime(object jd):             # <<<<<<<<<<<<<<
 *     """
 *     julian_to_datetime(julday)
 */
  __pyx_k_tuple_209 = PyTuple_Pack(9, ((PyObject *)__pyx_n_s__jd), ((PyObject *)__pyx_n_s__julday), ((PyObject *)__pyx_n_s__year), ((PyObject *)__pyx_n_s__month), ((PyObject *)__pyx_n_s__day), ((PyObject *)__pyx_n_s__hour), ((PyObject *)__pyx_n_s__minute), ((PyObject *)__pyx_n_s__second), ((PyObject *)__pyx_n_s__err)); if (unlikely(!__pyx_k_tuple_209)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_209);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_209));
  __pyx_k_codeobj_210 = (PyObject*)__Pyx_PyCode_New(1, 0, 9, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_209, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_200, __pyx_n_s__julian_to_datetime, 643, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_210)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pygrib.pyx":660
 *     return datetime(year, month, day, hour, minute, second)
 * 
 * def datetime_to_julian(object d):             # <<<<<<<<<<<<<<
 *     """
 *     datetime_to_julian(date)
 */
  __pyx_k_tuple_211 = PyTuple_Pack(9, ((PyObject *)__pyx_n_s__d), ((PyObject *)__pyx_n_s__julday), ((PyObject *)__pyx_n_s__err), ((PyObject *)__pyx_n_s__year), ((PyObject *)__pyx_n_s__month), ((PyObject *)__pyx_n_s__day), ((PyObject *)__pyx_n_s__hour), ((PyObject *)__pyx_n_s__minute), ((PyObject *)__pyx_n_s__second)); if (unlikely(!__pyx_k_tuple_211)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 660; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_211);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_211));
  __pyx_k_codeobj_212 = (PyObject*)__Pyx_PyCode_New(1, 0, 9, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_211, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_200, __pyx_n_s__datetime_to_julian, 660, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_212)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 660; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pygrib.pyx":686
 *     return setdates(grb)
 * 
 * def fromstring(gribstring):             # <<<<<<<<<<<<<<
 *     """
 *     fromstring(string)
 */
  __pyx_k_tuple_213 = PyTuple_Pack(4, ((PyObject *)__pyx_n_s__gribstring), ((PyObject *)__pyx_n_s__gribstr), ((PyObject *)__pyx_n_s__gh), ((PyObject *)__pyx_n_s__grb)); if (unlikely(!__pyx_k_tuple_213)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 686; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_213);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_213));
  __pyx_k_codeobj_214 = (PyObject*)__Pyx_PyCode_New(1, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_213, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_200, __pyx_n_s__fromstring, 686, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_214)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 686; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pygrib.pyx":707
 *     return setdates(grb)
 * 
 * def setdates(gribmessage grb):             # <<<<<<<<<<<<<<
 *     """
 *     setdates(grb)
 */
  __pyx_k_tuple_215 = PyTuple_Pack(2, ((PyObject *)__pyx_n_s__grb), ((PyObject *)__pyx_n_s__ftime)); if (unlikely(!__pyx_k_tuple_215)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 707; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_215);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_215));
  __pyx_k_codeobj_216 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_215, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_200, __pyx_n_s__setdates, 707, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_216)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 707; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pygrib.pyx":788
 *     return grb
 * 
 * def reload(gribmessage grb):             # <<<<<<<<<<<<<<
 *     """
 *     reload(grb)
 */
  __pyx_k_tuple_217 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__grb)); if (unlikely(!__pyx_k_tuple_217)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 788; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_217);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_217));
  __pyx_k_codeobj_218 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_217, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_200, __pyx_n_s__reload, 788, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_218)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 788; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pygrib.pyx":2024
 *             grib_index_delete(self._gi)
 * 
 * def _is_stringlike(a):             # <<<<<<<<<<<<<<
 *     if type(a) == str or type(a) == bytes or type(a) == unicode:
 *         return True
 */
  __pyx_k_tuple_219 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__a)); if (unlikely(!__pyx_k_tuple_219)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2024; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_219);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_219));
  __pyx_k_codeobj_220 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_219, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_200, __pyx_n_s___is_stringlike, 2024, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_220)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2024; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pygrib.pyx":2030
 *         return False
 * 
 * def _is_container(a):             # <<<<<<<<<<<<<<
 *     # is object container-like?  (can test for
 *     # membership with "is in", but not a string)
 */
  __pyx_k_tuple_221 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__a)); if (unlikely(!__pyx_k_tuple_221)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2030; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_221);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_221));
  __pyx_k_codeobj_222 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_221, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_200, __pyx_n_s___is_container, 2030, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_222)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2030; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pygrib.pyx":2038
 *     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_k_tuple_223 = PyTuple_Pack(7, ((PyObject *)__pyx_n_s__grb), ((PyObject *)__pyx_n_s__kwargs), ((PyObject *)__pyx_n_s__kwargs), ((PyObject *)__pyx_n_s__k), ((PyObject *)__pyx_n_s__v), ((PyObject *)__pyx_n_s__iscontainer), ((PyObject *)__pyx_n_s__iscallable)); if (unlikely(!__pyx_k_tuple_223)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2038; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_223);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_223));
  __pyx_k_codeobj_224 = (PyObject*)__Pyx_PyCode_New(1, 0, 7, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_223, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_200, __pyx_n_s___find, 2038, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_224)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2038; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_RefNannyFinishContext();
  return -1;
}

static int __Pyx_InitGlobals(void) {
  if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __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_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;};
  __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(10900); if (unlikely(!__pyx_int_10900)) {__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_Generator_USED
  if (__pyx_Generator_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #endif
  /*--- Library function declarations ---*/
  /*--- Threads initialization code ---*/
  #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
  #ifdef WITH_THREAD /* Python build with threading support? */
  PyEval_InitThreads();
  #endif
  #endif
  /*--- Module creation code ---*/
  #if PY_MAJOR_VERSION < 3
  __pyx_m = Py_InitModule4(__Pyx_NAMESTR("pygrib"), __pyx_methods, __Pyx_DOCSTR(__pyx_k_192), 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);
  #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
  __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); if (unlikely(!__pyx_b)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #if CYTHON_COMPILING_IN_PYPY
  Py_INCREF(__pyx_b);
  #endif
  if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  /*--- Initialize various global constants etc. ---*/
  if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
  if (__Pyx_init_sys_getdefaultencoding_params() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #endif
  if (__pyx_module_is_main_pygrib) {
    if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_n_s____main__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  }
  /*--- Builtin init code ---*/
  if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  /*--- Constants init code ---*/
  if (unlikely(__Pyx_InitCachedConstants() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  /*--- Global init code ---*/
  /*--- 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 = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyType_Ready(&__pyx_type_6pygrib_gribmessage) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 800; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_6pygrib_gribmessage, "__repr__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 800; __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 = __Pyx_GetAttrString((PyObject *)&__pyx_type_6pygrib_gribmessage, "__setitem__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 800; __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 = __Pyx_GetAttrString((PyObject *)&__pyx_type_6pygrib_gribmessage, "__getitem__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 800; __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 (__Pyx_SetAttrString(__pyx_m, "gribmessage", (PyObject *)&__pyx_type_6pygrib_gribmessage) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 800; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_6pygrib_gribmessage = &__pyx_type_6pygrib_gribmessage;
  if (PyType_Ready(&__pyx_type_6pygrib_open) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 368; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_6pygrib_open, "__call__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 368; __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 (__Pyx_SetAttrString(__pyx_m, "open", (PyObject *)&__pyx_type_6pygrib_open) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 368; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_6pygrib_open = &__pyx_type_6pygrib_open;
  if (PyType_Ready(&__pyx_type_6pygrib_index) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1816; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_6pygrib_index, "__call__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1816; __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 (__Pyx_SetAttrString(__pyx_m, "index", (PyObject *)&__pyx_type_6pygrib_index) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1816; __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 ---*/

  /* "pygrib.pyx":176
 * 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__ = '1.9.9'
 */
  if (PyDict_SetItem(__pyx_d, __pyx_n_s____test__, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pygrib.pyx":177
 * PERFORMANCE OF THIS SOFTWARE."""
 * __test__ = None
 * del __test__ # hack so epydoc doesn't show __test__             # <<<<<<<<<<<<<<
 * __version__ = '1.9.9'
 * 
 */
  if (__Pyx_PyObject_DelAttrStr(__pyx_m, __pyx_n_s____test__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pygrib.pyx":178
 * __test__ = None
 * del __test__ # hack so epydoc doesn't show __test__
 * __version__ = '1.9.9'             # <<<<<<<<<<<<<<
 * 
 * import numpy as np
 */
  if (PyDict_SetItem(__pyx_d, __pyx_n_s____version__, ((PyObject *)__pyx_kp_s_193)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pygrib.pyx":180
 * __version__ = '1.9.9'
 * 
 * import numpy as np             # <<<<<<<<<<<<<<
 * import warnings
 * from datetime import datetime
 */
  __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __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 = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pygrib.pyx":181
 * 
 * import numpy as np
 * import warnings             # <<<<<<<<<<<<<<
 * from datetime import datetime
 * from numpy import ma
 */
  __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__warnings), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __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 = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pygrib.pyx":182
 * 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 = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__datetime));
  PyList_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_n_s__datetime));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__datetime));
  __pyx_t_2 = __Pyx_Import(((PyObject *)__pyx_n_s__datetime), ((PyObject *)__pyx_t_1), -1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(((PyObject *)__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 = 182; __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 = 182; __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":183
 * 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 = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__ma));
  PyList_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_n_s__ma));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ma));
  __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), ((PyObject *)__pyx_t_2), -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(((PyObject *)__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 = 183; __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 = 183; __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":184
 * 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":185
 * from numpy import ma
 * try:
 *     import pyproj             # <<<<<<<<<<<<<<
 * except ImportError:
 *     try:
 */
      __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__pyproj), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __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 = 185; __pyx_clineno = __LINE__; goto __pyx_L2_error;}
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    }
    __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":186
 * 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 = 186; __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":187
 *     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":188
 * 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 = 188; __pyx_clineno = __LINE__; goto __pyx_L12_error;}
          __Pyx_GOTREF(__pyx_t_11);
          __Pyx_INCREF(((PyObject *)__pyx_n_s__pyproj));
          PyList_SET_ITEM(__pyx_t_11, 0, ((PyObject *)__pyx_n_s__pyproj));
          __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pyproj));
          __pyx_t_12 = __Pyx_Import(((PyObject *)__pyx_n_s_194), ((PyObject *)__pyx_t_11), -1); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L12_error;}
          __Pyx_GOTREF(__pyx_t_12);
          __Pyx_DECREF(((PyObject *)__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 = 188; __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 = 188; __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;
        }
        __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":189
 *     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 = 189; __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":190
 *         from mpl_toolkits.basemap import pyproj
 *     except:
 *         raise ImportError("either pyproj or basemap required")             # <<<<<<<<<<<<<<
 * from ncepgrib2 import Grib2Decode
 * import_array()
 */
          __pyx_t_14 = PyObject_Call(__pyx_builtin_ImportError, ((PyObject *)__pyx_k_tuple_196), NULL); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __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 = 190; __pyx_clineno = __LINE__; goto __pyx_L14_except_error;}
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
          __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
          __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
          goto __pyx_L13_exception_handled;
        }
        __pyx_L14_except_error:;
        __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_L13_exception_handled:;
        __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);
        __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;
    }
    __pyx_L4_except_error:;
    __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":191
 *     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 = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__Grib2Decode));
  PyList_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_n_s__Grib2Decode));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__Grib2Decode));
  __pyx_t_2 = __Pyx_Import(((PyObject *)__pyx_n_s__ncepgrib2), ((PyObject *)__pyx_t_7), -1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(((PyObject *)__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 = 191; __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 = 191; __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":192
 *         raise ImportError("either pyproj or basemap required")
 * from ncepgrib2 import Grib2Decode
 * import_array()             # <<<<<<<<<<<<<<
 * 
 * cdef extern from "stdlib.h":
 */
  import_array();

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

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

  /* "pygrib.pyx":303
 * #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)
 */
  __pyx_t_2 = PyFloat_FromDouble(-1.e100); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 303; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s__missingvalue_float, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 303; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pygrib.pyx":304
 * #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 = 304; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_199, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pygrib.pyx":311
 *     major = v
 *     return "%d.%d.%d" % (major,minor,revision)
 * grib_api_version = _get_grib_api_version()             # <<<<<<<<<<<<<<
 * tolerate_badgrib = False
 * 
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_199); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 311; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_7 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 311; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s__grib_api_version, __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 311; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "pygrib.pyx":312
 *     return "%d.%d.%d" % (major,minor,revision)
 * grib_api_version = _get_grib_api_version()
 * tolerate_badgrib = False             # <<<<<<<<<<<<<<
 * 
 * def tolerate_badgrib_on():
 */
  __pyx_t_7 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s__tolerate_badgrib, __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "pygrib.pyx":314
 * tolerate_badgrib = False
 * 
 * def tolerate_badgrib_on():             # <<<<<<<<<<<<<<
 *     """
 *     don't raise an exception when a missing or malformed key is encountered.
 */
  __pyx_t_7 = PyCFunction_NewEx(&__pyx_mdef_6pygrib_3tolerate_badgrib_on, NULL, __pyx_n_s__pygrib); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s__tolerate_badgrib_on, __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "pygrib.pyx":321
 *     tolerate_badgrib = True
 * 
 * def tolerate_badgrib_off():             # <<<<<<<<<<<<<<
 *     """
 *     raise an exception when a missing or malformed key is encountered
 */
  __pyx_t_7 = PyCFunction_NewEx(&__pyx_mdef_6pygrib_5tolerate_badgrib_off, NULL, __pyx_n_s__pygrib); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 321; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_203, __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 321; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "pygrib.pyx":329
 *     tolerate_badgrib = False
 * 
 * def gaulats(object nlats):             # <<<<<<<<<<<<<<
 *     """
 *     gaulats(nlats)
 */
  __pyx_t_7 = PyCFunction_NewEx(&__pyx_mdef_6pygrib_7gaulats, NULL, __pyx_n_s__pygrib); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s__gaulats, __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "pygrib.pyx":343
 * 
 * # dict for forecast time units (Code Table 4.4).
 * _ftimedict = {}             # <<<<<<<<<<<<<<
 * _ftimedict[0]='mins'
 * _ftimedict[1]='hrs'
 */
  __pyx_t_7 = PyDict_New(); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 343; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_7));
  if (PyDict_SetItem(__pyx_d, __pyx_n_s___ftimedict, ((PyObject *)__pyx_t_7)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 343; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;

  /* "pygrib.pyx":344
 * # dict for forecast time units (Code Table 4.4).
 * _ftimedict = {}
 * _ftimedict[0]='mins'             # <<<<<<<<<<<<<<
 * _ftimedict[1]='hrs'
 * _ftimedict[2]='days'
 */
  __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s___ftimedict); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 344; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  if (__Pyx_SetItemInt(__pyx_t_7, 0, ((PyObject *)__pyx_n_s__mins), sizeof(long), PyInt_FromLong, 0, 0, 1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 344; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "pygrib.pyx":345
 * _ftimedict = {}
 * _ftimedict[0]='mins'
 * _ftimedict[1]='hrs'             # <<<<<<<<<<<<<<
 * _ftimedict[2]='days'
 * _ftimedict[3]='months'
 */
  __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s___ftimedict); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 345; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  if (__Pyx_SetItemInt(__pyx_t_7, 1, ((PyObject *)__pyx_n_s__hrs), sizeof(long), PyInt_FromLong, 0, 0, 1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 345; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "pygrib.pyx":346
 * _ftimedict[0]='mins'
 * _ftimedict[1]='hrs'
 * _ftimedict[2]='days'             # <<<<<<<<<<<<<<
 * _ftimedict[3]='months'
 * _ftimedict[4]='yrs'
 */
  __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s___ftimedict); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 346; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  if (__Pyx_SetItemInt(__pyx_t_7, 2, ((PyObject *)__pyx_n_s__days), sizeof(long), PyInt_FromLong, 0, 0, 1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 346; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "pygrib.pyx":347
 * _ftimedict[1]='hrs'
 * _ftimedict[2]='days'
 * _ftimedict[3]='months'             # <<<<<<<<<<<<<<
 * _ftimedict[4]='yrs'
 * _ftimedict[5]='decades'
 */
  __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s___ftimedict); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 347; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  if (__Pyx_SetItemInt(__pyx_t_7, 3, ((PyObject *)__pyx_n_s__months), sizeof(long), PyInt_FromLong, 0, 0, 1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 347; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "pygrib.pyx":348
 * _ftimedict[2]='days'
 * _ftimedict[3]='months'
 * _ftimedict[4]='yrs'             # <<<<<<<<<<<<<<
 * _ftimedict[5]='decades'
 * _ftimedict[6]='30 yr periods'
 */
  __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s___ftimedict); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 348; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  if (__Pyx_SetItemInt(__pyx_t_7, 4, ((PyObject *)__pyx_n_s__yrs), sizeof(long), PyInt_FromLong, 0, 0, 1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 348; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "pygrib.pyx":349
 * _ftimedict[3]='months'
 * _ftimedict[4]='yrs'
 * _ftimedict[5]='decades'             # <<<<<<<<<<<<<<
 * _ftimedict[6]='30 yr periods'
 * _ftimedict[7]='centuries'
 */
  __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s___ftimedict); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  if (__Pyx_SetItemInt(__pyx_t_7, 5, ((PyObject *)__pyx_n_s__decades), sizeof(long), PyInt_FromLong, 0, 0, 1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "pygrib.pyx":350
 * _ftimedict[4]='yrs'
 * _ftimedict[5]='decades'
 * _ftimedict[6]='30 yr periods'             # <<<<<<<<<<<<<<
 * _ftimedict[7]='centuries'
 * _ftimedict[10]='3 hr periods'
 */
  __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s___ftimedict); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 350; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  if (__Pyx_SetItemInt(__pyx_t_7, 6, ((PyObject *)__pyx_kp_s_206), sizeof(long), PyInt_FromLong, 0, 0, 1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 350; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "pygrib.pyx":351
 * _ftimedict[5]='decades'
 * _ftimedict[6]='30 yr periods'
 * _ftimedict[7]='centuries'             # <<<<<<<<<<<<<<
 * _ftimedict[10]='3 hr periods'
 * _ftimedict[11]='6 hr periods'
 */
  __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s___ftimedict); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 351; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  if (__Pyx_SetItemInt(__pyx_t_7, 7, ((PyObject *)__pyx_n_s__centuries), sizeof(long), PyInt_FromLong, 0, 0, 1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 351; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "pygrib.pyx":352
 * _ftimedict[6]='30 yr periods'
 * _ftimedict[7]='centuries'
 * _ftimedict[10]='3 hr periods'             # <<<<<<<<<<<<<<
 * _ftimedict[11]='6 hr periods'
 * _ftimedict[12]='12 hr periods'
 */
  __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s___ftimedict); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 352; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  if (__Pyx_SetItemInt(__pyx_t_7, 10, ((PyObject *)__pyx_kp_s_27), sizeof(long), PyInt_FromLong, 0, 0, 1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 352; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "pygrib.pyx":353
 * _ftimedict[7]='centuries'
 * _ftimedict[10]='3 hr periods'
 * _ftimedict[11]='6 hr periods'             # <<<<<<<<<<<<<<
 * _ftimedict[12]='12 hr periods'
 * _ftimedict[13]='secs'
 */
  __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s___ftimedict); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 353; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  if (__Pyx_SetItemInt(__pyx_t_7, 11, ((PyObject *)__pyx_kp_s_28), sizeof(long), PyInt_FromLong, 0, 0, 1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 353; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "pygrib.pyx":354
 * _ftimedict[10]='3 hr periods'
 * _ftimedict[11]='6 hr periods'
 * _ftimedict[12]='12 hr periods'             # <<<<<<<<<<<<<<
 * _ftimedict[13]='secs'
 * 
 */
  __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s___ftimedict); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 354; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  if (__Pyx_SetItemInt(__pyx_t_7, 12, ((PyObject *)__pyx_kp_s_29), sizeof(long), PyInt_FromLong, 0, 0, 1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 354; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "pygrib.pyx":355
 * _ftimedict[11]='6 hr periods'
 * _ftimedict[12]='12 hr periods'
 * _ftimedict[13]='secs'             # <<<<<<<<<<<<<<
 * 
 * # turn on support for multi-field grib messages.
 */
  __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s___ftimedict); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 355; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  if (__Pyx_SetItemInt(__pyx_t_7, 13, ((PyObject *)__pyx_n_s__secs), sizeof(long), PyInt_FromLong, 0, 0, 1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 355; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

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

  /* "pygrib.pyx":360
 * grib_multi_support_on(NULL)
 * 
 * def multi_support_on():             # <<<<<<<<<<<<<<
 *     """turn on support for multi-field grib messages (default)"""
 *     grib_multi_support_on(NULL)
 */
  __pyx_t_7 = PyCFunction_NewEx(&__pyx_mdef_6pygrib_9multi_support_on, NULL, __pyx_n_s__pygrib); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s__multi_support_on, __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "pygrib.pyx":364
 *     grib_multi_support_on(NULL)
 * 
 * def multi_support_off():             # <<<<<<<<<<<<<<
 *     """turn off support for multi-field grib messages"""
 *     grib_multi_support_off(NULL)
 */
  __pyx_t_7 = PyCFunction_NewEx(&__pyx_mdef_6pygrib_11multi_support_off, NULL, __pyx_n_s__pygrib); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s__multi_support_off, __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

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

  /* "pygrib.pyx":641
 * # distinguished from grib keys.
 * _private_atts =\
 * ['_gh','fcstimeunits','expand_reduced','projparams','messagenumber','_all_keys','_ro_keys']             # <<<<<<<<<<<<<<
 * 
 * def julian_to_datetime(object jd):
 */
  __pyx_t_7 = PyList_New(7); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 641; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_INCREF(((PyObject *)__pyx_n_s___gh));
  PyList_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_n_s___gh));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s___gh));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__fcstimeunits));
  PyList_SET_ITEM(__pyx_t_7, 1, ((PyObject *)__pyx_n_s__fcstimeunits));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fcstimeunits));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__expand_reduced));
  PyList_SET_ITEM(__pyx_t_7, 2, ((PyObject *)__pyx_n_s__expand_reduced));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__expand_reduced));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__projparams));
  PyList_SET_ITEM(__pyx_t_7, 3, ((PyObject *)__pyx_n_s__projparams));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__projparams));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__messagenumber));
  PyList_SET_ITEM(__pyx_t_7, 4, ((PyObject *)__pyx_n_s__messagenumber));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__messagenumber));
  __Pyx_INCREF(((PyObject *)__pyx_n_s___all_keys));
  PyList_SET_ITEM(__pyx_t_7, 5, ((PyObject *)__pyx_n_s___all_keys));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s___all_keys));
  __Pyx_INCREF(((PyObject *)__pyx_n_s___ro_keys));
  PyList_SET_ITEM(__pyx_t_7, 6, ((PyObject *)__pyx_n_s___ro_keys));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s___ro_keys));
  if (PyDict_SetItem(__pyx_d, __pyx_n_s___private_atts, ((PyObject *)__pyx_t_7)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 640; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;

  /* "pygrib.pyx":643
 * ['_gh','fcstimeunits','expand_reduced','projparams','messagenumber','_all_keys','_ro_keys']
 * 
 * def julian_to_datetime(object jd):             # <<<<<<<<<<<<<<
 *     """
 *     julian_to_datetime(julday)
 */
  __pyx_t_7 = PyCFunction_NewEx(&__pyx_mdef_6pygrib_13julian_to_datetime, NULL, __pyx_n_s__pygrib); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s__julian_to_datetime, __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "pygrib.pyx":660
 *     return datetime(year, month, day, hour, minute, second)
 * 
 * def datetime_to_julian(object d):             # <<<<<<<<<<<<<<
 *     """
 *     datetime_to_julian(date)
 */
  __pyx_t_7 = PyCFunction_NewEx(&__pyx_mdef_6pygrib_15datetime_to_julian, NULL, __pyx_n_s__pygrib); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 660; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s__datetime_to_julian, __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 660; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "pygrib.pyx":686
 *     return setdates(grb)
 * 
 * def fromstring(gribstring):             # <<<<<<<<<<<<<<
 *     """
 *     fromstring(string)
 */
  __pyx_t_7 = PyCFunction_NewEx(&__pyx_mdef_6pygrib_17fromstring, NULL, __pyx_n_s__pygrib); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 686; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s__fromstring, __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 686; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "pygrib.pyx":707
 *     return setdates(grb)
 * 
 * def setdates(gribmessage grb):             # <<<<<<<<<<<<<<
 *     """
 *     setdates(grb)
 */
  __pyx_t_7 = PyCFunction_NewEx(&__pyx_mdef_6pygrib_19setdates, NULL, __pyx_n_s__pygrib); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 707; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s__setdates, __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 707; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "pygrib.pyx":788
 *     return grb
 * 
 * def reload(gribmessage grb):             # <<<<<<<<<<<<<<
 *     """
 *     reload(grb)
 */
  __pyx_t_7 = PyCFunction_NewEx(&__pyx_mdef_6pygrib_21reload, NULL, __pyx_n_s__pygrib); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 788; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s__reload, __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 788; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "pygrib.pyx":2024
 *             grib_index_delete(self._gi)
 * 
 * def _is_stringlike(a):             # <<<<<<<<<<<<<<
 *     if type(a) == str or type(a) == bytes or type(a) == unicode:
 *         return True
 */
  __pyx_t_7 = PyCFunction_NewEx(&__pyx_mdef_6pygrib_23_is_stringlike, NULL, __pyx_n_s__pygrib); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2024; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s___is_stringlike, __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2024; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "pygrib.pyx":2030
 *         return False
 * 
 * def _is_container(a):             # <<<<<<<<<<<<<<
 *     # is object container-like?  (can test for
 *     # membership with "is in", but not a string)
 */
  __pyx_t_7 = PyCFunction_NewEx(&__pyx_mdef_6pygrib_25_is_container, NULL, __pyx_n_s__pygrib); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2030; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s___is_container, __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2030; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "pygrib.pyx":2038
 *     return True
 * 
 * def _find(grb, **kwargs):             # <<<<<<<<<<<<<<
 *     # search for key/value matches in grib message.
 *     # If value is a container-like object, search for matches to any element.
 */
  __pyx_t_7 = PyCFunction_NewEx(&__pyx_mdef_6pygrib_27_find, NULL, __pyx_n_s__pygrib); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2038; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s___find, __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2038; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "pygrib.pyx":2061
 *     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.
 */
  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) {
    __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 /* CYTHON_REFNANNY */

static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
    PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
    if (unlikely(!result)) {
        PyErr_Format(PyExc_NameError,
#if PY_MAJOR_VERSION >= 3
            "name '%U' is not defined", name);
#else
            "name '%s' 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,
                 "%s() takes %s %" CYTHON_FORMAT_SSIZE_T "d positional argument%s (%" 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,
        "%s() keywords must be strings", function_name);
    goto bad;
invalid_keyword:
    PyErr_Format(PyExc_TypeError,
    #if PY_MAJOR_VERSION < 3
        "%s() got an unexpected keyword argument '%s'",
        function_name, PyString_AsString(key));
    #else
        "%s() got an unexpected keyword argument '%U'",
        function_name, key);
    #endif
bad:
    return -1;
}

static PyObject *
__Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *closure)
{
    if (unlikely(op->func_doc == NULL)) {
        if (op->func.m_ml->ml_doc) {
#if PY_MAJOR_VERSION >= 3
            op->func_doc = PyUnicode_FromString(op->func.m_ml->ml_doc);
#else
            op->func_doc = PyString_FromString(op->func.m_ml->ml_doc);
#endif
            if (unlikely(op->func_doc == NULL))
                return NULL;
        } else {
            Py_INCREF(Py_None);
            return Py_None;
        }
    }
    Py_INCREF(op->func_doc);
    return op->func_doc;
}
static int
__Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value)
{
    PyObject *tmp = op->func_doc;
    if (value == NULL)
        value = Py_None; /* Mark as deleted */
    Py_INCREF(value);
    op->func_doc = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op)
{
    if (unlikely(op->func_name == NULL)) {
#if PY_MAJOR_VERSION >= 3
        op->func_name = PyUnicode_InternFromString(op->func.m_ml->ml_name);
#else
        op->func_name = PyString_InternFromString(op->func.m_ml->ml_name);
#endif
        if (unlikely(op->func_name == NULL))
            return NULL;
    }
    Py_INCREF(op->func_name);
    return op->func_name;
}
static int
__Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value)
{
    PyObject *tmp;
#if PY_MAJOR_VERSION >= 3
    if (unlikely(value == NULL || !PyUnicode_Check(value))) {
#else
    if (unlikely(value == NULL || !PyString_Check(value))) {
#endif
        PyErr_SetString(PyExc_TypeError,
                        "__name__ must be set to a string object");
        return -1;
    }
    tmp = op->func_name;
    Py_INCREF(value);
    op->func_name = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject *op)
{
    Py_INCREF(op->func_qualname);
    return op->func_qualname;
}
static int
__Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value)
{
    PyObject *tmp;
#if PY_MAJOR_VERSION >= 3
    if (unlikely(value == NULL || !PyUnicode_Check(value))) {
#else
    if (unlikely(value == NULL || !PyString_Check(value))) {
#endif
        PyErr_SetString(PyExc_TypeError,
                        "__qualname__ must be set to a string object");
        return -1;
    }
    tmp = op->func_qualname;
    Py_INCREF(value);
    op->func_qualname = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_self(__pyx_CyFunctionObject *m, CYTHON_UNUSED void *closure)
{
    PyObject *self;
    self = m->func_closure;
    if (self == NULL)
        self = Py_None;
    Py_INCREF(self);
    return self;
}
static PyObject *
__Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op)
{
    if (unlikely(op->func_dict == NULL)) {
        op->func_dict = PyDict_New();
        if (unlikely(op->func_dict == NULL))
            return NULL;
    }
    Py_INCREF(op->func_dict);
    return op->func_dict;
}
static int
__Pyx_CyFunction_set_dict(__pyx_CyFunctionObject *op, PyObject *value)
{
    PyObject *tmp;
    if (unlikely(value == NULL)) {
        PyErr_SetString(PyExc_TypeError,
               "function's dictionary may not be deleted");
        return -1;
    }
    if (unlikely(!PyDict_Check(value))) {
        PyErr_SetString(PyExc_TypeError,
               "setting function's dictionary to a non-dict");
        return -1;
    }
    tmp = op->func_dict;
    Py_INCREF(value);
    op->func_dict = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_globals(CYTHON_UNUSED __pyx_CyFunctionObject *op)
{
    PyObject* dict = PyModule_GetDict(__pyx_m);
    Py_XINCREF(dict);
    return dict;
}
static PyObject *
__Pyx_CyFunction_get_closure(CYTHON_UNUSED __pyx_CyFunctionObject *op)
{
    Py_INCREF(Py_None);
    return Py_None;
}
static PyObject *
__Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op)
{
    PyObject* result = (op->func_code) ? op->func_code : Py_None;
    Py_INCREF(result);
    return result;
}
static int
__Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject *op) {
    PyObject *res = op->defaults_getter((PyObject *) op);
    if (unlikely(!res))
        return -1;
    op->defaults_tuple = PyTuple_GET_ITEM(res, 0);
    Py_INCREF(op->defaults_tuple);
    op->defaults_kwdict = PyTuple_GET_ITEM(res, 1);
    Py_INCREF(op->defaults_kwdict);
    Py_DECREF(res);
    return 0;
}
static int
__Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value) {
    PyObject* tmp;
    if (!value) {
        value = Py_None;
    } else if (value != Py_None && !PyTuple_Check(value)) {
        PyErr_SetString(PyExc_TypeError,
                        "__defaults__ must be set to a tuple object");
        return -1;
    }
    Py_INCREF(value);
    tmp = op->defaults_tuple;
    op->defaults_tuple = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op) {
    PyObject* result = op->defaults_tuple;
    if (unlikely(!result)) {
        if (op->defaults_getter) {
            if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL;
            result = op->defaults_tuple;
        } else {
            result = Py_None;
        }
    }
    Py_INCREF(result);
    return result;
}
static int
__Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject *op, PyObject* value) {
    PyObject* tmp;
    if (!value) {
        value = Py_None;
    } else if (value != Py_None && !PyDict_Check(value)) {
        PyErr_SetString(PyExc_TypeError,
                        "__kwdefaults__ must be set to a dict object");
        return -1;
    }
    Py_INCREF(value);
    tmp = op->defaults_kwdict;
    op->defaults_kwdict = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op) {
    PyObject* result = op->defaults_kwdict;
    if (unlikely(!result)) {
        if (op->defaults_getter) {
            if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL;
            result = op->defaults_kwdict;
        } else {
            result = Py_None;
        }
    }
    Py_INCREF(result);
    return result;
}
static int
__Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject *op, PyObject* value) {
    PyObject* tmp;
    if (!value || value == Py_None) {
        value = NULL;
    } else if (!PyDict_Check(value)) {
        PyErr_SetString(PyExc_TypeError,
                        "__annotations__ must be set to a dict object");
        return -1;
    }
    Py_XINCREF(value);
    tmp = op->func_annotations;
    op->func_annotations = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op) {
    PyObject* result = op->func_annotations;
    if (unlikely(!result)) {
        result = PyDict_New();
        if (unlikely(!result)) return NULL;
        op->func_annotations = result;
    }
    Py_INCREF(result);
    return result;
}
static PyGetSetDef __pyx_CyFunction_getsets[] = {
    {(char *) "func_doc", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
    {(char *) "__doc__",  (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
    {(char *) "func_name", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
    {(char *) "__name__", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
    {(char *) "__qualname__", (getter)__Pyx_CyFunction_get_qualname, (setter)__Pyx_CyFunction_set_qualname, 0, 0},
    {(char *) "__self__", (getter)__Pyx_CyFunction_get_self, 0, 0, 0},
    {(char *) "func_dict", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
    {(char *) "__dict__", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
    {(char *) "func_globals", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
    {(char *) "__globals__", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
    {(char *) "func_closure", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
    {(char *) "__closure__", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
    {(char *) "func_code", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
    {(char *) "__code__", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
    {(char *) "func_defaults", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
    {(char *) "__defaults__", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
    {(char *) "__kwdefaults__", (getter)__Pyx_CyFunction_get_kwdefaults, (setter)__Pyx_CyFunction_set_kwdefaults, 0, 0},
    {(char *) "__annotations__", (getter)__Pyx_CyFunction_get_annotations, (setter)__Pyx_CyFunction_set_annotations, 0, 0},
    {0, 0, 0, 0, 0}
};
#ifndef PY_WRITE_RESTRICTED /* < Py2.5 */
#define PY_WRITE_RESTRICTED WRITE_RESTRICTED
#endif
static PyMemberDef __pyx_CyFunction_members[] = {
    {(char *) "__module__", T_OBJECT, offsetof(__pyx_CyFunctionObject, func.m_module), PY_WRITE_RESTRICTED, 0},
    {0, 0, 0,  0, 0}
};
static PyObject *
__Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, CYTHON_UNUSED PyObject *args)
{
#if PY_MAJOR_VERSION >= 3
    return PyUnicode_FromString(m->func.m_ml->ml_name);
#else
    return PyString_FromString(m->func.m_ml->ml_name);
#endif
}
static PyMethodDef __pyx_CyFunction_methods[] = {
    {__Pyx_NAMESTR("__reduce__"), (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0},
    {0, 0, 0, 0}
};
static PyObject *__Pyx_CyFunction_New(PyTypeObject *type, PyMethodDef *ml, int flags, PyObject* qualname,
                                      PyObject *closure, PyObject *module, PyObject* code) {
    __pyx_CyFunctionObject *op = PyObject_GC_New(__pyx_CyFunctionObject, type);
    if (op == NULL)
        return NULL;
    op->flags = flags;
    op->func_weakreflist = NULL;
    op->func.m_ml = ml;
    op->func.m_self = (PyObject *) op;
    Py_XINCREF(closure);
    op->func_closure = closure;
    Py_XINCREF(module);
    op->func.m_module = module;
    op->func_dict = NULL;
    op->func_name = NULL;
    Py_INCREF(qualname);
    op->func_qualname = qualname;
    op->func_doc = NULL;
    op->func_classobj = NULL;
    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_code);
    Py_CLEAR(m->func_classobj);
    Py_CLEAR(m->defaults_tuple);
    Py_CLEAR(m->defaults_kwdict);
    Py_CLEAR(m->func_annotations);
    if (m->defaults) {
        PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
        int i;
        for (i = 0; i < m->defaults_pyobjects; i++)
            Py_XDECREF(pydefaults[i]);
        PyMem_Free(m->defaults);
        m->defaults = NULL;
    }
    return 0;
}
static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m)
{
    PyObject_GC_UnTrack(m);
    if (m->func_weakreflist != NULL)
        PyObject_ClearWeakRefs((PyObject *) m);
    __Pyx_CyFunction_clear(m);
    PyObject_GC_Del(m);
}
static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit, void *arg)
{
    Py_VISIT(m->func_closure);
    Py_VISIT(m->func.m_module);
    Py_VISIT(m->func_dict);
    Py_VISIT(m->func_name);
    Py_VISIT(m->func_qualname);
    Py_VISIT(m->func_doc);
    Py_VISIT(m->func_code);
    Py_VISIT(m->func_classobj);
    Py_VISIT(m->defaults_tuple);
    Py_VISIT(m->defaults_kwdict);
    if (m->defaults) {
        PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
        int i;
        for (i = 0; i < m->defaults_pyobjects; i++)
            Py_VISIT(pydefaults[i]);
    }
    return 0;
}
static PyObject *__Pyx_CyFunction_descr_get(PyObject *func, PyObject *obj, PyObject *type)
{
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    if (m->flags & __Pyx_CYFUNCTION_STATICMETHOD) {
        Py_INCREF(func);
        return func;
    }
    if (m->flags & __Pyx_CYFUNCTION_CLASSMETHOD) {
        if (type == NULL)
            type = (PyObject *)(Py_TYPE(obj));
        return PyMethod_New(func,
                            type, (PyObject *)(Py_TYPE(type)));
    }
    if (obj == Py_None)
        obj = NULL;
    return PyMethod_New(func, obj, type);
}
static PyObject*
__Pyx_CyFunction_repr(__pyx_CyFunctionObject *op)
{
#if PY_MAJOR_VERSION >= 3
    return PyUnicode_FromFormat("<cyfunction %U at %p>",
                                op->func_qualname, (void *)op);
#else
    return PyString_FromFormat("<cyfunction %s at %p>",
                               PyString_AsString(op->func_qualname), (void *)op);
#endif
}
#if CYTHON_COMPILING_IN_PYPY
static PyObject * __Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) {
    PyCFunctionObject* f = (PyCFunctionObject*)func;
    PyCFunction meth = PyCFunction_GET_FUNCTION(func);
    PyObject *self = PyCFunction_GET_SELF(func);
    Py_ssize_t size;
    switch (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST)) {
    case METH_VARARGS:
        if (likely(kw == NULL) || PyDict_Size(kw) == 0)
            return (*meth)(self, arg);
        break;
    case METH_VARARGS | METH_KEYWORDS:
        return (*(PyCFunctionWithKeywords)meth)(self, arg, kw);
    case METH_NOARGS:
        if (likely(kw == NULL) || PyDict_Size(kw) == 0) {
            size = PyTuple_GET_SIZE(arg);
            if (size == 0)
                return (*meth)(self, NULL);
            PyErr_Format(PyExc_TypeError,
                "%.200s() takes no arguments (%zd given)",
                f->m_ml->ml_name, size);
            return NULL;
        }
        break;
    case METH_O:
        if (likely(kw == NULL) || PyDict_Size(kw) == 0) {
            size = PyTuple_GET_SIZE(arg);
            if (size == 1)
                return (*meth)(self, PyTuple_GET_ITEM(arg, 0));
            PyErr_Format(PyExc_TypeError,
                "%.200s() takes exactly one argument (%zd given)",
                f->m_ml->ml_name, size);
            return NULL;
        }
        break;
    default:
        PyErr_SetString(PyExc_SystemError, "Bad call flags in "
                        "__Pyx_CyFunction_Call. METH_OLDARGS is no "
                        "longer supported!");
        return NULL;
    }
    PyErr_Format(PyExc_TypeError, "%.200s() takes no keyword arguments",
                 f->m_ml->ml_name);
    return NULL;
}
#else
static PyObject * __Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) {
	return PyCFunction_Call(func, arg, kw);
}
#endif
static PyTypeObject __pyx_CyFunctionType_type = {
    PyVarObject_HEAD_INIT(0, 0)
    __Pyx_NAMESTR("cython_function_or_method"), /*tp_name*/
    sizeof(__pyx_CyFunctionObject),   /*tp_basicsize*/
    0,                                  /*tp_itemsize*/
    (destructor) __Pyx_CyFunction_dealloc, /*tp_dealloc*/
    0,                                  /*tp_print*/
    0,                                  /*tp_getattr*/
    0,                                  /*tp_setattr*/
#if PY_MAJOR_VERSION < 3
    0,                                  /*tp_compare*/
#else
    0,                                  /*reserved*/
#endif
    (reprfunc) __Pyx_CyFunction_repr,   /*tp_repr*/
    0,                                  /*tp_as_number*/
    0,                                  /*tp_as_sequence*/
    0,                                  /*tp_as_mapping*/
    0,                                  /*tp_hash*/
    __Pyx_CyFunction_Call,              /*tp_call*/
    0,                                  /*tp_str*/
    0,                                  /*tp_getattro*/
    0,                                  /*tp_setattro*/
    0,                                  /*tp_as_buffer*/
    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, /* tp_flags*/
    0,                                  /*tp_doc*/
    (traverseproc) __Pyx_CyFunction_traverse,   /*tp_traverse*/
    (inquiry) __Pyx_CyFunction_clear,   /*tp_clear*/
    0,                                  /*tp_richcompare*/
    offsetof(__pyx_CyFunctionObject, func_weakreflist), /* tp_weaklistoffse */
    0,                                  /*tp_iter*/
    0,                                  /*tp_iternext*/
    __pyx_CyFunction_methods,           /*tp_methods*/
    __pyx_CyFunction_members,           /*tp_members*/
    __pyx_CyFunction_getsets,           /*tp_getset*/
    0,                                  /*tp_base*/
    0,                                  /*tp_dict*/
    __Pyx_CyFunction_descr_get,         /*tp_descr_get*/
    0,                                  /*tp_descr_set*/
    offsetof(__pyx_CyFunctionObject, func_dict),/*tp_dictoffset*/
    0,                                  /*tp_init*/
    0,                                  /*tp_alloc*/
    0,                                  /*tp_new*/
    0,                                  /*tp_free*/
    0,                                  /*tp_is_gc*/
    0,                                  /*tp_bases*/
    0,                                  /*tp_mro*/
    0,                                  /*tp_cache*/
    0,                                  /*tp_subclasses*/
    0,                                  /*tp_weaklist*/
    0,                                  /*tp_del*/
#if PY_VERSION_HEX >= 0x02060000
    0,                                  /*tp_version_tag*/
#endif
#if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE)
    0,                                  /*tp_finalize*/
#endif
};
static int __Pyx_CyFunction_init(void) {
#if !CYTHON_COMPILING_IN_PYPY
    __pyx_CyFunctionType_type.tp_call = PyCFunction_Call;
#endif
    if (PyType_Ready(&__pyx_CyFunctionType_type) < 0)
        return -1;
    __pyx_CyFunctionType = &__pyx_CyFunctionType_type;
    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%s 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;
}

static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) {
#if CYTHON_COMPILING_IN_CPYTHON
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    PyThreadState *tstate = PyThreadState_GET();
    tmp_type = tstate->curexc_type;
    tmp_value = tstate->curexc_value;
    tmp_tb = tstate->curexc_traceback;
    tstate->curexc_type = type;
    tstate->curexc_value = value;
    tstate->curexc_traceback = tb;
    Py_XDECREF(tmp_type);
    Py_XDECREF(tmp_value);
    Py_XDECREF(tmp_tb);
#else
    PyErr_Restore(type, value, tb);
#endif
}
static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) {
#if CYTHON_COMPILING_IN_CPYTHON
    PyThreadState *tstate = PyThreadState_GET();
    *type = tstate->curexc_type;
    *value = tstate->curexc_value;
    *tb = tstate->curexc_traceback;
    tstate->curexc_type = 0;
    tstate->curexc_value = 0;
    tstate->curexc_traceback = 0;
#else
    PyErr_Fetch(type, value, tb);
#endif
}

#if PY_MAJOR_VERSION < 3
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
                        CYTHON_UNUSED PyObject *cause) {
    Py_XINCREF(type);
    if (!value || value == Py_None)
        value = NULL;
    else
        Py_INCREF(value);
    if (!tb || tb == Py_None)
        tb = NULL;
    else {
        Py_INCREF(tb);
        if (!PyTraceBack_Check(tb)) {
            PyErr_SetString(PyExc_TypeError,
                "raise: arg 3 must be a traceback or None");
            goto raise_error;
        }
    }
    #if PY_VERSION_HEX < 0x02050000
    if (PyClass_Check(type)) {
    #else
    if (PyType_Check(type)) {
    #endif
#if CYTHON_COMPILING_IN_PYPY
        if (!value) {
            Py_INCREF(Py_None);
            value = Py_None;
        }
#endif
        PyErr_NormalizeException(&type, &value, &tb);
    } else {
        if (value) {
            PyErr_SetString(PyExc_TypeError,
                "instance exception may not have a separate value");
            goto raise_error;
        }
        value = type;
        #if PY_VERSION_HEX < 0x02050000
        if (PyInstance_Check(type)) {
            type = (PyObject*) ((PyInstanceObject*)type)->in_class;
            Py_INCREF(type);
        } else {
            type = 0;
            PyErr_SetString(PyExc_TypeError,
                "raise: exception must be an old-style class or instance");
            goto raise_error;
        }
        #else
        type = (PyObject*) Py_TYPE(type);
        Py_INCREF(type);
        if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
            PyErr_SetString(PyExc_TypeError,
                "raise: exception class must be a subclass of BaseException");
            goto raise_error;
        }
        #endif
    }
    __Pyx_ErrRestore(type, value, tb);
    return;
raise_error:
    Py_XDECREF(value);
    Py_XDECREF(type);
    Py_XDECREF(tb);
    return;
}
#else /* Python 3+ */
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
    PyObject* owned_instance = NULL;
    if (tb == Py_None) {
        tb = 0;
    } else if (tb && !PyTraceBack_Check(tb)) {
        PyErr_SetString(PyExc_TypeError,
            "raise: arg 3 must be a traceback or None");
        goto bad;
    }
    if (value == Py_None)
        value = 0;
    if (PyExceptionInstance_Check(type)) {
        if (value) {
            PyErr_SetString(PyExc_TypeError,
                "instance exception may not have a separate value");
            goto bad;
        }
        value = type;
        type = (PyObject*) Py_TYPE(value);
    } else if (PyExceptionClass_Check(type)) {
        PyObject *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 = PyEval_CallObject(type, args);
        Py_DECREF(args);
        if (!owned_instance)
            goto bad;
        value = owned_instance;
        if (!PyExceptionInstance_Check(value)) {
            PyErr_Format(PyExc_TypeError,
                         "calling %R should have returned an instance of "
                         "BaseException, not %R",
                         type, Py_TYPE(value));
            goto bad;
        }
    } else {
        PyErr_SetString(PyExc_TypeError,
            "raise: exception class must be a subclass of BaseException");
        goto bad;
    }
#if PY_VERSION_HEX >= 0x03030000
    if (cause) {
#else
    if (cause && cause != Py_None) {
#endif
        PyObject *fixed_cause;
        if (cause == Py_None) {
            fixed_cause = NULL;
        } else if (PyExceptionClass_Check(cause)) {
            fixed_cause = PyObject_CallObject(cause, NULL);
            if (fixed_cause == NULL)
                goto bad;
        } else if (PyExceptionInstance_Check(cause)) {
            fixed_cause = cause;
            Py_INCREF(fixed_cause);
        } else {
            PyErr_SetString(PyExc_TypeError,
                            "exception causes must derive from "
                            "BaseException");
            goto bad;
        }
        PyException_SetCause(value, fixed_cause);
    }
    PyErr_SetObject(type, value);
    if (tb) {
        PyThreadState *tstate = PyThreadState_GET();
        PyObject* tmp_tb = tstate->curexc_traceback;
        if (tb != tmp_tb) {
            Py_INCREF(tb);
            tstate->curexc_traceback = tb;
            Py_XDECREF(tmp_tb);
        }
    }
bad:
    Py_XDECREF(owned_instance);
    return;
}
#endif

static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name) {
    PyObject *result;
#if CYTHON_COMPILING_IN_CPYTHON
    result = PyDict_GetItem(__pyx_d, name);
    if (result) {
        Py_INCREF(result);
    } else {
#else
    result = PyObject_GetItem(__pyx_d, name);
    if (!result) {
        PyErr_Clear();
#endif
        result = __Pyx_GetBuiltinName(name);
    }
    return result;
}

static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
    if (unlikely(!type)) {
        PyErr_Format(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;
}

static CYTHON_INLINE int __Pyx_CheckKeywordStrings(
    PyObject *kwdict,
    const char* function_name,
    int kw_allowed)
{
    PyObject* key = 0;
    Py_ssize_t pos = 0;
#if CPYTHON_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,
        "%s() keywords must be strings", function_name);
    return 0;
#endif
invalid_keyword:
    PyErr_Format(PyExc_TypeError,
    #if PY_MAJOR_VERSION < 3
        "%s() got an unexpected keyword argument '%s'",
        function_name, PyString_AsString(key));
    #else
        "%s() got an unexpected keyword argument '%U'",
        function_name, key);
    #endif
    return 0;
}

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 >= 0x03010000 || (PY_MAJOR_VERSION < 3 && 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 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 (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
        goto bad;
    #endif
    Py_INCREF(local_type);
    Py_INCREF(local_value);
    Py_INCREF(local_tb);
    *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;
    /* Make sure tstate is in a consistent state when we XDECREF
       these objects (DECREF may run arbitrary code). */
    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 int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed,
    const char *name, int exact)
{
    if (!type) {
        PyErr_Format(PyExc_SystemError, "Missing type object");
        return 0;
    }
    if (none_allowed && obj == Py_None) return 1;
    else if (exact) {
        if (Py_TYPE(obj) == type) return 1;
    }
    else {
        if (PyObject_TypeCheck(obj, type)) return 1;
    }
    PyErr_Format(PyExc_TypeError,
        "Argument '%s' has incorrect type (expected %s, got %s)",
        name, type->tp_name, Py_TYPE(obj)->tp_name);
    return 0;
}

static double __Pyx__PyObject_AsDouble(PyObject* obj) {
    PyObject* float_value;
#if CYTHON_COMPILING_IN_PYPY
    float_value = PyNumber_Float(obj);
#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,
                                                              int wraparound, int boundscheck) {
#if CYTHON_COMPILING_IN_CPYTHON
    if (wraparound & unlikely(i < 0)) i += PyList_GET_SIZE(o);
    if ((!boundscheck) || likely((0 <= i) & (i < PyList_GET_SIZE(o)))) {
        PyObject *r = PyList_GET_ITEM(o, i);
        Py_INCREF(r);
        return r;
    }
    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
#else
    return PySequence_GetItem(o, i);
#endif
}
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
                                                              int wraparound, int boundscheck) {
#if CYTHON_COMPILING_IN_CPYTHON
    if (wraparound & unlikely(i < 0)) i += PyTuple_GET_SIZE(o);
    if ((!boundscheck) || likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) {
        PyObject *r = PyTuple_GET_ITEM(o, i);
        Py_INCREF(r);
        return r;
    }
    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
#else
    return PySequence_GetItem(o, i);
#endif
}
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
                                                     int is_list, int wraparound, int boundscheck) {
#if CYTHON_COMPILING_IN_CPYTHON
    if (is_list || PyList_CheckExact(o)) {
        Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
        if ((!boundscheck) || (likely((n >= 0) & (n < PyList_GET_SIZE(o))))) {
            PyObject *r = PyList_GET_ITEM(o, n);
            Py_INCREF(r);
            return r;
        }
    }
    else if (PyTuple_CheckExact(o)) {
        Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
        if ((!boundscheck) || likely((n >= 0) & (n < PyTuple_GET_SIZE(o)))) {
            PyObject *r = PyTuple_GET_ITEM(o, n);
            Py_INCREF(r);
            return r;
        }
    } else {
        PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
        if (likely(m && m->sq_item)) {
            if (wraparound && unlikely(i < 0) && likely(m->sq_length)) {
                Py_ssize_t l = m->sq_length(o);
                if (likely(l >= 0)) {
                    i += l;
                } else {
                    if (PyErr_ExceptionMatches(PyExc_OverflowError))
                        PyErr_Clear();
                    else
                        return NULL;
                }
            }
            return m->sq_item(o, i);
        }
    }
#else
    if (is_list || PySequence_Check(o)) {
        return PySequence_GetItem(o, i);
    }
#endif
    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
}

static CYTHON_INLINE 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_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 PY_MAJOR_VERSION >= 3
static CYTHON_INLINE PyObject* __Pyx_PyDict_Items(PyObject* d) {
    return __Pyx_PyObject_CallMethod1((PyObject*)&PyDict_Type, __pyx_n_s__items, d);
}
#endif

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, int wraparound, 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 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 PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
    PyObject *empty_list = 0;
    PyObject *module = 0;
    PyObject *global_dict = 0;
    PyObject *empty_dict = 0;
    PyObject *list;
    #if PY_VERSION_HEX < 0x03030000
    PyObject *py_import;
    py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s____import__);
    if (!py_import)
        goto bad;
    #endif
    if (from_list)
        list = from_list;
    else {
        empty_list = PyList_New(0);
        if (!empty_list)
            goto bad;
        list = empty_list;
    }
    global_dict = PyModule_GetDict(__pyx_m);
    if (!global_dict)
        goto bad;
    empty_dict = PyDict_New();
    if (!empty_dict)
        goto bad;
    #if PY_VERSION_HEX >= 0x02050000
    {
        #if PY_MAJOR_VERSION >= 3
        if (level == -1) {
            if (strchr(__Pyx_MODULE_NAME, '.')) {
                #if PY_VERSION_HEX < 0x03030000
                PyObject *py_level = PyInt_FromLong(1);
                if (!py_level)
                    goto bad;
                module = PyObject_CallFunctionObjArgs(py_import,
                    name, global_dict, empty_dict, list, py_level, NULL);
                Py_DECREF(py_level);
                #else
                module = PyImport_ImportModuleLevelObject(
                    name, global_dict, empty_dict, list, 1);
                #endif
                if (!module) {
                    if (!PyErr_ExceptionMatches(PyExc_ImportError))
                        goto bad;
                    PyErr_Clear();
                }
            }
            level = 0; /* try absolute import on failure */
        }
        #endif
        if (!module) {
            #if PY_VERSION_HEX < 0x03030000
            PyObject *py_level = PyInt_FromLong(level);
            if (!py_level)
                goto bad;
            module = PyObject_CallFunctionObjArgs(py_import,
                name, global_dict, empty_dict, list, py_level, NULL);
            Py_DECREF(py_level);
            #else
            module = PyImport_ImportModuleLevelObject(
                name, global_dict, empty_dict, list, level);
            #endif
        }
    }
    #else
    if (level>0) {
        PyErr_SetString(PyExc_RuntimeError, "Relative import is not supported for Python <=2.4.");
        goto bad;
    }
    module = PyObject_CallFunctionObjArgs(py_import,
        name, global_dict, empty_dict, list, NULL);
    #endif
bad:
    #if PY_VERSION_HEX < 0x03030000
    Py_XDECREF(py_import);
    #endif
    Py_XDECREF(empty_list);
    Py_XDECREF(empty_dict);
    return module;
}

static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) {
    const unsigned char neg_one = (unsigned char)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(unsigned char) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(unsigned char)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to unsigned char" :
                    "value too large to convert to unsigned char");
            }
            return (unsigned char)-1;
        }
        return (unsigned char)val;
    }
    return (unsigned char)__Pyx_PyInt_AsUnsignedLong(x);
}

static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject* x) {
    const unsigned short neg_one = (unsigned short)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(unsigned short) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(unsigned short)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to unsigned short" :
                    "value too large to convert to unsigned short");
            }
            return (unsigned short)-1;
        }
        return (unsigned short)val;
    }
    return (unsigned short)__Pyx_PyInt_AsUnsignedLong(x);
}

static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject* x) {
    const unsigned int neg_one = (unsigned int)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(unsigned int) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(unsigned int)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to unsigned int" :
                    "value too large to convert to unsigned int");
            }
            return (unsigned int)-1;
        }
        return (unsigned int)val;
    }
    return (unsigned int)__Pyx_PyInt_AsUnsignedLong(x);
}

static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject* x) {
    const char neg_one = (char)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(char) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(char)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to char" :
                    "value too large to convert to char");
            }
            return (char)-1;
        }
        return (char)val;
    }
    return (char)__Pyx_PyInt_AsLong(x);
}

static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject* x) {
    const short neg_one = (short)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(short) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(short)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to short" :
                    "value too large to convert to short");
            }
            return (short)-1;
        }
        return (short)val;
    }
    return (short)__Pyx_PyInt_AsLong(x);
}

static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject* x) {
    const int neg_one = (int)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(int) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(int)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to int" :
                    "value too large to convert to int");
            }
            return (int)-1;
        }
        return (int)val;
    }
    return (int)__Pyx_PyInt_AsLong(x);
}

static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject* x) {
    const signed char neg_one = (signed char)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(signed char) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(signed char)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to signed char" :
                    "value too large to convert to signed char");
            }
            return (signed char)-1;
        }
        return (signed char)val;
    }
    return (signed char)__Pyx_PyInt_AsSignedLong(x);
}

static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject* x) {
    const signed short neg_one = (signed short)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(signed short) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(signed short)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to signed short" :
                    "value too large to convert to signed short");
            }
            return (signed short)-1;
        }
        return (signed short)val;
    }
    return (signed short)__Pyx_PyInt_AsSignedLong(x);
}

static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) {
    const signed int neg_one = (signed int)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(signed int) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(signed int)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to signed int" :
                    "value too large to convert to signed int");
            }
            return (signed int)-1;
        }
        return (signed int)val;
    }
    return (signed int)__Pyx_PyInt_AsSignedLong(x);
}

static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject* x) {
    const int neg_one = (int)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(int) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(int)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to int" :
                    "value too large to convert to int");
            }
            return (int)-1;
        }
        return (int)val;
    }
    return (int)__Pyx_PyInt_AsLong(x);
}

#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
#if CYTHON_USE_PYLONG_INTERNALS
#include "longintrepr.h"
#endif
#endif
static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) {
    const unsigned long neg_one = (unsigned long)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        long val = PyInt_AS_LONG(x);
        if (is_unsigned && unlikely(val < 0)) {
            PyErr_SetString(PyExc_OverflowError,
                            "can't convert negative value to unsigned long");
            return (unsigned long)-1;
        }
        return (unsigned long)val;
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
#if CYTHON_USE_PYLONG_INTERNALS
            if (sizeof(digit) <= sizeof(unsigned long)) {
                switch (Py_SIZE(x)) {
                    case  0: return 0;
                    case  1: return (unsigned long) ((PyLongObject*)x)->ob_digit[0];
                }
            }
#endif
#endif
            if (unlikely(Py_SIZE(x) < 0)) {
                PyErr_SetString(PyExc_OverflowError,
                                "can't convert negative value to unsigned long");
                return (unsigned long)-1;
            }
            return (unsigned long)PyLong_AsUnsignedLong(x);
        } else {
#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
#if CYTHON_USE_PYLONG_INTERNALS
            if (sizeof(digit) <= sizeof(unsigned long)) {
                switch (Py_SIZE(x)) {
                    case  0: return 0;
                    case  1: return +(unsigned long) ((PyLongObject*)x)->ob_digit[0];
                    case -1: return -(unsigned long) ((PyLongObject*)x)->ob_digit[0];
                }
            }
#endif
#endif
            return (unsigned long)PyLong_AsLong(x);
        }
    } else {
        unsigned long val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (unsigned long)-1;
        val = __Pyx_PyInt_AsUnsignedLong(tmp);
        Py_DECREF(tmp);
        return val;
    }
}

#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
#if CYTHON_USE_PYLONG_INTERNALS
#include "longintrepr.h"
#endif
#endif
static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) {
    const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        long val = PyInt_AS_LONG(x);
        if (is_unsigned && unlikely(val < 0)) {
            PyErr_SetString(PyExc_OverflowError,
                            "can't convert negative value to unsigned PY_LONG_LONG");
            return (unsigned PY_LONG_LONG)-1;
        }
        return (unsigned PY_LONG_LONG)val;
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
#if CYTHON_USE_PYLONG_INTERNALS
            if (sizeof(digit) <= sizeof(unsigned PY_LONG_LONG)) {
                switch (Py_SIZE(x)) {
                    case  0: return 0;
                    case  1: return (unsigned PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0];
                }
            }
#endif
#endif
            if (unlikely(Py_SIZE(x) < 0)) {
                PyErr_SetString(PyExc_OverflowError,
                                "can't convert negative value to unsigned PY_LONG_LONG");
                return (unsigned PY_LONG_LONG)-1;
            }
            return (unsigned PY_LONG_LONG)PyLong_AsUnsignedLongLong(x);
        } else {
#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
#if CYTHON_USE_PYLONG_INTERNALS
            if (sizeof(digit) <= sizeof(unsigned PY_LONG_LONG)) {
                switch (Py_SIZE(x)) {
                    case  0: return 0;
                    case  1: return +(unsigned PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0];
                    case -1: return -(unsigned PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0];
                }
            }
#endif
#endif
            return (unsigned PY_LONG_LONG)PyLong_AsLongLong(x);
        }
    } else {
        unsigned PY_LONG_LONG val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (unsigned PY_LONG_LONG)-1;
        val = __Pyx_PyInt_AsUnsignedLongLong(tmp);
        Py_DECREF(tmp);
        return val;
    }
}

#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
#if CYTHON_USE_PYLONG_INTERNALS
#include "longintrepr.h"
#endif
#endif
static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) {
    const long neg_one = (long)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        long val = PyInt_AS_LONG(x);
        if (is_unsigned && unlikely(val < 0)) {
            PyErr_SetString(PyExc_OverflowError,
                            "can't convert negative value to long");
            return (long)-1;
        }
        return (long)val;
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
#if CYTHON_USE_PYLONG_INTERNALS
            if (sizeof(digit) <= sizeof(long)) {
                switch (Py_SIZE(x)) {
                    case  0: return 0;
                    case  1: return (long) ((PyLongObject*)x)->ob_digit[0];
                }
            }
#endif
#endif
            if (unlikely(Py_SIZE(x) < 0)) {
                PyErr_SetString(PyExc_OverflowError,
                                "can't convert negative value to long");
                return (long)-1;
            }
            return (long)PyLong_AsUnsignedLong(x);
        } else {
#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
#if CYTHON_USE_PYLONG_INTERNALS
            if (sizeof(digit) <= sizeof(long)) {
                switch (Py_SIZE(x)) {
                    case  0: return 0;
                    case  1: return +(long) ((PyLongObject*)x)->ob_digit[0];
                    case -1: return -(long) ((PyLongObject*)x)->ob_digit[0];
                }
            }
#endif
#endif
            return (long)PyLong_AsLong(x);
        }
    } else {
        long val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (long)-1;
        val = __Pyx_PyInt_AsLong(tmp);
        Py_DECREF(tmp);
        return val;
    }
}

#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
#if CYTHON_USE_PYLONG_INTERNALS
#include "longintrepr.h"
#endif
#endif
static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) {
    const PY_LONG_LONG neg_one = (PY_LONG_LONG)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        long val = PyInt_AS_LONG(x);
        if (is_unsigned && unlikely(val < 0)) {
            PyErr_SetString(PyExc_OverflowError,
                            "can't convert negative value to PY_LONG_LONG");
            return (PY_LONG_LONG)-1;
        }
        return (PY_LONG_LONG)val;
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
#if CYTHON_USE_PYLONG_INTERNALS
            if (sizeof(digit) <= sizeof(PY_LONG_LONG)) {
                switch (Py_SIZE(x)) {
                    case  0: return 0;
                    case  1: return (PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0];
                }
            }
#endif
#endif
            if (unlikely(Py_SIZE(x) < 0)) {
                PyErr_SetString(PyExc_OverflowError,
                                "can't convert negative value to PY_LONG_LONG");
                return (PY_LONG_LONG)-1;
            }
            return (PY_LONG_LONG)PyLong_AsUnsignedLongLong(x);
        } else {
#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
#if CYTHON_USE_PYLONG_INTERNALS
            if (sizeof(digit) <= sizeof(PY_LONG_LONG)) {
                switch (Py_SIZE(x)) {
                    case  0: return 0;
                    case  1: return +(PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0];
                    case -1: return -(PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0];
                }
            }
#endif
#endif
            return (PY_LONG_LONG)PyLong_AsLongLong(x);
        }
    } else {
        PY_LONG_LONG val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (PY_LONG_LONG)-1;
        val = __Pyx_PyInt_AsLongLong(tmp);
        Py_DECREF(tmp);
        return val;
    }
}

#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
#if CYTHON_USE_PYLONG_INTERNALS
#include "longintrepr.h"
#endif
#endif
static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) {
    const signed long neg_one = (signed long)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        long val = PyInt_AS_LONG(x);
        if (is_unsigned && unlikely(val < 0)) {
            PyErr_SetString(PyExc_OverflowError,
                            "can't convert negative value to signed long");
            return (signed long)-1;
        }
        return (signed long)val;
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
#if CYTHON_USE_PYLONG_INTERNALS
            if (sizeof(digit) <= sizeof(signed long)) {
                switch (Py_SIZE(x)) {
                    case  0: return 0;
                    case  1: return (signed long) ((PyLongObject*)x)->ob_digit[0];
                }
            }
#endif
#endif
            if (unlikely(Py_SIZE(x) < 0)) {
                PyErr_SetString(PyExc_OverflowError,
                                "can't convert negative value to signed long");
                return (signed long)-1;
            }
            return (signed long)PyLong_AsUnsignedLong(x);
        } else {
#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
#if CYTHON_USE_PYLONG_INTERNALS
            if (sizeof(digit) <= sizeof(signed long)) {
                switch (Py_SIZE(x)) {
                    case  0: return 0;
                    case  1: return +(signed long) ((PyLongObject*)x)->ob_digit[0];
                    case -1: return -(signed long) ((PyLongObject*)x)->ob_digit[0];
                }
            }
#endif
#endif
            return (signed long)PyLong_AsLong(x);
        }
    } else {
        signed long val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (signed long)-1;
        val = __Pyx_PyInt_AsSignedLong(tmp);
        Py_DECREF(tmp);
        return val;
    }
}

#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
#if CYTHON_USE_PYLONG_INTERNALS
#include "longintrepr.h"
#endif
#endif
static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) {
    const signed PY_LONG_LONG neg_one = (signed PY_LONG_LONG)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        long val = PyInt_AS_LONG(x);
        if (is_unsigned && unlikely(val < 0)) {
            PyErr_SetString(PyExc_OverflowError,
                            "can't convert negative value to signed PY_LONG_LONG");
            return (signed PY_LONG_LONG)-1;
        }
        return (signed PY_LONG_LONG)val;
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
#if CYTHON_USE_PYLONG_INTERNALS
            if (sizeof(digit) <= sizeof(signed PY_LONG_LONG)) {
                switch (Py_SIZE(x)) {
                    case  0: return 0;
                    case  1: return (signed PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0];
                }
            }
#endif
#endif
            if (unlikely(Py_SIZE(x) < 0)) {
                PyErr_SetString(PyExc_OverflowError,
                                "can't convert negative value to signed PY_LONG_LONG");
                return (signed PY_LONG_LONG)-1;
            }
            return (signed PY_LONG_LONG)PyLong_AsUnsignedLongLong(x);
        } else {
#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
#if CYTHON_USE_PYLONG_INTERNALS
            if (sizeof(digit) <= sizeof(signed PY_LONG_LONG)) {
                switch (Py_SIZE(x)) {
                    case  0: return 0;
                    case  1: return +(signed PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0];
                    case -1: return -(signed PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0];
                }
            }
#endif
#endif
            return (signed PY_LONG_LONG)PyLong_AsLongLong(x);
        }
    } else {
        signed PY_LONG_LONG val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (signed PY_LONG_LONG)-1;
        val = __Pyx_PyInt_AsSignedLongLong(tmp);
        Py_DECREF(tmp);
        return val;
    }
}

static int __Pyx_check_binary_version(void) {
    char ctversion[4], rtversion[4];
    PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
    PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion());
    if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) {
        char message[200];
        PyOS_snprintf(message, sizeof(message),
                      "compiletime version %s of module '%.100s' "
                      "does not match runtime version %s",
                      ctversion, __Pyx_MODULE_NAME, rtversion);
        #if PY_VERSION_HEX < 0x02050000
        return PyErr_Warn(NULL, message);
        #else
        return PyErr_WarnEx(NULL, message, 1);
        #endif
    }
    return 0;
}

#ifndef __PYX_HAVE_RT_ImportModule
#define __PYX_HAVE_RT_ImportModule
static PyObject *__Pyx_ImportModule(const char *name) {
    PyObject *py_name = 0;
    PyObject *py_module = 0;
    py_name = __Pyx_PyIdentifier_FromString(name);
    if (!py_name)
        goto bad;
    py_module = PyImport_Import(py_name);
    Py_DECREF(py_name);
    return py_module;
bad:
    Py_XDECREF(py_name);
    return 0;
}
#endif

#ifndef __PYX_HAVE_RT_ImportType
#define __PYX_HAVE_RT_ImportType
static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name,
    size_t size, int strict)
{
    PyObject *py_module = 0;
    PyObject *result = 0;
    PyObject *py_name = 0;
    char warning[200];
    Py_ssize_t basicsize;
#ifdef Py_LIMITED_API
    PyObject *py_basicsize;
#endif
    py_module = __Pyx_ImportModule(module_name);
    if (!py_module)
        goto bad;
    py_name = __Pyx_PyIdentifier_FromString(class_name);
    if (!py_name)
        goto bad;
    result = PyObject_GetAttr(py_module, py_name);
    Py_DECREF(py_name);
    py_name = 0;
    Py_DECREF(py_module);
    py_module = 0;
    if (!result)
        goto bad;
    if (!PyType_Check(result)) {
        PyErr_Format(PyExc_TypeError,
            "%s.%s is not a type object",
            module_name, class_name);
        goto bad;
    }
#ifndef Py_LIMITED_API
    basicsize = ((PyTypeObject *)result)->tp_basicsize;
#else
    py_basicsize = PyObject_GetAttrString(result, "__basicsize__");
    if (!py_basicsize)
        goto bad;
    basicsize = PyLong_AsSsize_t(py_basicsize);
    Py_DECREF(py_basicsize);
    py_basicsize = 0;
    if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred())
        goto bad;
#endif
    if (!strict && (size_t)basicsize > size) {
        PyOS_snprintf(warning, sizeof(warning),
            "%s.%s size changed, may indicate binary incompatibility",
            module_name, class_name);
        #if PY_VERSION_HEX < 0x02050000
        if (PyErr_Warn(NULL, warning) < 0) goto bad;
        #else
        if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad;
        #endif
    }
    else if ((size_t)basicsize != size) {
        PyErr_Format(PyExc_ValueError,
            "%s.%s has the wrong size, try recompiling",
            module_name, class_name);
        goto bad;
    }
    return (PyTypeObject *)result;
bad:
    Py_XDECREF(py_module);
    Py_XDECREF(result);
    return NULL;
}
#endif

static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
    int start = 0, mid = 0, end = count - 1;
    if (end >= 0 && code_line > entries[end].code_line) {
        return count;
    }
    while (start < end) {
        mid = (start + end) / 2;
        if (code_line < entries[mid].code_line) {
            end = mid;
        } else if (code_line > entries[mid].code_line) {
             start = mid + 1;
        } else {
            return mid;
        }
    }
    if (code_line <= entries[mid].code_line) {
        return mid;
    } else {
        return mid + 1;
    }
}
static PyCodeObject *__pyx_find_code_object(int code_line) {
    PyCodeObject* code_object;
    int pos;
    if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
        return NULL;
    }
    pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
    if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
        return NULL;
    }
    code_object = __pyx_code_cache.entries[pos].code_object;
    Py_INCREF(code_object);
    return code_object;
}
static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
    int pos, i;
    __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
    if (unlikely(!code_line)) {
        return;
    }
    if (unlikely(!entries)) {
        entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
        if (likely(entries)) {
            __pyx_code_cache.entries = entries;
            __pyx_code_cache.max_count = 64;
            __pyx_code_cache.count = 1;
            entries[0].code_line = code_line;
            entries[0].code_object = code_object;
            Py_INCREF(code_object);
        }
        return;
    }
    pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
    if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
        PyCodeObject* tmp = entries[pos].code_object;
        entries[pos].code_object = code_object;
        Py_DECREF(tmp);
        return;
    }
    if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
        int new_max = __pyx_code_cache.max_count + 64;
        entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
            __pyx_code_cache.entries, new_max*sizeof(__Pyx_CodeObjectCacheEntry));
        if (unlikely(!entries)) {
            return;
        }
        __pyx_code_cache.entries = entries;
        __pyx_code_cache.max_count = new_max;
    }
    for (i=__pyx_code_cache.count; i>pos; i--) {
        entries[i] = entries[i-1];
    }
    entries[pos].code_line = code_line;
    entries[pos].code_object = code_object;
    __pyx_code_cache.count++;
    Py_INCREF(code_object);
}

#include "compile.h"
#include "frameobject.h"
#include "traceback.h"
static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
            const char *funcname, int c_line,
            int py_line, const char *filename) {
    PyCodeObject *py_code = 0;
    PyObject *py_srcfile = 0;
    PyObject *py_funcname = 0;
    #if PY_MAJOR_VERSION < 3
    py_srcfile = PyString_FromString(filename);
    #else
    py_srcfile = PyUnicode_FromString(filename);
    #endif
    if (!py_srcfile) goto bad;
    if (c_line) {
        #if PY_MAJOR_VERSION < 3
        py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
        #else
        py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
        #endif
    }
    else {
        #if PY_MAJOR_VERSION < 3
        py_funcname = PyString_FromString(funcname);
        #else
        py_funcname = PyUnicode_FromString(funcname);
        #endif
    }
    if (!py_funcname) goto bad;
    py_code = __Pyx_PyCode_New(
        0,            /*int argcount,*/
        0,            /*int kwonlyargcount,*/
        0,            /*int nlocals,*/
        0,            /*int stacksize,*/
        0,            /*int flags,*/
        __pyx_empty_bytes, /*PyObject *code,*/
        __pyx_empty_tuple, /*PyObject *consts,*/
        __pyx_empty_tuple, /*PyObject *names,*/
        __pyx_empty_tuple, /*PyObject *varnames,*/
        __pyx_empty_tuple, /*PyObject *freevars,*/
        __pyx_empty_tuple, /*PyObject *cellvars,*/
        py_srcfile,   /*PyObject *filename,*/
        py_funcname,  /*PyObject *name,*/
        py_line,      /*int firstlineno,*/
        __pyx_empty_bytes  /*PyObject *lnotab*/
    );
    Py_DECREF(py_srcfile);
    Py_DECREF(py_funcname);
    return py_code;
bad:
    Py_XDECREF(py_srcfile);
    Py_XDECREF(py_funcname);
    return NULL;
}
static void __Pyx_AddTraceback(const char *funcname, int c_line,
                               int py_line, const char *filename) {
    PyCodeObject *py_code = 0;
    PyObject *py_globals = 0;
    PyFrameObject *py_frame = 0;
    py_code = __pyx_find_code_object(c_line ? c_line : py_line);
    if (!py_code) {
        py_code = __Pyx_CreateCodeObjectForTraceback(
            funcname, c_line, py_line, filename);
        if (!py_code) goto bad;
        __pyx_insert_code_object(c_line ? c_line : py_line, py_code);
    }
    py_globals = PyModule_GetDict(__pyx_m);
    if (!py_globals) goto bad;
    py_frame = PyFrame_New(
        PyThreadState_GET(), /*PyThreadState *tstate,*/
        py_code,             /*PyCodeObject *code,*/
        py_globals,          /*PyObject *globals,*/
        0                    /*PyObject *locals*/
    );
    if (!py_frame) goto bad;
    py_frame->f_lineno = py_line;
    PyTraceBack_Here(py_frame);
bad:
    Py_XDECREF(py_code);
    Py_XDECREF(py_frame);
}

static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
    while (t->p) {
        #if PY_MAJOR_VERSION < 3
        if (t->is_unicode) {
            *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
        } else if (t->intern) {
            *t->p = PyString_InternFromString(t->s);
        } else {
            *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
        }
        #else  /* Python 3+ has unicode identifiers */
        if (t->is_unicode | t->is_str) {
            if (t->intern) {
                *t->p = PyUnicode_InternFromString(t->s);
            } else if (t->encoding) {
                *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
            } else {
                *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
            }
        } else {
            *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
        }
        #endif
        if (!*t->p)
            return -1;
        ++t;
    }
    return 0;
}

static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(char* c_str) {
    return __Pyx_PyUnicode_FromStringAndSize(c_str, strlen(c_str));
}
static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject* o) {
    Py_ssize_t ignore;
    return __Pyx_PyObject_AsStringAndSize(o, &ignore);
}
static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
    if (
#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
            __Pyx_sys_getdefaultencoding_not_ascii &&
#endif
            PyUnicode_Check(o)) {
#if PY_VERSION_HEX < 0x03030000
        char* defenc_c;
        PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
        if (!defenc) return NULL;
        defenc_c = PyBytes_AS_STRING(defenc);
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
        {
            char* end = defenc_c + PyBytes_GET_SIZE(defenc);
            char* c;
            for (c = defenc_c; c < end; c++) {
                if ((unsigned char) (*c) >= 128) {
                    PyUnicode_AsASCIIString(o);
                    return NULL;
                }
            }
        }
#endif /*__PYX_DEFAULT_STRING_ENCODING_IS_ASCII*/
        *length = PyBytes_GET_SIZE(defenc);
        return defenc_c;
#else /* PY_VERSION_HEX < 0x03030000 */
        if (PyUnicode_READY(o) == -1) return NULL;
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
        if (PyUnicode_IS_ASCII(o)) {
            *length = PyUnicode_GET_DATA_SIZE(o);
            return PyUnicode_AsUTF8(o);
        } else {
            PyUnicode_AsASCIIString(o);
            return NULL;
        }
#else /* __PYX_DEFAULT_STRING_ENCODING_IS_ASCII */
        return PyUnicode_AsUTF8AndSize(o, length);
#endif /* __PYX_DEFAULT_STRING_ENCODING_IS_ASCII */
#endif /* PY_VERSION_HEX < 0x03030000 */
    } else
#endif /* __PYX_DEFAULT_STRING_ENCODING_IS_ASCII  || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT */
    {
        char* result;
        int r = PyBytes_AsStringAndSize(o, &result, length);
        if (r < 0) {
            return NULL;
        } else {
            return result;
        }
    }
}
static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
   int is_true = x == Py_True;
   if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
   else return PyObject_IsTrue(x);
}
static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) {
  PyNumberMethods *m;
  const char *name = NULL;
  PyObject *res = NULL;
#if PY_MAJOR_VERSION < 3
  if (PyInt_Check(x) || PyLong_Check(x))
#else
  if (PyLong_Check(x))
#endif
    return Py_INCREF(x), x;
  m = Py_TYPE(x)->tp_as_number;
#if PY_MAJOR_VERSION < 3
  if (m && m->nb_int) {
    name = "int";
    res = PyNumber_Int(x);
  }
  else if (m && m->nb_long) {
    name = "long";
    res = PyNumber_Long(x);
  }
#else
  if (m && m->nb_int) {
    name = "int";
    res = PyNumber_Long(x);
  }
#endif
  if (res) {
#if PY_MAJOR_VERSION < 3
    if (!PyInt_Check(res) && !PyLong_Check(res)) {
#else
    if (!PyLong_Check(res)) {
#endif
      PyErr_Format(PyExc_TypeError,
                   "__%s__ returned non-%s (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 = PyNumber_Index(b);
  if (!x) return -1;
  ival = PyInt_AsSsize_t(x);
  Py_DECREF(x);
  return ival;
}
static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
#if PY_VERSION_HEX < 0x02050000
   if (ival <= LONG_MAX)
       return PyInt_FromLong((long)ival);
   else {
       unsigned char *bytes = (unsigned char *) &ival;
       int one = 1; int little = (int)*(unsigned char*)&one;
       return _PyLong_FromByteArray(bytes, sizeof(size_t), little, 0);
   }
#else
   return PyInt_FromSize_t(ival);
#endif
}
static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) {
   unsigned PY_LONG_LONG val = __Pyx_PyInt_AsUnsignedLongLong(x);
   if (unlikely(val != (unsigned PY_LONG_LONG)(size_t)val)) {
       if ((val != (unsigned PY_LONG_LONG)-1) || !PyErr_Occurred())
           PyErr_SetString(PyExc_OverflowError,
                           "value too large to convert to size_t");
       return (size_t)-1;
   }
   return (size_t)val;
}


#endif /* Py_PYTHON_H */
